LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
RE04.cc File Reference

Main program of the runAndEvent/RE04 example. More...

#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4ScoringManager.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "RE04ActionInitialization.hh"
#include "RE04DetectorConstruction.hh"
#include "RE04ParallelWorldConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4ParallelWorldPhysics.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the runAndEvent/RE04 example.

Definition in file RE04.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 50 of file RE04.cc.

51 {
52  // Instantiate G4UIExecutive if there are no arguments (interactive mode)
53  G4UIExecutive* ui = nullptr;
54  if ( argc == 1 ) {
55  ui = new G4UIExecutive(argc, argv);
56  }
57 
58 // Construct the run manager
59  //
60 #ifdef G4MULTITHREADED
61  G4MTRunManager * runManager = new G4MTRunManager;
62  //runManager->SetNumberOfThreads(4);
63 #else
64  G4RunManager * runManager = new G4RunManager;
65 #endif
66 
67  G4ScoringManager::GetScoringManager();
68 
69  G4String paraWorldName = "ParallelWorld";
70 
71  // Set mandatory initialization classes
72  //
73  RE04DetectorConstruction* realWorld = new RE04DetectorConstruction;
74  RE04ParallelWorldConstruction* parallelWorld
75  = new RE04ParallelWorldConstruction(paraWorldName);
76  realWorld->RegisterParallelWorld(parallelWorld);
77  runManager->SetUserInitialization(realWorld);
78  //
79  G4VModularPhysicsList* physicsList = new FTFP_BERT;
80  physicsList->RegisterPhysics
81  (new G4ParallelWorldPhysics(paraWorldName,true));
82  runManager->SetUserInitialization(physicsList);
83 
84  // Set user action classes
85  //
86  runManager->SetUserInitialization(new RE04ActionInitialization);
87 
88  // Visualization manager
89  //
90  G4VisManager* visManager = new G4VisExecutive;
91  visManager->Initialize();
92 
93  // Initialize G4 kernel
94  //
95  runManager->Initialize();
96 
97  // Get the pointer to the User Interface manager
98  //
99  G4UImanager* pUImanager = G4UImanager::GetUIpointer();
100 
101  if (ui) // Define UI session for interactive mode
102  {
103  pUImanager->ApplyCommand("/control/execute vis.mac");
104  ui->SessionStart();
105  delete ui;
106  }
107  else // Batch mode
108  {
109  G4String command = "/control/execute ";
110  G4String fileName = argv[1];
111  pUImanager->ApplyCommand(command+fileName);
112  }
113 
114  delete visManager;
115  delete runManager;
116 
117  return 0;
118 }