Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
exampleB1.cc File Reference

Main program of the B1 example. More...

#include "B1DetectorConstruction.hh"
#include "B1ActionInitialization.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "QBBC.hh"
#include "Randomize.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the B1 example.

Definition in file exampleB1.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 55 of file exampleB1.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4RunManager::Initialize(), G4VisManager::Initialize(), G4UIExecutive::SessionStart(), G4RunManager::SetUserInitialization(), and G4VModularPhysicsList::SetVerboseLevel().

56 {
57  // Choose the Random engine
58  //
59  G4Random::setTheEngine(new CLHEP::RanecuEngine);
60 
61  // Construct the default run manager
62  //
63 #ifdef G4MULTITHREADED
64  G4MTRunManager* runManager = new G4MTRunManager;
65 #else
66  G4RunManager* runManager = new G4RunManager;
67 #endif
68 
69  // Set mandatory initialization classes
70  //
71  // Detector construction
73 
74  // Physics list
75  G4VModularPhysicsList* physicsList = new QBBC;
76  physicsList->SetVerboseLevel(1);
77  runManager->SetUserInitialization(physicsList);
78 
79  // User action initialization
81 
82  // Initialize G4 kernel
83  //
84  runManager->Initialize();
85 
86 #ifdef G4VIS_USE
87  // Initialize visualization
88  G4VisManager* visManager = new G4VisExecutive;
89  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
90  // G4VisManager* visManager = new G4VisExecutive("Quiet");
91  visManager->Initialize();
92 #endif
93 
94  // Get the pointer to the User Interface manager
96 
97  if (argc!=1) {
98  // batch mode
99  G4String command = "/control/execute ";
100  G4String fileName = argv[1];
101  UImanager->ApplyCommand(command+fileName);
102  }
103  else {
104  // interactive mode : define UI session
105 #ifdef G4UI_USE
106  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
107 #ifdef G4VIS_USE
108  UImanager->ApplyCommand("/control/execute init_vis.mac");
109 #else
110  UImanager->ApplyCommand("/control/execute init.mac");
111 #endif
112  ui->SessionStart();
113  delete ui;
114 #endif
115  }
116 
117  // Job termination
118  // Free the store: user actions, physics_list and detector_description are
119  // owned and deleted by the run manager, so they should not be deleted
120  // in the main() program !
121 
122 #ifdef G4VIS_USE
123  delete visManager;
124 #endif
125  delete runManager;
126 
127  return 0;
128 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Detector construction class to define materials and geometry.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void SetVerboseLevel(G4int value)
void Initialize()
Action initialization class.
virtual void Initialize()
Definition: QBBC.hh:44
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419