[807] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // ********************************************************************** |
---|
| 28 | // * * |
---|
| 29 | // * GEANT 4 xray_telescope advanced example * |
---|
| 30 | // * * |
---|
| 31 | // * MODULE: XrayTelPhysicsList.cc * |
---|
| 32 | // * ------- * |
---|
| 33 | // * * |
---|
| 34 | // * Version: 0.4 * |
---|
| 35 | // * Date: 06/11/00 * |
---|
| 36 | // * Author: R Nartallo * |
---|
| 37 | // * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands * |
---|
| 38 | // * * |
---|
| 39 | // ********************************************************************** |
---|
| 40 | // |
---|
| 41 | // CHANGE HISTORY |
---|
| 42 | // -------------- |
---|
| 43 | // |
---|
| 44 | // 06.11.2000 R.Nartallo |
---|
| 45 | // - First implementation of xray_telescope Physics list |
---|
| 46 | // - Based on Chandra and XMM models |
---|
| 47 | // |
---|
| 48 | // |
---|
| 49 | // ********************************************************************** |
---|
| 50 | |
---|
| 51 | #include "G4ParticleDefinition.hh" |
---|
| 52 | #include "G4ParticleWithCuts.hh" |
---|
| 53 | #include "G4ProcessManager.hh" |
---|
| 54 | #include "G4ProcessVector.hh" |
---|
| 55 | #include "G4ParticleTypes.hh" |
---|
| 56 | #include "G4ParticleTable.hh" |
---|
| 57 | #include "G4ShortLivedConstructor.hh" |
---|
| 58 | #include "G4Material.hh" |
---|
| 59 | #include "G4MaterialTable.hh" |
---|
| 60 | #include "G4ios.hh" |
---|
[1337] | 61 | // Hadrons |
---|
| 62 | #include "G4MesonConstructor.hh" |
---|
| 63 | #include "G4BaryonConstructor.hh" |
---|
| 64 | #include "G4IonConstructor.hh" |
---|
[807] | 65 | |
---|
| 66 | #include "globals.hh" |
---|
| 67 | |
---|
| 68 | #include "XrayTelPhysicsList.hh" |
---|
| 69 | |
---|
| 70 | XrayTelPhysicsList::XrayTelPhysicsList(): G4VUserPhysicsList() |
---|
| 71 | { |
---|
| 72 | // Default cut values |
---|
| 73 | defaultCutValue = 2.0*mm; |
---|
[1337] | 74 | cutForGamma = 1.0*m; |
---|
| 75 | cutForElectron = 1.0*m; |
---|
[807] | 76 | |
---|
| 77 | SetVerboseLevel(1); |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | XrayTelPhysicsList::~XrayTelPhysicsList() |
---|
| 81 | {} |
---|
| 82 | |
---|
| 83 | void XrayTelPhysicsList::ConstructParticle() |
---|
| 84 | { |
---|
| 85 | // Here are constructed all particles |
---|
| 86 | ConstructBosons(); |
---|
| 87 | ConstructLeptons(); |
---|
| 88 | ConstructMesons(); |
---|
| 89 | ConstructBaryons(); |
---|
[1337] | 90 | ConstructIons(); |
---|
[807] | 91 | ConstructAllShortLiveds(); |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | // In this method, static member functions should be called for ALL particles to be used. |
---|
| 95 | |
---|
| 96 | void XrayTelPhysicsList::ConstructBosons() |
---|
| 97 | { |
---|
| 98 | // pseudo-particles |
---|
| 99 | G4Geantino::GeantinoDefinition(); |
---|
| 100 | G4ChargedGeantino::ChargedGeantinoDefinition(); |
---|
| 101 | |
---|
| 102 | // gamma |
---|
| 103 | G4Gamma::GammaDefinition(); |
---|
| 104 | |
---|
| 105 | // optical photon |
---|
| 106 | G4OpticalPhoton::OpticalPhotonDefinition(); |
---|
| 107 | } |
---|
| 108 | void XrayTelPhysicsList::ConstructLeptons() |
---|
| 109 | { |
---|
| 110 | // leptons |
---|
| 111 | G4Electron::ElectronDefinition(); |
---|
| 112 | G4Positron::PositronDefinition(); |
---|
| 113 | |
---|
| 114 | G4NeutrinoE::NeutrinoEDefinition(); |
---|
| 115 | G4AntiNeutrinoE::AntiNeutrinoEDefinition(); |
---|
| 116 | G4NeutrinoMu::NeutrinoMuDefinition(); |
---|
| 117 | G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); |
---|
| 118 | } |
---|
| 119 | void XrayTelPhysicsList::ConstructMesons() |
---|
| 120 | { |
---|
[1337] | 121 | // mesons |
---|
| 122 | G4MesonConstructor mConstructor; |
---|
| 123 | mConstructor.ConstructParticle(); |
---|
[807] | 124 | } |
---|
| 125 | void XrayTelPhysicsList::ConstructBaryons() |
---|
| 126 | { |
---|
| 127 | // barions |
---|
[1337] | 128 | G4BaryonConstructor bConstructor; |
---|
| 129 | bConstructor.ConstructParticle(); |
---|
[807] | 130 | } |
---|
[1337] | 131 | void XrayTelPhysicsList::ConstructIons() |
---|
| 132 | { |
---|
| 133 | // ions |
---|
| 134 | G4IonConstructor iConstructor; |
---|
| 135 | iConstructor.ConstructParticle(); |
---|
| 136 | } |
---|
[807] | 137 | void XrayTelPhysicsList::ConstructAllShortLiveds() |
---|
| 138 | { |
---|
| 139 | } |
---|
| 140 | void XrayTelPhysicsList::ConstructProcess() |
---|
| 141 | { |
---|
| 142 | // Transportation, electromagnetic and general processes |
---|
| 143 | AddTransportation(); |
---|
| 144 | ConstructEM(); |
---|
| 145 | ConstructGeneral(); |
---|
| 146 | } |
---|
| 147 | |
---|
| 148 | // Here are respective header files for chosen processes |
---|
| 149 | |
---|
| 150 | #include "G4ComptonScattering.hh" |
---|
| 151 | #include "G4GammaConversion.hh" |
---|
| 152 | #include "G4PhotoElectricEffect.hh" |
---|
[1337] | 153 | |
---|
| 154 | #include "G4eMultipleScattering.hh" |
---|
| 155 | #include "G4hMultipleScattering.hh" |
---|
| 156 | |
---|
[807] | 157 | #include "G4eIonisation.hh" |
---|
| 158 | #include "G4eBremsstrahlung.hh" |
---|
| 159 | #include "G4eplusAnnihilation.hh" |
---|
| 160 | |
---|
[1337] | 161 | #include "G4MuIonisation.hh" |
---|
| 162 | #include "G4MuBremsstrahlung.hh" |
---|
| 163 | #include "G4MuPairProduction.hh" |
---|
| 164 | |
---|
| 165 | #include "G4hIonisation.hh" |
---|
| 166 | #include "G4hBremsstrahlung.hh" |
---|
| 167 | #include "G4hPairProduction.hh" |
---|
| 168 | |
---|
| 169 | #include "G4ionIonisation.hh" |
---|
| 170 | |
---|
[807] | 171 | void XrayTelPhysicsList::ConstructEM() |
---|
| 172 | { |
---|
| 173 | theParticleIterator->reset(); |
---|
| 174 | |
---|
| 175 | while( (*theParticleIterator)() ) |
---|
| 176 | { |
---|
| 177 | G4ParticleDefinition* particle = theParticleIterator->value(); |
---|
| 178 | G4ProcessManager* pmanager = particle->GetProcessManager(); |
---|
| 179 | G4String particleName = particle->GetParticleName(); |
---|
| 180 | |
---|
| 181 | if (particleName == "gamma") |
---|
| 182 | { |
---|
| 183 | //gamma |
---|
| 184 | pmanager->AddDiscreteProcess(new G4PhotoElectricEffect()); |
---|
| 185 | pmanager->AddDiscreteProcess(new G4ComptonScattering()); |
---|
| 186 | pmanager->AddDiscreteProcess(new G4GammaConversion()); |
---|
| 187 | } |
---|
| 188 | else if (particleName == "e-") |
---|
| 189 | { |
---|
| 190 | //electron |
---|
[1337] | 191 | pmanager->AddProcess(new G4eMultipleScattering(),-1, 1,1); |
---|
[807] | 192 | pmanager->AddProcess(new G4eIonisation(), -1, 2,2); |
---|
[1337] | 193 | pmanager->AddProcess(new G4eBremsstrahlung(), -1, 3,3); |
---|
| 194 | |
---|
| 195 | } else if (particleName == "e+") { |
---|
| 196 | |
---|
[807] | 197 | //positron |
---|
[1337] | 198 | pmanager->AddProcess(new G4eMultipleScattering(),-1, 1,1); |
---|
[807] | 199 | pmanager->AddProcess(new G4eIonisation(), -1, 2,2); |
---|
[1337] | 200 | pmanager->AddProcess(new G4eBremsstrahlung(), -1, 3,3); |
---|
[807] | 201 | pmanager->AddProcess(new G4eplusAnnihilation(), 0,-1,4); |
---|
[1337] | 202 | |
---|
| 203 | } else if( particleName == "mu-" || |
---|
| 204 | particleName == "mu+" ) { |
---|
| 205 | |
---|
| 206 | //muon |
---|
| 207 | pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); |
---|
| 208 | pmanager->AddProcess(new G4MuIonisation, -1, 2, 2); |
---|
| 209 | pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3); |
---|
| 210 | pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4); |
---|
| 211 | |
---|
| 212 | } else if( particleName == "pi-" || |
---|
| 213 | particleName == "pi+" ) { |
---|
| 214 | |
---|
| 215 | //pions |
---|
| 216 | pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); |
---|
| 217 | pmanager->AddProcess(new G4hIonisation, -1, 2, 2); |
---|
| 218 | pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3); |
---|
| 219 | pmanager->AddProcess(new G4hPairProduction, -1, 4, 4); |
---|
| 220 | |
---|
| 221 | } else if( particleName == "proton" ) { |
---|
| 222 | |
---|
| 223 | //proton |
---|
| 224 | pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); |
---|
| 225 | pmanager->AddProcess(new G4hIonisation, -1, 2, 2); |
---|
| 226 | pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3); |
---|
| 227 | pmanager->AddProcess(new G4hPairProduction, -1, 4, 4); |
---|
| 228 | |
---|
| 229 | } else if( particleName == "alpha" || |
---|
| 230 | particleName == "He3" || |
---|
| 231 | particleName == "GenericIon" ) { |
---|
| 232 | |
---|
| 233 | //Ions |
---|
| 234 | pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); |
---|
| 235 | pmanager->AddProcess(new G4ionIonisation, -1, 2, 2); |
---|
| 236 | |
---|
| 237 | } else if ((!particle->IsShortLived()) && |
---|
[807] | 238 | (particle->GetPDGCharge() != 0.0) && |
---|
[1337] | 239 | (particle->GetParticleName() != "chargedgeantino")) { |
---|
| 240 | |
---|
[807] | 241 | //all others charged particles except geantino |
---|
[1337] | 242 | pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); |
---|
| 243 | pmanager->AddProcess(new G4hIonisation, -1, 2, 2); |
---|
[807] | 244 | |
---|
| 245 | } |
---|
| 246 | } |
---|
| 247 | } |
---|
| 248 | |
---|
| 249 | #include "G4Decay.hh" |
---|
| 250 | |
---|
| 251 | void XrayTelPhysicsList::ConstructGeneral() |
---|
| 252 | { |
---|
| 253 | G4Decay* theDecayProcess = new G4Decay(); |
---|
| 254 | theParticleIterator->reset(); |
---|
| 255 | while( (*theParticleIterator)() ){ |
---|
| 256 | G4ParticleDefinition* particle = theParticleIterator->value(); |
---|
| 257 | G4ProcessManager* pmanager = particle->GetProcessManager(); |
---|
| 258 | if (theDecayProcess->IsApplicable(*particle)) { |
---|
| 259 | pmanager ->AddProcess(theDecayProcess); |
---|
| 260 | pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep); |
---|
| 261 | pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest); |
---|
| 262 | } |
---|
| 263 | } |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | void XrayTelPhysicsList::SetCuts() |
---|
| 267 | { |
---|
| 268 | // defaultCutValue you have typed in is used |
---|
| 269 | |
---|
| 270 | if (verboseLevel >1){ |
---|
| 271 | G4cout << "XrayTelPhysicsList::SetCuts:" << G4endl; |
---|
| 272 | } |
---|
| 273 | |
---|
| 274 | // set cut values for gamma at first and for e- second |
---|
| 275 | SetCutValue(cutForGamma, "gamma"); |
---|
| 276 | SetCutValue(cutForElectron, "e-"); |
---|
| 277 | SetCutValue(cutForElectron, "e+"); |
---|
| 278 | |
---|
| 279 | // SetCutValueForOthers(defaultCutValue); |
---|
| 280 | |
---|
| 281 | if (verboseLevel >1) { |
---|
| 282 | DumpCutValuesTable(); |
---|
| 283 | } |
---|
| 284 | } |
---|
| 285 | |
---|
| 286 | void XrayTelPhysicsList::SetCutForGamma(G4double cut) |
---|
| 287 | { |
---|
| 288 | ResetCuts(); |
---|
| 289 | cutForGamma = cut; |
---|
| 290 | } |
---|
| 291 | |
---|
| 292 | void XrayTelPhysicsList::SetCutForElectron(G4double cut) |
---|
| 293 | { |
---|
| 294 | ResetCuts(); |
---|
| 295 | cutForElectron = cut; |
---|
| 296 | } |
---|
| 297 | |
---|
| 298 | G4double XrayTelPhysicsList::GetCutForGamma() const |
---|
| 299 | { |
---|
| 300 | return cutForGamma; |
---|
| 301 | } |
---|
| 302 | |
---|
| 303 | G4double XrayTelPhysicsList::GetCutForElectron() const |
---|
| 304 | { |
---|
| 305 | return cutForElectron; |
---|
| 306 | } |
---|
| 307 | |
---|
| 308 | |
---|
| 309 | |
---|
| 310 | |
---|
| 311 | |
---|