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/TestEm16/src/Physics 26 /// \file electromagnetic/TestEm16/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // >> 29 // $Id: PhysicsList.cc 84365 2014-10-14 12:43:52Z gcosmo $ 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 36 37 #include "G4ComptonScattering.hh" << 38 #include "G4DecayPhysics.hh" << 39 #include "G4GammaConversion.hh" << 40 #include "G4MuBremsstrahlung.hh" << 41 #include "G4MuIonisation.hh" << 42 #include "G4MuMultipleScattering.hh" << 43 #include "G4MuPairProduction.hh" << 44 #include "G4ParticleDefinition.hh" 37 #include "G4ParticleDefinition.hh" 45 #include "G4ParticleTable.hh" << 38 #include "G4ProcessManager.hh" 46 #include "G4ParticleTypes.hh" 39 #include "G4ParticleTypes.hh" >> 40 #include "G4ParticleTable.hh" >> 41 >> 42 #include "G4ComptonScattering.hh" >> 43 #include "G4GammaConversion.hh" 47 #include "G4PhotoElectricEffect.hh" 44 #include "G4PhotoElectricEffect.hh" 48 #include "G4ProcessManager.hh" << 49 #include "G4ProcessTable.hh" << 50 #include "G4RayleighScattering.hh" 45 #include "G4RayleighScattering.hh" 51 #include "G4StepLimiter.hh" << 46 52 #include "G4SynchrotronRadiation.hh" << 53 #include "G4SynchrotronRadiationInMat.hh" << 54 #include "G4SystemOfUnits.hh" << 55 #include "G4XrayReflection.hh" << 56 #include "G4eBremsstrahlung.hh" << 57 #include "G4eIonisation.hh" << 58 #include "G4eMultipleScattering.hh" 47 #include "G4eMultipleScattering.hh" >> 48 #include "G4eIonisation.hh" >> 49 #include "G4eBremsstrahlung.hh" 59 #include "G4eplusAnnihilation.hh" 50 #include "G4eplusAnnihilation.hh" 60 #include "G4hBremsstrahlung.hh" << 51 61 #include "G4hIonisation.hh" << 52 #include "G4MuMultipleScattering.hh" >> 53 #include "G4MuIonisation.hh" >> 54 #include "G4MuBremsstrahlung.hh" >> 55 #include "G4MuPairProduction.hh" >> 56 62 #include "G4hMultipleScattering.hh" 57 #include "G4hMultipleScattering.hh" >> 58 #include "G4hIonisation.hh" >> 59 #include "G4hBremsstrahlung.hh" 63 #include "G4hPairProduction.hh" 60 #include "G4hPairProduction.hh" 64 61 >> 62 #include "G4SynchrotronRadiation.hh" >> 63 #include "G4SynchrotronRadiationInMat.hh" >> 64 >> 65 #include "G4StepLimiter.hh" >> 66 >> 67 #include "G4SystemOfUnits.hh" >> 68 #include "G4AutoDelete.hh" >> 69 65 //....oooOO0OOooo........oooOO0OOooo........oo 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 66 71 67 PhysicsList::PhysicsList() : G4VUserPhysicsLis << 72 PhysicsList::PhysicsList() >> 73 : G4VUserPhysicsList(), >> 74 fMess(0) 68 { 75 { 69 SetDefaultCutValue(1. * km); << 76 SetDefaultCutValue(1.*km); 70 << 77 71 fSRType = true; << 78 fSRType = true; 72 fMess = new PhysicsListMessenger(this); 79 fMess = new PhysicsListMessenger(this); 73 fDecayPhysics = new G4DecayPhysics(); << 80 } >> 81 >> 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 83 >> 84 PhysicsList::~PhysicsList() >> 85 { >> 86 delete fMess; 74 } 87 } 75 88 76 //....oooOO0OOooo........oooOO0OOooo........oo 89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 90 78 void PhysicsList::ConstructParticle() 91 void PhysicsList::ConstructParticle() 79 { 92 { 80 fDecayPhysics->ConstructParticle(); << 93 // In this method, static member functions should be called >> 94 // for all particles which you want to use. >> 95 // This ensures that objects of these particle types will be >> 96 // created in the program. >> 97 >> 98 ConstructBosons(); >> 99 ConstructLeptons(); >> 100 >> 101 // charged mesons >> 102 G4PionPlus::PionPlusDefinition(); >> 103 G4PionMinus::PionMinusDefinition(); >> 104 G4KaonPlus::KaonPlusDefinition(); >> 105 G4KaonMinus::KaonMinusDefinition(); >> 106 >> 107 // charged baryons >> 108 G4Proton::ProtonDefinition(); >> 109 G4AntiProton::AntiProtonDefinition(); >> 110 >> 111 // ions >> 112 //G4Deuteron::DeuteronDefinition(); >> 113 //G4Triton::TritonDefinition(); >> 114 //G4Alpha::AlphaDefinition(); >> 115 G4GenericIon::GenericIonDefinition(); >> 116 } >> 117 >> 118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 119 >> 120 void PhysicsList::ConstructBosons() >> 121 { >> 122 // pseudo-particles >> 123 G4Geantino::GeantinoDefinition(); >> 124 G4ChargedGeantino::ChargedGeantinoDefinition(); >> 125 >> 126 // gamma >> 127 G4Gamma::GammaDefinition(); >> 128 } >> 129 >> 130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 131 >> 132 void PhysicsList::ConstructLeptons() >> 133 { >> 134 // leptons >> 135 G4Electron::ElectronDefinition(); >> 136 G4Positron::PositronDefinition(); >> 137 G4MuonPlus::MuonPlusDefinition(); >> 138 G4MuonMinus::MuonMinusDefinition(); >> 139 >> 140 G4NeutrinoE::NeutrinoEDefinition(); >> 141 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); >> 142 G4NeutrinoMu::NeutrinoMuDefinition(); >> 143 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 81 } 144 } 82 145 83 //....oooOO0OOooo........oooOO0OOooo........oo 146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 84 147 85 void PhysicsList::ConstructProcess() 148 void PhysicsList::ConstructProcess() 86 { 149 { 87 AddTransportation(); 150 AddTransportation(); 88 ConstructEM(); 151 ConstructEM(); 89 fDecayPhysics->ConstructProcess(); << 152 ConstructGeneral(); 90 } 153 } 91 154 92 //....oooOO0OOooo........oooOO0OOooo........oo 155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 93 << 94 void PhysicsList::ConstructEM() 156 void PhysicsList::ConstructEM() 95 { 157 { 96 auto particleIterator = GetParticleIterator( << 158 theParticleIterator->reset(); 97 particleIterator->reset(); << 159 G4SynchrotronRadiation* fSync = new G4SynchrotronRadiation(); 98 auto fSync = new G4SynchrotronRadiation(); << 160 G4AutoDelete::Register(fSync); 99 while ((*particleIterator)()) { << 161 while( (*theParticleIterator)() ){ 100 G4ParticleDefinition* particle = particleI << 162 G4ParticleDefinition* particle = theParticleIterator->value(); 101 G4ProcessManager* pmanager = particle->Get 163 G4ProcessManager* pmanager = particle->GetProcessManager(); 102 G4String particleName = particle->GetParti 164 G4String particleName = particle->GetParticleName(); 103 165 104 if (particleName == "gamma") { 166 if (particleName == "gamma") { 105 // gamma 167 // gamma 106 pmanager->AddDiscreteProcess(new G4Photo 168 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect); 107 pmanager->AddDiscreteProcess(new G4Compt 169 pmanager->AddDiscreteProcess(new G4ComptonScattering); 108 pmanager->AddDiscreteProcess(new G4Gamma 170 pmanager->AddDiscreteProcess(new G4GammaConversion); 109 pmanager->AddDiscreteProcess(new G4Rayle 171 pmanager->AddDiscreteProcess(new G4RayleighScattering); 110 pmanager->AddDiscreteProcess(new G4XrayR << 172 111 } << 173 } else if (particleName == "e-") { 112 else if (particleName == "e-") { << 174 //electron 113 // electron << 175 pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1); 114 pmanager->AddProcess(new G4eMultipleScat << 176 pmanager->AddProcess(new G4eIonisation, -1, 2, 2); 115 pmanager->AddProcess(new G4eIonisation, << 177 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3); 116 pmanager->AddProcess(new G4eBremsstrahlu << 117 if (fSRType) { 178 if (fSRType) { 118 pmanager->AddProcess(fSync, -1, -1, 3) << 179 pmanager->AddProcess(fSync, -1,-1, 4); 119 } << 180 } else { 120 else { << 181 pmanager->AddProcess(new G4SynchrotronRadiationInMat,-1,-1, 4); 121 pmanager->AddProcess(new G4Synchrotron << 122 } 182 } 123 pmanager->AddProcess(new G4StepLimiter, << 183 pmanager->AddProcess(new G4StepLimiter, -1,-1, 5); 124 } << 184 125 else if (particleName == "e+") { << 185 } else if (particleName == "e+") { 126 // positron << 186 //positron 127 pmanager->AddProcess(new G4eMultipleScat << 187 pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1); 128 pmanager->AddProcess(new G4eIonisation, << 188 pmanager->AddProcess(new G4eIonisation, -1, 2, 2); 129 pmanager->AddProcess(new G4eBremsstrahlu << 189 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3); 130 pmanager->AddProcess(new G4eplusAnnihila << 190 pmanager->AddProcess(new G4eplusAnnihilation, 0,-1, 4); 131 if (fSRType) { 191 if (fSRType) { 132 pmanager->AddProcess(fSync, -1, -1, 4) << 192 pmanager->AddProcess(fSync, -1,-1, 5); 133 } << 193 } else { 134 else { << 194 pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 5); 135 pmanager->AddProcess(new G4Synchrotron << 136 } 195 } 137 pmanager->AddProcess(new G4StepLimiter, << 196 pmanager->AddProcess(new G4StepLimiter, -1,-1, 6); 138 } << 197 139 else if (particleName == "mu+" || particle << 198 } else if( particleName == "mu+" || 140 // muon << 199 particleName == "mu-" ) { 141 pmanager->AddProcess(new G4MuMultipleSca << 200 //muon 142 pmanager->AddProcess(new G4MuIonisation, << 201 pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1); 143 pmanager->AddProcess(new G4MuBremsstrahl << 202 pmanager->AddProcess(new G4MuIonisation, -1, 2, 2); 144 pmanager->AddProcess(new G4MuPairProduct << 203 pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3); 145 pmanager->AddProcess(fSync, -1, -1, 4); << 204 pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4); 146 pmanager->AddProcess(new G4StepLimiter, << 205 pmanager->AddProcess(fSync, -1,-1, 5); 147 } << 206 pmanager->AddProcess(new G4StepLimiter, -1,-1, 6); 148 else if (particleName == "proton") { << 207 149 // proton << 208 } else if( particleName == "proton") { 150 pmanager->AddProcess(new G4hMultipleScat << 209 //proton 151 pmanager->AddProcess(new G4hIonisation, << 210 pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); 152 pmanager->AddProcess(new G4hBremsstrahlu << 211 pmanager->AddProcess(new G4hIonisation, -1, 2, 2); 153 pmanager->AddProcess(new G4hPairProducti << 212 pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3); 154 pmanager->AddProcess(fSync, -1, -1, 4); << 213 pmanager->AddProcess(new G4hPairProduction, -1, 4, 4); 155 pmanager->AddProcess(new G4StepLimiter, << 214 pmanager->AddProcess(fSync, -1,-1, 5); 156 } << 215 pmanager->AddProcess(new G4StepLimiter, -1,-1, 6); 157 else if (particle->GetPDGCharge() != 0.0 & << 216 } 158 pmanager->AddProcess(fSync, -1, -1, 1); << 217 else if (particle->GetPDGCharge() != 0.0 && !particle->IsShortLived()) >> 218 { >> 219 pmanager->AddProcess(fSync,-1,-1, 1); 159 } 220 } 160 } 221 } 161 } 222 } 162 223 163 //....oooOO0OOooo........oooOO0OOooo........oo 224 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 164 225 165 void PhysicsList::SetXrayReflectionRoughness(G << 226 #include "G4Decay.hh" >> 227 >> 228 void PhysicsList::ConstructGeneral() 166 { 229 { 167 G4ProcessTable* theProcessTable = G4ProcessT << 230 // Add Decay Process 168 G4XrayReflection* XrayReflectionProcess = << 231 G4Decay* theDecayProcess = new G4Decay(); 169 (G4XrayReflection*)theProcessTable->FindPr << 232 theParticleIterator->reset(); 170 if (XrayReflectionProcess) << 233 while ((*theParticleIterator)()){ 171 XrayReflectionProcess->SetSurfaceRoughness << 234 G4ParticleDefinition* particle = theParticleIterator->value(); 172 else << 235 G4ProcessManager* pmanager = particle->GetProcessManager(); 173 G4cout << "Warning. No process XrayReflect << 236 if (theDecayProcess->IsApplicable(*particle)) { 174 "SetXrayReflectionRoughness igno << 237 pmanager ->AddProcess(theDecayProcess); 175 << G4endl; << 238 // set ordering for PostStepDoIt and AtRestDoIt >> 239 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep); >> 240 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest); >> 241 } >> 242 } 176 } 243 } 177 244 178 //....oooOO0OOooo........oooOO0OOooo........oo 245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 179 246