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 // 26 // 27 // ******************************************* 27 // ********************************************************************** 28 // * 28 // * * 29 // * GEANT 4 xray_telescope 29 // * GEANT 4 xray_telescope advanced example * 30 // * 30 // * * 31 // * MODULE: XrayTelPhysicsList.cc 31 // * MODULE: XrayTelPhysicsList.cc * 32 // * ------- 32 // * ------- * 33 // * 33 // * * 34 // * Version: 0.4 34 // * Version: 0.4 * 35 // * Date: 06/11/00 35 // * Date: 06/11/00 * 36 // * Author: R Nartallo 36 // * Author: R Nartallo * 37 // * Organisation: ESA/ESTEC, Noordwijk, 37 // * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands * 38 // * 38 // * * 39 // ******************************************* 39 // ********************************************************************** 40 // 40 // 41 // CHANGE HISTORY 41 // CHANGE HISTORY 42 // -------------- 42 // -------------- 43 // 43 // 44 // 06.11.2000 R.Nartallo 44 // 06.11.2000 R.Nartallo 45 // - First implementation of xray_telescope Ph 45 // - First implementation of xray_telescope Physics list 46 // - Based on Chandra and XMM models 46 // - Based on Chandra and XMM models 47 // 47 // 48 // 48 // 49 // ******************************************* 49 // ********************************************************************** 50 50 51 #include "XrayTelPhysicsList.hh" 51 #include "XrayTelPhysicsList.hh" 52 52 53 #include "globals.hh" 53 #include "globals.hh" 54 #include "G4SystemOfUnits.hh" 54 #include "G4SystemOfUnits.hh" 55 #include "G4ParticleDefinition.hh" 55 #include "G4ParticleDefinition.hh" 56 #include "G4ParticleWithCuts.hh" 56 #include "G4ParticleWithCuts.hh" 57 #include "G4ProcessManager.hh" 57 #include "G4ProcessManager.hh" 58 #include "G4ProcessVector.hh" 58 #include "G4ProcessVector.hh" 59 #include "G4ParticleTypes.hh" 59 #include "G4ParticleTypes.hh" 60 #include "G4ParticleTable.hh" 60 #include "G4ParticleTable.hh" 61 #include "G4ShortLivedConstructor.hh" 61 #include "G4ShortLivedConstructor.hh" 62 #include "G4Material.hh" 62 #include "G4Material.hh" 63 #include "G4MaterialTable.hh" 63 #include "G4MaterialTable.hh" 64 #include "G4ios.hh" 64 #include "G4ios.hh" 65 // Hadrons 65 // Hadrons 66 #include "G4MesonConstructor.hh" 66 #include "G4MesonConstructor.hh" 67 #include "G4BaryonConstructor.hh" 67 #include "G4BaryonConstructor.hh" 68 #include "G4IonConstructor.hh" 68 #include "G4IonConstructor.hh" 69 69 70 XrayTelPhysicsList::XrayTelPhysicsList(): G4V 70 XrayTelPhysicsList::XrayTelPhysicsList(): G4VUserPhysicsList() 71 { 71 { 72 // Default cut values 72 // Default cut values 73 defaultCutValue = 2.0*mm; 73 defaultCutValue = 2.0*mm; 74 cutForGamma = 1.0*m; 74 cutForGamma = 1.0*m; 75 cutForElectron = 1.0*m; 75 cutForElectron = 1.0*m; 76 76 77 SetVerboseLevel(1); 77 SetVerboseLevel(1); 78 } 78 } 79 79 80 XrayTelPhysicsList::~XrayTelPhysicsList() 80 XrayTelPhysicsList::~XrayTelPhysicsList() 81 {} 81 {} 82 82 83 void XrayTelPhysicsList::ConstructParticle() 83 void XrayTelPhysicsList::ConstructParticle() 84 { 84 { 85 // Here are constructed all particles 85 // Here are constructed all particles 86 ConstructBosons(); 86 ConstructBosons(); 87 ConstructLeptons(); 87 ConstructLeptons(); 88 ConstructMesons(); 88 ConstructMesons(); 89 ConstructBaryons(); 89 ConstructBaryons(); 90 ConstructIons(); 90 ConstructIons(); 91 ConstructAllShortLiveds(); 91 ConstructAllShortLiveds(); 92 } 92 } 93 93 94 // In this method, static member functions sho 94 // In this method, static member functions should be called for ALL particles to be used. 95 95 96 void XrayTelPhysicsList::ConstructBosons() 96 void XrayTelPhysicsList::ConstructBosons() 97 { 97 { 98 // pseudo-particles 98 // pseudo-particles 99 G4Geantino::GeantinoDefinition(); 99 G4Geantino::GeantinoDefinition(); 100 G4ChargedGeantino::ChargedGeantinoDefinition 100 G4ChargedGeantino::ChargedGeantinoDefinition(); 101 101 102 // gamma 102 // gamma 103 G4Gamma::GammaDefinition(); 103 G4Gamma::GammaDefinition(); 104 104 105 // optical photon 105 // optical photon 106 G4OpticalPhoton::OpticalPhotonDefinition(); 106 G4OpticalPhoton::OpticalPhotonDefinition(); 107 } 107 } 108 void XrayTelPhysicsList::ConstructLeptons() 108 void XrayTelPhysicsList::ConstructLeptons() 109 { 109 { 110 // leptons 110 // leptons 111 G4Electron::ElectronDefinition(); 111 G4Electron::ElectronDefinition(); 112 G4Positron::PositronDefinition(); 112 G4Positron::PositronDefinition(); 113 113 114 G4NeutrinoE::NeutrinoEDefinition(); 114 G4NeutrinoE::NeutrinoEDefinition(); 115 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); 115 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); 116 G4NeutrinoMu::NeutrinoMuDefinition(); 116 G4NeutrinoMu::NeutrinoMuDefinition(); 117 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition() 117 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 118 118 119 G4MuonPlus::Definition(); 119 G4MuonPlus::Definition(); 120 G4MuonMinus::Definition(); 120 G4MuonMinus::Definition(); 121 } 121 } 122 void XrayTelPhysicsList::ConstructMesons() 122 void XrayTelPhysicsList::ConstructMesons() 123 { 123 { 124 // mesons 124 // mesons 125 G4MesonConstructor mConstructor; 125 G4MesonConstructor mConstructor; 126 mConstructor.ConstructParticle(); 126 mConstructor.ConstructParticle(); 127 } 127 } 128 128 129 void XrayTelPhysicsList::ConstructBaryons() 129 void XrayTelPhysicsList::ConstructBaryons() 130 { 130 { 131 // barions 131 // barions 132 G4BaryonConstructor bConstructor; 132 G4BaryonConstructor bConstructor; 133 bConstructor.ConstructParticle(); 133 bConstructor.ConstructParticle(); 134 } 134 } 135 135 136 void XrayTelPhysicsList::ConstructIons() 136 void XrayTelPhysicsList::ConstructIons() 137 { 137 { 138 // ions 138 // ions 139 G4IonConstructor iConstructor; 139 G4IonConstructor iConstructor; 140 iConstructor.ConstructParticle(); 140 iConstructor.ConstructParticle(); 141 } 141 } 142 142 143 void XrayTelPhysicsList::ConstructAllShortLive 143 void XrayTelPhysicsList::ConstructAllShortLiveds() 144 { 144 { 145 //Short-lived 145 //Short-lived 146 G4ShortLivedConstructor slConstructor; 146 G4ShortLivedConstructor slConstructor; 147 slConstructor.ConstructParticle(); 147 slConstructor.ConstructParticle(); 148 } 148 } 149 149 150 150 151 void XrayTelPhysicsList::ConstructProcess() 151 void XrayTelPhysicsList::ConstructProcess() 152 { 152 { 153 // Transportation, electromagnetic and gener 153 // Transportation, electromagnetic and general processes 154 AddTransportation(); 154 AddTransportation(); 155 ConstructEM(); 155 ConstructEM(); 156 ConstructGeneral(); 156 ConstructGeneral(); 157 } 157 } 158 158 159 // Here are respective header files for chosen 159 // Here are respective header files for chosen processes 160 160 161 #include "G4ComptonScattering.hh" 161 #include "G4ComptonScattering.hh" 162 #include "G4GammaConversion.hh" 162 #include "G4GammaConversion.hh" 163 #include "G4PhotoElectricEffect.hh" 163 #include "G4PhotoElectricEffect.hh" 164 164 165 #include "G4eMultipleScattering.hh" 165 #include "G4eMultipleScattering.hh" 166 #include "G4hMultipleScattering.hh" 166 #include "G4hMultipleScattering.hh" 167 167 168 #include "G4eIonisation.hh" 168 #include "G4eIonisation.hh" 169 #include "G4eBremsstrahlung.hh" 169 #include "G4eBremsstrahlung.hh" 170 #include "G4eplusAnnihilation.hh" 170 #include "G4eplusAnnihilation.hh" 171 171 172 #include "G4MuIonisation.hh" 172 #include "G4MuIonisation.hh" 173 #include "G4MuBremsstrahlung.hh" 173 #include "G4MuBremsstrahlung.hh" 174 #include "G4MuPairProduction.hh" 174 #include "G4MuPairProduction.hh" 175 175 176 #include "G4hIonisation.hh" 176 #include "G4hIonisation.hh" 177 #include "G4hBremsstrahlung.hh" 177 #include "G4hBremsstrahlung.hh" 178 #include "G4hPairProduction.hh" 178 #include "G4hPairProduction.hh" 179 179 180 #include "G4ionIonisation.hh" 180 #include "G4ionIonisation.hh" 181 181 182 void XrayTelPhysicsList::ConstructEM() 182 void XrayTelPhysicsList::ConstructEM() 183 { 183 { 184 auto particleIterator=GetParticleIterator(); 184 auto particleIterator=GetParticleIterator(); 185 particleIterator->reset(); 185 particleIterator->reset(); 186 186 187 while( (*particleIterator)() ) 187 while( (*particleIterator)() ) 188 { 188 { 189 G4ParticleDefinition* particle = particl 189 G4ParticleDefinition* particle = particleIterator->value(); 190 G4ProcessManager* pmanager = particle->G 190 G4ProcessManager* pmanager = particle->GetProcessManager(); 191 G4String particleName = particle->GetPar 191 G4String particleName = particle->GetParticleName(); 192 192 193 if (particleName == "gamma") 193 if (particleName == "gamma") 194 { 194 { 195 //gamma 195 //gamma 196 pmanager->AddDiscreteProcess(new G4PhotoEl 196 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect()); 197 pmanager->AddDiscreteProcess(new G4Compton 197 pmanager->AddDiscreteProcess(new G4ComptonScattering()); 198 pmanager->AddDiscreteProcess(new G4GammaCo 198 pmanager->AddDiscreteProcess(new G4GammaConversion()); 199 } 199 } 200 else if (particleName == "e-") 200 else if (particleName == "e-") 201 { 201 { 202 //electron 202 //electron 203 pmanager->AddProcess(new G4eMultipleScatte 203 pmanager->AddProcess(new G4eMultipleScattering(),-1, 1,1); 204 pmanager->AddProcess(new G4eIonisation(), 204 pmanager->AddProcess(new G4eIonisation(), -1, 2,2); 205 pmanager->AddProcess(new G4eBremsstrahlung 205 pmanager->AddProcess(new G4eBremsstrahlung(), -1, 3,3); 206 206 207 } else if (particleName == "e+") { 207 } else if (particleName == "e+") { 208 208 209 //positron 209 //positron 210 pmanager->AddProcess(new G4eMultipleScatte 210 pmanager->AddProcess(new G4eMultipleScattering(),-1, 1,1); 211 pmanager->AddProcess(new G4eIonisation(), 211 pmanager->AddProcess(new G4eIonisation(), -1, 2,2); 212 pmanager->AddProcess(new G4eBremsstrahlung 212 pmanager->AddProcess(new G4eBremsstrahlung(), -1, 3,3); 213 pmanager->AddProcess(new G4eplusAnnihilati 213 pmanager->AddProcess(new G4eplusAnnihilation(), 0,-1,4); 214 214 215 } else if( particleName == "mu-" || 215 } else if( particleName == "mu-" || 216 particleName == "mu+" ) { 216 particleName == "mu+" ) { 217 217 218 //muon 218 //muon 219 pmanager->AddProcess(new G4hMultipleScatte 219 pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); 220 pmanager->AddProcess(new G4MuIonisation, 220 pmanager->AddProcess(new G4MuIonisation, -1, 2, 2); 221 pmanager->AddProcess(new G4MuBremsstrahlun 221 pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3); 222 pmanager->AddProcess(new G4MuPairProductio 222 pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4); 223 223 224 } else if( particleName == "pi-" || 224 } else if( particleName == "pi-" || 225 particleName == "pi+" ) { 225 particleName == "pi+" ) { 226 226 227 //pions 227 //pions 228 pmanager->AddProcess(new G4hMultipleScatte 228 pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); 229 pmanager->AddProcess(new G4hIonisation, 229 pmanager->AddProcess(new G4hIonisation, -1, 2, 2); 230 pmanager->AddProcess(new G4hBremsstrahlung 230 pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3); 231 pmanager->AddProcess(new G4hPairProduction 231 pmanager->AddProcess(new G4hPairProduction, -1, 4, 4); 232 232 233 } else if( particleName == "proton" ) { 233 } else if( particleName == "proton" ) { 234 234 235 //proton 235 //proton 236 pmanager->AddProcess(new G4hMultipleScatte 236 pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); 237 pmanager->AddProcess(new G4hIonisation, 237 pmanager->AddProcess(new G4hIonisation, -1, 2, 2); 238 pmanager->AddProcess(new G4hBremsstrahlung 238 pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3); 239 pmanager->AddProcess(new G4hPairProduction 239 pmanager->AddProcess(new G4hPairProduction, -1, 4, 4); 240 240 241 } else if( particleName == "alpha" || 241 } else if( particleName == "alpha" || 242 particleName == "He3" || 242 particleName == "He3" || 243 particleName == "GenericIon" ) { 243 particleName == "GenericIon" ) { 244 244 245 //Ions 245 //Ions 246 pmanager->AddProcess(new G4hMultipleScatte 246 pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); 247 pmanager->AddProcess(new G4ionIonisation, 247 pmanager->AddProcess(new G4ionIonisation, -1, 2, 2); 248 248 249 } else if ((!particle->IsShortLived()) && 249 } else if ((!particle->IsShortLived()) && 250 (particle->GetPDGCharge() != 0.0) && 250 (particle->GetPDGCharge() != 0.0) && 251 (particle->GetParticleName() != "char 251 (particle->GetParticleName() != "chargedgeantino")) { 252 252 253 //all others charged particles except gean 253 //all others charged particles except geantino 254 pmanager->AddProcess(new G4hMultipleScatte 254 pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1); 255 pmanager->AddProcess(new G4hIonisation, 255 pmanager->AddProcess(new G4hIonisation, -1, 2, 2); 256 256 257 } 257 } 258 } 258 } 259 } 259 } 260 260 261 #include "G4Decay.hh" 261 #include "G4Decay.hh" 262 262 263 void XrayTelPhysicsList::ConstructGeneral() 263 void XrayTelPhysicsList::ConstructGeneral() 264 { 264 { 265 G4Decay* theDecayProcess = new G4Decay(); 265 G4Decay* theDecayProcess = new G4Decay(); 266 auto particleIterator=GetParticleIterator(); 266 auto particleIterator=GetParticleIterator(); 267 particleIterator->reset(); 267 particleIterator->reset(); 268 while( (*particleIterator)() ){ 268 while( (*particleIterator)() ){ 269 G4ParticleDefinition* particle = particleI 269 G4ParticleDefinition* particle = particleIterator->value(); 270 G4ProcessManager* pmanager = particle->Get 270 G4ProcessManager* pmanager = particle->GetProcessManager(); 271 if (theDecayProcess->IsApplicable(*particl 271 if (theDecayProcess->IsApplicable(*particle)) { 272 pmanager ->AddProcess(theDecayProcess); 272 pmanager ->AddProcess(theDecayProcess); 273 pmanager ->SetProcessOrdering(theDecayPr 273 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep); 274 pmanager ->SetProcessOrdering(theDecayPr 274 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest); 275 } 275 } 276 } 276 } 277 } 277 } 278 278 279 void XrayTelPhysicsList::SetCuts() 279 void XrayTelPhysicsList::SetCuts() 280 { 280 { 281 // defaultCutValue you have typed in is used 281 // defaultCutValue you have typed in is used 282 282 283 if (verboseLevel >1){ 283 if (verboseLevel >1){ 284 G4cout << "XrayTelPhysicsList::SetCuts:" < 284 G4cout << "XrayTelPhysicsList::SetCuts:" << G4endl; 285 } 285 } 286 286 287 // set cut values for gamma at first and for 287 // set cut values for gamma at first and for e- second 288 SetCutValue(cutForGamma, "gamma"); 288 SetCutValue(cutForGamma, "gamma"); 289 SetCutValue(cutForElectron, "e-"); 289 SetCutValue(cutForElectron, "e-"); 290 SetCutValue(cutForElectron, "e+"); 290 SetCutValue(cutForElectron, "e+"); 291 291 292 // SetCutValueForOthers(defaultCutValue); 292 // SetCutValueForOthers(defaultCutValue); 293 293 294 if (verboseLevel >1) { 294 if (verboseLevel >1) { 295 DumpCutValuesTable(); 295 DumpCutValuesTable(); 296 } 296 } 297 } 297 } 298 298 299 void XrayTelPhysicsList::SetCutForGamma(G4doub 299 void XrayTelPhysicsList::SetCutForGamma(G4double cut) 300 { 300 { >> 301 ResetCuts(); 301 cutForGamma = cut; 302 cutForGamma = cut; 302 } 303 } 303 304 304 void XrayTelPhysicsList::SetCutForElectron(G4d 305 void XrayTelPhysicsList::SetCutForElectron(G4double cut) 305 { 306 { >> 307 ResetCuts(); 306 cutForElectron = cut; 308 cutForElectron = cut; 307 } 309 } 308 310 309 G4double XrayTelPhysicsList::GetCutForGamma() 311 G4double XrayTelPhysicsList::GetCutForGamma() const 310 { 312 { 311 return cutForGamma; 313 return cutForGamma; 312 } 314 } 313 315 314 G4double XrayTelPhysicsList::GetCutForElectron 316 G4double XrayTelPhysicsList::GetCutForElectron() const 315 { 317 { 316 return cutForElectron; 318 return cutForElectron; 317 } 319 } 318 320 319 321 320 322 321 323 322 324 323 325