74 G4bool modelTrigger =
false;
88 fCrystalData->SetGeometryParameters(crystallogic);
91 momentumDirectionGamma =
98 GetTopTransform().TransformPoint(aTrack.
GetPosition());
102 xyzGamma = fCrystalData->CoordinatesFromBoxToLattice(xyzGamma0);
106 txGamma0 = std::atan(momentumDirectionGamma.
x()/momentumDirectionGamma.
z());
107 tyGamma0 = std::atan(momentumDirectionGamma.
y()/momentumDirectionGamma.
z());
110 G4double angle = fCrystalData->AngleXFromBoxToLattice(txGamma0,xyzGamma.
z());
111 if (fCrystalData->GetModel()==2)
113 angle = std::sqrt(angle*angle+tyGamma0*tyGamma0);
118 modelTrigger = (momentumDirectionGamma.
z()>0. &&
132 G4double txPreStep0=0.,tyPreStep0=0.;
139 G4double x1=0.,x2=0.,x3=0.,x4=0.,y1=0.,y2=0.,y3=0.,y4=0.;
141 G4double tx1=0.,tx2=0.,tx3=0.,tx4=0.,ty1=0.,ty2=0.,ty3=0.,ty4=0.;
143 G4double kvx1=0.,kvx2=0.,kvx3=0.,kvx4=0.,kvy1=0.,kvy2=0.,kvy3=0.,kvy4=0.;
158 G4double fa1=0.,faseBefore=0.,faseBeforedz=0.,faseBeforedzd2=0.;
159 G4double faseAfter=0.,fa2dfaseBefore2=0.;
182 fullVectorEtotal.clear();
185 fullVectorTX.clear();
186 fullVectorTY.clear();
187 fPairProductionCDFdz.clear();
188 fPairProductionCDFdz.push_back(0.);
190 const G4double charge[2] = {-1.,1.};
191 const G4String particleName[2] = {
"e-",
"e+"};
203 for(
G4int i=0; i<fNMCPairs;i++)
206 G4double etotal = fMass + fPPKineticEnergyCut +
217 for(
G4int j=0; j<2;j++)
219 if(j==1){etotal=eGamma-etotal;}
220 twoVectorEtotal[j]=etotal;
225 G4double gammaInverse2 = fMass*fMass/(etotal*etotal);
227 G4double coefNorm = CLHEP::fine_structure_const/(8*(CLHEP::pi2))/(2.*fNMCPairs);
237 G4double coefNorme2deprime2 = coefNorm*e2/eprime2;
239 G4double gammaInverse2om = gammaInverse2*om*om;
242 G4double fa=0.,ss=0.,sc=0.,ssx=0.,ssy=0.,scx=0.,scy=0.;
249 fCrystalData->SetParticleProperties(etotal, fMass,
250 charge[j], particleName[j]);
254 fCrystalData->CoordinatesFromBoxToLattice(xyzGamma0);
277 G4double tx = fCrystalData->AngleXFromBoxToLattice(txGamma0,z);
279 G4double momentumDirectionZGamma = 1./
280 std::sqrt(1.+std::pow(std::tan(tx),2)+
281 std::pow(std::tan(ty),2));
288 G4double paramParticleAngle = fChargeParticleAngleFactor*fMass/etotal;
291 if (fCrystalData->GetModel()==1)
293 axangle = std::abs(tx);
295 else if (fCrystalData->GetModel()==2)
297 axangle = std::sqrt(tx*tx+ty*ty);
300 if(axangle>fCrystalData->GetLindhardAngle()+
DBL_EPSILON)
302 paramParticleAngle+=axangle
303 -std::sqrt(axangle*axangle
304 -fCrystalData->GetLindhardAngle()
305 *fCrystalData->GetLindhardAngle());
309 paramParticleAngle+=fCrystalData->GetLindhardAngle();
314 if (paramParticleAngle>CLHEP::halfpi-
DBL_EPSILON){paramParticleAngle=CLHEP::halfpi;}
317 G4double rhocut=CLHEP::halfpi/paramParticleAngle;
319 G4double norm=std::atan(rhocut*rhocut)*
320 CLHEP::pi*paramParticleAngle*paramParticleAngle;
333 G4double angleNormCoef = (1.+rho*rho*rho*rho)*norm;
335 tx+=charge[j]*paramParticleAngle*rho*std::cos(phi);
337 ty+=charge[j]*paramParticleAngle*rho*std::sin(phi);
346 for(
G4int k=0; k<fNTrajectorySteps;k++)
349 txPreStep0 = fCrystalData->AngleXFromLatticeToBox(tx,z);
352 dz = fCrystalData->GetSimulationStep(tx,ty);
362 kvx1=fCrystalData->Ex(x,y);
364 tx1=tx+(kvx1-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dzd3;
365 if (fCrystalData->GetModel()==2)
367 kvy1=fCrystalData->Ey(x,y);
373 kvx2=fCrystalData->Ex(x1,y1);
375 tx2=tx-(kvx1-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dzd3+
376 (kvx2-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dz;
377 if (fCrystalData->GetModel()==2)
379 kvy2=fCrystalData->Ey(x1,y1);
381 ty2=ty-kvy1*dzd3+kvy2*dz;
385 kvx3=fCrystalData->Ex(x2,y2);
386 x3=x+(tx-tx1+tx2)*dz;
387 tx3=tx+(kvx1-kvx2+kvx3-
388 fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dz;
389 if (fCrystalData->GetModel()==2)
391 kvy3=fCrystalData->Ey(x2,y2);
392 y3=y+(ty-ty1+ty2)*dz;
393 ty3=ty+(kvy1-kvy2+kvy3)*dz;
397 kvx4=fCrystalData->Ex(x3,y3);
398 x4=x+(tx+3.*tx1+3.*tx2+tx3)*dzd8;
399 tx4=tx+(kvx1+3.*kvx2+3.*kvx3+kvx4)*dzd8-
400 fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ()*dz;
401 if (fCrystalData->GetModel()==2)
403 kvy4=fCrystalData->Ey(x3,y3);
404 y4=y+(ty+3.*ty1+3.*ty2+ty3)*dzd8;
405 ty4=ty+(kvy1+3.*kvy2+3.*kvy3+kvy4)*dzd8;
418 z+=dz*fCrystalData->GetCorrectionZ();
421 xyzparticle = fCrystalData->ChannelChange(x,y,z);
426 momentumDirectionStep =
427 dz*std::sqrt(1+std::pow(std::tan(tx),2)+std::pow(std::tan(ty),2));
428 zalongGamma += dz/momentumDirectionZGamma;
431 scatteringAnglesAndEnergyLoss.
set(0.,0.,0.);
433 if(fIncoherentScattering)
436 for (
G4int ii = 0; ii < fCrystalData->GetNelements(); ii++)
439 effectiveStep = momentumDirectionStep*
440 fCrystalData->NuclearDensity(x,y,ii);
443 scatteringAnglesAndEnergyLoss +=
444 fCrystalData->CoulombAtomicScattering(effectiveStep,
445 momentumDirectionStep,
449 scatteringAnglesAndEnergyLoss += fCrystalData->CoulombElectronScattering(
450 fCrystalData->MinIonizationEnergy(x,y),
451 fCrystalData->ElectronDensity(x,y),
452 momentumDirectionStep);
453 tx += scatteringAnglesAndEnergyLoss.
x();
454 ty += scatteringAnglesAndEnergyLoss.
y();
461 G4cout <<
"Warning: particle angle is beyond +-pi/2 range => "
462 "skipping the calculation of its probability" <<
G4endl;
470 tx0 = fCrystalData->AngleXFromLatticeToBox(tx,z);
473 dzMeV=momentumDirectionStep/CLHEP::hbarc;
476 axt=(tx0-scatteringAnglesAndEnergyLoss.
x()-txPreStep0)/dzMeV;
477 ayt=(ty0-scatteringAnglesAndEnergyLoss.
y()-tyPreStep0)/dzMeV;
483 vxno = vxin-scatteringAnglesAndEnergyLoss.
x();
484 vyno = vyin-scatteringAnglesAndEnergyLoss.
y();
487 faseBefore=omprimed2*(gammaInverse2+vxno*vxno+vyno*vyno);
489 faseBeforedz = faseBefore*dzMeV;
490 faseBeforedzd2 = faseBeforedz/2.;
492 fa1=fa-faseBeforedzd2;
493 dzmod=2*std::sin(faseBeforedzd2)/faseBefore;
496 fa2dfaseBefore2 = omprime*(axt*vxno+ayt*vyno)/(faseBefore*faseBefore);
499 faseAfter=omprimed2*(gammaInverse2+vxin*vxin+vyin*vyin);
501 skJ=1/faseAfter-1/faseBefore-fa2dfaseBefore2*dzmod;
502 skIx=vxin/faseAfter-vxno/faseBefore+dzmod*(axt/faseBefore-
503 vxno*fa2dfaseBefore2);
504 skIy=vyin/faseAfter-vyno/faseBefore+dzmod*(ayt/faseBefore-
505 vyno*fa2dfaseBefore2);
507 sinfa1 = std::sin(fa1);
508 cosfa1 = std::cos(fa1);
521 G4double i2=ssx*ssx+scx*scx+ssy*ssy+scy*scy;
524 probabilityPPdz += coefNorme2deprime2*angleNormCoef*
525 (i2*e2pluseprime2+j2*gammaInverse2om)/zalongGamma;
530 fPairProductionCDFdz.push_back(fPairProductionCDFdz[i]+probabilityPPdz);
534 fullVectorEtotal.push_back(twoVectorEtotal);
535 fullVectorX.push_back(twoVectorX);
536 fullVectorY.push_back(twoVectorY);
537 fullVectorTX.push_back(twoVectorTX);
538 fullVectorTY.push_back(twoVectorTY);
544 G4double lMeanFreePath = 1/fPairProductionCDFdz.back();
546 fEffectiveLrad = 7.*lMeanFreePath/9.;
548 return lMeanFreePath;