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