LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
exampleRE05.cc File Reference

Main program of the RE05 example. More...

#include "G4RunManager.hh"
#include "RE05SteppingVerbose.hh"
#include "G4UImanager.hh"
#include "RE05DetectorConstruction.hh"
#include "RE05CalorimeterParallelWorld.hh"
#include "QBBC.hh"
#include "G4ParallelWorldPhysics.hh"
#include "RE05ActionInitialization.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the RE05 example.

Definition in file exampleRE05.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file exampleRE05.cc.

60 {
61 #ifdef G4MULTITHREADED
62  G4MTRunManager* runManager = new G4MTRunManager;
63  G4int number_of_threads = 4; // default number of threads
64  runManager->SetNumberOfThreads(number_of_threads);
65  runManager->SetUserInitialization(new RE05WorkerInitialization);
66 #else
67  G4VSteppingVerbose* verbosity = new RE05SteppingVerbose;
68  G4VSteppingVerbose::SetInstance(verbosity);
69  G4RunManager* runManager = new G4RunManager;
70 #endif
71 
72  G4String parallelWorldName = "ReadoutWorld";
73  // User Initialization classes (mandatory)
74  //
75  G4VUserDetectorConstruction* detector = new RE05DetectorConstruction();
76  detector->RegisterParallelWorld
77  (new RE05CalorimeterParallelWorld(parallelWorldName));
78  runManager->SetUserInitialization(detector);
79  //
80  G4VModularPhysicsList* physicsList = new QBBC;
81  physicsList
82  ->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
83  runManager->SetUserInitialization(physicsList);
84  //
85  G4VUserActionInitialization* actions = new RE05ActionInitialization;
86  runManager->SetUserInitialization(actions);
87 
88  runManager->Initialize();
89 
90 #ifdef G4VIS_USE
91  G4VisManager* visManager = new G4VisExecutive;
92  visManager->Initialize();
93 #endif
94 
95  //get the pointer to the User Interface manager
96  G4UImanager* UImanager = G4UImanager::GetUIpointer();
97 
98  if (argc!=1) // batch mode
99  {
100  G4String command = "/control/execute ";
101  G4String fileName = argv[1];
102  UImanager->ApplyCommand(command+fileName);
103  }
104  else // interactive mode : define UI session
105  {
106 #ifdef G4UI_USE
107  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
108 #ifdef G4VIS_USE
109  UImanager->ApplyCommand("/control/execute vis.mac");
110 #endif
111  ui->SessionStart();
112  delete ui;
113 #endif
114 
115 #ifdef G4VIS_USE
116  delete visManager;
117 #endif
118  }
119 
120  // Job termination
121  // Free the store: user actions, physics_list and detector_description are
122  // owned and deleted by the run manager, so they should not
123  // be deleted in the main() program !
124  delete runManager;
125 
126  return 0;
127 }