Geant4  10.00.p02
exampleRE06.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 // $Id: exampleRE06.cc 75123 2013-10-28 09:53:28Z gcosmo $
30 //
31 // --------------------------------------------------------------
32 // GEANT 4 - example RE06
33 // --------------------------------------------------------------
34 
35 #ifdef G4MULTITHREADED
36 #include "G4MTRunManager.hh"
37 #else
38 #include "G4RunManager.hh"
39 #endif
40 
41 #ifdef G4VIS_USE
42 #include "G4VisExecutive.hh"
43 #endif
44 
45 #ifdef G4UI_USE
46 #include "G4UIExecutive.hh"
47 #endif
48 
49 #include "G4UImanager.hh"
50 
51 
53 #include "RE06ParallelWorld.hh"
54 #include "RE06PhysicsList.hh"
56 #include "RE06RunAction.hh"
57 #include "RE06SteppingVerbose.hh"
60 
61 int main(int argc,char** argv)
62 {
63  // Construct the stepping verbose class
66 
67  // Construct the run manager
68  //
69 #ifdef G4MULTITHREADED
70  G4MTRunManager * runManager = new G4MTRunManager;
71  runManager->SetNumberOfThreads(4);
73 #else
74  G4RunManager* runManager = new G4RunManager;
75 #endif
76 
77  // Set mandatory initialization classes
78  //
80  detector->RegisterParallelWorld(new RE06ParallelWorld("ParallelScoringWorld"));
81  runManager->SetUserInitialization(detector);
82  //
83  G4VUserPhysicsList* physics = new RE06PhysicsList;
84  runManager->SetUserInitialization(physics);
85 
86  // Set user action classes
87  //
89 
90 #ifdef G4VIS_USE
91  // Visualization manager
92  //
93  G4VisManager* visManager = new G4VisExecutive;
94  visManager->Initialize();
95 #endif
96 
97  // Initialize G4 kernel
98  //
99  runManager->Initialize();
100 
101  // Get the pointer to the User Interface manager
102  //
103  G4UImanager* UImanager = G4UImanager::GetUIpointer();
104 
105  if (argc==1) // Define UI session for interactive mode
106  {
107 #ifdef G4UI_USE
108  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
109 #ifdef G4VIS_USE
110  UImanager->ApplyCommand("/control/execute vis.mac");
111 #endif
112  ui->SessionStart();
113  delete ui;
114 #endif
115  }
116  else // Batch mode
117  {
118  G4String command = "/control/execute ";
119  G4String fileName = argv[1];
120  UImanager->ApplyCommand(command+fileName);
121  }
122 
123  // Job termination
124  // Free the store:
125  // user actions, physics_list and detector_description are
126  // owned and deleted by the run manager, so they should not
127  // be deleted in the main() program !
128 
129 #ifdef G4VIS_USE
130  delete visManager;
131 #endif
132  delete runManager;
133 
134  return 0;
135 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
int main(int argc, char **argv)
Definition: exampleRE06.cc:61
Definition of the RE06SteppingVerbose class.
void SetNumberOfThreads(G4int n)
Definition of the RE06ActionInitialization class.
Definition of the RE06ParallelWorld class.
void RegisterParallelWorld(G4VUserParallelWorld *)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
virtual void SetUserInitialization(G4VUserPhysicsList *userPL)
Definition of the RE06PhysicsList class.
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Initialize()
Definition of the RE06PrimaryGeneratorAction class.
Definition of the RE06DetectorConstruction class.
Definition of the RE06RunAction class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432
Definition of the RE06WorkerInitialization class.