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 // Please cite the following paper if you use << 26 // ------------------------------------------------------------------- 27 // Nucl.Instrum.Meth.B260:20-27, 2007 << 27 // $Id: PhysicsList.cc,v 1.4 2008/12/18 12:56:26 gunter Exp $ >> 28 // ------------------------------------------------------------------- 28 29 29 #include "PhysicsList.hh" 30 #include "PhysicsList.hh" 30 #include "G4SystemOfUnits.hh" << 31 31 32 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 33 33 34 PhysicsList::PhysicsList(): G4VUserPhysicsLis 34 PhysicsList::PhysicsList(): G4VUserPhysicsList() 35 { 35 { 36 defaultCutValue = 1*micrometer; 36 defaultCutValue = 1*micrometer; 37 fCutForGamma = defaultCutValue; << 37 cutForGamma = defaultCutValue; 38 fCutForElectron = defaultCutValue; << 38 cutForElectron = defaultCutValue; 39 fCutForPositron = defaultCutValue; << 39 cutForPositron = defaultCutValue; 40 fCutForProton = defaultCutValue; << 40 cutForProton = defaultCutValue; 41 41 42 SetVerboseLevel(1); 42 SetVerboseLevel(1); 43 } 43 } 44 44 45 //....oooOO0OOooo........oooOO0OOooo........oo 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 46 46 47 PhysicsList::~PhysicsList() 47 PhysicsList::~PhysicsList() 48 {} 48 {} 49 49 50 //....oooOO0OOooo........oooOO0OOooo........oo 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 51 51 52 void PhysicsList::ConstructParticle() 52 void PhysicsList::ConstructParticle() 53 { 53 { >> 54 // In this method, static member functions should be called >> 55 // for all particles which you want to use. >> 56 // This ensures that objects of these particle types will be >> 57 // created in the program. >> 58 54 ConstructBosons(); 59 ConstructBosons(); 55 ConstructLeptons(); 60 ConstructLeptons(); 56 ConstructBarions(); 61 ConstructBarions(); 57 } 62 } 58 63 59 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 60 65 61 void PhysicsList::ConstructBosons() 66 void PhysicsList::ConstructBosons() 62 { 67 { >> 68 63 // gamma 69 // gamma 64 G4Gamma::GammaDefinition(); 70 G4Gamma::GammaDefinition(); 65 71 66 // optical photon 72 // optical photon 67 G4OpticalPhoton::OpticalPhotonDefinition(); 73 G4OpticalPhoton::OpticalPhotonDefinition(); 68 } 74 } 69 //....oooOO0OOooo........oooOO0OOooo........o 75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 70 76 71 void PhysicsList::ConstructLeptons() 77 void PhysicsList::ConstructLeptons() 72 { 78 { 73 // leptons 79 // leptons 74 G4Electron::ElectronDefinition(); 80 G4Electron::ElectronDefinition(); 75 G4Positron::PositronDefinition(); 81 G4Positron::PositronDefinition(); 76 } 82 } 77 83 78 //....oooOO0OOooo........oooOO0OOooo........oo 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 79 85 80 void PhysicsList::ConstructBarions() 86 void PhysicsList::ConstructBarions() 81 { 87 { 82 // barions 88 // barions 83 G4Proton::ProtonDefinition(); 89 G4Proton::ProtonDefinition(); 84 G4AntiProton::AntiProtonDefinition(); 90 G4AntiProton::AntiProtonDefinition(); 85 G4GenericIon::GenericIonDefinition(); << 86 } 91 } 87 92 88 //....oooOO0OOooo........oooOO0OOooo........oo 93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 89 94 90 void PhysicsList::ConstructProcess() 95 void PhysicsList::ConstructProcess() 91 { 96 { 92 AddTransportation(); 97 AddTransportation(); 93 ConstructEM(); 98 ConstructEM(); 94 ConstructGeneral(); 99 ConstructGeneral(); 95 } 100 } 96 101 97 //....oooOO0OOooo........oooOO0OOooo........oo 102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 98 103 99 #include "G4PhotoElectricEffect.hh" 104 #include "G4PhotoElectricEffect.hh" 100 #include "G4ComptonScattering.hh" 105 #include "G4ComptonScattering.hh" 101 #include "G4GammaConversion.hh" 106 #include "G4GammaConversion.hh" 102 107 103 #include "G4eMultipleScattering.hh" << 108 #include "G4MultipleScattering.hh" 104 #include "G4eIonisation.hh" 109 #include "G4eIonisation.hh" 105 #include "G4eBremsstrahlung.hh" 110 #include "G4eBremsstrahlung.hh" 106 #include "G4eplusAnnihilation.hh" 111 #include "G4eplusAnnihilation.hh" 107 112 108 #include "G4MuMultipleScattering.hh" << 109 #include "G4WentzelVIModel.hh" << 110 << 111 #include "G4MuIonisation.hh" 113 #include "G4MuIonisation.hh" 112 #include "G4MuBremsstrahlung.hh" 114 #include "G4MuBremsstrahlung.hh" 113 #include "G4MuPairProduction.hh" 115 #include "G4MuPairProduction.hh" 114 #include "G4CoulombScattering.hh" << 115 116 116 #include "G4hMultipleScattering.hh" 117 #include "G4hMultipleScattering.hh" 117 #include "G4ionIonisation.hh" 118 #include "G4ionIonisation.hh" 118 #include "G4hIonisation.hh" 119 #include "G4hIonisation.hh" 119 #include "G4hBremsstrahlung.hh" << 120 #include "G4hPairProduction.hh" << 121 120 122 #include "G4StepLimiter.hh" 121 #include "G4StepLimiter.hh" 123 122 124 //....oooOO0OOooo........oooOO0OOooo........oo 123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 125 124 126 void PhysicsList::ConstructEM() 125 void PhysicsList::ConstructEM() 127 { 126 { 128 127 129 G4PhysicsListHelper* ph = G4PhysicsListHelpe << 128 theParticleIterator->reset(); 130 << 131 // ******************************************* << 132 // Identical to G4EmStandardPhysics but added << 133 // ******************************************* << 134 129 >> 130 while( (*theParticleIterator)() ){ 135 131 136 auto particleIterator=GetParticleIterator(); << 132 G4ParticleDefinition* particle = theParticleIterator->value(); 137 particleIterator->reset(); << 133 G4ProcessManager* pmanager = particle->GetProcessManager(); 138 << 139 while( (*particleIterator)() ){ << 140 << 141 G4ParticleDefinition* particle = particleI << 142 << 143 G4String particleName = particle->GetParti 134 G4String particleName = particle->GetParticleName(); 144 135 145 if (particleName == "gamma") { 136 if (particleName == "gamma") { 146 137 147 ph->RegisterProcess(new G4PhotoElectricE << 138 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect); 148 ph->RegisterProcess(new G4ComptonScatter << 139 pmanager->AddDiscreteProcess(new G4ComptonScattering); 149 ph->RegisterProcess(new G4GammaConversio << 140 pmanager->AddDiscreteProcess(new G4GammaConversion); 150 141 151 } else if (particleName == "e-") { 142 } else if (particleName == "e-") { 152 143 153 ph->RegisterProcess(new G4eMultipleScatt << 144 pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1); 154 ph->RegisterProcess(new G4eIonisation(), << 145 pmanager->AddProcess(new G4eIonisation, -1, 2, 2); 155 ph->RegisterProcess(new G4eBremsstrahlun << 146 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3); 156 147 157 } else if (particleName == "e+") { 148 } else if (particleName == "e+") { 158 149 159 ph->RegisterProcess(new G4eMultipleScatt << 150 pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1); 160 ph->RegisterProcess(new G4eIonisation(), << 151 pmanager->AddProcess(new G4eIonisation, -1, 2, 2); 161 ph->RegisterProcess(new G4eBremsstrahlun << 152 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3); 162 ph->RegisterProcess(new G4eplusAnnihilat << 153 pmanager->AddProcess(new G4eplusAnnihilation, 0,-1, 4); 163 154 164 } else if( particleName == "mu+" || 155 } else if( particleName == "mu+" || 165 particleName == "mu-" ) { 156 particleName == "mu-" ) { 166 157 167 G4MuMultipleScattering* msc = new G4MuMu << 158 pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1); 168 msc->AddEmModel(0, new G4WentzelVIModel( << 159 pmanager->AddProcess(new G4MuIonisation, -1, 2, 2); 169 << 160 pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3); 170 ph->RegisterProcess(msc, particle); << 161 pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4); 171 ph->RegisterProcess(new G4MuIonisation() << 172 ph->RegisterProcess(new G4MuBremsstrahlu << 173 ph->RegisterProcess(new G4MuPairProducti << 174 ph->RegisterProcess(new G4CoulombScatter << 175 162 176 } else if (particleName == "alpha" || 163 } else if (particleName == "alpha" || 177 particleName == "He3") { << 164 particleName == "He3" || 178 << 165 particleName == "GenericIon") { 179 ph->RegisterProcess(new G4hMultipleScatt << 166 // ions with charge >= +2 180 ph->RegisterProcess(new G4ionIonisation( << 167 pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1); 181 << 168 pmanager->AddProcess(new G4ionIonisation, -1, 2, 2); 182 } else if (particleName == "GenericIon") { << 183 << 184 ph->RegisterProcess(new G4hMultipleScatt << 185 ph->RegisterProcess(new G4ionIonisation( << 186 169 187 } else if (particleName == "proton") { << 170 } else if ((!particle->IsShortLived()) && 188 ph->RegisterProcess(new G4hMultipleScatt << 171 (particle->GetPDGCharge() != 0.0) && 189 ph->RegisterProcess(new G4hIonisation(), << 172 (particle->GetParticleName() != "chargedgeantino")) { 190 ph->RegisterProcess(new G4hBremsstrahlun << 173 //all others charged particles except geantino and short-lived 191 ph->RegisterProcess(new G4hPairProductio << 174 pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1); >> 175 pmanager->AddProcess(new G4hIonisation, -1, 2, 2); 192 176 193 ph->RegisterProcess(new G4StepLimiter(), << 177 pmanager->AddProcess(new G4StepLimiter(),-1,-1,3); 194 178 195 } 179 } 196 } 180 } 197 } 181 } 198 182 199 //....oooOO0OOooo........oooOO0OOooo........oo 183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 200 184 201 void PhysicsList::ConstructGeneral() 185 void PhysicsList::ConstructGeneral() 202 { } 186 { } 203 187 204 //....oooOO0OOooo........oooOO0OOooo........oo 188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 205 189 206 void PhysicsList::SetCuts() 190 void PhysicsList::SetCuts() 207 { 191 { 208 if (verboseLevel >0){ 192 if (verboseLevel >0){ 209 G4cout << "PhysicsList::SetCuts:"; 193 G4cout << "PhysicsList::SetCuts:"; 210 G4cout << "CutLength : " << G4BestUnit(def 194 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 211 } 195 } 212 196 213 SetCutValue(fCutForGamma, "gamma"); << 197 // set cut values for gamma at first and for e- second and next for e+, 214 SetCutValue(fCutForElectron, "e-"); << 198 // because some processes for e+/e- need cut values for gamma 215 SetCutValue(fCutForPositron, "e+"); << 199 SetCutValue(cutForGamma, "gamma"); 216 SetCutValue(fCutForProton, "proton"); << 200 SetCutValue(cutForElectron, "e-"); 217 SetCutValue(fCutForProton, "anti_proton"); << 201 SetCutValue(cutForPositron, "e+"); >> 202 >> 203 // set cut values for proton and anti_proton before all other hadrons >> 204 // because some processes for hadrons need cut values for proton/anti_proton >> 205 SetCutValue(cutForProton, "proton"); >> 206 SetCutValue(cutForProton, "anti_proton"); >> 207 >> 208 //SetCutValueForOthers(defaultCutValue); 218 209 219 if (verboseLevel>0) DumpCutValuesTable(); 210 if (verboseLevel>0) DumpCutValuesTable(); 220 } 211 } 221 212 222 //....oooOO0OOooo........oooOO0OOooo........oo 213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 223 214 >> 215 void PhysicsList::SetGammaLowLimit(G4double lowcut) >> 216 { >> 217 if (verboseLevel >0){ >> 218 G4cout << "PhysicsList::SetCuts:"; >> 219 G4cout << "Gamma cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; >> 220 } >> 221 >> 222 // G4Gamma::SetEnergyRange(lowcut,1e5); >> 223 SetGELowLimit(lowcut); >> 224 } >> 225 >> 226 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 227 >> 228 void PhysicsList::SetElectronLowLimit(G4double lowcut) >> 229 { >> 230 if (verboseLevel >0){ >> 231 >> 232 G4cout << "PhysicsList::SetCuts:"; >> 233 G4cout << "Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; >> 234 } >> 235 >> 236 // G4Electron::SetEnergyRange(lowcut,1e5); >> 237 SetGELowLimit(lowcut); >> 238 } >> 239 >> 240 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 241 >> 242 void PhysicsList::SetPositronLowLimit(G4double lowcut) >> 243 { >> 244 if (verboseLevel >0){ >> 245 >> 246 G4cout << "PhysicsList::SetCuts:"; >> 247 G4cout << "Positron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; >> 248 } >> 249 >> 250 G4cerr << "PhysicsList::SetPositronLowLimit: Not currently able to set Positron LowLimit." << G4endl; >> 251 G4Exception("Positron Low Limit: not implemented in PhysicsList"); >> 252 } >> 253 >> 254 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 255 >> 256 void PhysicsList::SetProtonLowLimit(G4double lowcut) >> 257 { >> 258 if (verboseLevel >0){ >> 259 >> 260 G4cout << "PhysicsList::SetCuts:"; >> 261 G4cout << "Proton cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; >> 262 } >> 263 >> 264 G4cerr << "PhysicsList::SetProtonLowLimit: Not currently able to set Proton LowLimit." << G4endl; >> 265 G4Exception("Proton Low Limit: not implemented in PhysicsList"); >> 266 } >> 267 >> 268 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 269 >> 270 void PhysicsList::SetGEPLowLimit(G4double lowcut) >> 271 { >> 272 if (verboseLevel >0){ >> 273 G4cout << "PhysicsList::SetGEPLowLimit:"; >> 274 G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; >> 275 } >> 276 >> 277 this->SetGELowLimit(lowcut); >> 278 >> 279 G4cerr << " SetGEPLowLimit : Uncertain whether setting Positron low limit " << G4endl; >> 280 } >> 281 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 282 >> 283 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 284 void PhysicsList::SetGELowLimit(G4double lowcut) >> 285 { >> 286 if (verboseLevel >0){ >> 287 G4cout << "PhysicsList::SetGELowLimit:"; >> 288 G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; >> 289 } >> 290 >> 291 G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowcut,1e5); >> 292 } 224 void PhysicsList::SetGammaCut(G4double val) 293 void PhysicsList::SetGammaCut(G4double val) 225 { 294 { 226 fCutForGamma = val; << 295 ResetCuts(); >> 296 cutForGamma = val; 227 } 297 } 228 298 229 //....oooOO0OOooo........oooOO0OOooo........oo 299 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 230 300 231 void PhysicsList::SetElectronCut(G4double val) 301 void PhysicsList::SetElectronCut(G4double val) 232 { 302 { 233 fCutForElectron = val; << 303 // ResetCuts(); >> 304 cutForElectron = val; 234 } 305 } 235 306 236 //....oooOO0OOooo........oooOO0OOooo........oo 307 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 237 308 238 void PhysicsList::SetPositronCut(G4double val) 309 void PhysicsList::SetPositronCut(G4double val) 239 { 310 { 240 fCutForPositron = val; << 311 // ResetCuts(); >> 312 cutForPositron = val; 241 } 313 } 242 314 243 //....oooOO0OOooo........oooOO0OOooo........oo 315 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 244 316 245 void PhysicsList::SetProtonCut(G4double val) 317 void PhysicsList::SetProtonCut(G4double val) 246 { 318 { 247 fCutForProton = val; << 319 //ResetCuts(); >> 320 cutForProton = val; 248 } 321 } >> 322 >> 323 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 249 324