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