LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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 98775 2016-08-09 14:30:39Z gcosmo $
27 //
30 //
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #ifdef G4MULTITHREADED
36 #include "G4MTRunManager.hh"
37 #include "RE05WorkerInitialization.hh"
38 #else
39 #include "G4RunManager.hh"
40 #include "RE05SteppingVerbose.hh"
41 #endif
42 
43 #include "G4UImanager.hh"
44 
45 #include "RE05DetectorConstruction.hh"
46 #include "RE05CalorimeterParallelWorld.hh"
47 #include "QBBC.hh"
48 #include "G4ParallelWorldPhysics.hh"
49 #include "RE05ActionInitialization.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);
65  runManager->SetUserInitialization(new RE05WorkerInitialization);
66 #else
67  G4VSteppingVerbose* verbosity = new RE05SteppingVerbose;
68  G4VSteppingVerbose::SetInstance(verbosity);
69  G4RunManager* runManager = new G4RunManager;
70 #endif
71 
72  G4String parallelWorldName = "ReadoutWorld";
73  // User Initialization classes (mandatory)
74  //
75  G4VUserDetectorConstruction* detector = new RE05DetectorConstruction();
76  detector->RegisterParallelWorld
77  (new RE05CalorimeterParallelWorld(parallelWorldName));
78  runManager->SetUserInitialization(detector);
79  //
80  G4VModularPhysicsList* physicsList = new QBBC;
81  physicsList
82  ->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
83  runManager->SetUserInitialization(physicsList);
84  //
85  G4VUserActionInitialization* actions = new RE05ActionInitialization;
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......
int main(int argc, char **argv)
Definition: exampleRE05.cc:59