ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GammaTherapy.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GammaTherapy.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 //
26 //
29 //
30 //
31 // -------------------------------------------------------------
32 // GEANT4 ibrem
33 //
34 // History: based on object model of
35 // 2nd December 1995, G.Cosmo
36 // ---------- ibrem ----------------------------
37 //
38 // Modified: 05.04.01 Vladimir Ivanchenko new design of ibrem
39 //
40 // -------------------------------------------------------------
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44 #include "G4Types.hh"
45 
46 #ifdef G4MULTITHREADED
47 #include "G4MTRunManager.hh"
48 #else
49 #include "G4RunManager.hh"
50 #endif
51 
52 #include "G4UImanager.hh"
53 #include "Randomize.hh"
54 
55 #include "G4UIExecutive.hh"
56 #include "G4VisExecutive.hh"
57 
58 #include "DetectorConstruction.hh"
59 #include "PhysicsList.hh"
60 #include "ActionInitialization.hh"
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64 
65 int main(int argc,char** argv) {
66 
67  //detect interactive mode (if no arguments) and define UI session
68  G4UIExecutive* ui = nullptr;
69  if (argc == 1) ui = new G4UIExecutive(argc,argv);
70 
71  //choose the Random engine
72  G4Random::setTheEngine(new CLHEP::RanecuEngine);
73 
74  // Construct the default run manager
75 #ifdef G4MULTITHREADED
76  G4MTRunManager* runManager = new G4MTRunManager;
78  if (argc==3) nThreads = G4UIcommand::ConvertToInt(argv[2]);
79  runManager->SetNumberOfThreads(nThreads);
80  G4cout << "===== GammaTherapy is started with "
81  << runManager->GetNumberOfThreads() << " threads =====" << G4endl;
82 #else
83  G4RunManager* runManager = new G4RunManager();
84 #endif
85 
86  //set mandatory initialization classes
88  runManager->SetUserInitialization(det);
89 
90  runManager->SetUserInitialization(new PhysicsList());
91 
92  // set user action classes
93  runManager->SetUserInitialization(new ActionInitialization(det));
94 
95  //initialize visualization
96  G4VisManager* visManager = nullptr;
97 
98  //get the pointer to the User Interface manager
100 
101  if (ui) {
102  //interactive mode
103  visManager = new G4VisExecutive;
104  visManager->Initialize();
105  UImanager->ApplyCommand("/control/execute vis.mac");
106  ui->SessionStart();
107  delete ui;
108  }
109  else {
110  //batch mode
111  G4String command = "/control/execute ";
112  G4String fileName = argv[1];
113  UImanager->ApplyCommand(command+fileName);
114  }
115 
116  //job termination
117  delete visManager;
118  delete runManager;
119 }
120 
121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......