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