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 100276 2016-10-17 08:31:11Z 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 auto particleIterator=GetParticleIterator(); 97 particleIterator->reset(); 159 particleIterator->reset(); 98 auto fSync = new G4SynchrotronRadiation(); << 160 G4SynchrotronRadiation* fSync = new G4SynchrotronRadiation(); 99 while ((*particleIterator)()) { << 161 G4AutoDelete::Register(fSync); >> 162 while( (*particleIterator)() ){ 100 G4ParticleDefinition* particle = particleI 163 G4ParticleDefinition* particle = particleIterator->value(); 101 G4ProcessManager* pmanager = particle->Get 164 G4ProcessManager* pmanager = particle->GetProcessManager(); 102 G4String particleName = particle->GetParti 165 G4String particleName = particle->GetParticleName(); 103 166 104 if (particleName == "gamma") { 167 if (particleName == "gamma") { 105 // gamma 168 // gamma 106 pmanager->AddDiscreteProcess(new G4Photo 169 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect); 107 pmanager->AddDiscreteProcess(new G4Compt 170 pmanager->AddDiscreteProcess(new G4ComptonScattering); 108 pmanager->AddDiscreteProcess(new G4Gamma 171 pmanager->AddDiscreteProcess(new G4GammaConversion); 109 pmanager->AddDiscreteProcess(new G4Rayle 172 pmanager->AddDiscreteProcess(new G4RayleighScattering); 110 pmanager->AddDiscreteProcess(new G4XrayR << 173 111 } << 174 } else if (particleName == "e-") { 112 else if (particleName == "e-") { << 175 //electron 113 // electron << 176 pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1); 114 pmanager->AddProcess(new G4eMultipleScat << 177 pmanager->AddProcess(new G4eIonisation, -1, 2, 2); 115 pmanager->AddProcess(new G4eIonisation, << 178 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3); 116 pmanager->AddProcess(new G4eBremsstrahlu << 117 if (fSRType) { 179 if (fSRType) { 118 pmanager->AddProcess(fSync, -1, -1, 3) << 180 pmanager->AddProcess(fSync, -1,-1, 4); >> 181 } else { >> 182 pmanager->AddProcess(new G4SynchrotronRadiationInMat,-1,-1, 4); 119 } 183 } 120 else { << 184 pmanager->AddProcess(new G4StepLimiter, -1,-1, 5); 121 pmanager->AddProcess(new G4Synchrotron << 185 122 } << 186 } else if (particleName == "e+") { 123 pmanager->AddProcess(new G4StepLimiter, << 187 //positron 124 } << 188 pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1); 125 else if (particleName == "e+") { << 189 pmanager->AddProcess(new G4eIonisation, -1, 2, 2); 126 // positron << 190 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3); 127 pmanager->AddProcess(new G4eMultipleScat << 191 pmanager->AddProcess(new G4eplusAnnihilation, 0,-1, 4); 128 pmanager->AddProcess(new G4eIonisation, << 129 pmanager->AddProcess(new G4eBremsstrahlu << 130 pmanager->AddProcess(new G4eplusAnnihila << 131 if (fSRType) { 192 if (fSRType) { 132 pmanager->AddProcess(fSync, -1, -1, 4) << 193 pmanager->AddProcess(fSync, -1,-1, 5); >> 194 } else { >> 195 pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 5); 133 } 196 } 134 else { << 197 pmanager->AddProcess(new G4StepLimiter, -1,-1, 6); 135 pmanager->AddProcess(new G4Synchrotron << 198 136 } << 199 } else if( particleName == "mu+" || 137 pmanager->AddProcess(new G4StepLimiter, << 200 particleName == "mu-" ) { 138 } << 201 //muon 139 else if (particleName == "mu+" || particle << 202 pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1); 140 // muon << 203 pmanager->AddProcess(new G4MuIonisation, -1, 2, 2); 141 pmanager->AddProcess(new G4MuMultipleSca << 204 pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3); 142 pmanager->AddProcess(new G4MuIonisation, << 205 pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4); 143 pmanager->AddProcess(new G4MuBremsstrahl << 206 pmanager->AddProcess(fSync, -1,-1, 5); 144 pmanager->AddProcess(new G4MuPairProduct << 207 pmanager->AddProcess(new G4StepLimiter, -1,-1, 6); 145 pmanager->AddProcess(fSync, -1, -1, 4); << 208 146 pmanager->AddProcess(new G4StepLimiter, << 209 } else if( particleName == "proton") { 147 } << 210 //proton 148 else if (particleName == "proton") { << 211 pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); 149 // proton << 212 pmanager->AddProcess(new G4hIonisation, -1, 2, 2); 150 pmanager->AddProcess(new G4hMultipleScat << 213 pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3); 151 pmanager->AddProcess(new G4hIonisation, << 214 pmanager->AddProcess(new G4hPairProduction, -1, 4, 4); 152 pmanager->AddProcess(new G4hBremsstrahlu << 215 pmanager->AddProcess(fSync, -1,-1, 5); 153 pmanager->AddProcess(new G4hPairProducti << 216 pmanager->AddProcess(new G4StepLimiter, -1,-1, 6); 154 pmanager->AddProcess(fSync, -1, -1, 4); << 217 } 155 pmanager->AddProcess(new G4StepLimiter, << 218 else if (particle->GetPDGCharge() != 0.0 && !particle->IsShortLived()) 156 } << 219 { 157 else if (particle->GetPDGCharge() != 0.0 & << 220 pmanager->AddProcess(fSync,-1,-1, 1); 158 pmanager->AddProcess(fSync, -1, -1, 1); << 159 } 221 } 160 } 222 } 161 } 223 } 162 224 163 //....oooOO0OOooo........oooOO0OOooo........oo 225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 164 226 165 void PhysicsList::SetXrayReflectionRoughness(G << 227 #include "G4Decay.hh" >> 228 >> 229 void PhysicsList::ConstructGeneral() 166 { 230 { 167 G4ProcessTable* theProcessTable = G4ProcessT << 231 // Add Decay Process 168 G4XrayReflection* XrayReflectionProcess = << 232 G4Decay* theDecayProcess = new G4Decay(); 169 (G4XrayReflection*)theProcessTable->FindPr << 233 auto particleIterator=GetParticleIterator(); 170 if (XrayReflectionProcess) << 234 particleIterator->reset(); 171 XrayReflectionProcess->SetSurfaceRoughness << 235 while ((*particleIterator)()){ 172 else << 236 G4ParticleDefinition* particle = particleIterator->value(); 173 G4cout << "Warning. No process XrayReflect << 237 G4ProcessManager* pmanager = particle->GetProcessManager(); 174 "SetXrayReflectionRoughness igno << 238 if (theDecayProcess->IsApplicable(*particle)) { 175 << G4endl; << 239 pmanager ->AddProcess(theDecayProcess); >> 240 // set ordering for PostStepDoIt and AtRestDoIt >> 241 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep); >> 242 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest); >> 243 } >> 244 } 176 } 245 } 177 246 178 //....oooOO0OOooo........oooOO0OOooo........oo 247 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 179 248