LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
microbeam.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"

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
97  G4UImanager* UImanager = G4UImanager::GetUIpointer();
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 }