Geant4  10.00.p03
exgps.cc
Go to the documentation of this file.
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 // $Id: exgps.cc 76468 2013-11-11 10:27:19Z gcosmo $
27 //
30 //
31 #include "G4RunManager.hh"
32 #include "G4UImanager.hh"
33 
34 #ifdef G4MULTITHREADED
35 #include "G4MTRunManager.hh"
36 #else
37 #include "G4RunManager.hh"
38 #endif
39 
40 #include "G4UImanager.hh"
41 
42 #ifdef G4VIS_USE
43 #include "G4VisExecutive.hh"
44 #endif
45 
46 #ifdef G4UI_USE
47 #include "G4UIExecutive.hh"
48 #endif
49 
50 
52 #include "exGPSPhysicsList.hh"
54 #include "exGPSRunAction.hh"
55 #include "exGPSEventAction.hh"
57 
58 int main(int argc,char** argv) {
59 
60  // Construct the default run manager
61 #ifdef G4MULTITHREADED
62  G4int nThreads = 4;
63  G4MTRunManager * runManager = new G4MTRunManager;
64  runManager->SetNumberOfThreads(nThreads);
65 #else
66  G4RunManager * runManager = new G4RunManager;
67 #endif
68 
69  // set mandatory initialization classes
71  runManager->SetUserInitialization(detector);
72  runManager->SetUserInitialization(new exGPSPhysicsList);
74 
75  //Initialize G4 kernel
76  runManager->Initialize();
77 
78  // visualization manager
79 #ifdef G4VIS_USE
80  G4VisManager* visManager = new G4VisExecutive;
81  visManager->Initialize();
82 #endif
83 
84  // get the pointer to the User Interface manager
85  G4UImanager* UImanager = G4UImanager::GetUIpointer();
86  // UI->ApplyCommand("/control/execute display.mac");
87 
88  if (argc!=1) // batch mode
89  {
90  G4String command = "/control/execute ";
91  G4String fileName = argv[1];
92  UImanager->ApplyCommand(command+fileName);
93  }
94  else
95  { // interactive mode : define UI session
96 #ifdef G4UI_USE
97  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
98  ui->SessionStart();
99  delete ui;
100 #endif
101  }
102 
103  // job termination
104 #ifdef G4VIS_USE
105  delete visManager;
106 #endif
107  delete runManager;
108 
109  return 0;
110 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
Definition of the exGPSPrimaryGeneratorAction class.
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
Definition of the exGPSRunAction class.
Definition of the exGPSPhysicsList class.
Definition of the exGPSEventAction class.
int main(int argc, char **argv)
Definition: exgps.cc:58
virtual void Initialize()
Action initialization class.
Definition of the exGPSGeometryConstruction class.
Definition of the exGPSActionInitialization class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432