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 RE05/exampleRE05.cc 27 /// \file RE05/exampleRE05.cc 28 /// \brief Main program of the RE05 example 28 /// \brief Main program of the RE05 example 29 // 29 // 30 30 31 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 33 34 #include "QBBC.hh" << 34 #include "G4Types.hh" 35 #include "RE05ActionInitialization.hh" << 36 #include "RE05CalorimeterParallelWorld.hh" << 37 #include "RE05DetectorConstruction.hh" << 38 #include "RE05SteppingVerbose.hh" << 39 35 40 #include "G4ParallelWorldPhysics.hh" << 41 #include "G4RunManagerFactory.hh" 36 #include "G4RunManagerFactory.hh" 42 #include "G4Types.hh" << 37 #include "RE05SteppingVerbose.hh" 43 #include "G4UIExecutive.hh" << 38 44 #include "G4UImanager.hh" 39 #include "G4UImanager.hh" >> 40 >> 41 #include "RE05DetectorConstruction.hh" >> 42 #include "RE05CalorimeterParallelWorld.hh" >> 43 #include "QBBC.hh" >> 44 #include "G4ParallelWorldPhysics.hh" >> 45 #include "RE05ActionInitialization.hh" >> 46 45 #include "G4VisExecutive.hh" 47 #include "G4VisExecutive.hh" >> 48 #include "G4UIExecutive.hh" 46 49 47 int main(int argc, char** argv) << 50 int main(int argc,char** argv) 48 { 51 { 49 // Instantiate G4UIExecutive if there are no 52 // Instantiate G4UIExecutive if there are no arguments (interactive mode) 50 G4UIExecutive* ui = nullptr; 53 G4UIExecutive* ui = nullptr; 51 if (argc == 1) { << 54 if ( argc == 1 ) { 52 ui = new G4UIExecutive(argc, argv); 55 ui = new G4UIExecutive(argc, argv); 53 } 56 } 54 57 55 // Setting the application-sepcific Stepping 58 // Setting the application-sepcific SteppingVerbose 56 auto verbosity = new RE05SteppingVerbose; 59 auto verbosity = new RE05SteppingVerbose; 57 60 58 // Creating the run manager 61 // Creating the run manager 59 auto runManager = G4RunManagerFactory::Creat 62 auto runManager = G4RunManagerFactory::CreateRunManager(); 60 63 61 G4String parallelWorldName = "ReadoutWorld"; 64 G4String parallelWorldName = "ReadoutWorld"; 62 // User Initialization classes (mandatory) 65 // User Initialization classes (mandatory) 63 // 66 // 64 auto detector = new RE05DetectorConstruction 67 auto detector = new RE05DetectorConstruction(); 65 detector->RegisterParallelWorld(new RE05Calo << 68 detector->RegisterParallelWorld >> 69 (new RE05CalorimeterParallelWorld(parallelWorldName)); 66 runManager->SetUserInitialization(detector); 70 runManager->SetUserInitialization(detector); 67 // 71 // 68 auto physicsList = new QBBC; 72 auto physicsList = new QBBC; 69 physicsList->RegisterPhysics(new G4ParallelW << 73 physicsList >> 74 ->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName)); 70 runManager->SetUserInitialization(physicsLis 75 runManager->SetUserInitialization(physicsList); 71 // 76 // 72 auto actions = new RE05ActionInitialization; 77 auto actions = new RE05ActionInitialization; 73 runManager->SetUserInitialization(actions); 78 runManager->SetUserInitialization(actions); 74 79 75 runManager->Initialize(); 80 runManager->Initialize(); 76 81 77 auto visManager = new G4VisExecutive; 82 auto visManager = new G4VisExecutive; 78 visManager->Initialize(); 83 visManager->Initialize(); 79 84 80 // get the pointer to the User Interface man << 85 //get the pointer to the User Interface manager 81 auto UImanager = G4UImanager::GetUIpointer() << 86 auto UImanager = G4UImanager::GetUIpointer(); 82 87 83 if (!ui) // batch mode << 88 if (!ui) // batch mode 84 { 89 { 85 G4String command = "/control/execute "; 90 G4String command = "/control/execute "; 86 G4String fileName = argv[1]; 91 G4String fileName = argv[1]; 87 UImanager->ApplyCommand(command + fileName << 92 UImanager->ApplyCommand(command+fileName); 88 } 93 } 89 else // interactive mode : define UI sessio << 94 else // interactive mode : define UI session 90 { 95 { 91 UImanager->ApplyCommand("/control/execute 96 UImanager->ApplyCommand("/control/execute vis.mac"); 92 ui->SessionStart(); 97 ui->SessionStart(); 93 delete ui; 98 delete ui; 94 } 99 } 95 100 96 // Job termination 101 // Job termination 97 // Free the store: user actions, physics_lis 102 // Free the store: user actions, physics_list and detector_description are 98 // owned and deleted by the 103 // owned and deleted by the run manager, so they should not 99 // be deleted in the main() 104 // be deleted in the main() program ! 100 delete verbosity; << 101 delete visManager; 105 delete visManager; 102 delete runManager; 106 delete runManager; >> 107 delete verbosity; 103 108 104 return 0; 109 return 0; 105 } 110 } 106 111 107 //....oooOO0OOooo........oooOO0OOooo........oo 112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 108 113