[807] | 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 | // Created by Joanna Weng 26.11.2004 |
---|
| 27 | using namespace std; |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | //std includes |
---|
| 31 | #include <algorithm> |
---|
| 32 | #include <iostream> |
---|
| 33 | #include "G4Timer.hh" |
---|
| 34 | // G4 includes |
---|
| 35 | #include "G4ios.hh" |
---|
| 36 | #include "G4GlobalFastSimulationManager.hh" |
---|
| 37 | #include "G4Timer.hh" |
---|
| 38 | #include "G4RunManager.hh" |
---|
| 39 | #include "G4UImanager.hh" |
---|
| 40 | #include "G4UIterminal.hh" |
---|
| 41 | #include "G4UItcsh.hh" |
---|
| 42 | |
---|
| 43 | // my project |
---|
| 44 | #include "ExGflashDetectorConstruction.hh" |
---|
| 45 | #include "ExGflashPhysicsList.hh" |
---|
| 46 | #include "ExGflashPrimaryGeneratorAction.hh" |
---|
| 47 | #include "ExGflashEventAction.hh" |
---|
| 48 | #include "ExGflashRunAction.hh" |
---|
| 49 | |
---|
| 50 | #ifdef G4VIS_USE |
---|
| 51 | #include "ExGflashVisManager.hh" |
---|
| 52 | #endif |
---|
| 53 | |
---|
| 54 | #ifdef G4_SOLVE_TEMPLATES |
---|
| 55 | #ifdef G4VIS_USE |
---|
| 56 | #define G4_SOLVE_VIS_TEMPLATES |
---|
| 57 | #endif |
---|
| 58 | #endif |
---|
| 59 | G4Timer Timer; |
---|
| 60 | G4Timer Timerintern; |
---|
| 61 | |
---|
| 62 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 63 | |
---|
| 64 | int main(int argc,char** argv) |
---|
| 65 | { |
---|
| 66 | // Timer to see GFlash performance |
---|
| 67 | Timer.Start(); |
---|
| 68 | |
---|
| 69 | cout<<"+-------------------------------------------------------+"<<endl; |
---|
| 70 | cout<<"| |"<<endl; |
---|
| 71 | cout<<"| This is an example of Shower |"<<endl; |
---|
| 72 | cout<<"| Parameterization with GFLASH |"<<endl; |
---|
| 73 | cout<<"+-------------------------------------------------------+"<<endl; |
---|
| 74 | |
---|
| 75 | G4RunManager* runManager = new G4RunManager; |
---|
| 76 | |
---|
| 77 | // UserInitialization classes (mandatory) |
---|
| 78 | cout<<"# GFlash Example: Detector Construction"<<endl; |
---|
| 79 | runManager->SetUserInitialization(new ExGflashDetectorConstruction); |
---|
| 80 | cout<<"# GFlash Example: Physics list"<<endl; |
---|
| 81 | runManager->SetUserInitialization(new ExGflashPhysicsList); |
---|
| 82 | cout<<"# GFlash Example: Primary Generator"<<endl; |
---|
| 83 | runManager->SetUserAction(new ExGflashPrimaryGeneratorAction); |
---|
| 84 | cout<<"# GFlash Example: User Action Classes"<<endl; |
---|
| 85 | runManager->SetUserAction(new ExGflashEventAction); |
---|
| 86 | runManager->SetUserAction(new ExGflashRunAction); |
---|
| 87 | |
---|
| 88 | #ifdef G4VIS_USE |
---|
| 89 | G4VisManager* visManager = new ExGflashVisManager; |
---|
| 90 | visManager->Initialize(); |
---|
| 91 | #endif |
---|
| 92 | |
---|
| 93 | G4UImanager* UI = G4UImanager::GetUIpointer(); |
---|
| 94 | UI->ApplyCommand("/run/verbose 0"); |
---|
| 95 | runManager->Initialize(); |
---|
| 96 | UI->ApplyCommand("/Step/Verbose 0"); |
---|
| 97 | |
---|
| 98 | if (argc==1) // Define UI terminal for interactive mode |
---|
| 99 | { |
---|
| 100 | G4UIsession * session = new G4UIterminal(new G4UItcsh); |
---|
| 101 | UI->ApplyCommand("/control/execute vis.mac"); |
---|
| 102 | session->SessionStart(); |
---|
| 103 | //delete session; |
---|
| 104 | } |
---|
| 105 | else // Batch mode |
---|
| 106 | { |
---|
| 107 | G4String s=*(argv+1); |
---|
| 108 | UI->ApplyCommand("/control/execute "+s); |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | #ifdef G4VIS_USE |
---|
| 112 | delete visManager; |
---|
| 113 | #endif |
---|
| 114 | delete runManager; |
---|
| 115 | |
---|
| 116 | Timer.Stop(); |
---|
| 117 | cout << endl; |
---|
| 118 | cout << "******************************************"; |
---|
| 119 | cout << endl; |
---|
| 120 | cout << "Total Real Elapsed Time is: "<< Timer.GetRealElapsed(); |
---|
| 121 | cout << endl; |
---|
| 122 | cout << "Total System Elapsed Time: " << Timer.GetSystemElapsed(); |
---|
| 123 | cout << endl; |
---|
| 124 | cout << "Total GetUserElapsed Time: " << Timer.GetUserElapsed(); |
---|
| 125 | cout << endl; |
---|
| 126 | cout << "******************************************"; |
---|
| 127 | cout << endl; |
---|
| 128 | |
---|
| 129 | return 0; |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | |
---|