Geant4  10.02.p02
RE03.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 #ifdef G4MULTITHREADED
33 #include "G4MTRunManager.hh"
34 #else
35 #include "G4RunManager.hh"
36 #endif
37 #include "G4UImanager.hh"
38 #include "G4ScoringManager.hh"
39 
41 #include "FTFP_BERT.hh"
43 
44 #ifdef G4VIS_USE
45 #include "G4VisExecutive.hh"
46 #endif
47 
48 #ifdef G4UI_USE
49 #include "G4UIExecutive.hh"
50 #endif
51 
52 //====================================================================
53 // Un-comment this line for user defined score writer
54 // #include "RE03UserScoreWriter.hh"
55 //====================================================================
56 
57 int main(int argc,char** argv)
58 {
59  // Construct the run manager
60  //
61 #ifdef G4MULTITHREADED
62  G4MTRunManager * runManager = new G4MTRunManager;
63  runManager->SetNumberOfThreads(4);
64 #else
65  G4RunManager * runManager = new G4RunManager;
66 #endif
67 
68  // Activate UI-command base scorer
70  scManager->SetVerboseLevel(1);
71 
72 //====================================================================
73 // Un-comment this line for user defined score writer
74 // scManager->SetScoreWriter(new RE03UserScoreWriter());
75 //====================================================================
76 
77  // Set mandatory initialization classes
78  //
80  runManager->SetUserInitialization(detector);
81  //
82  G4VUserPhysicsList* physics = new FTFP_BERT;
83  runManager->SetUserInitialization(physics);
84 
85  // Set user action classes through Worker Initialization
86  //
88  runManager->SetUserInitialization(actions);
89 
90 #ifdef G4VIS_USE
91  // Visualization manager
92  G4VisManager* visManager = new G4VisExecutive;
93  visManager->Initialize();
94 #endif
95 
96  // Initialize G4 kernel
97  //
98  runManager->Initialize();
99 
100  // Get the pointer to the User Interface manager
101  //
102  G4UImanager* UImanager = G4UImanager::GetUIpointer();
103 
104  if (argc==1) // Define UI session for interactive mode
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  else // Batch mode
116  {
117  G4String command = "/control/execute ";
118  G4String fileName = argv[1];
119  UImanager->ApplyCommand(command+fileName);
120  }
121 
122  // Job termination
123  // Free the store: user actions, physics_list and detector_description are
124  // owned and deleted by the run manager, so they should not
125  // be deleted in the main() program !
126 
127 #ifdef G4VIS_USE
128  delete visManager;
129 #endif
130  delete runManager;
131 
132  return 0;
133 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
Definition of the RE03ActionInitialization class.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
int main(int argc, char **argv)
Definition: RE03.cc:57
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
virtual void Initialize()
static G4ScoringManager * GetScoringManager()
void SetVerboseLevel(G4int vl)
Definition of the RE03DetectorConstruction class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446