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