Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file ExGflasha.cc 27 /// \file ExGflasha.cc 28 /// \brief Main program of the parameterisatio 28 /// \brief Main program of the parameterisations/gflash/gflasha example 29 // 29 // >> 30 // Created by Joanna Weng 26.11.2004 30 31 31 // G4 includes 32 // G4 includes 32 #include "G4PhysListFactory.hh" << 33 #include "G4RunManagerFactory.hh" << 34 #include "G4Timer.hh" << 35 #include "G4Types.hh" 33 #include "G4Types.hh" 36 #include "G4UImanager.hh" << 37 #include "G4ios.hh" 34 #include "G4ios.hh" >> 35 #include "G4Timer.hh" >> 36 #include "G4UImanager.hh" >> 37 >> 38 #include "G4RunManagerFactory.hh" 38 39 39 // my project 40 // my project 40 #include "ExGflashActionInitialization.hh" << 41 #include "ExGflashDetectorConstruction.hh" 41 #include "ExGflashDetectorConstruction.hh" >> 42 #include "ExGflashActionInitialization.hh" 42 43 >> 44 #include "FTFP_BERT.hh" 43 #include "G4FastSimulationPhysics.hh" 45 #include "G4FastSimulationPhysics.hh" 44 #include "G4UIExecutive.hh" << 46 45 #include "G4VisExecutive.hh" 47 #include "G4VisExecutive.hh" >> 48 #include "G4UIExecutive.hh" 46 49 47 //....oooOO0OOooo........oooOO0OOooo........oo 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 48 51 49 int main(int argc, char** argv) << 52 int main(int argc,char** argv) 50 { 53 { 51 // Instantiate G4UIExecutive if interactive 54 // Instantiate G4UIExecutive if interactive mode 52 G4UIExecutive* ui = nullptr; 55 G4UIExecutive* ui = nullptr; 53 if (argc == 1) { << 56 if ( argc == 1 ) { 54 ui = new G4UIExecutive(argc, argv); 57 ui = new G4UIExecutive(argc, argv); 55 } 58 } 56 59 57 // timer to see GFlash performance 60 // timer to see GFlash performance 58 G4Timer timer; 61 G4Timer timer; 59 timer.Start(); 62 timer.Start(); 60 63 61 G4cout << "+-------------------------------- << 64 G4cout<<"+-------------------------------------------------------+"<<G4endl; 62 G4cout << "| << 65 G4cout<<"| |"<<G4endl; 63 G4cout << "| This is an example of << 66 G4cout<<"| This is an example of Shower |"<<G4endl; 64 G4cout << "| Parameterization with << 67 G4cout<<"| Parameterization with GFLASH |"<<G4endl; 65 G4cout << "+-------------------------------- << 68 G4cout<<"+-------------------------------------------------------+"<<G4endl; 66 69 67 auto* runManager = G4RunManagerFactory::Crea 70 auto* runManager = G4RunManagerFactory::CreateRunManager(); 68 71 69 // UserInitialization classes (mandatory) 72 // UserInitialization classes (mandatory) 70 auto detector = new ExGflashDetectorConstruc << 73 ExGflashDetectorConstruction* detector = new ExGflashDetectorConstruction; 71 runManager->SetUserInitialization(detector); 74 runManager->SetUserInitialization(detector); 72 75 73 // -- Select a physics list: 76 // -- Select a physics list: 74 G4PhysListFactory listFactory; << 77 G4VModularPhysicsList* physicsList = new FTFP_BERT(); 75 G4String name; << 76 auto list_name = std::getenv("PHYSLIST"); << 77 if (list_name == nullptr || std::strlen(list << 78 name = "FTFP_BERT"; << 79 } << 80 else { << 81 name = list_name; << 82 } << 83 G4VModularPhysicsList* physicsList = listFac << 84 << 85 // -- Create a fast simulation physics const 78 // -- Create a fast simulation physics constructor, used to augment 86 // -- the above physics list to allow for fa 79 // -- the above physics list to allow for fast simulation: 87 auto fastSimulationPhysics = new G4FastSimul << 80 G4FastSimulationPhysics* fastSimulationPhysics = new G4FastSimulationPhysics(); 88 81 89 // -- We now configure the fastSimulationPhy 82 // -- We now configure the fastSimulationPhysics object. 90 // -- The gflash model (GFlashShowerModel, s << 83 // -- The gflash model (GFlashShowerModel, see ExGflashDetectorConstruction.cc) 91 // ExGflashDetectorConstruction.cc) << 92 // -- is applicable to e+ and e- : we augmen 84 // -- is applicable to e+ and e- : we augment the physics list for these 93 // -- particles (by adding a G4FastSimulatio 85 // -- particles (by adding a G4FastSimulationManagerProcess with below's 94 // -- calls), this will make the fast simula 86 // -- calls), this will make the fast simulation to be activated: 95 fastSimulationPhysics->ActivateFastSimulatio 87 fastSimulationPhysics->ActivateFastSimulation("e-"); 96 fastSimulationPhysics->ActivateFastSimulatio 88 fastSimulationPhysics->ActivateFastSimulation("e+"); 97 // -- Register this fastSimulationPhysics to 89 // -- Register this fastSimulationPhysics to the physicsList, 98 // -- when the physics list will be called b 90 // -- when the physics list will be called by the run manager 99 // -- (will happen at initialization of the 91 // -- (will happen at initialization of the run manager) 100 // -- for physics process construction, the 92 // -- for physics process construction, the fast simulation 101 // -- configuration will be applied as well. 93 // -- configuration will be applied as well. 102 physicsList->RegisterPhysics(fastSimulationP << 94 physicsList->RegisterPhysics( fastSimulationPhysics ); 103 runManager->SetUserInitialization(physicsLis 95 runManager->SetUserInitialization(physicsList); 104 96 105 // Action initialization: 97 // Action initialization: 106 runManager->SetUserInitialization(new ExGfla 98 runManager->SetUserInitialization(new ExGflashActionInitialization(detector)); 107 99 108 G4VisManager* visManager = new G4VisExecutiv 100 G4VisManager* visManager = new G4VisExecutive; 109 visManager->Initialize(); 101 visManager->Initialize(); 110 102 111 G4UImanager* UImanager = G4UImanager::GetUIp 103 G4UImanager* UImanager = G4UImanager::GetUIpointer(); >> 104 UImanager->ApplyCommand("/run/verbose 0"); >> 105 runManager->Initialize(); >> 106 UImanager->ApplyCommand("/Step/Verbose 0"); 112 107 113 if (ui != nullptr) // Define UI terminal fo << 108 if (ui) // Define UI terminal for interactive mode 114 { 109 { 115 UImanager->ApplyCommand("/control/execute 110 UImanager->ApplyCommand("/control/execute vis.mac"); 116 ui->SessionStart(); 111 ui->SessionStart(); 117 delete ui; 112 delete ui; 118 } 113 } 119 else // Batch mode << 114 else // Batch mode 120 { 115 { 121 G4String s = *(argv + 1); << 116 G4String s=*(argv+1); 122 UImanager->ApplyCommand("/control/execute << 117 UImanager->ApplyCommand("/control/execute "+s); 123 } 118 } 124 119 125 delete visManager; 120 delete visManager; 126 delete runManager; 121 delete runManager; 127 122 128 timer.Stop(); 123 timer.Stop(); 129 G4cout << G4endl; 124 G4cout << G4endl; 130 G4cout << "********************************* 125 G4cout << "******************************************"; 131 G4cout << G4endl; 126 G4cout << G4endl; 132 G4cout << "Total Real Elapsed Time is: " << << 127 G4cout << "Total Real Elapsed Time is: "<< timer.GetRealElapsed(); 133 G4cout << G4endl; 128 G4cout << G4endl; 134 G4cout << "Total System Elapsed Time: " << t 129 G4cout << "Total System Elapsed Time: " << timer.GetSystemElapsed(); 135 G4cout << G4endl; 130 G4cout << G4endl; 136 G4cout << "Total GetUserElapsed Time: " << t 131 G4cout << "Total GetUserElapsed Time: " << timer.GetUserElapsed(); 137 G4cout << G4endl; 132 G4cout << G4endl; 138 G4cout << "********************************* 133 G4cout << "******************************************"; 139 G4cout << G4endl; 134 G4cout << G4endl; 140 135 141 return 0; 136 return 0; 142 } 137 } 143 138 144 //....oooOO0OOooo........oooOO0OOooo........oo 139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 145 140