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