Geant4  10.02
RE01.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 //
28 //
29 //
30 // $Id: $
31 //
32 //
33 // --------------------------------------------------------------
34 // GEANT4 - RE01 exsample code
35 //
36 // --------------------------------------------------------------
37 // Comments
38 //
39 //
40 // --------------------------------------------------------------
41 
42 
43 #ifdef G4MULTITHREADED
44 #include "G4MTRunManager.hh"
45 #else
46 #include "G4RunManager.hh"
47 #endif
48 #include "G4UImanager.hh"
49 
51 #include "RE01PhysicsList.hh"
52 #include "QGSP_BERT.hh"
53 
55 
56 
57 #ifdef G4VIS_USE
58 #include "G4VisExecutive.hh"
59 #endif
60 
61 #ifdef G4UI_USE
62 #include "G4UIExecutive.hh"
63 #endif
64 
65 int main(int argc,char** argv)
66 {
67 #ifdef G4MULTITHREADED
68  G4MTRunManager * runManager = new G4MTRunManager;
69  //runManager->SetNumberOfThreads(4);
70 #else
71  G4RunManager * runManager = new G4RunManager;
72 #endif
73 
74 #ifdef G4VIS_USE
75  // Visualization manager construction
76  G4VisManager* visManager = new G4VisExecutive;
77  visManager->Initialize();
78 #endif
79 
81  runManager->SetUserInitialization(new RE01PhysicsList);
82  //runManager->SetUserInitialization(new QGSP_BERT);
83 
85 
86  runManager->Initialize();
87 
88  if(argc==1)
89  {
90 #ifdef G4UI_USE
91  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
92  ui->SessionStart();
93  delete ui;
94 #endif
95  }
96  else
97  {
98  G4UImanager* UImanager = G4UImanager::GetUIpointer();
99  G4String command = "/control/execute ";
100  G4String fileName = argv[1];
101  UImanager->ApplyCommand(command+fileName);
102  }
103 
104 #ifdef G4VIS_USE
105  delete visManager;
106 #endif
107 
108  delete runManager;
109 
110  return 0;
111 }
112 
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Definition of the RE01ActionInitialization class.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
Definition of the RE01PhysicsList class.
void Initialize()
int main(int argc, char **argv)
Definition: RE01.cc:65
virtual void Initialize()
Definition of the RE01DetectorConstruction class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446