| 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"
|
|---|
| 61 |
|
|---|
| 62 | #include "globals.hh"
|
|---|
| 63 |
|
|---|
| 64 | #include "XrayTelPhysicsList.hh"
|
|---|
| 65 |
|
|---|
| 66 | XrayTelPhysicsList::XrayTelPhysicsList(): G4VUserPhysicsList()
|
|---|
| 67 | {
|
|---|
| 68 | // Default cut values
|
|---|
| 69 | defaultCutValue = 2.0*mm;
|
|---|
| 70 | cutForGamma = 1.0*micrometer;
|
|---|
| 71 | cutForElectron = 1.0*micrometer;
|
|---|
| 72 | cutForProton = 1.0*micrometer;
|
|---|
| 73 |
|
|---|
| 74 | SetVerboseLevel(1);
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | XrayTelPhysicsList::~XrayTelPhysicsList()
|
|---|
| 78 | {}
|
|---|
| 79 |
|
|---|
| 80 | void XrayTelPhysicsList::ConstructParticle()
|
|---|
| 81 | {
|
|---|
| 82 | // Here are constructed all particles
|
|---|
| 83 | ConstructBosons();
|
|---|
| 84 | ConstructLeptons();
|
|---|
| 85 | ConstructMesons();
|
|---|
| 86 | ConstructBaryons();
|
|---|
| 87 | ConstructAllShortLiveds();
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | // In this method, static member functions should be called for ALL particles to be used.
|
|---|
| 91 |
|
|---|
| 92 | void XrayTelPhysicsList::ConstructBosons()
|
|---|
| 93 | {
|
|---|
| 94 | // pseudo-particles
|
|---|
| 95 | G4Geantino::GeantinoDefinition();
|
|---|
| 96 | G4ChargedGeantino::ChargedGeantinoDefinition();
|
|---|
| 97 |
|
|---|
| 98 | // gamma
|
|---|
| 99 | G4Gamma::GammaDefinition();
|
|---|
| 100 |
|
|---|
| 101 | // optical photon
|
|---|
| 102 | G4OpticalPhoton::OpticalPhotonDefinition();
|
|---|
| 103 | }
|
|---|
| 104 | void XrayTelPhysicsList::ConstructLeptons()
|
|---|
| 105 | {
|
|---|
| 106 | // leptons
|
|---|
| 107 | G4Electron::ElectronDefinition();
|
|---|
| 108 | G4Positron::PositronDefinition();
|
|---|
| 109 |
|
|---|
| 110 | G4NeutrinoE::NeutrinoEDefinition();
|
|---|
| 111 | G4AntiNeutrinoE::AntiNeutrinoEDefinition();
|
|---|
| 112 | G4NeutrinoMu::NeutrinoMuDefinition();
|
|---|
| 113 | G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
|
|---|
| 114 | }
|
|---|
| 115 | void XrayTelPhysicsList::ConstructMesons()
|
|---|
| 116 | {
|
|---|
| 117 | }
|
|---|
| 118 | void XrayTelPhysicsList::ConstructBaryons()
|
|---|
| 119 | {
|
|---|
| 120 | // barions
|
|---|
| 121 | G4Proton::ProtonDefinition();
|
|---|
| 122 | G4AntiProton::AntiProtonDefinition();
|
|---|
| 123 | G4Neutron::NeutronDefinition();
|
|---|
| 124 | G4AntiNeutron::AntiNeutronDefinition();
|
|---|
| 125 | }
|
|---|
| 126 | void XrayTelPhysicsList::ConstructAllShortLiveds()
|
|---|
| 127 | {
|
|---|
| 128 | }
|
|---|
| 129 | void XrayTelPhysicsList::ConstructProcess()
|
|---|
| 130 | {
|
|---|
| 131 | // Transportation, electromagnetic and general processes
|
|---|
| 132 | AddTransportation();
|
|---|
| 133 | ConstructEM();
|
|---|
| 134 | ConstructGeneral();
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | // Here are respective header files for chosen processes
|
|---|
| 138 |
|
|---|
| 139 | #include "G4ComptonScattering.hh"
|
|---|
| 140 | #include "G4GammaConversion.hh"
|
|---|
| 141 | #include "G4PhotoElectricEffect.hh"
|
|---|
| 142 | #include "G4eIonisation.hh"
|
|---|
| 143 | #include "G4eBremsstrahlung.hh"
|
|---|
| 144 | #include "G4eplusAnnihilation.hh"
|
|---|
| 145 | #include "G4MultipleScattering.hh"
|
|---|
| 146 | #include "G4hLowEnergyIonisation.hh"
|
|---|
| 147 |
|
|---|
| 148 | void XrayTelPhysicsList::ConstructEM()
|
|---|
| 149 | {
|
|---|
| 150 | theParticleIterator->reset();
|
|---|
| 151 |
|
|---|
| 152 | while( (*theParticleIterator)() )
|
|---|
| 153 | {
|
|---|
| 154 | G4ParticleDefinition* particle = theParticleIterator->value();
|
|---|
| 155 | G4ProcessManager* pmanager = particle->GetProcessManager();
|
|---|
| 156 | G4String particleName = particle->GetParticleName();
|
|---|
| 157 |
|
|---|
| 158 | if (particleName == "gamma")
|
|---|
| 159 | {
|
|---|
| 160 | //gamma
|
|---|
| 161 | pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
|
|---|
| 162 | pmanager->AddDiscreteProcess(new G4ComptonScattering());
|
|---|
| 163 | pmanager->AddDiscreteProcess(new G4GammaConversion());
|
|---|
| 164 | }
|
|---|
| 165 | else if (particleName == "e-")
|
|---|
| 166 | {
|
|---|
| 167 | //electron
|
|---|
| 168 | pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
|
|---|
| 169 | pmanager->AddProcess(new G4eIonisation(), -1, 2,2);
|
|---|
| 170 | pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);
|
|---|
| 171 | }
|
|---|
| 172 | else if (particleName == "e+")
|
|---|
| 173 | {
|
|---|
| 174 | //positron
|
|---|
| 175 | pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
|
|---|
| 176 | pmanager->AddProcess(new G4eIonisation(), -1, 2,2);
|
|---|
| 177 | pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);
|
|---|
| 178 | pmanager->AddProcess(new G4eplusAnnihilation(), 0,-1,4);
|
|---|
| 179 | }
|
|---|
| 180 | else if ((!particle->IsShortLived()) &&
|
|---|
| 181 | (particle->GetPDGCharge() != 0.0) &&
|
|---|
| 182 | (particle->GetParticleName() != "chargedgeantino"))
|
|---|
| 183 | {
|
|---|
| 184 | //all others charged particles except geantino
|
|---|
| 185 | pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
|
|---|
| 186 |
|
|---|
| 187 | G4double demax = 0.05; // try to lose at most 5% of the energy in
|
|---|
| 188 | // a single step (in limit of large energies)
|
|---|
| 189 | G4double stmin = 1.e-9 * m; // length of the final step: 10 angstrom
|
|---|
| 190 | // reproduced angular distribution of TRIM
|
|---|
| 191 |
|
|---|
| 192 | G4hLowEnergyIonisation* lowEIonisation = new G4hLowEnergyIonisation();
|
|---|
| 193 | pmanager->AddProcess( lowEIonisation, -1,2,2);
|
|---|
| 194 | lowEIonisation->SetStepFunction( demax, stmin );
|
|---|
| 195 | }
|
|---|
| 196 | }
|
|---|
| 197 | }
|
|---|
| 198 |
|
|---|
| 199 | #include "G4Decay.hh"
|
|---|
| 200 |
|
|---|
| 201 | void XrayTelPhysicsList::ConstructGeneral()
|
|---|
| 202 | {
|
|---|
| 203 | G4Decay* theDecayProcess = new G4Decay();
|
|---|
| 204 | theParticleIterator->reset();
|
|---|
| 205 | while( (*theParticleIterator)() ){
|
|---|
| 206 | G4ParticleDefinition* particle = theParticleIterator->value();
|
|---|
| 207 | G4ProcessManager* pmanager = particle->GetProcessManager();
|
|---|
| 208 | if (theDecayProcess->IsApplicable(*particle)) {
|
|---|
| 209 | pmanager ->AddProcess(theDecayProcess);
|
|---|
| 210 | pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
|
|---|
| 211 | pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
|
|---|
| 212 | }
|
|---|
| 213 | }
|
|---|
| 214 | }
|
|---|
| 215 |
|
|---|
| 216 | void XrayTelPhysicsList::SetCuts()
|
|---|
| 217 | {
|
|---|
| 218 | // defaultCutValue you have typed in is used
|
|---|
| 219 |
|
|---|
| 220 | if (verboseLevel >1){
|
|---|
| 221 | G4cout << "XrayTelPhysicsList::SetCuts:" << G4endl;
|
|---|
| 222 | }
|
|---|
| 223 |
|
|---|
| 224 | // set cut values for gamma at first and for e- second
|
|---|
| 225 | SetCutValue(cutForGamma, "gamma");
|
|---|
| 226 | SetCutValue(cutForElectron, "e-");
|
|---|
| 227 | SetCutValue(cutForElectron, "e+");
|
|---|
| 228 |
|
|---|
| 229 | // set cut values for proton
|
|---|
| 230 | SetCutValue(cutForProton, "proton");
|
|---|
| 231 | SetCutValue(cutForProton, "anti_proton");
|
|---|
| 232 |
|
|---|
| 233 | // SetCutValueForOthers(defaultCutValue);
|
|---|
| 234 |
|
|---|
| 235 | if (verboseLevel >1) {
|
|---|
| 236 | DumpCutValuesTable();
|
|---|
| 237 | }
|
|---|
| 238 | }
|
|---|
| 239 |
|
|---|
| 240 | void XrayTelPhysicsList::SetCutForGamma(G4double cut)
|
|---|
| 241 | {
|
|---|
| 242 | ResetCuts();
|
|---|
| 243 | cutForGamma = cut;
|
|---|
| 244 | }
|
|---|
| 245 |
|
|---|
| 246 | void XrayTelPhysicsList::SetCutForElectron(G4double cut)
|
|---|
| 247 | {
|
|---|
| 248 | ResetCuts();
|
|---|
| 249 | cutForElectron = cut;
|
|---|
| 250 | }
|
|---|
| 251 |
|
|---|
| 252 | void XrayTelPhysicsList::SetCutForProton(G4double cut)
|
|---|
| 253 | {
|
|---|
| 254 | ResetCuts();
|
|---|
| 255 | cutForProton = cut;
|
|---|
| 256 | }
|
|---|
| 257 |
|
|---|
| 258 | G4double XrayTelPhysicsList::GetCutForGamma() const
|
|---|
| 259 | {
|
|---|
| 260 | return cutForGamma;
|
|---|
| 261 | }
|
|---|
| 262 |
|
|---|
| 263 | G4double XrayTelPhysicsList::GetCutForElectron() const
|
|---|
| 264 | {
|
|---|
| 265 | return cutForElectron;
|
|---|
| 266 | }
|
|---|
| 267 |
|
|---|
| 268 | G4double XrayTelPhysicsList::GetCutForProton() const
|
|---|
| 269 | {
|
|---|
| 270 | return cutForProton;
|
|---|
| 271 | }
|
|---|
| 272 |
|
|---|
| 273 |
|
|---|
| 274 |
|
|---|
| 275 |
|
|---|
| 276 |
|
|---|