Geant4  10.03
channeling.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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 
32 #ifdef G4MULTITHREADED
33 #include "G4MTRunManager.hh"
34 #else
35 #include "G4RunManager.hh"
36 #endif
37 #include "G4ScoringManager.hh"
38 #include "G4UImanager.hh"
39 
40 #include "Randomize.hh"
41 
43 
44 #ifdef G4MULTITHREADED
46 #else
48 #include "ExExChTrackingAction.hh"
49 #include "ExExChStackingAction.hh"
50 #include "ExExChEventAction.hh"
51 #include "ExExChRunAction.hh"
52 #endif
53 
54 #include "ExExChPhysicsList.hh"
55 #include "QGSP_BERT.hh"
56 
57 #ifdef G4VIS_USE
58 #include "G4VisExecutive.hh"
59 #endif
60 
61 #ifdef G4UI_USE
62 #include "G4UIExecutive.hh"
63 #endif
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 
67 int main(int argc,char** argv)
68 {
69  // Construct the default run manager
70 #ifdef G4MULTITHREADED
71  G4MTRunManager* runManager = new G4MTRunManager;
72  if(argv[2]){
73  if(atoi(argv[2])>0){
74  runManager->SetNumberOfThreads(atoi(argv[2]));
75  }
76  }
77  G4cout << "MT MODE ON " << runManager->GetNumberOfThreads() << G4endl;
78 #else
79  G4RunManager* runManager = new G4RunManager;
80  G4cout << "MT MODE OFF" << G4endl;
81 #endif
82 
83  // Activate UI-command base scorer
85  scManager->SetVerboseLevel(0);
86 
87  // Choose the Random engine
88 #ifndef G4MULTITHREADED
89  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
90 #endif
91 
92  // Set mandatory initialization classes
93  G4VUserDetectorConstruction* detector =
95  runManager->SetUserInitialization(detector);
96  runManager->SetUserInitialization(new ExExChPhysicsList());
97 
98 #ifndef G4MULTITHREADED
99  // Set user action classes
100  runManager->SetUserAction(new ExExChPrimaryGeneratorAction());
101  runManager->SetUserAction(new ExExChEventAction());
102  runManager->SetUserAction(new ExExChStackingAction());
103  runManager->SetUserAction(new ExExChTrackingAction());
104  runManager->SetUserAction(new ExExChRunAction());
105 #else
106  runManager->SetUserInitialization(
107  new ExExChUserActionInitialization());
108 #endif
109 
110  // Get the pointer to the User Interface manager
112 
113  if(argc!=1) {
114  // Batch mode
115  G4String command = "/control/execute ";
116  G4String fileName = argv[1];
117  UI->ApplyCommand(command+fileName);
118  }
119 
120  else {
121  // Define visualization and UI terminal for interactive mode
122 #ifdef G4VIS_USE
123  G4VisManager* visManager = new G4VisExecutive;
124  visManager->Initialize();
125 #endif
126 
127 #ifdef G4UI_USE
128  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
129  ui->SessionStart();
130  delete ui;
131 #endif
132 
133 #ifdef G4VIS_USE
134  delete visManager;
135 #endif
136  }
137 
138  // Job termination
139  delete runManager;
140 
141  return 0;
142 }
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4GLOB_DLL std::ostream G4cout
Definition of the ExExChTrackingAction class.
G4int GetNumberOfThreads() const
Definition of the ExExChEventAction class.
void Initialize()
Definition of the ExExChPrimaryGeneratorAction class.
#define G4endl
Definition: G4ios.hh:61
static G4ScoringManager * GetScoringManager()
Definition of the ExExChUserActionInitialization class.
void SetVerboseLevel(G4int vl)
Definition of the ExExChRunAction class.
Definition of the ExExChPhysicsList class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446
Definition of the ExExChStackingAction class.
virtual void SetUserAction(G4UserRunAction *userAction)
int main(int argc, char **argv)
Definition: channeling.cc:67
Definition of the ExExChDetectorConstruction class.