Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
microbeam.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
Include dependency graph for microbeam.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 52 of file microbeam.cc.

52  {
53 
54  // Detect interactive mode (if no arguments) and define UI session
55  //
56  G4UIExecutive* ui = 0;
57  if ( argc == 1 ) {
58  ui = new G4UIExecutive(argc, argv);
59  }
60 
61  // Choose the Random engine
62 
63  G4Random::setTheEngine(new CLHEP::RanecuEngine);
64 
65  // Construct the default run manager
66 
67 #ifdef G4MULTITHREADED
68  G4MTRunManager* runManager = new G4MTRunManager;
69  // runManager->SetNumberOfThreads(2);
70 #else
71  G4RunManager* runManager = new G4RunManager;
72 #endif
73 
74  // Set mandatory user initialization classes
75 
77  runManager->SetUserInitialization(detector);
78 
79  runManager->SetUserInitialization(new PhysicsList);
80 
81  // User action initialization
82 
83  runManager->SetUserInitialization(new ActionInitialization(detector));
84 
85  // Initialize G4 kernel
86 
87  runManager->Initialize();
88 
89 #ifdef G4VIS_USE
90  G4VisManager* visManager = new G4VisExecutive;
91  visManager->Initialize();
92 #endif
93 
94  // Get the pointer to the User Interface manager
95 
96  // Get the pointer to the User Interface manager
98 
99  // Process macro or start UI session
100  //
101  if ( ! ui ) {
102  // batch mode
103  G4String command = "/control/execute ";
104  G4String fileName = argv[1];
105  UImanager->ApplyCommand(command+fileName);
106  }
107  else {
108  // interactive mode
109  UImanager->ApplyCommand("/control/execute vis.mac");
110  ui->SessionStart();
111  delete ui;
112  }
113 
114 #ifdef G4VIS_USE
115  delete visManager;
116 #endif
117  delete runManager;
118 
119  return 0;
120 
121 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
void Initialize()
virtual void Initialize()
Detector construction class to define materials and geometry.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
Physics list class.
Definition: PhysicsList.hh:47

Here is the call graph for this function: