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

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

#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "RE01DetectorConstruction.hh"
#include "RE01CalorimeterROGeometry.hh"
#include "QGSP_BERT.hh"
#include "G4UnknownDecayPhysics.hh"
#include "G4ParallelWorldPhysics.hh"
#include "RE01ActionInitialization.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the runAndEvent/RE01 example.

Definition in file RE01.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 60 of file RE01.cc.

61 {
62  // Instantiate G4UIExecutive if there are no arguments (interactive mode)
63  G4UIExecutive* ui = nullptr;
64  if ( argc == 1 ) {
65  ui = new G4UIExecutive(argc, argv);
66  }
67 
68 #ifdef G4MULTITHREADED
69  G4MTRunManager * runManager = new G4MTRunManager;
70  //runManager->SetNumberOfThreads(4);
71 #else
72  G4RunManager * runManager = new G4RunManager;
73 #endif
74 
75  // Visualization manager construction
76  G4VisManager* visManager = new G4VisExecutive;
77  visManager->Initialize();
78 
79  G4String parallelWorldName = "ReadoutWorld";
80  G4VUserDetectorConstruction* detector
81  = new RE01DetectorConstruction();
82  detector->RegisterParallelWorld(
83  new RE01CalorimeterROGeometry(parallelWorldName));
84  runManager->SetUserInitialization(detector);
85 
86  G4VModularPhysicsList* physicsList = new QGSP_BERT;
87  physicsList->RegisterPhysics(new G4UnknownDecayPhysics);
88  physicsList->RegisterPhysics(
89  new G4ParallelWorldPhysics(parallelWorldName));
90  runManager->SetUserInitialization(physicsList);
91 
92  runManager->SetUserInitialization(
93  new RE01ActionInitialization);
94 
95  runManager->Initialize();
96 
97  if(ui)
98  {
99  ui->SessionStart();
100  delete ui;
101  }
102  else
103  {
104  G4UImanager* UImanager = G4UImanager::GetUIpointer();
105  G4String command = "/control/execute ";
106  G4String fileName = argv[1];
107  UImanager->ApplyCommand(command+fileName);
108  }
109 
110  delete visManager;
111 
112  delete runManager;
113 
114  return 0;
115 }