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 // 27 /// \file ch2.cc 28 /// \brief Main program of the ch2 example 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 32 #include "DetectorConstruction.hh" 33 #include "ActionInitialization.hh" 34 35 #include "G4RunManagerFactory.hh" 36 #include "G4SteppingVerbose.hh" 37 #include "G4UImanager.hh" 38 #include "FTFP_BERT.hh" 39 #include "G4FastSimulationPhysics.hh" 40 41 #include "G4VisExecutive.hh" 42 #include "G4UIExecutive.hh" 43 44 #include "Randomize.hh" 45 #include "G4Timer.hh" 46 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 49 int main(int argc,char** argv) 50 { 51 // Get current time 52 G4Timer* theTimer = new G4Timer(); 53 theTimer->Start(); 54 55 // Choose the Random engine 56 G4Random::setTheEngine(new CLHEP::RanecuEngi 57 CLHEP::HepRandom::setTheSeed(0.); 58 59 //use G4SteppingVerboseWithUnits 60 G4int precision = 4; 61 G4SteppingVerbose::UseBestUnit(precision); 62 63 // Detect interactive mode (if no arguments) 64 G4UIExecutive* ui = nullptr; 65 if ( argc == 1 ) { ui = new G4UIExecutive(ar 66 67 // Construct the default run manager 68 auto* runManager = 69 G4RunManagerFactory::CreateRunManager(G4Ru 70 71 // Set mandatory initialization classes 72 // 73 // Detector construction 74 runManager->SetUserInitialization(new Detect 75 76 // Physics list 77 G4VModularPhysicsList* physicsList = new FTF 78 79 // -- Create helper tool, used to activate t 80 G4FastSimulationPhysics* fastSimulationPhysi 81 fastSimulationPhysics->BeVerbose(); 82 // -- activation of fast simulation for part 83 // -- attached in the mass geometry: 84 // you may add any charged particles here 85 // CAUTION: for the particles other then e+- 86 // to switch off the radiation 87 fastSimulationPhysics->ActivateFastSimulatio 88 fastSimulationPhysics->ActivateFastSimulatio 89 fastSimulationPhysics->ActivateFastSimulatio 90 fastSimulationPhysics->ActivateFastSimulatio 91 fastSimulationPhysics->ActivateFastSimulatio 92 fastSimulationPhysics->ActivateFastSimulatio 93 fastSimulationPhysics->ActivateFastSimulatio 94 fastSimulationPhysics->ActivateFastSimulatio 95 fastSimulationPhysics->ActivateFastSimulatio 96 //fastSimulationPhysics->ActivateFastSimulat 97 // you may activate this model for any charg 98 // a neutral particle will not enter the mod 99 100 // -- Attach the fast simulation physics con 101 physicsList->RegisterPhysics( fastSimulation 102 physicsList->SetVerboseLevel(1); 103 runManager->SetUserInitialization(physicsLis 104 105 // User action initialization 106 runManager->SetUserInitialization(new Action 107 108 // Initialize visualization 109 G4VisManager* visManager = new G4VisExecutiv 110 // G4VisExecutive can take a verbosity argum 111 // G4VisManager* visManager = new G4VisExecu 112 visManager->Initialize(); 113 114 // Get the pointer to the User Interface man 115 G4UImanager* UImanager = G4UImanager::GetUIp 116 117 // Process macro or start UI session 118 if ( ! ui ) { 119 // batch mode 120 G4String command = "/control/execute "; 121 G4String fileName = argv[1]; 122 UImanager->ApplyCommand(command+fileName); 123 } 124 else { 125 // interactive mode 126 UImanager->ApplyCommand("/control/execute 127 ui->SessionStart(); 128 delete ui; 129 } 130 131 // Job termination 132 // Free the store: user actions, physics_lis 133 // owned and deleted by the run manager, so 134 // in the main() program ! 135 136 delete visManager; 137 delete runManager; 138 139 theTimer->Stop(); 140 G4cout << "Execution terminated" << G4endl; 141 G4cout << (*theTimer) << G4endl; 142 delete theTimer; 143 144 } 145 146 //....oooOO0OOooo........oooOO0OOooo........oo 147