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

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