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/TestEm6/src/PhysicsL 26 /// \file electromagnetic/TestEm6/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // >> 29 // $Id$ 29 // 30 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "PhysicsList.hh" 34 #include "PhysicsList.hh" 34 << 35 #include "PhysicsListMessenger.hh" 35 #include "PhysicsListMessenger.hh" 36 #include "StepMax.hh" << 37 36 38 #include "G4AnnihiToMuPair.hh" << 39 #include "G4DecayPhysics.hh" << 40 #include "G4Electron.hh" << 41 #include "G4EmLivermorePhysics.hh" << 42 #include "G4EmLowEPPhysics.hh" << 43 #include "G4EmPenelopePhysics.hh" << 44 #include "G4EmStandardPhysics.hh" << 45 #include "G4EmStandardPhysicsGS.hh" << 46 #include "G4EmStandardPhysicsSS.hh" << 47 #include "G4EmStandardPhysicsWVI.hh" << 48 #include "G4EmStandardPhysics_option1.hh" << 49 #include "G4EmStandardPhysics_option2.hh" << 50 #include "G4EmStandardPhysics_option3.hh" << 51 #include "G4EmStandardPhysics_option4.hh" << 52 #include "G4Gamma.hh" << 53 #include "G4GammaConversionToMuons.hh" << 54 #include "G4LossTableManager.hh" << 55 #include "G4ParticleDefinition.hh" 37 #include "G4ParticleDefinition.hh" 56 #include "G4ParticleTable.hh" << 57 #include "G4Positron.hh" << 58 #include "G4ProcessManager.hh" 38 #include "G4ProcessManager.hh" >> 39 #include "G4ParticleTypes.hh" >> 40 #include "G4ParticleTable.hh" >> 41 >> 42 #include "G4Proton.hh" >> 43 #include "G4AntiProton.hh" >> 44 #include "G4Neutron.hh" >> 45 #include "G4AntiNeutron.hh" >> 46 >> 47 #include "G4GammaConversionToMuons.hh" >> 48 >> 49 #include "G4eMultipleScattering.hh" >> 50 #include "G4MuMultipleScattering.hh" >> 51 #include "G4hMultipleScattering.hh" >> 52 >> 53 #include "G4eIonisation.hh" >> 54 #include "G4eBremsstrahlung.hh" >> 55 #include "G4eplusAnnihilation.hh" >> 56 #include "G4AnnihiToMuPair.hh" >> 57 >> 58 #include "G4MuIonisation.hh" >> 59 #include "G4MuBremsstrahlung.hh" >> 60 #include "G4MuPairProduction.hh" >> 61 >> 62 #include "G4hIonisation.hh" >> 63 #include "G4hhIonisation.hh" >> 64 #include "G4ionIonisation.hh" >> 65 #include "G4eeToHadrons.hh" >> 66 >> 67 #include "G4Decay.hh" >> 68 #include "G4EmProcessOptions.hh" >> 69 >> 70 #include "G4StepLimiter.hh" >> 71 59 #include "G4ProcessTable.hh" 72 #include "G4ProcessTable.hh" >> 73 >> 74 #include "G4ComptonScattering.hh" >> 75 #include "G4GammaConversion.hh" >> 76 #include "G4PhotoElectricEffect.hh" >> 77 60 #include "G4SystemOfUnits.hh" 78 #include "G4SystemOfUnits.hh" 61 #include "G4UnitsTable.hh" << 62 #include "G4eeToHadrons.hh" << 63 79 64 //....oooOO0OOooo........oooOO0OOooo........oo 80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 81 66 PhysicsList::PhysicsList() 82 PhysicsList::PhysicsList() 67 : G4VModularPhysicsList(), fEmPhysicsList(0) << 83 : G4VUserPhysicsList() 68 { 84 { 69 G4LossTableManager::Instance()->SetVerbose(1 << 85 defaultCutValue = 1.*km; 70 << 71 defaultCutValue = 1. * km; << 72 fMes = new PhysicsListMessenger(this); 86 fMes = new PhysicsListMessenger(this); 73 << 87 SetVerboseLevel(1); 74 fStepMaxProcess = new StepMax(); << 75 << 76 fDecayPhysicsList = new G4DecayPhysics(); << 77 << 78 SetVerboseLevel(2); << 79 } 88 } 80 89 81 //....oooOO0OOooo........oooOO0OOooo........oo 90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 91 83 PhysicsList::~PhysicsList() 92 PhysicsList::~PhysicsList() 84 { 93 { 85 delete fMes; 94 delete fMes; 86 delete fDecayPhysicsList; << 87 delete fEmPhysicsList; << 88 delete fStepMaxProcess; << 89 } 95 } 90 96 91 //....oooOO0OOooo........oooOO0OOooo........oo 97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 92 98 93 void PhysicsList::ConstructParticle() 99 void PhysicsList::ConstructParticle() 94 { 100 { 95 fDecayPhysicsList->ConstructParticle(); << 101 // In this method, static member functions should be called >> 102 // for all particles which you want to use. >> 103 // This ensures that objects of these particle types will be >> 104 // created in the program. >> 105 >> 106 ConstructBosons(); >> 107 ConstructLeptons(); >> 108 ConstructHadrons(); 96 } 109 } 97 110 98 //....oooOO0OOooo........oooOO0OOooo........oo 111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 99 112 100 void PhysicsList::ConstructProcess() << 113 void PhysicsList::ConstructBosons() 101 { 114 { 102 AddTransportation(); << 115 // pseudo-particles >> 116 G4Geantino::GeantinoDefinition(); >> 117 G4ChargedGeantino::ChargedGeantinoDefinition(); >> 118 >> 119 // gamma >> 120 G4Gamma::GammaDefinition(); >> 121 } 103 122 104 if (fEmPhysicsList) fEmPhysicsList->Construc << 123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 105 fDecayPhysicsList->ConstructProcess(); << 106 124 107 AddStepMax(); << 125 void PhysicsList::ConstructLeptons() >> 126 { >> 127 // leptons >> 128 G4Electron::ElectronDefinition(); >> 129 G4Positron::PositronDefinition(); >> 130 G4MuonPlus::MuonPlusDefinition(); >> 131 G4MuonMinus::MuonMinusDefinition(); >> 132 >> 133 G4NeutrinoE::NeutrinoEDefinition(); >> 134 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); >> 135 G4NeutrinoMu::NeutrinoMuDefinition(); >> 136 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); >> 137 } >> 138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 108 139 109 ConstructHighEnergy(); << 140 void PhysicsList::ConstructHadrons() >> 141 { >> 142 // mesons >> 143 G4PionPlus::PionPlusDefinition(); >> 144 G4PionMinus::PionMinusDefinition(); >> 145 G4PionZero::PionZeroDefinition(); >> 146 G4Eta::EtaDefinition(); >> 147 G4EtaPrime::EtaPrimeDefinition(); >> 148 G4KaonPlus::KaonPlusDefinition(); >> 149 G4KaonMinus::KaonMinusDefinition(); >> 150 G4KaonZero::KaonZeroDefinition(); >> 151 G4AntiKaonZero::AntiKaonZeroDefinition(); >> 152 G4KaonZeroLong::KaonZeroLongDefinition(); >> 153 G4KaonZeroShort::KaonZeroShortDefinition(); >> 154 >> 155 // baryons >> 156 G4Proton::ProtonDefinition(); >> 157 G4AntiProton::AntiProtonDefinition(); >> 158 G4Neutron::NeutronDefinition(); >> 159 G4AntiNeutron::AntiNeutronDefinition(); 110 } 160 } 111 161 112 //....oooOO0OOooo........oooOO0OOooo........oo 162 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 113 163 114 void PhysicsList::ConstructHighEnergy() << 164 void PhysicsList::ConstructProcess() 115 { 165 { 116 const G4ParticleDefinition* particle = G4Gam << 166 AddTransportation(); 117 G4ProcessManager* pmanager = particle->GetPr << 167 ConstructEM(); >> 168 ConstructGeneral(); >> 169 } 118 170 119 pmanager->AddDiscreteProcess(new G4GammaConv << 171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 120 172 121 particle = G4Positron::Positron(); << 173 void PhysicsList::ConstructEM() 122 pmanager = particle->GetProcessManager(); << 174 { >> 175 theParticleIterator->reset(); >> 176 while( (*theParticleIterator)() ){ >> 177 G4ParticleDefinition* particle = theParticleIterator->value(); >> 178 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 179 G4String particleName = particle->GetParticleName(); 123 180 124 pmanager->AddDiscreteProcess(new G4AnnihiToM << 181 if (particleName == "gamma") { 125 pmanager->AddDiscreteProcess(new G4eeToHadro << 182 // gamma allow only gamma -> mu+mu- >> 183 pmanager->AddDiscreteProcess(new G4GammaConversionToMuons); >> 184 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect); >> 185 pmanager->AddDiscreteProcess(new G4ComptonScattering); >> 186 pmanager->AddDiscreteProcess(new G4GammaConversion); >> 187 >> 188 } else if (particleName == "e-") { >> 189 //electron >> 190 pmanager->AddProcess(new G4eMultipleScattering,-1, 1,1); >> 191 pmanager->AddProcess(new G4eIonisation, -1, 2,2); >> 192 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3); >> 193 pmanager->AddProcess(new G4StepLimiter, -1,-1,4); >> 194 >> 195 } else if (particleName == "e+") { >> 196 //positron >> 197 // to make the process of e+e- annihilation more visible, >> 198 // do not enable the other standard processes: >> 199 //pmanager->AddProcess(new G4eMultipleScattering,-1, 1,1); >> 200 //pmanager->AddProcess(new G4eIonisation, -1, 2,2); >> 201 //pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3); >> 202 //pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4); >> 203 >> 204 pmanager->AddDiscreteProcess(new G4AnnihiToMuPair); >> 205 pmanager->AddDiscreteProcess(new G4eeToHadrons); >> 206 pmanager->AddDiscreteProcess(new G4StepLimiter); >> 207 >> 208 } else if( particleName == "mu+" || >> 209 particleName == "mu-" ) { >> 210 //muon >> 211 pmanager->AddProcess(new G4MuMultipleScattering,-1, 1,1); >> 212 pmanager->AddProcess(new G4MuIonisation, -1, 2,2); >> 213 pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3,3); >> 214 pmanager->AddProcess(new G4MuPairProduction, -1, 4,4); >> 215 pmanager->AddProcess(new G4StepLimiter, -1,-1,5); >> 216 >> 217 } else if( particleName == "anti_proton") { >> 218 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1); >> 219 pmanager->AddProcess(new G4hhIonisation, -1, 2,2); >> 220 pmanager->AddProcess(new G4StepLimiter, -1,-1,3); >> 221 >> 222 } else if( particleName == "GenericIon") { >> 223 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1); >> 224 pmanager->AddProcess(new G4ionIonisation, -1, 2,2); >> 225 pmanager->AddProcess(new G4StepLimiter, -1,-1,3); >> 226 >> 227 } else if( particle->GetPDGCharge() != 0.0 && !particle->IsShortLived() >> 228 && particleName != "chargedgeantino") { >> 229 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1); >> 230 pmanager->AddProcess(new G4hIonisation, -1, 2,2); >> 231 pmanager->AddProcess(new G4StepLimiter, -1,-1,3); >> 232 } >> 233 } >> 234 >> 235 G4EmProcessOptions opt; >> 236 opt.SetVerbose(1); >> 237 opt.SetMinEnergy(100*eV); >> 238 opt.SetMaxEnergy(1000*TeV); >> 239 opt.SetDEDXBinning(13*7); >> 240 opt.SetLambdaBinning(13*7); 126 } 241 } 127 242 128 //....oooOO0OOooo........oooOO0OOooo........oo 243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 129 244 130 void PhysicsList::SetGammaToMuPairFac(G4double << 245 void PhysicsList::ConstructGeneral() 131 { 246 { 132 G4ProcessTable* theProcessTable = G4ProcessT << 247 // Add Decay Process 133 G4GammaConversionToMuons* gammaToMuPairProce << 248 G4Decay* theDecayProcess = new G4Decay(); 134 (G4GammaConversionToMuons*)theProcessTable << 249 theParticleIterator->reset(); 135 if (gammaToMuPairProcess) << 250 while ((*theParticleIterator)()){ 136 gammaToMuPairProcess->SetCrossSecFactor(fa << 251 G4ParticleDefinition* particle = theParticleIterator->value(); 137 else << 252 G4ProcessManager* pmanager = particle->GetProcessManager(); 138 G4cout << "Warning. No process GammaToMuPa << 253 if (theDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { >> 254 pmanager ->AddProcess(theDecayProcess); >> 255 // set ordering for PostStepDoIt and AtRestDoIt >> 256 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep); >> 257 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest); >> 258 } >> 259 } 139 } 260 } 140 261 141 //....oooOO0OOooo........oooOO0OOooo........oo 262 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 142 263 143 void PhysicsList::SetAnnihiToMuPairFac(G4doubl << 264 void PhysicsList::SetCuts() 144 { 265 { 145 G4ProcessTable* theProcessTable = G4ProcessT << 266 if (verboseLevel >0){ 146 G4AnnihiToMuPair* annihiToMuPairProcess = << 267 G4cout << "PhysicsList::SetCuts:"; 147 (G4AnnihiToMuPair*)theProcessTable->FindPr << 268 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 148 if (annihiToMuPairProcess) << 269 } 149 annihiToMuPairProcess->SetCrossSecFactor(f << 270 150 else << 271 // set cut values for gamma at first and for e- second and next for e+, 151 G4cout << "Warning. No process AnnihiToMuP << 272 // because some processes for e+/e- need cut values for gamma >> 273 SetCutValue(defaultCutValue, "gamma"); >> 274 SetCutValue(defaultCutValue, "e-"); >> 275 SetCutValue(defaultCutValue, "e+"); >> 276 >> 277 if (verboseLevel>0) DumpCutValuesTable(); 152 } 278 } 153 279 154 //....oooOO0OOooo........oooOO0OOooo........oo 280 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 155 281 156 void PhysicsList::SetAnnihiToHadronFac(G4doubl << 282 void PhysicsList::SetGammaToMuPairFac(G4double fac) 157 { 283 { 158 G4ProcessTable* theProcessTable = G4ProcessT 284 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 159 G4eeToHadrons* eehadProcess = (G4eeToHadrons << 285 G4GammaConversionToMuons* theGammaToMuPairProcess = (G4GammaConversionToMuons*) theProcessTable->FindProcess("GammaToMuPair","gamma"); 160 if (eehadProcess) << 286 if(theGammaToMuPairProcess) theGammaToMuPairProcess->SetCrossSecFactor(fac); 161 eehadProcess->SetCrossSecFactor(fac); << 287 else G4cout << "Warning. No process GammaToMuPair found, SetGammaToMuPairFac was ignored" << G4endl; 162 else << 163 G4cout << "Warning. No process ee2hadr fou << 164 } 288 } 165 289 166 //....oooOO0OOooo........oooOO0OOooo........oo 290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 167 291 168 void PhysicsList::AddPhysicsList(const G4Strin << 292 void PhysicsList::SetAnnihiToMuPairFac(G4double fac) 169 { 293 { 170 if (verboseLevel > 1) { << 294 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 171 G4cout << "PhysicsList::AddPhysicsList: <" << 295 G4AnnihiToMuPair* theAnnihiToMuPairProcess = (G4AnnihiToMuPair*) theProcessTable->FindProcess("AnnihiToMuPair","e+"); 172 } << 296 if(theAnnihiToMuPairProcess) theAnnihiToMuPairProcess->SetCrossSecFactor(fac); 173 << 297 else G4cout << "Warning. No process AnnihiToMuPair found, SetAnnihiToMuPairFac was ignored" << G4endl; 174 if (name == fEmName) { << 175 return; << 176 } << 177 else if (name == "emstandard_opt0") { << 178 fEmName = name; << 179 delete fEmPhysicsList; << 180 fEmPhysicsList = new G4EmStandardPhysics() << 181 } << 182 else if (name == "emstandard_opt1") { << 183 fEmName = name; << 184 delete fEmPhysicsList; << 185 fEmPhysicsList = new G4EmStandardPhysics_o << 186 } << 187 else if (name == "emstandard_opt2") { << 188 fEmName = name; << 189 delete fEmPhysicsList; << 190 fEmPhysicsList = new G4EmStandardPhysics_o << 191 } << 192 else if (name == "emstandard_opt3") { << 193 fEmName = name; << 194 delete fEmPhysicsList; << 195 fEmPhysicsList = new G4EmStandardPhysics_o << 196 } << 197 else if (name == "emstandard_opt4") { << 198 fEmName = name; << 199 delete fEmPhysicsList; << 200 fEmPhysicsList = new G4EmStandardPhysics_o << 201 } << 202 else if (name == "emlivermore") { << 203 fEmName = name; << 204 delete fEmPhysicsList; << 205 fEmPhysicsList = new G4EmLivermorePhysics( << 206 } << 207 else if (name == "empenelope") { << 208 fEmName = name; << 209 delete fEmPhysicsList; << 210 fEmPhysicsList = new G4EmPenelopePhysics() << 211 } << 212 else if (name == "emlowenergy") { << 213 fEmName = name; << 214 delete fEmPhysicsList; << 215 fEmPhysicsList = new G4EmLowEPPhysics(); << 216 } << 217 else if (name == "emstandardGS") { << 218 fEmName = name; << 219 delete fEmPhysicsList; << 220 fEmPhysicsList = new G4EmStandardPhysicsGS << 221 } << 222 else if (name == "emstandardSS") { << 223 fEmName = name; << 224 delete fEmPhysicsList; << 225 fEmPhysicsList = new G4EmStandardPhysicsSS << 226 } << 227 else if (name == "emstandardWVI") { << 228 fEmName = name; << 229 delete fEmPhysicsList; << 230 fEmPhysicsList = new G4EmStandardPhysicsWV << 231 } << 232 else { << 233 G4cout << "PhysicsList::AddPhysicsList: <" << 234 << " is not defined" << G4endl; << 235 } << 236 } 298 } 237 299 238 //....oooOO0OOooo........oooOO0OOooo........oo 300 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 239 301 240 void PhysicsList::AddStepMax() << 302 void PhysicsList::SetAnnihiToHadronFac(G4double fac) 241 { 303 { 242 // Step limitation seen as a process << 304 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 243 << 305 G4eeToHadrons* eehadProcess = (G4eeToHadrons*) theProcessTable->FindProcess("ee2hadr","e+"); 244 auto particleIterator = GetParticleIterator( << 306 if(eehadProcess) eehadProcess->SetCrossSecFactor(fac); 245 particleIterator->reset(); << 307 else G4cout << "Warning. No process ee2hadr found, SetAnnihiToHadronFac was ignored" << G4endl; 246 while ((*particleIterator)()) { << 247 G4ParticleDefinition* particle = particleI << 248 G4ProcessManager* pmanager = particle->Get << 249 << 250 if (fStepMaxProcess->IsApplicable(*particl << 251 pmanager->AddDiscreteProcess(fStepMaxPro << 252 } << 253 } << 254 } 308 } 255 309 256 //....oooOO0OOooo........oooOO0OOooo........oo 310 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 257 311