LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
nanobeam.cc File Reference
#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4UImanager.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 43 of file nanobeam.cc.

43  {
44 
45  // Choose the Random engine
46 
47  G4Random::setTheEngine(new CLHEP::RanecuEngine);
48 
49  // Construct the default run manager
50 
51 #ifdef G4MULTITHREADED
52  G4MTRunManager* runManager = new G4MTRunManager;
53 
54  // Use only one thread for aberration coefficient calculation ("coef*" macros)
55  //
56  // For high statistics (no aberration coefficient calculation, "image*" & "grid*" macros),
57  // switch to more threads
58 
59  runManager->SetNumberOfThreads(1);
60 
61 #else
62  G4RunManager* runManager = new G4RunManager;
63 #endif
64 
65  // Set mandatory initialization classes
66 
68 
69  runManager->SetUserInitialization(detector);
70 
71  runManager->SetUserInitialization(new PhysicsList);
72 
73  // User action initialization
74 
75  runManager->SetUserInitialization(new ActionInitialization(detector));
76 
77  // Initialize G4 kernel
78 
79  runManager->Initialize();
80 
81  // Get the pointer to the User Interface manager
82 
83  G4UImanager* UImanager = G4UImanager::GetUIpointer();
84 
85  if (argc==1) // Define UI session for interactive mode.
86  {
87  UImanager->ApplyCommand("/control/execute default.mac");
88  }
89  else // Batch mode
90  {
91  G4String command = "/control/execute ";
92  G4String fileName = argv[1];
93  UImanager->ApplyCommand(command+fileName);
94  }
95 
96  //
97 
98  delete runManager;
99 
100  return 0;
101 }