ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
field05.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file field05.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 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
36 #ifndef WIN32
37 #include <unistd.h>
38 #endif
39 
40 #include "G4Types.hh"
41 
42 #ifdef G4MULTITHREADED
43 #include "G4MTRunManager.hh"
44 #else
45 #include "F05SteppingVerbose.hh"
46 #include "G4RunManager.hh"
47 #endif
48 
49 #include "F05PhysicsList.hh"
51 
53 
54 #include "G4UImanager.hh"
55 
56 #include "Randomize.hh"
57 
58 #include "G4VisExecutive.hh"
59 #include "G4UIExecutive.hh"
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
63 int main(int argc,char** argv)
64 {
65  // Instantiate G4UIExecutive if there are no arguments (interactive mode)
66  G4UIExecutive* ui = nullptr;
67  if ( argc == 1 ) {
68  ui = new G4UIExecutive(argc, argv);
69  }
70 
71  // Choose the Random engine
72  //
73  G4Random::setTheEngine(new CLHEP::RanecuEngine);
74 
75  G4int myseed = 1234;
76  if (argc > 2) myseed = atoi(argv[argc-1]);
77 
78  // Construct the default run manager
79  //
80 #ifdef G4MULTITHREADED
81  G4MTRunManager * runManager = new G4MTRunManager;
82 #else
84  G4RunManager * runManager = new G4RunManager;
85 #endif
86 
87  G4Random::setTheSeed(myseed);
88 
89  // Set mandatory initialization classes
90  //
91  // Detector construction
93  // Physics list
94  runManager->SetUserInitialization(new F05PhysicsList());
95  // User action initialization
97 
98  // Initialize visualization
99  //
100  G4VisManager* visManager = new G4VisExecutive;
101  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
102  // G4VisManager* visManager = new G4VisExecutive("Quiet");
103  visManager->Initialize();
104 
105  // Get the pointer to the User Interface manager
106  //
107  G4UImanager* UImanager = G4UImanager::GetUIpointer();
108 
109  if (!ui) // batch mode
110  {
111  G4String command = "/control/execute ";
112  G4String fileName = argv[1];
113  UImanager->ApplyCommand(command+fileName);
114  }
115  else
116  { // interactive mode : define UI session
117  UImanager->ApplyCommand("/control/execute init_vis.mac");
118  if (ui->IsGUI())
119  UImanager->ApplyCommand("/control/execute gui.mac");
120  ui->SessionStart();
121  delete ui;
122  }
123 
124  // Job termination
125  // Free the store: user actions, physics_list and detector_description are
126  // owned and deleted by the run manager, so they should not
127  // be deleted in the main() program !
128 
129  delete visManager;
130  delete runManager;
131 
132  return 0;
133 }
134 
135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......