Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // Authors: Francesco Longo, franzlongo1969@gm 26 // Authors: Francesco Longo, franzlongo1969@gmail.com 27 // 27 // 28 // Code based on the hadrontherapy && radiopro 28 // Code based on the hadrontherapy && radioprotection advanced example 29 29 30 #include "GammaRayTelPhysicsList.hh" 30 #include "GammaRayTelPhysicsList.hh" 31 #include "GammaRayTelPhysicsListMessenger.hh" 31 #include "GammaRayTelPhysicsListMessenger.hh" 32 #include "G4PhysListFactory.hh" 32 #include "G4PhysListFactory.hh" 33 #include "G4VPhysicsConstructor.hh" 33 #include "G4VPhysicsConstructor.hh" 34 34 35 // Physics lists (contained inside the Geant4 << 35 // Physic lists (contained inside the Geant4 distribution) >> 36 #include "G4EmStandardPhysics_option3.hh" >> 37 #include "G4EmStandardPhysics_option4.hh" // to treat the new polarised process 36 #include "G4EmLivermorePhysics.hh" 38 #include "G4EmLivermorePhysics.hh" 37 #include "G4EmLivermorePolarizedPhysics.hh" << 38 #include "G4EmPenelopePhysics.hh" 39 #include "G4EmPenelopePhysics.hh" 39 #include "G4EmStandardPhysics_option3.hh" << 40 #include "G4EmLivermorePolarizedPhysics.hh" // 40 #include "G4EmStandardPhysics_option4.hh" // t << 41 41 42 #include "G4Decay.hh" << 43 #include "G4DecayPhysics.hh" 42 #include "G4DecayPhysics.hh" 44 #include "G4HadronDElasticPhysics.hh" << 45 #include "G4HadronElasticPhysics.hh" 43 #include "G4HadronElasticPhysics.hh" >> 44 #include "G4HadronDElasticPhysics.hh" 46 #include "G4HadronElasticPhysicsHP.hh" 45 #include "G4HadronElasticPhysicsHP.hh" 47 #include "G4HadronPhysicsQGSP_BIC_HP.hh" << 48 #include "G4IonBinaryCascadePhysics.hh" 46 #include "G4IonBinaryCascadePhysics.hh" 49 #include "G4IonFluctuations.hh" << 47 #include "G4Decay.hh" 50 #include "G4IonParametrisedLossModel.hh" << 51 #include "G4LossTableManager.hh" << 52 #include "G4ProcessManager.hh" << 53 #include "G4RadioactiveDecayPhysics.hh" << 54 #include "G4StepLimiter.hh" 48 #include "G4StepLimiter.hh" 55 #include "G4SystemOfUnits.hh" << 49 #include "G4LossTableManager.hh" 56 #include "G4UnitsTable.hh" 50 #include "G4UnitsTable.hh" >> 51 #include "G4SystemOfUnits.hh" >> 52 #include "G4ProcessManager.hh" 57 53 58 //....oooOO0OOooo........oooOO0OOooo........oo << 54 #include "G4IonFluctuations.hh" 59 << 55 #include "G4IonParametrisedLossModel.hh" 60 GammaRayTelPhysicsList::GammaRayTelPhysicsList << 56 #include "G4HadronPhysicsQGSP_BIC_HP.hh" 61 G4LossTableManager::Instance(); << 57 #include "G4RadioactiveDecayPhysics.hh" 62 << 63 constexpr auto DEFAULT_CUT_VALUE{100 * mic << 64 defaultCutValue = DEFAULT_CUT_VALUE; << 65 << 66 SetVerboseLevel(1); << 67 << 68 constexpr auto ENERGY_LOWER_BOUND{250 * eV << 69 constexpr auto ENERGY_UPPER_BOUND{1 * GeV} << 70 << 71 G4ProductionCutsTable::GetProductionCutsTa << 72 SetDefaultCutValue (defaultCutValue); << 73 DumpCutValuesTable(); << 74 << 75 helIsRegisted = false; << 76 bicIsRegisted = false; << 77 biciIsRegisted = false; << 78 locIonIonInelasticIsRegistered = false; << 79 radioactiveDecayIsRegisted = false; << 80 << 81 pMessenger = new GammaRayTelPhysicsListMes << 82 << 83 SetVerboseLevel(1); << 84 << 85 // EM physics << 86 emPhysicsList = new G4EmStandardPhysics_op << 87 emName = G4String("emstandard_opt3"); << 88 << 89 // Decay physics and all particles << 90 decPhysicsList = new G4DecayPhysics(); << 91 } << 92 58 93 //....oooOO0OOooo........oooOO0OOooo........oo << 59 ///////////////////////////////////////////////////////////////////////////// >> 60 GammaRayTelPhysicsList::GammaRayTelPhysicsList() : G4VModularPhysicsList() >> 61 { >> 62 G4LossTableManager::Instance(); >> 63 defaultCutValue = 100*micrometer; >> 64 SetVerboseLevel(1); >> 65 >> 66 G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(250*eV, 1*GeV); >> 67 SetDefaultCutValue(defaultCutValue); >> 68 DumpCutValuesTable(); >> 69 >> 70 helIsRegisted = false; >> 71 bicIsRegisted = false; >> 72 biciIsRegisted = false; >> 73 locIonIonInelasticIsRegistered = false; >> 74 radioactiveDecayIsRegisted = false; >> 75 >> 76 pMessenger = new GammaRayTelPhysicsListMessenger(this); >> 77 >> 78 SetVerboseLevel(1); >> 79 >> 80 // EM physics >> 81 emPhysicsList = new G4EmStandardPhysics_option3(1); >> 82 emName = G4String("emstandard_opt3"); >> 83 >> 84 // Decay physics and all particles >> 85 decPhysicsList = new G4DecayPhysics(); >> 86 } >> 87 >> 88 ///////////////////////////////////////////////////////////////////////////// >> 89 GammaRayTelPhysicsList::~GammaRayTelPhysicsList() >> 90 { >> 91 delete pMessenger; >> 92 delete emPhysicsList; >> 93 delete decPhysicsList; >> 94 for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];} >> 95 } >> 96 >> 97 ///////////////////////////////////////////////////////////////////////////// >> 98 void GammaRayTelPhysicsList::AddPackage(const G4String& name) >> 99 { >> 100 G4PhysListFactory factory; >> 101 G4VModularPhysicsList* phys =factory.GetReferencePhysList(name); >> 102 G4int i=0; >> 103 const G4VPhysicsConstructor* elem= phys->GetPhysics(i); >> 104 G4VPhysicsConstructor* tmp = const_cast<G4VPhysicsConstructor*> (elem); >> 105 while (elem !=0) >> 106 { >> 107 RegisterPhysics(tmp); >> 108 elem= phys->GetPhysics(++i) ; >> 109 tmp = const_cast<G4VPhysicsConstructor*> (elem); >> 110 } >> 111 } >> 112 >> 113 ///////////////////////////////////////////////////////////////////////////// >> 114 void GammaRayTelPhysicsList::ConstructParticle() >> 115 { >> 116 decPhysicsList->ConstructParticle(); >> 117 } >> 118 >> 119 ///////////////////////////////////////////////////////////////////////////// >> 120 void GammaRayTelPhysicsList::ConstructProcess() >> 121 { >> 122 // transportation >> 123 // >> 124 AddTransportation(); >> 125 >> 126 // electromagnetic physics list >> 127 // >> 128 emPhysicsList->ConstructProcess(); >> 129 em_config.AddModels(); >> 130 >> 131 // decay physics list >> 132 // >> 133 decPhysicsList->ConstructProcess(); >> 134 >> 135 // hadronic physics lists >> 136 for(size_t i=0; i<hadronPhys.size(); i++) { >> 137 hadronPhys[i]->ConstructProcess(); >> 138 } >> 139 >> 140 // step limitation (as a full process) >> 141 // >> 142 // AddStepMax(); >> 143 } >> 144 >> 145 ///////////////////////////////////////////////////////////////////////////// >> 146 void GammaRayTelPhysicsList::AddPhysicsList(const G4String& name) >> 147 { >> 148 >> 149 if (verboseLevel>1) { >> 150 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; >> 151 } >> 152 if (name == emName) return; >> 153 >> 154 ///////////////////////////////////////////////////////////////////////////// >> 155 // ELECTROMAGNETIC MODELS >> 156 ///////////////////////////////////////////////////////////////////////////// 94 157 95 GammaRayTelPhysicsList::~GammaRayTelPhysicsLis << 158 if (name == "standard_opt3") { 96 delete pMessenger; << 159 emName = name; 97 delete emPhysicsList; 160 delete emPhysicsList; 98 delete decPhysicsList; << 161 emPhysicsList = new G4EmStandardPhysics_option3(); >> 162 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl; 99 163 100 for (auto &hadronPhy : hadronPhys) { << 164 } else if (name == "LowE_Livermore") { 101 delete hadronPhy; << 165 emName = name; 102 } << 166 delete emPhysicsList; 103 } << 167 emPhysicsList = new G4EmLivermorePhysics(); 104 << 168 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl; 105 //....oooOO0OOooo........oooOO0OOooo........oo << 169 } else if (name == "LowE_Penelope") { 106 << 170 emName = name; 107 void GammaRayTelPhysicsList::AddPackage(const << 171 delete emPhysicsList; 108 G4PhysListFactory factory; << 172 emPhysicsList = new G4EmPenelopePhysics(); 109 auto *phys = factory.GetReferencePhysList( << 173 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl; 110 << 174 } else if (name == "LowE_Polarized") { 111 G4int i = 0; << 175 emName = name; 112 const G4VPhysicsConstructor *element = phy << 176 delete emPhysicsList; 113 auto *tmp = const_cast<G4VPhysicsConstruct << 177 emPhysicsList = new G4EmLivermorePolarizedPhysics(); 114 << 178 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl; 115 while (element != nullptr) { << 179 } else if (name == "standard_opt4") { 116 RegisterPhysics(tmp); << 180 emName = name; 117 element = phys->GetPhysics(++i); << 181 delete emPhysicsList; 118 tmp = const_cast<G4VPhysicsConstructor << 182 emPhysicsList = new G4EmStandardPhysics_option4(); 119 } << 183 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardOption_4" << G4endl; 120 } << 121 << 122 //....oooOO0OOooo........oooOO0OOooo........oo << 123 << 124 void GammaRayTelPhysicsList::ConstructParticle << 125 decPhysicsList->ConstructParticle(); << 126 } << 127 << 128 //....oooOO0OOooo........oooOO0OOooo........oo << 129 << 130 void GammaRayTelPhysicsList::ConstructProcess( << 131 // transportation << 132 // << 133 AddTransportation(); << 134 << 135 // electromagnetic physics list << 136 // << 137 emPhysicsList->ConstructProcess(); << 138 emConfigurator.AddModels(); << 139 << 140 // decay physics list << 141 // << 142 decPhysicsList->ConstructProcess(); << 143 << 144 // hadronic physics lists << 145 for (auto &hadronPhy : hadronPhys) { << 146 hadronPhy->ConstructProcess(); << 147 } << 148 << 149 // step limitation (as a full process) << 150 // AddStepMax(); << 151 } << 152 << 153 //....oooOO0OOooo........oooOO0OOooo........oo << 154 << 155 void GammaRayTelPhysicsList::AddPhysicsList(co << 156 if (verboseLevel > 1) { << 157 G4cout << "PhysicsList::AddPhysicsList << 158 } << 159 if (name == emName) { << 160 return; << 161 } << 162 << 163 //////////////////////////////// << 164 // ELECTROMAGNETIC MODELS // << 165 //////////////////////////////// << 166 << 167 if (name == "standard_opt3") { << 168 emName = name; << 169 delete emPhysicsList; << 170 emPhysicsList = new G4EmStandardPhysic << 171 G4cout << "THE FOLLOWING ELECTROMAGNET << 172 } else if (name == "LowE_Livermore") { << 173 emName = name; << 174 delete emPhysicsList; << 175 emPhysicsList = new G4EmLivermorePhysi << 176 G4cout << "THE FOLLOWING ELECTROMAGNET << 177 } else if (name == "LowE_Penelope") { << 178 emName = name; << 179 delete emPhysicsList; << 180 emPhysicsList = new G4EmPenelopePhysic << 181 G4cout << "THE FOLLOWING ELECTROMAGNET << 182 } else if (name == "LowE_Polarized") { << 183 emName = name; << 184 delete emPhysicsList; << 185 emPhysicsList = new G4EmLivermorePolar << 186 G4cout << "THE FOLLOWING ELECTROMAGNET << 187 } else if (name == "standard_opt4") { << 188 emName = name; << 189 delete emPhysicsList; << 190 emPhysicsList = new G4EmStandardPhysic << 191 G4cout << "THE FOLLOWING ELECTROMAGNET << 192 << 193 ///////////////////////// << 194 // HADRONIC MODELS // << 195 ///////////////////////// << 196 << 197 } else if (name == "elastic" && !helIsRegi << 198 G4cout << "THE FOLLOWING HADRONIC ELAS << 199 hadronPhys.push_back(new G4HadronElast << 200 helIsRegisted = true; << 201 } else if (name == "DElastic" && !helIsReg << 202 hadronPhys.push_back(new G4HadronDElas << 203 helIsRegisted = true; << 204 } else if (name == "HPElastic" && !helIsRe << 205 hadronPhys.push_back(new G4HadronElast << 206 helIsRegisted = true; << 207 } else if (name == "binary" && !bicIsRegis << 208 hadronPhys.push_back(new G4HadronPhysi << 209 bicIsRegisted = true; << 210 G4cout << "THE FOLLOWING HADRONIC INEL << 211 } else if (name == "binary_ion" && !biciIs << 212 hadronPhys.push_back(new G4IonBinaryCa << 213 biciIsRegisted = true; << 214 G4cout << "THE FOLLOWING HADRONIC INEL << 215 } else if (name == "radioactive_decay" && << 216 hadronPhys.push_back(new G4Radioactive << 217 radioactiveDecayIsRegisted = true; << 218 G4cout << "THE FOLLOWING HADRONIC INEL << 219 } else { << 220 G4cout << "PhysicsList::AddPhysicsList << 221 } << 222 } << 223 << 224 //....oooOO0OOooo........oooOO0OOooo........oo << 225 << 226 void GammaRayTelPhysicsList::SetCutForGamma(G4 << 227 SetParticleCuts(cut, G4Gamma::Gamma()); << 228 } << 229 << 230 //....oooOO0OOooo........oooOO0OOooo........oo << 231 184 232 void GammaRayTelPhysicsList::SetCutForElectron << 185 ///////////////////////////////////////////////////////////////////////////// 233 SetParticleCuts(cut, G4Electron::Electron( << 186 // HADRONIC MODELS >> 187 ///////////////////////////////////////////////////////////////////////////// >> 188 } else if (name == "elastic" && !helIsRegisted) { >> 189 G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronElasticPhysics()" << G4endl; >> 190 hadronPhys.push_back( new G4HadronElasticPhysics()); >> 191 helIsRegisted = true; >> 192 >> 193 } else if (name == "DElastic" && !helIsRegisted) { >> 194 hadronPhys.push_back( new G4HadronDElasticPhysics()); >> 195 helIsRegisted = true; >> 196 >> 197 } else if (name == "HPElastic" && !helIsRegisted) { >> 198 hadronPhys.push_back( new G4HadronElasticPhysicsHP()); >> 199 helIsRegisted = true; >> 200 >> 201 } else if (name == "binary" && !bicIsRegisted) { >> 202 hadronPhys.push_back(new G4HadronPhysicsQGSP_BIC_HP()); >> 203 bicIsRegisted = true; >> 204 G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: HadronPhysicsQGSP_BIC_HP()" << G4endl; >> 205 >> 206 } else if (name == "binary_ion" && !biciIsRegisted) { >> 207 hadronPhys.push_back(new G4IonBinaryCascadePhysics()); >> 208 biciIsRegisted = true; >> 209 G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4IonBinaryCascadePhysics()" << G4endl; >> 210 } else if (name == "radioactive_decay" && !radioactiveDecayIsRegisted ) { >> 211 hadronPhys.push_back(new G4RadioactiveDecayPhysics()); >> 212 radioactiveDecayIsRegisted = true; >> 213 G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4RadioactiveDecayPhysics()" << G4endl; >> 214 } else { >> 215 >> 216 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" >> 217 << " is not defined" >> 218 << G4endl; >> 219 } >> 220 } >> 221 >> 222 void GammaRayTelPhysicsList::SetCutForGamma(G4double cut) >> 223 { >> 224 SetParticleCuts(cut, G4Gamma::Gamma()); >> 225 } >> 226 >> 227 void GammaRayTelPhysicsList::SetCutForElectron(G4double cut) >> 228 { >> 229 SetParticleCuts(cut, G4Electron::Electron()); >> 230 } >> 231 >> 232 void GammaRayTelPhysicsList::SetCutForPositron(G4double cut) >> 233 { >> 234 SetParticleCuts(cut, G4Positron::Positron()); 234 } 235 } 235 236 236 //....oooOO0OOooo........oooOO0OOooo........oo << 237 << 238 void GammaRayTelPhysicsList::SetCutForPositron << 239 SetParticleCuts(cut, G4Positron::Positron( << 240 } << 241 237