LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lArCal.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "FCALTestbeamSetup.hh"
#include "G4PhysListFactory.hh"
#include "FCALActionInitialization.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 61 of file lArCal.cc.

61  {
62 
63  // choose the Random engine
64  G4Random::setTheEngine(new CLHEP::RanecuEngine);
65 
66  // Construct the default run manager
67 #ifdef G4MULTITHREADED
68  G4MTRunManager* runManager = new G4MTRunManager;
69 #else
70  G4RunManager* runManager = new G4RunManager;
71 #endif
72 
73  // set mandatory initialization classes
74  FCALTestbeamSetup* detector = new FCALTestbeamSetup;
75  runManager->SetUserInitialization(detector);
76 
77  G4PhysListFactory factory;
78  runManager->SetUserInitialization(factory.ReferencePhysList());
79 
80  runManager->SetUserInitialization(new FCALActionInitialization);
81 
82  // get the pointer to the User Interface manager
83  G4UImanager* UImanager = G4UImanager::GetUIpointer();
84 
85 #ifdef G4VIS_USE
86  // visualization manager
87  G4VisManager* visManager = new G4VisExecutive;
88  visManager->Initialize();
89 #endif
90 
91  if (argc==1) // Define UI session for interactive mode.
92  {
93 #ifdef G4UI_USE
94  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
95 #ifdef G4VIS_USE
96  UImanager->ApplyCommand("/control/execute prerunlArcal.mac");
97 #endif
98  if (ui->IsGUI())
99  UImanager->ApplyCommand("/control/execute gui.mac");
100  ui->SessionStart();
101  delete ui;
102 #endif
103  }
104  else // Batch mode
105  {
106  G4String command = "/control/execute ";
107  G4String fileName = argv[1];
108  UImanager->ApplyCommand(command+fileName);
109  }
110 
111  // job termination
112 #ifdef G4VIS_USE
113  delete visManager;
114 #endif
115  delete runManager;
116 
117  return 0;
118 }