LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
exampleRE06.cc File Reference

Main program of the RE06 example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "G4ParallelWorldPhysics.hh"
#include "RE06DetectorConstruction.hh"
#include "RE06ParallelWorld.hh"
#include "RE06PrimaryGeneratorAction.hh"
#include "RE06RunAction.hh"
#include "RE06SteppingVerbose.hh"
#include "RE06ActionInitialization.hh"
#include "RE06WorkerInitialization.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the RE06 example.

Definition in file exampleRE06.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 61 of file exampleRE06.cc.

62 {
63  // Construct the stepping verbose class
64  RE06SteppingVerbose* verbosity = new RE06SteppingVerbose;
65  G4VSteppingVerbose::SetInstance(verbosity);
66 
67  // Construct the run manager
68  //
69 #ifdef G4MULTITHREADED
70  G4MTRunManager * runManager = new G4MTRunManager;
71  runManager->SetNumberOfThreads(4);
72  runManager->SetUserInitialization(new RE06WorkerInitialization);
73 #else
74  G4RunManager* runManager = new G4RunManager;
75 #endif
76 
77  // Set mandatory initialization classes
78  //
79  G4String parallelWorldName = "ParallelScoringWorld";
80  G4VUserDetectorConstruction* detector = new RE06DetectorConstruction;
81  detector->RegisterParallelWorld(new RE06ParallelWorld(parallelWorldName));
82  runManager->SetUserInitialization(detector);
83  //
84  G4VModularPhysicsList* physics = new FTFP_BERT;
85  physics->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
86  runManager->SetUserInitialization(physics);
87 
88  // Set user action classes
89  //
90  runManager->SetUserInitialization(new RE06ActionInitialization);
91 
92 #ifdef G4VIS_USE
93  // Visualization manager
94  //
95  G4VisManager* visManager = new G4VisExecutive;
96  visManager->Initialize();
97 #endif
98 
99  // Initialize G4 kernel
100  //
101  runManager->Initialize();
102 
103  // Get the pointer to the User Interface manager
104  //
105  G4UImanager* UImanager = G4UImanager::GetUIpointer();
106 
107  if (argc==1) // Define UI session for interactive mode
108  {
109 #ifdef G4UI_USE
110  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
111 #ifdef G4VIS_USE
112  UImanager->ApplyCommand("/control/execute vis.mac");
113 #endif
114  ui->SessionStart();
115  delete ui;
116 #endif
117  }
118  else // Batch mode
119  {
120  G4String command = "/control/execute ";
121  G4String fileName = argv[1];
122  UImanager->ApplyCommand(command+fileName);
123  }
124 
125  // Job termination
126  // Free the store:
127  // user actions, physics_list and detector_description are
128  // owned and deleted by the run manager, so they should not
129  // be deleted in the main() program !
130 
131 #ifdef G4VIS_USE
132  delete visManager;
133 #endif
134  delete runManager;
135 
136  return 0;
137 }