File indexing completed on 2025-01-31 09:22:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 #include "G4LowEnergyGammaConversion.hh"
0051
0052 #include "Randomize.hh"
0053 #include "G4PhysicalConstants.hh"
0054 #include "G4SystemOfUnits.hh"
0055 #include "G4ParticleDefinition.hh"
0056 #include "G4Track.hh"
0057 #include "G4Step.hh"
0058 #include "G4ForceCondition.hh"
0059 #include "G4Gamma.hh"
0060 #include "G4Electron.hh"
0061 #include "G4DynamicParticle.hh"
0062 #include "G4VParticleChange.hh"
0063 #include "G4ThreeVector.hh"
0064 #include "G4Positron.hh"
0065 #include "G4IonisParamElm.hh"
0066 #include "G4Material.hh"
0067 #include "G4RDVCrossSectionHandler.hh"
0068 #include "G4RDCrossSectionHandler.hh"
0069 #include "G4RDVEMDataSet.hh"
0070 #include "G4RDVDataSetAlgorithm.hh"
0071 #include "G4RDLogLogInterpolation.hh"
0072 #include "G4RDVRangeTest.hh"
0073 #include "G4RDRangeTest.hh"
0074 #include "G4MaterialCutsCouple.hh"
0075
0076 G4LowEnergyGammaConversion::G4LowEnergyGammaConversion(const G4String& processName)
0077 : G4VDiscreteProcess(processName),
0078 lowEnergyLimit(1.022000*MeV),
0079 highEnergyLimit(100*GeV),
0080 intrinsicLowEnergyLimit(1.022000*MeV),
0081 intrinsicHighEnergyLimit(100*GeV),
0082 smallEnergy(2.*MeV)
0083
0084 {
0085 if (lowEnergyLimit < intrinsicLowEnergyLimit ||
0086 highEnergyLimit > intrinsicHighEnergyLimit)
0087 {
0088 G4Exception("G4LowEnergyGammaConversion::G4LowEnergyGammaConversion()",
0089 "OutOfRange", FatalException,
0090 "Energy limit outside intrinsic process validity range!");
0091 }
0092
0093
0094
0095 crossSectionHandler = new G4RDCrossSectionHandler();
0096 crossSectionHandler->Initialise(0,1.0220*MeV,100.*GeV,400);
0097 meanFreePathTable = 0;
0098 rangeTest = new G4RDRangeTest;
0099
0100 if (verboseLevel > 0)
0101 {
0102 G4cout << GetProcessName() << " is created " << G4endl
0103 << "Energy range: "
0104 << lowEnergyLimit / MeV << " MeV - "
0105 << highEnergyLimit / GeV << " GeV"
0106 << G4endl;
0107 }
0108 }
0109
0110 G4LowEnergyGammaConversion::~G4LowEnergyGammaConversion()
0111 {
0112 delete meanFreePathTable;
0113 delete crossSectionHandler;
0114 delete rangeTest;
0115 }
0116
0117 void G4LowEnergyGammaConversion::BuildPhysicsTable(const G4ParticleDefinition& )
0118 {
0119
0120 crossSectionHandler->Clear();
0121 G4String crossSectionFile = "pair/pp-cs-";
0122 crossSectionHandler->LoadData(crossSectionFile);
0123
0124 delete meanFreePathTable;
0125 meanFreePathTable = crossSectionHandler->BuildMeanFreePathForMaterials();
0126 }
0127
0128 G4VParticleChange* G4LowEnergyGammaConversion::PostStepDoIt(const G4Track& aTrack,
0129 const G4Step& aStep)
0130 {
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141 aParticleChange.Initialize(aTrack);
0142
0143 const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
0144
0145 const G4DynamicParticle* incidentPhoton = aTrack.GetDynamicParticle();
0146 G4double photonEnergy = incidentPhoton->GetKineticEnergy();
0147 G4ParticleMomentum photonDirection = incidentPhoton->GetMomentumDirection();
0148
0149 G4double epsilon ;
0150 G4double epsilon0 = electron_mass_c2 / photonEnergy ;
0151
0152
0153 if (photonEnergy < smallEnergy )
0154 {
0155 epsilon = epsilon0 + (0.5 - epsilon0) * G4UniformRand();
0156 }
0157 else
0158 {
0159
0160 const G4Element* element = crossSectionHandler->SelectRandomElement(couple,photonEnergy);
0161
0162 if (element == 0)
0163 {
0164 G4cout << "G4LowEnergyGammaConversion::PostStepDoIt - element = 0" << G4endl;
0165 }
0166 G4IonisParamElm* ionisation = element->GetIonisation();
0167 if (ionisation == 0)
0168 {
0169 G4cout << "G4LowEnergyGammaConversion::PostStepDoIt - ionisation = 0" << G4endl;
0170 }
0171
0172
0173 G4double fZ = 8. * (ionisation->GetlogZ3());
0174 if (photonEnergy > 50. * MeV) fZ += 8. * (element->GetfCoulomb());
0175
0176
0177 G4double screenFactor = 136. * epsilon0 / (element->GetIonisation()->GetZ3()) ;
0178 G4double screenMax = std::exp ((42.24 - fZ)/8.368) - 0.952 ;
0179 G4double screenMin = std::min(4.*screenFactor,screenMax) ;
0180
0181
0182 G4double epsilon1 = 0.5 - 0.5 * std::sqrt(1. - screenMin / screenMax) ;
0183 G4double epsilonMin = std::max(epsilon0,epsilon1);
0184 G4double epsilonRange = 0.5 - epsilonMin ;
0185
0186
0187 G4double screen;
0188 G4double gReject ;
0189
0190 G4double f10 = ScreenFunction1(screenMin) - fZ;
0191 G4double f20 = ScreenFunction2(screenMin) - fZ;
0192 G4double normF1 = std::max(f10 * epsilonRange * epsilonRange,0.);
0193 G4double normF2 = std::max(1.5 * f20,0.);
0194
0195 do {
0196 if (normF1 / (normF1 + normF2) > G4UniformRand() )
0197 {
0198 epsilon = 0.5 - epsilonRange * std::pow(G4UniformRand(), 0.3333) ;
0199 screen = screenFactor / (epsilon * (1. - epsilon));
0200 gReject = (ScreenFunction1(screen) - fZ) / f10 ;
0201 }
0202 else
0203 {
0204 epsilon = epsilonMin + epsilonRange * G4UniformRand();
0205 screen = screenFactor / (epsilon * (1 - epsilon));
0206 gReject = (ScreenFunction2(screen) - fZ) / f20 ;
0207 }
0208 } while ( gReject < G4UniformRand() );
0209
0210 }
0211
0212
0213
0214 G4double electronTotEnergy;
0215 G4double positronTotEnergy;
0216
0217 if (CLHEP::RandBit::shootBit())
0218 {
0219 electronTotEnergy = (1. - epsilon) * photonEnergy;
0220 positronTotEnergy = epsilon * photonEnergy;
0221 }
0222 else
0223 {
0224 positronTotEnergy = (1. - epsilon) * photonEnergy;
0225 electronTotEnergy = epsilon * photonEnergy;
0226 }
0227
0228
0229
0230
0231
0232 G4double u;
0233 const G4double a1 = 0.625;
0234 G4double a2 = 3. * a1;
0235
0236
0237
0238 if (0.25 > G4UniformRand())
0239 {
0240 u = - std::log(G4UniformRand() * G4UniformRand()) / a1 ;
0241 }
0242 else
0243 {
0244 u = - std::log(G4UniformRand() * G4UniformRand()) / a2 ;
0245 }
0246
0247 G4double thetaEle = u*electron_mass_c2/electronTotEnergy;
0248 G4double thetaPos = u*electron_mass_c2/positronTotEnergy;
0249 G4double phi = twopi * G4UniformRand();
0250
0251 G4double dxEle= std::sin(thetaEle)*std::cos(phi),dyEle= std::sin(thetaEle)*std::sin(phi),dzEle=std::cos(thetaEle);
0252 G4double dxPos=-std::sin(thetaPos)*std::cos(phi),dyPos=-std::sin(thetaPos)*std::sin(phi),dzPos=std::cos(thetaPos);
0253
0254
0255
0256
0257
0258
0259 G4double localEnergyDeposit = 0. ;
0260
0261 aParticleChange.SetNumberOfSecondaries(2) ;
0262 G4double electronKineEnergy = std::max(0.,electronTotEnergy - electron_mass_c2) ;
0263
0264
0265
0266 G4double safety = aStep.GetPostStepPoint()->GetSafety();
0267
0268 if (rangeTest->Escape(G4Electron::Electron(),couple,electronKineEnergy,safety))
0269 {
0270 G4ThreeVector electronDirection (dxEle, dyEle, dzEle);
0271 electronDirection.rotateUz(photonDirection);
0272
0273 G4DynamicParticle* particle1 = new G4DynamicParticle (G4Electron::Electron(),
0274 electronDirection,
0275 electronKineEnergy);
0276 aParticleChange.AddSecondary(particle1) ;
0277 }
0278 else
0279 {
0280 localEnergyDeposit += electronKineEnergy ;
0281 }
0282
0283
0284 G4double positronKineEnergy = std::max(0.,positronTotEnergy - electron_mass_c2) ;
0285
0286
0287 if (! (rangeTest->Escape(G4Positron::Positron(),couple,positronKineEnergy,safety)))
0288 {
0289 localEnergyDeposit += positronKineEnergy ;
0290 positronKineEnergy = 0. ;
0291 }
0292
0293 G4ThreeVector positronDirection (dxPos, dyPos, dzPos);
0294 positronDirection.rotateUz(photonDirection);
0295
0296
0297 G4DynamicParticle* particle2 = new G4DynamicParticle(G4Positron::Positron(),
0298 positronDirection, positronKineEnergy);
0299 aParticleChange.AddSecondary(particle2) ;
0300
0301 aParticleChange.ProposeLocalEnergyDeposit(localEnergyDeposit) ;
0302
0303
0304 aParticleChange.ProposeMomentumDirection(0.,0.,0.) ;
0305 aParticleChange.ProposeEnergy(0.) ;
0306 aParticleChange.ProposeTrackStatus(fStopAndKill) ;
0307
0308
0309 return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
0310 }
0311
0312 G4bool G4LowEnergyGammaConversion::IsApplicable(const G4ParticleDefinition& particle)
0313 {
0314 return ( &particle == G4Gamma::Gamma() );
0315 }
0316
0317 G4double G4LowEnergyGammaConversion::GetMeanFreePath(const G4Track& track,
0318 G4double,
0319 G4ForceCondition*)
0320 {
0321 const G4DynamicParticle* photon = track.GetDynamicParticle();
0322 G4double energy = photon->GetKineticEnergy();
0323 const G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple();
0324 size_t materialIndex = couple->GetIndex();
0325
0326 G4double meanFreePath;
0327 if (energy > highEnergyLimit) meanFreePath = meanFreePathTable->FindValue(highEnergyLimit,materialIndex);
0328 else if (energy < lowEnergyLimit) meanFreePath = DBL_MAX;
0329 else meanFreePath = meanFreePathTable->FindValue(energy,materialIndex);
0330 return meanFreePath;
0331 }
0332
0333 G4double G4LowEnergyGammaConversion::ScreenFunction1(G4double screenVariable)
0334 {
0335
0336
0337 G4double value;
0338
0339 if (screenVariable > 1.)
0340 value = 42.24 - 8.368 * std::log(screenVariable + 0.952);
0341 else
0342 value = 42.392 - screenVariable * (7.796 - 1.961 * screenVariable);
0343
0344 return value;
0345 }
0346
0347 G4double G4LowEnergyGammaConversion::ScreenFunction2(G4double screenVariable)
0348 {
0349
0350
0351 G4double value;
0352
0353 if (screenVariable > 1.)
0354 value = 42.24 - 8.368 * std::log(screenVariable + 0.952);
0355 else
0356 value = 41.405 - screenVariable * (5.828 - 0.8945 * screenVariable);
0357
0358 return value;
0359 }