Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /// \file RE06/exampleRE06.cc 27 /// \brief Main program of the RE06 example 28 // 29 // 30 // ------------------------------------------- 31 // GEANT 4 - example RE06 32 // ------------------------------------------- 33 34 #include "FTFP_BERT.hh" 35 #include "RE06ActionInitialization.hh" 36 #include "RE06DetectorConstruction.hh" 37 #include "RE06ParallelWorld.hh" 38 #include "RE06PrimaryGeneratorAction.hh" 39 #include "RE06RunAction.hh" 40 #include "RE06SteppingVerbose.hh" 41 42 #include "G4ParallelWorldPhysics.hh" 43 #include "G4RunManagerFactory.hh" 44 #include "G4Types.hh" 45 #include "G4UIExecutive.hh" 46 #include "G4UImanager.hh" 47 #include "G4VisExecutive.hh" 48 49 int main(int argc, char** argv) 50 { 51 // Instantiate G4UIExecutive if there are no 52 G4UIExecutive* ui = nullptr; 53 if (argc == 1) { 54 ui = new G4UIExecutive(argc, argv); 55 } 56 57 // Construct the stepping verbose class 58 // 59 auto verbosity = new RE06SteppingVerbose; 60 61 // Construct the run manager 62 // 63 auto runManager = G4RunManagerFactory::Creat 64 65 // Set mandatory initialization classes 66 // 67 G4String parallelWorldName = "ParallelScorin 68 auto detector = new RE06DetectorConstruction 69 detector->RegisterParallelWorld(new RE06Para 70 runManager->SetUserInitialization(detector); 71 // 72 auto physics = new FTFP_BERT; 73 physics->RegisterPhysics(new G4ParallelWorld 74 runManager->SetUserInitialization(physics); 75 76 // Set user action classes 77 // 78 runManager->SetUserInitialization(new RE06Ac 79 80 // Visualization manager 81 // 82 auto visManager = new G4VisExecutive; 83 visManager->Initialize(); 84 85 // Initialize G4 kernel 86 // 87 runManager->Initialize(); 88 89 // Get the pointer to the User Interface man 90 // 91 auto UImanager = G4UImanager::GetUIpointer() 92 93 if (ui) // Define UI session for interactiv 94 { 95 UImanager->ApplyCommand("/control/execute 96 ui->SessionStart(); 97 delete ui; 98 } 99 else // Batch mode 100 { 101 G4String command = "/control/execute "; 102 G4String fileName = argv[1]; 103 UImanager->ApplyCommand(command + fileName 104 } 105 106 // Job termination 107 // Free the store: 108 // user actions, physics_list and detector_d 109 // owned and deleted by the run manager, so 110 // be deleted in the main() program ! 111 112 delete verbosity; 113 delete visManager; 114 delete runManager; 115 116 return 0; 117 } 118