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 // D Chiappara, GAP Cirrone, G Petringa 28 // 29 // ** RADIOBIO example ** 30 // make easy the calculation of the main radio 31 // charged particles radiation therapy: depth 32 // LET (Linear Energy Transfer) and RBE (Relat 33 // 34 35 #include "G4PhysListFactory.hh" 36 #include "G4RunManagerFactory.hh" 37 #include "G4ScoringManager.hh" 38 #include "G4Timer.hh" 39 #include "G4UImanager.hh" 40 #include "G4UImessenger.hh" 41 #include "G4VModularPhysicsList.hh" 42 #include "Randomize.hh" 43 #include "globals.hh" 44 45 #include "ActionInitialization.hh" 46 #include "DetectorConstruction.hh" 47 #include "Dose.hh" 48 #include "LET.hh" 49 #include "Manager.hh" 50 #include "PhysicsList.hh" 51 #include "PrimaryGeneratorAction.hh" 52 #include "RBE.hh" 53 #include <time.h> 54 55 // #ifdef G4VIS_USE 56 #include "G4VisExecutive.hh" 57 // #endif 58 59 // #ifdef G4UI_USE 60 #include "G4UIExecutive.hh" 61 // #endif 62 63 using namespace RadioBio; 64 65 ////////////////////////////////////////////// 66 int main(int argc, char** argv) 67 { 68 G4UIExecutive* ui = nullptr; 69 if (argc == 1) { 70 ui = new G4UIExecutive(argc, argv); 71 } 72 73 // Instantiate the G4Timer object, to monito 74 // the entire execution 75 G4Timer* theTimer = new G4Timer(); 76 // Start the benchmark 77 theTimer->Start(); 78 79 // Set the Random engine 80 // The following guarantees random generatio 81 // in multithread 82 CLHEP::RanluxEngine defaultEngine(1234567, 4 83 G4Random::setTheEngine(&defaultEngine); 84 G4int seed = time(NULL); 85 G4Random::setTheSeed(seed); 86 87 // Create the run manager. Uses by default s 88 auto* runManager = G4RunManagerFactory::Crea 89 90 // Create Scoring manager 91 G4ScoringManager* scoringManager = G4Scoring 92 scoringManager->SetVerboseLevel(1); 93 94 // Creating PhysicsList 95 G4VModularPhysicsList* phys = new PhysicsLis 96 97 // Set mandatory initialization classes 98 DetectorConstruction* det = new DetectorCons 99 runManager->SetUserInitialization(det); 100 101 // Creation of Manager 102 Manager* RBman = Manager::CreateInstance(); 103 104 // Create and Register Radiobiological quant 105 Dose* dose = new Dose(); 106 RBman->Register(dose, "Dose"); 107 108 LET* let = new LET(); 109 RBman->Register(let, "LET"); 110 111 RBE* rbe = new RBE(); 112 RBman->Register(rbe, "RBE"); 113 114 // Initialisation of physics 115 runManager->SetUserInitialization(phys); 116 117 // Initialisation of the Actions 118 runManager->SetUserInitialization(new Action 119 120 // Initialize command based scoring 121 G4ScoringManager::GetScoringManager(); 122 123 // Initialise the Visualisation 124 // #ifdef G4VIS_USE 125 G4VisManager* visManager = new G4VisExecutiv 126 visManager->Initialize(); 127 // #endif 128 129 //** Get the pointer to the User Interface m 130 G4UImanager* UImanager = G4UImanager::GetUIp 131 132 if (!ui) { 133 // batch mode 134 G4String command = "/control/execute "; 135 G4String fileName = argv[1]; 136 UImanager->ApplyCommand(command + fileName 137 } 138 139 else { 140 // UImanager -> ApplyCommand("/control/exe 141 UImanager->ApplyCommand("/control/execute 142 143 ui->SessionStart(); 144 delete ui; 145 } 146 147 // Save data in RadioBioManager 148 RBman->StoreAll(); 149 150 // Stop the benchmark here 151 theTimer->Stop(); 152 153 G4cout << "The simulation took: " << theTime 154 << G4endl; 155 156 delete theTimer; 157 delete runManager; 158 } 159