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 /// \file electromagnetic/TestEm7/src/PhysicsL << 26 // $Id: PhysicsList.cc,v 1.39 2010-06-04 15:42:23 vnivanch Exp $ 27 /// \brief Implementation of the PhysicsList c << 27 // GEANT4 tag $Name: geant4-09-04-patch-01 $ 28 // << 29 // 28 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 31 33 #include "PhysicsList.hh" 32 #include "PhysicsList.hh" >> 33 #include "PhysicsListMessenger.hh" 34 34 35 #include "PhysListEmStandard.hh" 35 #include "PhysListEmStandard.hh" >> 36 #include "PhysListEmStandardSS.hh" 36 #include "PhysListEmStandardNR.hh" 37 #include "PhysListEmStandardNR.hh" 37 #include "PhysicsListMessenger.hh" << 38 #include "StepMax.hh" << 39 << 40 #include "G4BetheBlochIonGasModel.hh" << 41 #include "G4BraggIonGasModel.hh" << 42 #include "G4Decay.hh" << 43 #include "G4DecayPhysics.hh" << 44 #include "G4EmConfigurator.hh" << 45 #include "G4EmLivermorePhysics.hh" << 46 #include "G4EmLowEPPhysics.hh" << 47 #include "G4EmPenelopePhysics.hh" << 48 #include "G4EmStandardPhysics.hh" 38 #include "G4EmStandardPhysics.hh" 49 #include "G4EmStandardPhysicsGS.hh" << 50 #include "G4EmStandardPhysicsSS.hh" << 51 #include "G4EmStandardPhysicsWVI.hh" << 52 #include "G4EmStandardPhysics_option1.hh" 39 #include "G4EmStandardPhysics_option1.hh" 53 #include "G4EmStandardPhysics_option2.hh" 40 #include "G4EmStandardPhysics_option2.hh" 54 #include "G4EmStandardPhysics_option3.hh" 41 #include "G4EmStandardPhysics_option3.hh" 55 #include "G4EmStandardPhysics_option4.hh" << 42 #include "G4EmLivermorePhysics.hh" 56 #include "G4HadronDElasticPhysics.hh" << 43 #include "G4EmPenelopePhysics.hh" >> 44 >> 45 #include "G4DecayPhysics.hh" >> 46 57 #include "G4HadronElasticPhysics.hh" 47 #include "G4HadronElasticPhysics.hh" >> 48 #include "G4HadronDElasticPhysics.hh" 58 #include "G4HadronHElasticPhysics.hh" 49 #include "G4HadronHElasticPhysics.hh" >> 50 #include "G4HadronQElasticPhysics.hh" 59 #include "G4HadronInelasticQBBC.hh" 51 #include "G4HadronInelasticQBBC.hh" 60 #include "G4IonFluctuations.hh" << 52 #include "G4IonBinaryCascadePhysics.hh" 61 #include "G4IonParametrisedLossModel.hh" << 53 62 #include "G4IonPhysics.hh" << 63 #include "G4LossTableManager.hh" 54 #include "G4LossTableManager.hh" 64 #include "G4PhysicalConstants.hh" << 55 #include "G4EmConfigurator.hh" 65 #include "G4ProcessManager.hh" << 66 #include "G4SystemOfUnits.hh" << 67 #include "G4UnitsTable.hh" 56 #include "G4UnitsTable.hh" >> 57 >> 58 #include "G4ProcessManager.hh" >> 59 #include "G4Decay.hh" >> 60 >> 61 #include "StepMax.hh" >> 62 >> 63 #include "G4IonFluctuations.hh" >> 64 #include "G4IonParametrisedLossModel.hh" 68 #include "G4UniversalFluctuation.hh" 65 #include "G4UniversalFluctuation.hh" 69 66 >> 67 #include "G4BraggIonGasModel.hh" >> 68 #include "G4BetheBlochIonGasModel.hh" >> 69 70 //....oooOO0OOooo........oooOO0OOooo........oo 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 71 72 PhysicsList::PhysicsList() : G4VModularPhysics << 72 PhysicsList::PhysicsList() : G4VModularPhysicsList() 73 { 73 { 74 fHelIsRegisted = false; << 74 G4LossTableManager::Instance(); 75 fBicIsRegisted = false; << 75 defaultCutValue = 1.*mm; 76 fBiciIsRegisted = false; << 76 cutForGamma = defaultCutValue; >> 77 cutForElectron = defaultCutValue; >> 78 cutForPositron = defaultCutValue; >> 79 >> 80 helIsRegisted = false; >> 81 bicIsRegisted = false; >> 82 biciIsRegisted = false; 77 83 78 // protected member of the base class << 84 stepMaxProcess = 0; 79 verboseLevel = 1; << 80 85 81 fMessenger = new PhysicsListMessenger(this); << 86 pMessenger = new PhysicsListMessenger(this); >> 87 >> 88 SetVerboseLevel(1); 82 89 83 // EM physics 90 // EM physics 84 fEmName = G4String("emstandard_opt0"); << 91 emName = G4String("emstandard_opt0"); 85 fEmPhysicsList = new G4EmStandardPhysics(ver << 92 emPhysicsList = new G4EmStandardPhysics(1); 86 93 87 // Deacy physics and all particles 94 // Deacy physics and all particles 88 fDecPhysicsList = new G4DecayPhysics(verbose << 95 decPhysicsList = new G4DecayPhysics(); 89 } 96 } 90 97 91 //....oooOO0OOooo........oooOO0OOooo........oo 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 92 99 93 PhysicsList::~PhysicsList() 100 PhysicsList::~PhysicsList() 94 { 101 { 95 delete fMessenger; << 102 delete pMessenger; 96 delete fEmPhysicsList; << 103 delete emPhysicsList; 97 delete fDecPhysicsList; << 104 delete decPhysicsList; 98 for (size_t i = 0; i < fHadronPhys.size(); i << 105 for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];} 99 delete fHadronPhys[i]; << 100 } << 101 } 106 } 102 107 103 //....oooOO0OOooo........oooOO0OOooo........oo 108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 104 109 105 void PhysicsList::ConstructParticle() 110 void PhysicsList::ConstructParticle() 106 { 111 { 107 fDecPhysicsList->ConstructParticle(); << 112 decPhysicsList->ConstructParticle(); 108 } 113 } 109 114 110 //....oooOO0OOooo........oooOO0OOooo........oo 115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 111 116 112 void PhysicsList::ConstructProcess() 117 void PhysicsList::ConstructProcess() 113 { 118 { 114 // transportation 119 // transportation 115 // 120 // 116 AddTransportation(); 121 AddTransportation(); 117 << 122 118 // electromagnetic physics list 123 // electromagnetic physics list 119 // 124 // 120 fEmPhysicsList->ConstructProcess(); << 125 emPhysicsList->ConstructProcess(); 121 126 122 // decay physics list 127 // decay physics list 123 // 128 // 124 fDecPhysicsList->ConstructProcess(); << 129 decPhysicsList->ConstructProcess(); 125 << 130 126 // hadronic physics lists 131 // hadronic physics lists 127 for (size_t i = 0; i < fHadronPhys.size(); i << 132 for(size_t i=0; i<hadronPhys.size(); i++) { 128 fHadronPhys[i]->ConstructProcess(); << 133 hadronPhys[i]->ConstructProcess(); 129 } 134 } 130 << 135 131 // step limitation (as a full process) 136 // step limitation (as a full process) 132 // << 137 // 133 AddStepMax(); << 138 AddStepMax(); 134 } 139 } 135 140 136 //....oooOO0OOooo........oooOO0OOooo........oo 141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 137 142 138 void PhysicsList::AddPhysicsList(const G4Strin 143 void PhysicsList::AddPhysicsList(const G4String& name) 139 { 144 { 140 if (verboseLevel > 1) { << 145 if (verboseLevel>1) { 141 G4cout << "PhysicsList::AddPhysicsList: <" 146 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 142 } 147 } 143 148 144 if (name == fEmName) return; << 149 if (name == emName) return; 145 150 146 if (name == "local") { 151 if (name == "local") { 147 fEmName = name; << 152 148 delete fEmPhysicsList; << 153 emName = name; 149 fEmPhysicsList = new PhysListEmStandard(na << 154 delete emPhysicsList; 150 } << 155 emPhysicsList = new PhysListEmStandard(name); 151 else if (name == "emstandard_opt0") { << 156 152 fEmName = name; << 157 } else if (name == "emstandard_opt0") { 153 delete fEmPhysicsList; << 158 154 fEmPhysicsList = new G4EmStandardPhysics(v << 159 emName = name; 155 } << 160 delete emPhysicsList; 156 else if (name == "emstandard_opt1") { << 161 emPhysicsList = new G4EmStandardPhysics(1); 157 fEmName = name; << 162 158 delete fEmPhysicsList; << 163 } else if (name == "emstandard_opt1") { 159 fEmPhysicsList = new G4EmStandardPhysics_o << 164 160 } << 165 emName = name; 161 else if (name == "emstandard_opt2") { << 166 delete emPhysicsList; 162 fEmName = name; << 167 emPhysicsList = new G4EmStandardPhysics_option1(); 163 delete fEmPhysicsList; << 168 164 fEmPhysicsList = new G4EmStandardPhysics_o << 169 } else if (name == "emstandard_opt2") { 165 } << 170 166 else if (name == "emstandard_opt3") { << 171 emName = name; 167 fEmName = name; << 172 delete emPhysicsList; 168 delete fEmPhysicsList; << 173 emPhysicsList = new G4EmStandardPhysics_option2(); 169 fEmPhysicsList = new G4EmStandardPhysics_o << 174 170 } << 175 } else if (name == "emstandard_opt3") { 171 else if (name == "emstandard_opt4") { << 176 172 fEmName = name; << 177 emName = name; 173 delete fEmPhysicsList; << 178 delete emPhysicsList; 174 fEmPhysicsList = new G4EmStandardPhysics_o << 179 emPhysicsList = new G4EmStandardPhysics_option3(); 175 } << 180 176 else if (name == "ionGasModels") { << 181 } else if (name == "standardSS") { >> 182 >> 183 emName = name; >> 184 delete emPhysicsList; >> 185 emPhysicsList = new PhysListEmStandardSS(name); >> 186 >> 187 } else if (name == "ionGasModels") { >> 188 177 AddPhysicsList("emstandard_opt0"); 189 AddPhysicsList("emstandard_opt0"); 178 fEmName = name; << 190 emName = name; 179 AddIonGasModels(); 191 AddIonGasModels(); 180 } << 192 181 else if (name == "standardNR") { << 193 } else if (name == "standardNR") { 182 fEmName = name; << 194 183 delete fEmPhysicsList; << 195 emName = name; 184 fEmPhysicsList = new PhysListEmStandardNR( << 196 delete emPhysicsList; 185 } << 197 emPhysicsList = new PhysListEmStandardNR(name); 186 else if (name == "emlivermore") { << 198 187 fEmName = name; << 199 } else if (name == "emlivermore") { 188 delete fEmPhysicsList; << 200 emName = name; 189 fEmPhysicsList = new G4EmLivermorePhysics( << 201 delete emPhysicsList; 190 } << 202 emPhysicsList = new G4EmLivermorePhysics(); 191 else if (name == "empenelope") { << 203 192 fEmName = name; << 204 } else if (name == "empenelope") { 193 delete fEmPhysicsList; << 205 emName = name; 194 fEmPhysicsList = new G4EmPenelopePhysics(v << 206 delete emPhysicsList; 195 } << 207 emPhysicsList = new G4EmPenelopePhysics(); 196 else if (name == "emlowenergy") { << 208 197 fEmName = name; << 209 } else if (name == "elastic" && !helIsRegisted) { 198 delete fEmPhysicsList; << 210 hadronPhys.push_back( new G4HadronElasticPhysics()); 199 fEmPhysicsList = new G4EmLowEPPhysics(verb << 211 helIsRegisted = true; 200 } << 212 201 else if (name == "emstandardSS") { << 213 } else if (name == "DElastic" && !helIsRegisted) { 202 fEmName = name; << 214 hadronPhys.push_back( new G4HadronDElasticPhysics()); 203 delete fEmPhysicsList; << 215 helIsRegisted = true; 204 fEmPhysicsList = new G4EmStandardPhysicsSS << 216 205 } << 217 } else if (name == "HElastic" && !helIsRegisted) { 206 else if (name == "emstandardWVI") { << 218 hadronPhys.push_back( new G4HadronHElasticPhysics()); 207 fEmName = name; << 219 helIsRegisted = true; 208 delete fEmPhysicsList; << 220 209 fEmPhysicsList = new G4EmStandardPhysicsWV << 221 } else if (name == "QElastic" && !helIsRegisted) { 210 } << 222 hadronPhys.push_back( new G4HadronQElasticPhysics()); 211 else if (name == "emstandardGS") { << 223 helIsRegisted = true; 212 fEmName = name; << 224 213 delete fEmPhysicsList; << 225 } else if (name == "binary" && !bicIsRegisted) { 214 fEmPhysicsList = new G4EmStandardPhysicsGS << 226 hadronPhys.push_back(new G4HadronInelasticQBBC()); 215 } << 227 bicIsRegisted = true; 216 else if (name == "elastic" && !fHelIsRegiste << 228 217 fHadronPhys.push_back(new G4HadronElasticP << 229 } else if (name == "binary_ion" && !biciIsRegisted) { 218 fHelIsRegisted = true; << 230 hadronPhys.push_back(new G4IonBinaryCascadePhysics()); 219 } << 231 biciIsRegisted = true; 220 else if (name == "DElastic" && !fHelIsRegist << 232 221 fHadronPhys.push_back(new G4HadronDElastic << 233 } else { 222 fHelIsRegisted = true; << 234 223 } << 224 else if (name == "HElastic" && !fHelIsRegist << 225 fHadronPhys.push_back(new G4HadronHElastic << 226 fHelIsRegisted = true; << 227 } << 228 else if (name == "binary" && !fBicIsRegisted << 229 fHadronPhys.push_back(new G4HadronInelasti << 230 fBicIsRegisted = true; << 231 } << 232 else if (name == "binary_ion" && !fBiciIsReg << 233 fHadronPhys.push_back(new G4IonPhysics(ver << 234 fBiciIsRegisted = true; << 235 } << 236 else { << 237 G4cout << "PhysicsList::AddPhysicsList: <" 235 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 238 << " is not defined" << G4endl; << 236 << " is not defined" >> 237 << G4endl; 239 } 238 } 240 } 239 } 241 240 242 //....oooOO0OOooo........oooOO0OOooo........oo 241 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 243 242 244 void PhysicsList::AddStepMax() 243 void PhysicsList::AddStepMax() 245 { 244 { 246 // Step limitation seen as a process 245 // Step limitation seen as a process 247 fStepMaxProcess = new StepMax(); << 246 stepMaxProcess = new StepMax(); 248 247 249 auto particleIterator = GetParticleIterator( << 248 theParticleIterator->reset(); 250 particleIterator->reset(); << 249 while ((*theParticleIterator)()){ 251 while ((*particleIterator)()) { << 250 G4ParticleDefinition* particle = theParticleIterator->value(); 252 G4ParticleDefinition* particle = particleI << 253 G4ProcessManager* pmanager = particle->Get 251 G4ProcessManager* pmanager = particle->GetProcessManager(); 254 252 255 if (fStepMaxProcess->IsApplicable(*particl << 253 if (stepMaxProcess->IsApplicable(*particle) && pmanager) 256 pmanager->AddDiscreteProcess(fStepMaxPro << 254 { 257 } << 255 pmanager ->AddDiscreteProcess(stepMaxProcess); >> 256 } 258 } 257 } 259 } 258 } 260 259 261 //....oooOO0OOooo........oooOO0OOooo........oo 260 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 262 261 >> 262 void PhysicsList::SetCuts() >> 263 { >> 264 >> 265 if (verboseLevel >0){ >> 266 G4cout << "PhysicsList::SetCuts:"; >> 267 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; >> 268 } >> 269 >> 270 // set cut values for gamma at first and for e- second and next for e+, >> 271 // because some processes for e+/e- need cut values for gamma >> 272 SetCutValue(cutForGamma, "gamma"); >> 273 SetCutValue(cutForElectron, "e-"); >> 274 SetCutValue(cutForPositron, "e+"); >> 275 >> 276 if (verboseLevel>0) DumpCutValuesTable(); >> 277 } >> 278 >> 279 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 280 >> 281 void PhysicsList::SetCutForGamma(G4double cut) >> 282 { >> 283 cutForGamma = cut; >> 284 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 285 } >> 286 >> 287 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 288 >> 289 void PhysicsList::SetCutForElectron(G4double cut) >> 290 { >> 291 cutForElectron = cut; >> 292 SetParticleCuts(cutForElectron, G4Electron::Electron()); >> 293 } >> 294 >> 295 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 296 >> 297 void PhysicsList::SetCutForPositron(G4double cut) >> 298 { >> 299 cutForPositron = cut; >> 300 SetParticleCuts(cutForPositron, G4Positron::Positron()); >> 301 } >> 302 >> 303 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 304 263 void PhysicsList::AddIonGasModels() 305 void PhysicsList::AddIonGasModels() 264 { 306 { 265 G4EmConfigurator* em_config = G4LossTableMan 307 G4EmConfigurator* em_config = G4LossTableManager::Instance()->EmConfigurator(); 266 auto particleIterator = GetParticleIterator( << 308 theParticleIterator->reset(); 267 particleIterator->reset(); << 309 while ((*theParticleIterator)()) 268 while ((*particleIterator)()) { << 310 { 269 G4ParticleDefinition* particle = particleI << 311 G4ParticleDefinition* particle = theParticleIterator->value(); 270 G4String partname = particle->GetParticleN 312 G4String partname = particle->GetParticleName(); 271 if (partname == "alpha" || partname == "He << 313 if(partname == "alpha" || partname == "He3" || partname == "GenericIon") { 272 G4BraggIonGasModel* mod1 = new G4BraggIo 314 G4BraggIonGasModel* mod1 = new G4BraggIonGasModel(); 273 G4BetheBlochIonGasModel* mod2 = new G4Be 315 G4BetheBlochIonGasModel* mod2 = new G4BetheBlochIonGasModel(); 274 G4double eth = 2. * MeV * particle->GetP << 316 G4double eth = 2.*MeV*particle->GetPDGMass()/proton_mass_c2; 275 em_config->SetExtraEmModel(partname, "io << 317 em_config->SetExtraEmModel(partname,"ionIoni",mod1,"",0.0,eth, 276 em_config->SetExtraEmModel(partname, "io << 318 new G4IonFluctuations()); 277 new G4Univers << 319 em_config->SetExtraEmModel(partname,"ionIoni",mod2,"",eth,100*TeV, >> 320 new G4UniversalFluctuation()); >> 321 278 } 322 } 279 } 323 } 280 } 324 } 281 325 282 //....oooOO0OOooo........oooOO0OOooo........oo 326 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 327 283 328