Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file electromagnetic/TestEm6/src/PhysicsL << 23 // $Id: PhysicsList.cc,v 1.7 2004/09/27 09:35:38 maire Exp $ 27 /// \brief Implementation of the PhysicsList c << 24 // GEANT4 tag $Name: geant4-07-00-patch-01 $ 28 // << 29 // 25 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 26 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 28 33 #include "PhysicsList.hh" 29 #include "PhysicsList.hh" 34 << 35 #include "PhysicsListMessenger.hh" 30 #include "PhysicsListMessenger.hh" 36 #include "StepMax.hh" << 37 31 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" 32 #include "G4ParticleDefinition.hh" 56 #include "G4ParticleTable.hh" << 57 #include "G4Positron.hh" << 58 #include "G4ProcessManager.hh" 33 #include "G4ProcessManager.hh" 59 #include "G4ProcessTable.hh" << 34 #include "G4ParticleTypes.hh" 60 #include "G4SystemOfUnits.hh" << 35 #include "G4ParticleTable.hh" 61 #include "G4UnitsTable.hh" << 62 #include "G4eeToHadrons.hh" << 63 36 64 //....oooOO0OOooo........oooOO0OOooo........oo 37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 38 66 PhysicsList::PhysicsList() 39 PhysicsList::PhysicsList() 67 : G4VModularPhysicsList(), fEmPhysicsList(0) << 40 : G4VUserPhysicsList() 68 { 41 { 69 G4LossTableManager::Instance()->SetVerbose(1 << 42 defaultCutValue = 1.*km; >> 43 pMes = new PhysicsListMessenger(this); >> 44 theGammaToMuPairProcess = 0; >> 45 theAnnihiToMuPairProcess = 0; >> 46 SetVerboseLevel(1); >> 47 } 70 48 71 defaultCutValue = 1. * km; << 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 fMes = new PhysicsListMessenger(this); << 50 >> 51 PhysicsList::~PhysicsList() >> 52 { delete pMes; } 73 53 74 fStepMaxProcess = new StepMax(); << 54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 55 76 fDecayPhysicsList = new G4DecayPhysics(); << 56 void PhysicsList::ConstructParticle() >> 57 { >> 58 // In this method, static member functions should be called >> 59 // for all particles which you want to use. >> 60 // This ensures that objects of these particle types will be >> 61 // created in the program. 77 62 78 SetVerboseLevel(2); << 63 ConstructBosons(); >> 64 ConstructLeptons(); 79 } 65 } 80 66 81 //....oooOO0OOooo........oooOO0OOooo........oo 67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 68 83 PhysicsList::~PhysicsList() << 69 void PhysicsList::ConstructBosons() 84 { 70 { 85 delete fMes; << 71 // pseudo-particles 86 delete fDecayPhysicsList; << 72 G4Geantino::GeantinoDefinition(); 87 delete fEmPhysicsList; << 73 G4ChargedGeantino::ChargedGeantinoDefinition(); 88 delete fStepMaxProcess; << 74 >> 75 // gamma >> 76 G4Gamma::GammaDefinition(); 89 } 77 } 90 78 91 //....oooOO0OOooo........oooOO0OOooo........oo 79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 92 80 93 void PhysicsList::ConstructParticle() << 81 void PhysicsList::ConstructLeptons() 94 { 82 { 95 fDecayPhysicsList->ConstructParticle(); << 83 // leptons >> 84 G4Electron::ElectronDefinition(); >> 85 G4Positron::PositronDefinition(); >> 86 G4MuonPlus::MuonPlusDefinition(); >> 87 G4MuonMinus::MuonMinusDefinition(); >> 88 >> 89 G4NeutrinoE::NeutrinoEDefinition(); >> 90 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); >> 91 G4NeutrinoMu::NeutrinoMuDefinition(); >> 92 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 96 } 93 } 97 94 98 //....oooOO0OOooo........oooOO0OOooo........oo 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 99 96 100 void PhysicsList::ConstructProcess() 97 void PhysicsList::ConstructProcess() 101 { 98 { 102 AddTransportation(); 99 AddTransportation(); 103 << 100 ConstructEM(); 104 if (fEmPhysicsList) fEmPhysicsList->Construc << 101 ConstructGeneral(); 105 fDecayPhysicsList->ConstructProcess(); << 106 << 107 AddStepMax(); << 108 << 109 ConstructHighEnergy(); << 110 } 102 } 111 103 112 //....oooOO0OOooo........oooOO0OOooo........oo 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 113 105 114 void PhysicsList::ConstructHighEnergy() << 106 #include "G4GammaConversionToMuons.hh" 115 { << 116 const G4ParticleDefinition* particle = G4Gam << 117 G4ProcessManager* pmanager = particle->GetPr << 118 107 119 pmanager->AddDiscreteProcess(new G4GammaConv << 108 #include "G4MultipleScattering.hh" 120 109 121 particle = G4Positron::Positron(); << 110 #include "G4eIonisation.hh" 122 pmanager = particle->GetProcessManager(); << 111 #include "G4eBremsstrahlung.hh" >> 112 #include "G4eplusAnnihilation.hh" >> 113 #include "G4AnnihiToMuPair.hh" 123 114 124 pmanager->AddDiscreteProcess(new G4AnnihiToM << 115 #include "G4MuIonisation.hh" 125 pmanager->AddDiscreteProcess(new G4eeToHadro << 116 #include "G4MuBremsstrahlung.hh" 126 } << 117 #include "G4MuPairProduction.hh" 127 118 128 //....oooOO0OOooo........oooOO0OOooo........oo 119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 129 120 130 void PhysicsList::SetGammaToMuPairFac(G4double << 121 void PhysicsList::ConstructEM() 131 { 122 { 132 G4ProcessTable* theProcessTable = G4ProcessT << 123 theParticleIterator->reset(); 133 G4GammaConversionToMuons* gammaToMuPairProce << 124 while( (*theParticleIterator)() ){ 134 (G4GammaConversionToMuons*)theProcessTable << 125 G4ParticleDefinition* particle = theParticleIterator->value(); 135 if (gammaToMuPairProcess) << 126 G4ProcessManager* pmanager = particle->GetProcessManager(); 136 gammaToMuPairProcess->SetCrossSecFactor(fa << 127 G4String particleName = particle->GetParticleName(); 137 else << 128 138 G4cout << "Warning. No process GammaToMuPa << 129 if (particleName == "gamma") { >> 130 // gamma allow only gamma -> mu+mu- >> 131 theGammaToMuPairProcess=new G4GammaConversionToMuons; >> 132 pmanager->AddDiscreteProcess(theGammaToMuPairProcess); >> 133 >> 134 } else if (particleName == "e-") { >> 135 //electron >> 136 pmanager->AddProcess(new G4MultipleScattering,-1, 1,1); >> 137 pmanager->AddProcess(new G4eIonisation, -1, 2,2); >> 138 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3); >> 139 >> 140 } else if (particleName == "e+") { >> 141 //positron >> 142 // to make the process of e+e- annihilation more visible, >> 143 // do not enable the other standard processes: >> 144 // pmanager->AddProcess(new G4MultipleScattering,-1, 1,1); >> 145 // pmanager->AddProcess(new G4eIonisation, -1, 2,2); >> 146 // pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3); >> 147 // pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4); >> 148 theAnnihiToMuPairProcess=new G4AnnihiToMuPair; >> 149 pmanager->AddDiscreteProcess(theAnnihiToMuPairProcess); >> 150 >> 151 } else if( particleName == "mu+" || >> 152 particleName == "mu-" ) { >> 153 //muon >> 154 pmanager->AddProcess(new G4MultipleScattering,-1, 1,1); >> 155 pmanager->AddProcess(new G4MuIonisation, -1, 2,2); >> 156 pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3,3); >> 157 pmanager->AddProcess(new G4MuPairProduction, -1, 4,4); >> 158 >> 159 } >> 160 } 139 } 161 } 140 162 141 //....oooOO0OOooo........oooOO0OOooo........oo 163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 142 164 143 void PhysicsList::SetAnnihiToMuPairFac(G4doubl << 165 #include "G4Decay.hh" 144 { << 166 145 G4ProcessTable* theProcessTable = G4ProcessT << 167 void PhysicsList::ConstructGeneral() 146 G4AnnihiToMuPair* annihiToMuPairProcess = << 168 { 147 (G4AnnihiToMuPair*)theProcessTable->FindPr << 169 // Add Decay Process 148 if (annihiToMuPairProcess) << 170 G4Decay* theDecayProcess = new G4Decay(); 149 annihiToMuPairProcess->SetCrossSecFactor(f << 171 theParticleIterator->reset(); 150 else << 172 while ((*theParticleIterator)()){ 151 G4cout << "Warning. No process AnnihiToMuP << 173 G4ParticleDefinition* particle = theParticleIterator->value(); >> 174 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 175 if (theDecayProcess->IsApplicable(*particle)) { >> 176 pmanager ->AddProcess(theDecayProcess); >> 177 // set ordering for PostStepDoIt and AtRestDoIt >> 178 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep); >> 179 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest); >> 180 } >> 181 } 152 } 182 } 153 183 154 //....oooOO0OOooo........oooOO0OOooo........oo 184 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 155 185 156 void PhysicsList::SetAnnihiToHadronFac(G4doubl << 186 void PhysicsList::SetCuts() 157 { << 187 { 158 G4ProcessTable* theProcessTable = G4ProcessT << 188 if (verboseLevel >0){ 159 G4eeToHadrons* eehadProcess = (G4eeToHadrons << 189 G4cout << "PhysicsList::SetCuts:"; 160 if (eehadProcess) << 190 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 161 eehadProcess->SetCrossSecFactor(fac); << 191 } 162 else << 192 163 G4cout << "Warning. No process ee2hadr fou << 193 // set cut values for gamma at first and for e- second and next for e+, >> 194 // because some processes for e+/e- need cut values for gamma >> 195 SetCutValue(defaultCutValue, "gamma"); >> 196 SetCutValue(defaultCutValue, "e-"); >> 197 SetCutValue(defaultCutValue, "e+"); >> 198 >> 199 if (verboseLevel>0) DumpCutValuesTable(); 164 } 200 } 165 201 166 //....oooOO0OOooo........oooOO0OOooo........oo 202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 167 203 168 void PhysicsList::AddPhysicsList(const G4Strin << 204 void PhysicsList::SetGammaToMuPairFac(G4double fac) 169 { 205 { 170 if (verboseLevel > 1) { << 206 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 } 207 } 237 208 238 //....oooOO0OOooo........oooOO0OOooo........oo 209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 239 210 240 void PhysicsList::AddStepMax() << 211 void PhysicsList::SetAnnihiToMuPairFac(G4double fac) 241 { 212 { 242 // Step limitation seen as a process << 213 if(theAnnihiToMuPairProcess) theAnnihiToMuPairProcess->SetCrossSecFactor(fac); 243 << 244 auto particleIterator = GetParticleIterator( << 245 particleIterator->reset(); << 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 } 214 } 255 215 256 //....oooOO0OOooo........oooOO0OOooo........oo 216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 257 217