ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE02.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RE02.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 //
31 //
32 
34 #include "QGS_BIC.hh"
36 
37 #ifdef G4MULTITHREADED
38 #include "G4MTRunManager.hh"
39 #else
40 #include "G4RunManager.hh"
41 #endif
42 
43 #include "G4UImanager.hh"
44 #include "G4SystemOfUnits.hh"
45 
46 #include "G4UIExecutive.hh"
47 #include "G4VisExecutive.hh"
48 
49 //
50 int main(int argc,char** argv) {
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
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
91 
92  //Initialize G4 kernel
93  runManager->Initialize();
94 
95  //get the pointer to the User Interface manager
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 }
118 
119 //
120