[807] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
[1230] | 26 | // HadrontherapyPhysicsList.cc |
---|
| 27 | // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy |
---|
| 28 | |
---|
| 29 | // This class provides all the physic models that can be activated inside Hadrontherapy; |
---|
| 30 | // Each model can be setted via macro commands; |
---|
| 31 | // Inside Hadrontherapy the models can be activate with three different complementar methods: |
---|
[807] | 32 | // |
---|
[1230] | 33 | // 1. Use of the *Packages*. |
---|
| 34 | // Packages (that are contained inside the |
---|
| 35 | // Geant4 distribution at $G4INSTALL/source/physics_lists/lists) provide a full set |
---|
| 36 | // of models (both electromagnetic and hadronic). |
---|
| 37 | // The User can use this method simply add the line /physic/addPackage <nameOfPackage> |
---|
| 38 | // in his/her macro file. No other action is required. |
---|
| 39 | // For Hadrontherapy applications we suggest the use of the QGSP_BIC package |
---|
| 40 | // for proton beams. The same can be used |
---|
| 41 | // also for ligth ion beam. |
---|
| 42 | // Example of use of package can be found in the packageQGSP_BIC.mac file. |
---|
| 43 | // |
---|
| 44 | // 2. Use of the *Physic Lists*. |
---|
| 45 | // Physic lists are also already ready to use inside the Geant4 distribution |
---|
| 46 | // ($G4INSTALL/source/physics_lists/builders). To use them the simple |
---|
| 47 | // /physic/addPhysics <nameOfPhysicList> command must be used in the macro. |
---|
| 48 | // In Hadrontherapy we provide physics list to activate Electromagnetic, |
---|
| 49 | // Hadronic elastic and Hadronic inelastic models. |
---|
| 50 | // |
---|
| 51 | // For Hadrontherapy we suggest the use of: |
---|
| 52 | // |
---|
| 53 | // /physic/addPhysic/emstandard_option3 (electromagnetic model) |
---|
| 54 | // /physic/addPhysic/QElastic (hadronic elastic model) |
---|
| 55 | // /physic/addPhysic/binary (hadronic inelastic models for proton and neutrons) |
---|
| 56 | // /physic/addPhysic/binary_ion (hadronic inelastic models for ions) |
---|
| 57 | // |
---|
| 58 | // Example of the use of physics lists can be found in the macro files included in the |
---|
| 59 | // 'macro' folder . |
---|
| 60 | // |
---|
| 61 | // 3. Use of a *local* physics. In this case the models are implemented in local files |
---|
| 62 | // contained in the Hadrontherapy folder. The use of local physic is recommended |
---|
| 63 | // to more expert Users. |
---|
| 64 | // We provide as local, only the LocalStandardICRU73EmPhysic.cc (an Elecromagnetic |
---|
| 65 | // implementation containing the new ICRU73 data table for ions stopping powers) |
---|
| 66 | // and the LocalIonIonInelasticPhysic.cc (physic list to use for the ion-ion interaction |
---|
| 67 | // case) |
---|
| 68 | // The *local* physics can be activated with the same /physic/addPhysic <nameOfPhysic> command; |
---|
| 69 | // |
---|
| 70 | // While Packages approch must be used exclusively, Physics List and Local physics can |
---|
| 71 | // be activated, if necessary, contemporaneously in the same simulation run. |
---|
| 72 | // |
---|
| 73 | // AT MOMENT, IF ACCURATE RESULTS ARE NEDED, WE STRONGLY RECOMMEND THE USE OF THE MACROS: |
---|
| 74 | // proton_therapy.mac: use of the built-in Geant4 physics list for proton beams) |
---|
| 75 | // ion_therapy.mac : use of mixed combination of native Geant4 physic lists |
---|
| 76 | // and local physic for ion-ion enelastic processes) |
---|
[807] | 77 | |
---|
| 78 | #include "HadrontherapyPhysicsList.hh" |
---|
| 79 | #include "HadrontherapyPhysicsListMessenger.hh" |
---|
[1230] | 80 | #include "HadrontherapyStepMax.hh" |
---|
| 81 | #include "G4PhysListFactory.hh" |
---|
| 82 | #include "G4VPhysicsConstructor.hh" |
---|
[807] | 83 | |
---|
[1230] | 84 | // Local physic directly implemented in the Hadronthrapy directory |
---|
| 85 | #include "LocalIonIonInelasticPhysic.hh" // Physic dedicated to the ion-ion inelastic processes |
---|
| 86 | #include "LocalINCLIonIonInelasticPhysic.hh" // Physic dedicated to the ion-ion inelastic processes using INCL/ABLA |
---|
[807] | 87 | |
---|
[1230] | 88 | // Physic lists (contained inside the Geant4 distribution) |
---|
| 89 | #include "G4EmStandardPhysics_option3.hh" |
---|
| 90 | #include "G4EmLivermorePhysics.hh" |
---|
| 91 | #include "G4EmPenelopePhysics.hh" |
---|
| 92 | #include "G4DecayPhysics.hh" |
---|
| 93 | #include "G4HadronElasticPhysics.hh" |
---|
| 94 | #include "G4HadronDElasticPhysics.hh" |
---|
| 95 | #include "G4HadronHElasticPhysics.hh" |
---|
| 96 | #include "G4HadronQElasticPhysics.hh" |
---|
| 97 | #include "G4HadronInelasticQBBC.hh" |
---|
| 98 | #include "G4IonBinaryCascadePhysics.hh" |
---|
| 99 | #include "G4Decay.hh" |
---|
[807] | 100 | |
---|
[1230] | 101 | #include "G4LossTableManager.hh" |
---|
| 102 | #include "G4UnitsTable.hh" |
---|
| 103 | #include "G4ProcessManager.hh" |
---|
[807] | 104 | |
---|
[1230] | 105 | #include "G4IonFluctuations.hh" |
---|
| 106 | #include "G4IonParametrisedLossModel.hh" |
---|
| 107 | #include "G4EmProcessOptions.hh" |
---|
[807] | 108 | |
---|
[1230] | 109 | #include "G4RadioactiveDecayPhysics.hh" |
---|
[807] | 110 | |
---|
[1230] | 111 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 112 | HadrontherapyPhysicsList::HadrontherapyPhysicsList() : G4VModularPhysicsList() |
---|
[807] | 113 | { |
---|
[1230] | 114 | G4LossTableManager::Instance(); |
---|
| 115 | defaultCutValue = 1.*mm; |
---|
| 116 | cutForGamma = defaultCutValue; |
---|
| 117 | cutForElectron = defaultCutValue; |
---|
| 118 | cutForPositron = defaultCutValue; |
---|
[807] | 119 | |
---|
[1230] | 120 | helIsRegisted = false; |
---|
| 121 | bicIsRegisted = false; |
---|
| 122 | biciIsRegisted = false; |
---|
| 123 | locIonIonInelasticIsRegistered = false; |
---|
| 124 | radioactiveDecayIsRegisted = false; |
---|
[807] | 125 | |
---|
[1230] | 126 | stepMaxProcess = 0; |
---|
[807] | 127 | |
---|
[1230] | 128 | pMessenger = new HadrontherapyPhysicsListMessenger(this); |
---|
[807] | 129 | |
---|
[1230] | 130 | SetVerboseLevel(1); |
---|
[807] | 131 | |
---|
[1230] | 132 | // EM physics |
---|
| 133 | emPhysicsList = new G4EmStandardPhysics_option3(1); |
---|
| 134 | emName = G4String("emstandard_opt3"); |
---|
[807] | 135 | |
---|
[1230] | 136 | // Deacy physics and all particles |
---|
| 137 | decPhysicsList = new G4DecayPhysics(); |
---|
| 138 | } |
---|
[807] | 139 | |
---|
[1230] | 140 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 141 | HadrontherapyPhysicsList::~HadrontherapyPhysicsList() |
---|
| 142 | { |
---|
| 143 | delete pMessenger; |
---|
| 144 | delete emPhysicsList; |
---|
| 145 | delete decPhysicsList; |
---|
| 146 | for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];} |
---|
| 147 | } |
---|
[807] | 148 | |
---|
[1230] | 149 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 150 | void HadrontherapyPhysicsList::AddPackage(const G4String& name) |
---|
| 151 | { |
---|
| 152 | G4PhysListFactory factory; |
---|
| 153 | G4VModularPhysicsList* phys =factory.GetReferencePhysList(name); |
---|
| 154 | G4int i=0; |
---|
| 155 | const G4VPhysicsConstructor* elem= phys->GetPhysics(i); |
---|
| 156 | G4VPhysicsConstructor* tmp = const_cast<G4VPhysicsConstructor*> (elem); |
---|
| 157 | while (elem !=0) |
---|
[807] | 158 | { |
---|
[1230] | 159 | RegisterPhysics(tmp); |
---|
| 160 | elem= phys->GetPhysics(++i) ; |
---|
| 161 | tmp = const_cast<G4VPhysicsConstructor*> (elem); |
---|
[807] | 162 | } |
---|
[1230] | 163 | } |
---|
[807] | 164 | |
---|
[1230] | 165 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 166 | void HadrontherapyPhysicsList::ConstructParticle() |
---|
| 167 | { |
---|
| 168 | decPhysicsList->ConstructParticle(); |
---|
| 169 | } |
---|
[807] | 170 | |
---|
[1230] | 171 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 172 | void HadrontherapyPhysicsList::ConstructProcess() |
---|
| 173 | { |
---|
| 174 | // transportation |
---|
| 175 | // |
---|
| 176 | AddTransportation(); |
---|
[807] | 177 | |
---|
[1230] | 178 | // electromagnetic physics list |
---|
| 179 | // |
---|
| 180 | emPhysicsList->ConstructProcess(); |
---|
| 181 | em_config.AddModels(); |
---|
[807] | 182 | |
---|
[1230] | 183 | // decay physics list |
---|
| 184 | // |
---|
| 185 | decPhysicsList->ConstructProcess(); |
---|
[807] | 186 | |
---|
[1230] | 187 | // hadronic physics lists |
---|
| 188 | for(size_t i=0; i<hadronPhys.size(); i++) { |
---|
| 189 | hadronPhys[i]->ConstructProcess(); |
---|
| 190 | } |
---|
[807] | 191 | |
---|
[1230] | 192 | // step limitation (as a full process) |
---|
| 193 | // |
---|
| 194 | AddStepMax(); |
---|
| 195 | } |
---|
[807] | 196 | |
---|
[1230] | 197 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 198 | void HadrontherapyPhysicsList::AddPhysicsList(const G4String& name) |
---|
| 199 | { |
---|
[807] | 200 | |
---|
[1230] | 201 | if (verboseLevel>1) { |
---|
| 202 | G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; |
---|
| 203 | } |
---|
| 204 | if (name == emName) return; |
---|
[807] | 205 | |
---|
[1230] | 206 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 207 | // ELECTROMAGNETIC MODELS |
---|
| 208 | ///////////////////////////////////////////////////////////////////////////// |
---|
[807] | 209 | |
---|
[1230] | 210 | if (name == "standard_opt3") { |
---|
| 211 | emName = name; |
---|
| 212 | delete emPhysicsList; |
---|
| 213 | emPhysicsList = new G4EmStandardPhysics_option3(); |
---|
| 214 | G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl; |
---|
[807] | 215 | |
---|
[1230] | 216 | } else if (name == "LowE_Livermore") { |
---|
| 217 | emName = name; |
---|
| 218 | delete emPhysicsList; |
---|
| 219 | emPhysicsList = new G4EmLivermorePhysics(); |
---|
| 220 | G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl; |
---|
[807] | 221 | |
---|
[1230] | 222 | } else if (name == "LowE_Penelope") { |
---|
| 223 | emName = name; |
---|
| 224 | delete emPhysicsList; |
---|
| 225 | emPhysicsList = new G4EmPenelopePhysics(); |
---|
| 226 | G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl; |
---|
[807] | 227 | |
---|
[1230] | 228 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 229 | // HADRONIC MODELS |
---|
| 230 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 231 | } else if (name == "elastic" && !helIsRegisted) { |
---|
| 232 | G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronElasticPhysics()" << G4endl; |
---|
| 233 | hadronPhys.push_back( new G4HadronElasticPhysics()); |
---|
| 234 | helIsRegisted = true; |
---|
[807] | 235 | |
---|
[1230] | 236 | } else if (name == "DElastic" && !helIsRegisted) { |
---|
| 237 | hadronPhys.push_back( new G4HadronDElasticPhysics()); |
---|
| 238 | helIsRegisted = true; |
---|
[807] | 239 | |
---|
[1230] | 240 | } else if (name == "HElastic" && !helIsRegisted) { |
---|
| 241 | hadronPhys.push_back( new G4HadronHElasticPhysics()); |
---|
| 242 | helIsRegisted = true; |
---|
[807] | 243 | |
---|
[1230] | 244 | } else if (name == "QElastic" && !helIsRegisted) { |
---|
| 245 | hadronPhys.push_back( new G4HadronQElasticPhysics()); |
---|
| 246 | helIsRegisted = true; |
---|
[807] | 247 | |
---|
[1230] | 248 | } else if (name == "binary" && !bicIsRegisted) { |
---|
| 249 | hadronPhys.push_back(new G4HadronInelasticQBBC()); |
---|
| 250 | bicIsRegisted = true; |
---|
| 251 | G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronInelasticQBBC()" << G4endl; |
---|
[807] | 252 | |
---|
[1230] | 253 | } else if (name == "binary_ion" && !biciIsRegisted) { |
---|
| 254 | hadronPhys.push_back(new G4IonBinaryCascadePhysics()); |
---|
| 255 | biciIsRegisted = true; |
---|
[807] | 256 | |
---|
[1230] | 257 | } else if (name == "local_ion_ion_inelastic" && !locIonIonInelasticIsRegistered) { |
---|
| 258 | hadronPhys.push_back(new LocalIonIonInelasticPhysic()); |
---|
| 259 | locIonIonInelasticIsRegistered = true; |
---|
[807] | 260 | |
---|
[1230] | 261 | } else if (name == "local_incl_ion_ion_inelastic" && !locIonIonInelasticIsRegistered) { |
---|
| 262 | hadronPhys.push_back(new LocalINCLIonIonInelasticPhysic()); |
---|
| 263 | locIonIonInelasticIsRegistered = true; |
---|
[807] | 264 | |
---|
[1230] | 265 | } else if (name == "radioactive_decay" && !radioactiveDecayIsRegisted ) { |
---|
| 266 | hadronPhys.push_back(new G4RadioactiveDecayPhysics()); |
---|
| 267 | radioactiveDecayIsRegisted = true; |
---|
[807] | 268 | |
---|
[1230] | 269 | } else { |
---|
[807] | 270 | |
---|
[1230] | 271 | G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" |
---|
| 272 | << " is not defined" |
---|
| 273 | << G4endl; |
---|
| 274 | } |
---|
| 275 | } |
---|
[807] | 276 | |
---|
[1230] | 277 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 278 | void HadrontherapyPhysicsList::AddStepMax() |
---|
| 279 | { |
---|
| 280 | // Step limitation seen as a process |
---|
| 281 | stepMaxProcess = new HadrontherapyStepMax(); |
---|
[807] | 282 | |
---|
[1230] | 283 | theParticleIterator->reset(); |
---|
| 284 | while ((*theParticleIterator)()){ |
---|
| 285 | G4ParticleDefinition* particle = theParticleIterator->value(); |
---|
| 286 | G4ProcessManager* pmanager = particle->GetProcessManager(); |
---|
[807] | 287 | |
---|
[1230] | 288 | if (stepMaxProcess->IsApplicable(*particle) && pmanager) |
---|
| 289 | { |
---|
| 290 | pmanager ->AddDiscreteProcess(stepMaxProcess); |
---|
| 291 | } |
---|
| 292 | } |
---|
| 293 | } |
---|
[807] | 294 | |
---|
[1230] | 295 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 296 | void HadrontherapyPhysicsList::SetCuts() |
---|
| 297 | { |
---|
[807] | 298 | |
---|
[1230] | 299 | if (verboseLevel >0){ |
---|
| 300 | G4cout << "PhysicsList::SetCuts:"; |
---|
| 301 | G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; |
---|
| 302 | } |
---|
[807] | 303 | |
---|
[1230] | 304 | // set cut values for gamma at first and for e- second and next for e+, |
---|
| 305 | // because some processes for e+/e- need cut values for gamma |
---|
| 306 | SetCutValue(cutForGamma, "gamma"); |
---|
| 307 | SetCutValue(cutForElectron, "e-"); |
---|
| 308 | SetCutValue(cutForPositron, "e+"); |
---|
[807] | 309 | |
---|
[1230] | 310 | if (verboseLevel>0) DumpCutValuesTable(); |
---|
| 311 | } |
---|
[807] | 312 | |
---|
[1230] | 313 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 314 | void HadrontherapyPhysicsList::SetCutForGamma(G4double cut) |
---|
| 315 | { |
---|
| 316 | cutForGamma = cut; |
---|
| 317 | SetParticleCuts(cutForGamma, G4Gamma::Gamma()); |
---|
| 318 | } |
---|
[807] | 319 | |
---|
[1230] | 320 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 321 | void HadrontherapyPhysicsList::SetCutForElectron(G4double cut) |
---|
| 322 | { |
---|
| 323 | cutForElectron = cut; |
---|
| 324 | SetParticleCuts(cutForElectron, G4Electron::Electron()); |
---|
[807] | 325 | } |
---|
| 326 | |
---|
[1230] | 327 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 328 | void HadrontherapyPhysicsList::SetCutForPositron(G4double cut) |
---|
| 329 | { |
---|
| 330 | cutForPositron = cut; |
---|
| 331 | SetParticleCuts(cutForPositron, G4Positron::Positron()); |
---|
[807] | 332 | } |
---|