Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
28 //
29 // Created by Joanna Weng 26.11.2004
30 
31 //std includes
32 #include <algorithm>
33 #include <iostream>
34 #include "G4Timer.hh"
35 // G4 includes
36 #include "G4ios.hh"
38 #include "G4Timer.hh"
39 #include "G4RunManager.hh"
40 #include "G4UImanager.hh"
41 
42 // my project
44 #include "ExGflashPhysicsList.hh"
46 #include "ExGflashEventAction.hh"
47 #include "ExGflashRunAction.hh"
48 
49 using namespace std;
50 
51 #ifdef G4VIS_USE
52 #include "G4VisExecutive.hh"
53 #endif
54 
55 #ifdef G4UI_USE
56 #include "G4UIExecutive.hh"
57 #endif
58 
59 #ifdef G4_SOLVE_TEMPLATES
60 #ifdef G4VIS_USE
61 #define G4_SOLVE_VIS_TEMPLATES
62 #endif
63 #endif
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
69 int main(int argc,char** argv)
70 {
71  // Timer to see GFlash performance
72  Timer.Start();
73 
74  G4cout<<"+-------------------------------------------------------+"<<G4endl;
75  G4cout<<"| |"<<G4endl;
76  G4cout<<"| This is an example of Shower |"<<G4endl;
77  G4cout<<"| Parameterization with GFLASH |"<<G4endl;
78  G4cout<<"+-------------------------------------------------------+"<<G4endl;
79 
80  G4RunManager* runManager = new G4RunManager;
81 
82  // UserInitialization classes (mandatory)
83  G4cout<<"# GFlash Example: Detector Construction"<<G4endl;
85  G4cout<<"# GFlash Example: Physics list"<<G4endl;
87  G4cout<<"# GFlash Example: Primary Generator"<<G4endl;
89  G4cout<<"# GFlash Example: User Action Classes"<<G4endl;
90  runManager->SetUserAction(new ExGflashEventAction);
91  runManager->SetUserAction(new ExGflashRunAction);
92 
93 #ifdef G4VIS_USE
94  G4VisManager* visManager = new G4VisExecutive;
95  visManager->Initialize();
96 #endif
97 
99  UImanager->ApplyCommand("/run/verbose 0");
100  runManager->Initialize();
101  UImanager->ApplyCommand("/Step/Verbose 0");
102 
103  if (argc==1) // Define UI terminal for interactive mode
104  {
105 #ifdef G4UI_USE
106  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
107 #ifdef G4VIS_USE
108  UImanager->ApplyCommand("/control/execute vis.mac");
109 #endif
110  ui->SessionStart();
111  delete ui;
112 #endif
113  }
114  else // Batch mode
115  {
116  G4String s=*(argv+1);
117  UImanager->ApplyCommand("/control/execute "+s);
118  }
119 
120  #ifdef G4VIS_USE
121  delete visManager;
122  #endif
123  delete runManager;
124 
125  Timer.Stop();
126  G4cout << G4endl;
127  G4cout << "******************************************";
128  G4cout << G4endl;
129  G4cout << "Total Real Elapsed Time is: "<< Timer.GetRealElapsed();
130  G4cout << G4endl;
131  G4cout << "Total System Elapsed Time: " << Timer.GetSystemElapsed();
132  G4cout << G4endl;
133  G4cout << "Total GetUserElapsed Time: " << Timer.GetUserElapsed();
134  G4cout << G4endl;
135  G4cout << "******************************************";
136  G4cout << G4endl;
137 
138  return 0;
139 }
140 
141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
142 
143 
144