Geant4  10.00.p01
exampleRE05.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: exampleRE05.cc 69920 2013-05-17 13:36:37Z gcosmo $
27 //
30 //
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #ifdef G4MULTITHREADED
36 #include "G4MTRunManager.hh"
38 #else
39 #include "G4RunManager.hh"
40 #include "RE05SteppingVerbose.hh"
41 #endif
42 
43 #include "G4UImanager.hh"
44 
47 #include "QBBC.hh"
50 
51 #ifdef G4VIS_USE
52 #include "G4VisExecutive.hh"
53 #endif
54 
55 #ifdef G4UI_USE
56 #include "G4UIExecutive.hh"
57 #endif
58 
59 int main(int argc,char** argv)
60 {
61 #ifdef G4MULTITHREADED
62  G4MTRunManager* runManager = new G4MTRunManager;
63  G4int number_of_threads = 4; // default number of threads
64  runManager->SetNumberOfThreads(number_of_threads);
66 #else
67  G4VSteppingVerbose* verbosity = new RE05SteppingVerbose;
69  G4RunManager* runManager = new G4RunManager;
70 #endif
71 
72  G4String parallelWorldName = "ReadoutWorld";
73  // User Initialization classes (mandatory)
74  //
76  detector->RegisterParallelWorld
77  (new RE05CalorimeterROGeometry(parallelWorldName));
78  runManager->SetUserInitialization(detector);
79  //
80  G4VModularPhysicsList* physicsList = new QBBC;
81  physicsList
82  ->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
83  runManager->SetUserInitialization(physicsList);
84  //
86  runManager->SetUserInitialization(actions);
87 
88  runManager->Initialize();
89 
90 #ifdef G4VIS_USE
91  G4VisManager* visManager = new G4VisExecutive;
92  visManager->Initialize();
93 #endif
94 
95  //get the pointer to the User Interface manager
96  G4UImanager* UImanager = G4UImanager::GetUIpointer();
97 
98  if (argc!=1) // batch mode
99  {
100  G4String command = "/control/execute ";
101  G4String fileName = argv[1];
102  UImanager->ApplyCommand(command+fileName);
103  }
104  else // interactive mode : define UI session
105  {
106 #ifdef G4UI_USE
107  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
108 #ifdef G4VIS_USE
109  UImanager->ApplyCommand("/control/execute vis.mac");
110 #endif
111  ui->SessionStart();
112  delete ui;
113 #endif
114 
115 #ifdef G4VIS_USE
116  delete visManager;
117 #endif
118  }
119 
120  // Job termination
121  // Free the store: user actions, physics_list and detector_description are
122  // owned and deleted by the run manager, so they should not
123  // be deleted in the main() program !
124  delete runManager;
125 
126  return 0;
127 }
128 
129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
int main(int argc, char **argv)
Definition: exampleRE05.cc:59
void RegisterPhysics(G4VPhysicsConstructor *)
void SetNumberOfThreads(G4int n)
This class manages the verbose outputs in G4SteppingManager. It inherits from G4SteppingVerbose. It shows how to extract informations during the tracking of a particle.
Definition of the RE05ActionInitialization class.
int G4int
Definition: G4Types.hh:78
void RegisterParallelWorld(G4VUserParallelWorld *)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
Definition of the RE05CalorimeterROGeometry class.
virtual void SetUserInitialization(G4VUserPhysicsList *userPL)
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Initialize()
Definition of the RE05DetectorConstruction class.
Definition: QBBC.hh:44
Definition of the RE05SteppingVerbose class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
Definition of the RE05WorkerInitialization class.