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

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

#include "RE02DetectorConstruction.hh"
#include "QGS_BIC.hh"
#include "RE02ActionInitialization.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4SystemOfUnits.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the runAndEvent/RE02 example.

Definition in file RE02.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 50 of file RE02.cc.

50  {
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  // Run manager
59 #ifdef G4MULTITHREADED
60  G4MTRunManager * runManager = new G4MTRunManager;
61  //runManager->SetNumberOfThreads(4);
62 #else
63  G4RunManager * runManager = new G4RunManager;
64 #endif
65 
66  // UserInitialization classes (mandatory)
67  //---
68  // Create Detector
69  RE02DetectorConstruction* detector = new RE02DetectorConstruction;
70  detector->SetPhantomSize(G4ThreeVector(200*mm,200*mm,400*mm)); //Default
71  detector->SetNumberOfSegmentsInPhantom(100,100,200); //Default
72  // If your machine does not have enough memory,
73  // please try to reduce Number of Segements in phantom.
74  //detector->SetNumberOfSegmentsInPhantom(1,1,100); // For small memory size.
75  //
76  detector->SetLeadSegment(TRUE); // Default (Water and Lead)
77  // Water and Lead segments are placed alternately, by defult.,
78  // If you want to simulation homogeneous water phantom, please set it FALSE.
79  //detector->SetLeadSegment(FALSE); // Homogeneous water phantom
80  //
81  runManager->SetUserInitialization(detector);
82  //
83  runManager->SetUserInitialization(new QGS_BIC());
84 
85  // Visualization, if you choose to have it!
86  G4VisManager* visManager = new G4VisExecutive;
87  visManager->Initialize();
88 
89  // UserAction classes
90  runManager->SetUserInitialization(new RE02ActionInitialization);
91 
92  //Initialize G4 kernel
93  runManager->Initialize();
94 
95  //get the pointer to the User Interface manager
96  G4UImanager * pUI = G4UImanager::GetUIpointer();
97 
98  if(ui)
99  // Define (G)UI terminal for interactive mode
100  {
101  pUI->ApplyCommand("/control/execute vis.mac");
102  ui->SessionStart();
103  delete ui;
104  }
105  else
106  // Batch mode
107  {
108  G4String command = "/control/execute ";
109  G4String fileName = argv[1];
110  pUI->ApplyCommand(command+fileName);
111  }
112 
113  delete visManager;
114  delete runManager;
115 
116  return 0;
117 }