Geant4  10.00.p01
ExGflash.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: ExGflash.cc 72372 2013-07-16 14:30:39Z gcosmo $
27 //
30 //
31 // Created by Joanna Weng 26.11.2004
32 
33 //std includes
34 #include <algorithm>
35 #include <iostream>
36 #include "G4Timer.hh"
37 // G4 includes
38 #include "G4ios.hh"
40 #include "G4Timer.hh"
41 #include "G4UImanager.hh"
42 
43 #ifdef G4MULTITHREADED
44 #include "G4MTRunManager.hh"
45 #else
46 #include "G4RunManager.hh"
47 #endif
49 
50 // my project
52 #include "ExGflashPhysicsList.hh"
54 #include "ExGflashEventAction.hh"
55 #include "ExGflashRunAction.hh"
56 
57 #include "QBBC.hh"
58 
59 
60 using namespace std;
61 
62 #ifdef G4VIS_USE
63 #include "G4VisExecutive.hh"
64 #endif
65 
66 #ifdef G4UI_USE
67 #include "G4UIExecutive.hh"
68 #endif
69 
70 #ifdef G4_SOLVE_TEMPLATES
71 #ifdef G4VIS_USE
72 #define G4_SOLVE_VIS_TEMPLATES
73 #endif
74 #endif
75 
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
79 int main(int argc,char** argv)
80 {
81  // Timer to see GFlash performance
82  G4Timer Timer;
83  Timer.Start();
84 
85  G4cout<<"+-------------------------------------------------------+"<<G4endl;
86  G4cout<<"| |"<<G4endl;
87  G4cout<<"| This is an example of Shower |"<<G4endl;
88  G4cout<<"| Parameterization with GFLASH |"<<G4endl;
89  G4cout<<"+-------------------------------------------------------+"<<G4endl;
90 
91 
92 
93 #ifdef G4MULTITHREADED
94  G4MTRunManager * runManager = new G4MTRunManager;
95  runManager->SetNumberOfThreads(4);
96  G4cout<<"+-------------------------------------------------------+"<<G4endl;
97  G4cout<<"| Constructing MT run manager |"<<G4endl;
98  G4cout<<"+-------------------------------------------------------+"<<G4endl;
99 #else
100  G4RunManager * runManager = new G4RunManager;
101  G4cout<<"+-------------------------------------------------------+"<<G4endl;
102  G4cout<<"| Constructing sequential run manager |"<<G4endl;
103  G4cout<<"+-------------------------------------------------------+"<<G4endl;
104 #endif
105 
106  // UserInitialization classes (mandatory)
107  G4cout<<"# GFlash Example: Detector Construction"<<G4endl;
109  G4cout<<"# GFlash Example: Physics list"<<G4endl;
111  // runManager->SetUserInitialization(new QBBC);
112  // Action initialization:
114 
115 
116 #ifdef G4VIS_USE
117  G4VisManager* visManager = new G4VisExecutive;
118  visManager->Initialize();
119 #endif
120 
121  G4UImanager* UImanager = G4UImanager::GetUIpointer();
122  UImanager->ApplyCommand("/run/verbose 0");
123  runManager->Initialize();
124  UImanager->ApplyCommand("/Step/Verbose 0");
125 
126  if (argc==1) // Define UI terminal for interactive mode
127  {
128 #ifdef G4UI_USE
129  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
130 #ifdef G4VIS_USE
131  UImanager->ApplyCommand("/control/execute vis.mac");
132 #endif
133  ui->SessionStart();
134  delete ui;
135 #endif
136  }
137  else // Batch mode
138  {
139  G4String s=*(argv+1);
140  UImanager->ApplyCommand("/control/execute "+s);
141  }
142 
143  #ifdef G4VIS_USE
144  delete visManager;
145  #endif
146  delete runManager;
147 
148  Timer.Stop();
149  G4cout << G4endl;
150  G4cout << "******************************************";
151  G4cout << G4endl;
152  G4cout << "Total Real Elapsed Time is: "<< Timer.GetRealElapsed();
153  G4cout << G4endl;
154  G4cout << "Total System Elapsed Time: " << Timer.GetSystemElapsed();
155  G4cout << G4endl;
156  G4cout << "Total GetUserElapsed Time: " << Timer.GetUserElapsed();
157  G4cout << G4endl;
158  G4cout << "******************************************";
159  G4cout << G4endl;
160 
161  return 0;
162 }
163 
164 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
165 
166 
167 
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
G4double GetSystemElapsed() const
Definition: G4Timer.cc:119
Definition of the ExGflashPrimaryGeneratorAction class.
void SetNumberOfThreads(G4int n)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
static const double s
Definition: G4SIunits.hh:150
G4GLOB_DLL std::ostream G4cout
G4double GetUserElapsed() const
Definition: G4Timer.cc:130
Definition of the ExGflashEventAction class.
Definition of the ExGflashRunAction class.
void Initialize()
G4double GetRealElapsed() const
Definition: G4Timer.cc:107
void Stop()
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
Definition of the ExGflashActionInitialization class.
void Start()
Definition of the ExGflashPhysicsList class.
Definition of the ExGflashDetectorConstruction class.
int main(int argc, char **argv)
Definition: ExGflash.cc:79
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419