ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
spower.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file spower.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 #include "G4Types.hh"
29 
30 #ifdef G4MULTITHREADED
31 #include "G4MTRunManager.hh"
32 #else
33 #include "G4RunManager.hh"
34 #endif
35 
36 #include "G4UImanager.hh"
37 #include "Randomize.hh"
38 
39 #include "DetectorConstruction.hh"
40 #include "PhysicsList.hh"
41 
42 #include "ActionInitialization.hh"
43 #include "SteppingVerbose.hh"
44 
45 #include "G4VisExecutive.hh"
46 #include "G4UIExecutive.hh"
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49 
50 int main(int argc,char** argv) {
51 
52  //delete output file
53  remove ("spower.txt");
54 
55  // Detect interactive mode (if no arguments) and define UI session
56  //
57  G4UIExecutive* ui = 0;
58  if ( argc == 1 ) {
59  ui = new G4UIExecutive(argc, argv);
60  }
61 
62  //construct the default run manager
63 #ifdef G4MULTITHREADED
64  G4MTRunManager* runManager = new G4MTRunManager;
65 #else
67  G4RunManager* runManager = new G4RunManager;
68 #endif
69 
70  //set mandatory initialization classes
72  runManager->SetUserInitialization(det);
73 
74  PhysicsList* phys = new PhysicsList;
75  runManager->SetUserInitialization(phys);
76 
78 
79  // Initialize visualization
80  //
81  G4VisManager* visManager = new G4VisExecutive;
82  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
83  // G4VisManager* visManager = new G4VisExecutive("Quiet");
84  visManager->Initialize();
85 
86  // Get the pointer to the User Interface manager
88 
89  // Process macro or start UI session
90  //
91  if ( ! ui ) {
92  // batch mode
93  G4String command = "/control/execute ";
94  G4String fileName = argv[1];
95  UImanager->ApplyCommand(command+fileName);
96  }
97  else {
98  // interactive mode
99  ui->SessionStart();
100  delete ui;
101  }
102 
103  //job termination
104  delete runManager;
105 
106  return 0;
107 }