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 // GEANT 4 - Hadronthe 28 // ------------------------------------------- 29 // 30 // MAIN AU 31 // ========== 32 // G.A.P. Cirrone(a)*, L. Pandola(a), 33 // *Corresponding author, email t 34 // 35 // 36 // ==========> PAST CONTRIBU 37 // 38 // R.Calcagno(a), G.Daniels 39 // S.Guatelli(c), A.Heikkin 40 // A.Lechner(d), S.E.Mazzag 41 // M.G.Pia(e), F.Romano(a), 42 // M.Russo(a), A.Tramontana 43 // 44 // (a) Laboratori Nazionali del S 45 // (b) Helsinki Institute of Phys 46 // (c) University of Wallongong, 47 // (d) CERN, Geneve, Switzwerland 48 // (e) INFN Section of Genova, Ge 49 // (f) Physics and Astronomy Depa 50 // (g) CNR-IBFM, Italy 51 // (h) Institute of Applied Elect 52 // Huazhong University of Sci 53 // 54 // 55 // WE 56 // ====== 57 // https://twiki.cern.ch/twiki/bin/view/ 58 // 59 // ------------------------------------------- 60 61 #include "G4RunManager.hh" 62 #include "G4UImanager.hh" 63 #include "G4PhysListFactory.hh" 64 #include "G4VModularPhysicsList.hh" 65 #include "HadrontherapyEventAction.hh" 66 #include "HadrontherapyPhysicsList.hh" 67 #include "HadrontherapyDetectorSD.hh" 68 #include "HadrontherapyPrimaryGeneratorAction. 69 #include "HadrontherapyRunAction.hh" 70 #include "HadrontherapyMatrix.hh" 71 #include "Randomize.hh" 72 73 #include "G4UImessenger.hh" 74 #include "globals.hh" 75 #include "HadrontherapySteppingAction.hh" 76 #include "HadrontherapyGeometryController.hh" 77 #include "HadrontherapyGeometryMessenger.hh" 78 #include "HadrontherapyInteractionParameters.h 79 #include "HadrontherapyLet.hh" 80 81 #include "G4ScoringManager.hh" 82 #include "G4ParallelWorldPhysics.hh" 83 #include <time.h> 84 #include "G4Timer.hh" 85 #include "G4RunManagerFactory.hh" 86 #include "HadrontherapyActionInitialization.hh 87 88 #include "G4VisExecutive.hh" 89 #include "G4UIExecutive.hh" 90 91 #include "QBBC.hh" 92 93 ////////////////////////////////////////////// 94 int main(int argc ,char ** argv) 95 { 96 // Detect interactive mode (if no argument 97 // 98 G4UIExecutive* ui = nullptr; 99 if ( argc == 1 ) { ui = new G4UIExecutive( 100 101 //Instantiate the G4Timer object, to monit 102 //the entire execution 103 G4Timer* theTimer = new G4Timer(); 104 //Start the benchmark 105 theTimer->Start(); 106 107 // Set the Random engine 108 // The following guarantees random generat 109 // in multithread 110 CLHEP::RanluxEngine defaultEngine( 1234567 111 G4Random::setTheEngine( &defaultEngine ); 112 G4int seed = (G4int) time( NULL ); 113 G4Random::setTheSeed( seed ); 114 115 // Construct the default run manager 116 // 117 auto* runManager = G4RunManagerFactory::Cr 118 119 // Define the number of threads for the si 120 G4int nThreads = 4; 121 runManager->SetNumberOfThreads(nThreads); 122 123 // Geometry controller is responsible for 124 // 125 HadrontherapyGeometryController *geometryC 126 127 // Connect the geometry controller to the 128 // 129 HadrontherapyGeometryMessenger *geometryMe 130 131 G4ScoringManager *scoringManager = G4Scori 132 scoringManager->SetVerboseLevel(1); 133 134 // Initialize the default Hadrontherapy ge 135 geometryController->SetGeometry("default") 136 137 // Initialize the physics 138 G4PhysListFactory factory; 139 G4VModularPhysicsList* physicsList = 0; 140 physicsList = new HadrontherapyPhysicsList 141 142 if (physicsList) 143 { 144 G4cout << "Going to register G4Paralle 145 physicsList -> RegisterPhysics(new G4P 146 } 147 148 // Initialisations of physics 149 runManager->SetUserInitialization(physicsL 150 151 // Initialisation of the Actions 152 runManager->SetUserInitialization(new Hadr 153 154 // Initialize command based scoring 155 G4ScoringManager::GetScoringManager(); 156 157 // Interaction data: stopping powers 158 // 159 HadrontherapyInteractionParameters* pInter 160 161 // Initialize analysis 162 // 163 HadrontherapyAnalysis* analysis = Hadronth 164 165 166 // Initialise the Visualisation 167 // 168 auto visManager = new G4VisExecutive(argc, 169 visManager -> Initialize(); 170 171 //** Get the pointer to the User Interface 172 // 173 auto UImanager = G4UImanager::GetUIpointer 174 175 if ( !ui ) { 176 // batch mode 177 G4String command = "/control/execute " 178 G4String fileName = argv[1]; 179 UImanager->ApplyCommand(command+fileNa 180 } 181 182 else { 183 UImanager -> ApplyCommand("/control/ma 184 UImanager -> ApplyCommand("/control/ex 185 ui -> SessionStart(); 186 delete ui; 187 } 188 delete visManager; 189 190 //Stop the benchmark here 191 theTimer->Stop(); 192 193 G4cout << "The simulation took: " << theTi 194 << G4endl; 195 196 // Job termination 197 // Free the store: user actions, physics_l 198 // owned and deleted by the run manager, s 199 // in the main() program ! 200 201 202 if ( HadrontherapyMatrix * pMatrix = H 203 { 204 // pMatrix -> TotalEnergyDeposit(); 205 pMatrix -> StoreDoseFluenceAscii(); 206 207 } 208 209 if (HadrontherapyLet *let = HadrontherapyL 210 if(let -> doCalculation) 211 { 212 let -> LetOutput(); // Calculate 213 let -> StoreLetAscii(); // Store i 214 } 215 216 delete geometryMessenger; 217 delete geometryController; 218 delete pInteraction; 219 delete runManager; 220 delete analysis; 221 return 0; 222 223 } 224