46 G4int G4LivermorePolarizedGammaConversionModel::maxZ = 99;
55 fParticleChange =
nullptr;
67 if(verboseLevel > 0) {
68 G4cout <<
"Livermore Polarized GammaConversion is constructed "
79 for(
G4int i=0; i<maxZ; ++i) {
95 G4cout <<
"Calling1 G4LivermorePolarizedGammaConversionModel::Initialise()"
113 char* path = getenv(
"G4LEDATA");
120 for(
G4int i=0; i<numOfCouples; ++i)
127 for (
G4int j=0; j<nelm; ++j)
131 else if(Z > maxZ) { Z = maxZ; }
132 if(!
data[Z]) { ReadData(Z, path); }
136 if(isInitialised) {
return; }
138 isInitialised =
true;
156 return lowEnergyLimit;
161 void G4LivermorePolarizedGammaConversionModel::ReadData(
size_t Z,
const char* path)
163 if (verboseLevel > 1)
165 G4cout <<
"Calling ReadData() of G4LivermorePolarizedGammaConversionModel"
169 if(
data[Z]) {
return; }
171 const char* datadir = path;
175 datadir = getenv(
"G4LEDATA");
178 G4Exception(
"G4LivermorePolarizedGammaConversionModel::ReadData()",
180 "Environment variable G4LEDATA not defined");
191 std::ostringstream ost;
192 ost << datadir <<
"/livermore/pair/pp-cs-" << Z <<
".dat";
193 std::ifstream fin(ost.str().c_str());
198 ed <<
"G4LivermorePolarizedGammaConversionModel data file <" << ost.str().c_str()
199 <<
"> is not opened!" <<
G4endl;
200 G4Exception(
"G4LivermorePolarizedGammaConversionModel::ReadData()",
202 ed,
"G4LEDATA version should be G4EMLOW6.27 or later.");
208 if(verboseLevel > 3) {
G4cout <<
"File " << ost.str()
209 <<
" is opened by G4LivermorePolarizedGammaConversionModel" <<
G4endl;}
211 data[
Z]->Retrieve(fin,
true);
215 data[
Z] ->SetSpline(
true);
227 if (verboseLevel > 1) {
228 G4cout <<
"G4LivermorePolarizedGammaConversionModel::ComputeCrossSectionPerAtom()"
231 if (GammaEnergy < lowEnergyLimit) {
return 0.0; }
237 if(intZ < 1 || intZ > maxZ) {
return xs; }
247 if(!pv) {
return xs; }
250 xs = pv->
Value(GammaEnergy);
255 G4cout <<
"****** DEBUG: tcs value for Z=" << Z <<
" at energy (MeV)="
257 G4cout <<
" cs (Geant4 internal unit)=" << xs <<
G4endl;
258 G4cout <<
" -> first cs value in EADL data file (iu) =" << (*pv)[0] <<
G4endl;
259 G4cout <<
" -> last cs value in EADL data file (iu) =" << (*pv)[
n] <<
G4endl;
260 G4cout <<
"*********************************************************" <<
G4endl;
281 if (verboseLevel > 3)
282 G4cout <<
"Calling SampleSecondaries() of G4LivermorePolarizedGammaConversionModel" <<
G4endl;
287 if(photonEnergy <= lowEnergyLimit)
301 if(!(gammaPolarization0.
isOrthogonal(gammaDirection0, 1e-6))||(gammaPolarization0.
mag()==0))
303 gammaPolarization0 = GetRandomPolarization(gammaDirection0);
309 gammaPolarization0 = GetPerpendicularPolarization(gammaDirection0, gammaPolarization0);
321 if (photonEnergy < smallEnergy )
323 epsilon = epsilon0Local + (0.5 - epsilon0Local) *
G4UniformRand();
336 G4cout <<
"G4LivermorePolarizedGammaConversionModel::SampleSecondaries - element = 0" <<
G4endl;
345 G4cout <<
"G4LivermorePolarizedGammaConversionModel::SampleSecondaries - ionisation = 0" <<
G4endl;
352 if (photonEnergy > 50. *
MeV) fZ += 8. * (element->
GetfCoulomb());
360 G4double epsilon1 = 0.5 - 0.5 * sqrt(1. - screenMin / screenMax) ;
362 G4double epsilonRange = 0.5 - epsilonMin ;
368 G4double f10 = ScreenFunction1(screenMin) - fZ;
369 G4double f20 = ScreenFunction2(screenMin) - fZ;
376 epsilon = 0.5 - epsilonRange * pow(
G4UniformRand(), 0.3333) ;
377 screen = screenFactor / (epsilon * (1. -
epsilon));
378 gReject = (ScreenFunction1(screen) - fZ) / f10 ;
383 screen = screenFactor / (epsilon * (1 -
epsilon));
384 gReject = (ScreenFunction2(screen) - fZ) / f20 ;
401 electronTotEnergy = (1. -
epsilon) * photonEnergy;
402 positronTotEnergy = epsilon * photonEnergy;
406 positronTotEnergy = (1. -
epsilon) * photonEnergy;
407 electronTotEnergy = epsilon * photonEnergy;
434 SetTheta(&cosTheta,&sinTheta,Ene);
445 phi = SetPhi(photonEnergy);
446 psi = SetPsi(photonEnergy,phi);
503 SystemOfRefChange(gammaDirection0,electronDirection,
517 SetTheta(&cosTheta,&sinTheta,Ene);
521 dirX = sinTheta*cos(phip);
522 dirY = sinTheta*sin(phip);
527 SystemOfRefChange(gammaDirection0,positronDirection,
532 positronDirection, positronKineEnergy);
535 fvect->push_back(particle1);
536 fvect->push_back(particle2);
546 G4double G4LivermorePolarizedGammaConversionModel::ScreenFunction1(
G4double screenVariable)
552 if (screenVariable > 1.)
553 value = 42.24 - 8.368 * log(screenVariable + 0.952);
555 value = 42.392 - screenVariable * (7.796 - 1.961 * screenVariable);
562 G4double G4LivermorePolarizedGammaConversionModel::ScreenFunction2(
G4double screenVariable)
568 if (screenVariable > 1.)
569 value = 42.24 - 8.368 * log(screenVariable + 0.952);
571 value = 41.405 - screenVariable * (5.828 - 0.8945 * screenVariable);
577 void G4LivermorePolarizedGammaConversionModel::SetTheta(
G4double* p_cosTheta,
G4double* p_sinTheta,
G4double Energy)
583 G4double Momentum = sqrt(Energy*Energy -1);
586 *p_cosTheta = (Energy*((2*Rand)- 1) + Momentum)/((Momentum*(2*Rand-1))+Energy);
587 *p_sinTheta = (2*sqrt(Rand*(1-Rand)))/(Momentum*(2*Rand-1)+Energy);
611 const G4double ay0=5.6, by0=18.6, aa0=2.9, ba0 = 8.16E-3;
612 const G4double aw = 0.0151, bw = 10.7, cw = -410.;
614 const G4double axc = 3.1455, bxc = -1.11, cxc = 310.;
616 pl[0] = Fln(ay0,by0,Ene);
617 pl[1] = aa0 + ba0*(Ene);
618 pl[2] = Poli(aw,bw,cw,Ene);
619 pl[3] = Poli(axc,bxc,cxc,Ene);
621 const G4double abf = 3.1216, bbf = 2.68;
623 pt[1] = abf + bbf/Ene;
632 n1 = Fintlor(pl,
pi) - Fintlor(pl,xe);
633 n2 = Finttan(pt,xe) - Finttan(pt,0.);
639 const G4double aw = 0.21, bw = 10.8, cw = -58.;
640 const G4double axc = 3.17, bxc = -0.87, cxc = -6.;
642 pl[0] = Fln(ay0, by0, Ene);
643 pl[1] = Fln(aa0, ba0, Ene);
644 pl[2] = Poli(aw,bw,cw,Ene);
645 pl[3] = Poli(axc,bxc,cxc,Ene);
649 n1 = Fintlor(pl,
pi) - Fintlor(pl,xe);
676 value = Finvlor(pl,xe,r2);
677 xco = Glor(pl,value)/
c1;
683 value = Finvtan(pt,n,r1);
691 value = Finvlor(pl,xe,r2);
692 xco = Glor(pl,value)/
c1;
717 const G4double ay00 = 3.4, by00 = 9.8, aa00 = 1.34, ba00 = 5.3;
718 const G4double aw0 = 0.014, bw0 = 9.7, cw0 = -2.E4;
719 const G4double axc0 = 3.1423, bxc0 = -2.35, cxc0 = 0.;
720 const G4double ay0p = 1.53, by0p = 3.2, aap = 0.67, bap = 8.5E-3;
721 const G4double awp = 6.9E-3, bwp = 12.6, cwp = -3.8E4;
722 const G4double axcp = 2.8E-3,bxcp = -3.133;
723 const G4double abf0 = 3.1213, bbf0 = 2.61;
724 const G4double abfpm = 3.1231, bbfpm = 2.84;
726 p0l[0] = Fln(ay00, by00, Ene);
727 p0l[1] = Fln(aa00, ba00, Ene);
728 p0l[2] = Poli(aw0, bw0, cw0, Ene);
729 p0l[3] = Poli(axc0, bxc0, cxc0, Ene);
731 ppml[0] = Fln(ay0p, by0p, Ene);
732 ppml[1] = aap + bap*(Ene);
733 ppml[2] = Poli(awp, bwp, cwp, Ene);
734 ppml[3] = Fln(axcp,bxcp,Ene);
737 p0t[1] = abf0 + bbf0/Ene;
739 ppmt[1] = abfpm + bbfpm/Ene;
745 xe0 = Encu(p0l, p0t, xi);
747 xepm = Encu(ppml, ppmt, xi);
752 const G4double ay00 = 2.82, by00 = 6.35;
753 const G4double aa00 = -1.75, ba00 = 0.25;
755 const G4double aw0 = 0.028, bw0 = 5., cw0 = -50.;
756 const G4double axc0 = 3.14213, bxc0 = -2.3, cxc0 = 5.7;
757 const G4double ay0p = 1.56, by0p = 3.6;
758 const G4double aap = 0.86, bap = 8.3E-3;
759 const G4double awp = 0.022, bwp = 7.4, cwp = -51.;
762 p0l[0] = Fln(ay00, by00, Ene);
763 p0l[1] = aa00+pow(Ene, ba00);
764 p0l[2] = Poli(aw0, bw0, cw0, Ene);
765 p0l[3] = Poli(axc0, bxc0, cxc0, Ene);
766 ppml[0] = Fln(ay0p, by0p, Ene);
767 ppml[1] = aap + bap*(Ene);
768 ppml[2] = Poli(awp, bwp, cwp, Ene);
779 b = (ppml[0]+2*ppml[1]*ppml[2]*Flor(ppml,PhiLocal));
783 b = Ftan(ppmt,PhiLocal);
787 a = (p0l[0]+2*p0l[1]*p0l[2]*Flor(p0l,PhiLocal));
791 a = Ftan(p0t,PhiLocal);
796 b = (ppml[0]+2*ppml[1]*ppml[2]*Flor(ppml,PhiLocal));
797 a = (p0l[0]+2*p0l[1]*p0l[2]*Flor(p0l,PhiLocal));
818 r3 = nr*(a*cos(value)*cos(value) + b*sin(value)*sin(value));
825 G4double G4LivermorePolarizedGammaConversionModel::Poli
831 value =(a + b/x + c/(x*x*
x));
839 G4double G4LivermorePolarizedGammaConversionModel::Fln
855 G4double G4LivermorePolarizedGammaConversionModel::Encu
865 fx = (Flor(p_p1,x)*Glor(p_p1,x) - Ftan(p_p2, x))/
866 (Fdlor(p_p1,x) - Fdtan(p_p2,x));
868 if(x > xmax) {
return xmax; }
873 if(std::fabs(fx) <= x*1.0e-6) {
break; }
876 if(x < 0.0) { x = 0.0; }
889 value = 1./(
pi*(w*w + 4.*(x-xc)*(x-xc)));
902 value = (y0 *
pi*(w*w + 4.*(x-xc)*(x-xc)) + 2.*A*w);
915 value = (-16.*A*w*(x-xc))/
916 (
pi*(w*w+4.*(x-xc)*(x-xc))*(w*w+4.*(x-xc)*(x-xc)));
929 value = y0*x + A*atan( 2*(x-xc)/w) /
pi;
943 nor = atan(2.*(
pi-xc)/w)/(2.*
pi*w) - atan(2.*(x-xc)/w)/(2.*
pi*w);
944 value = xc - (w/2.)*tan(-2.*r*nor*
pi*w+atan(2*(xc-x)/w));
967 value = -1.*a / ((x-
b)*(x-b));
990 value = b*(1-
G4Exp(r*cnor/a));
1009 return x < z ?
G4ThreeVector(-dy,dx,0) : G4ThreeVector(0,-dz,dy);
1011 return y < z ?
G4ThreeVector(dz,0,-dx) : G4ThreeVector(-dy,dx,0);
1030 c.
setX(std::cos(angle)*(a0.
x())+std::sin(angle)*b0.
x());
1031 c.
setY(std::cos(angle)*(a0.
y())+std::sin(angle)*b0.
y());
1032 c.
setZ(std::cos(angle)*(a0.
z())+std::sin(angle)*b0.
z());
1042 G4ThreeVector G4LivermorePolarizedGammaConversionModel::GetPerpendicularPolarization
1056 return gammaPolarization - gammaPolarization.
dot(gammaDirection)/gammaDirection.
dot(gammaDirection) * gammaDirection;
1062 void G4LivermorePolarizedGammaConversionModel::SystemOfRefChange
1077 direction1 = (direction_x*Axis_X0 + direction_y*Axis_Y0 + direction_z*Axis_Z0).unit();
1091 G4AutoLock l(&LivermorePolarizedGammaConversionModelMutex);
1094 if(!
data[Z]) { ReadData(Z); }
virtual void InitialiseForElement(const G4ParticleDefinition *, G4int Z)
G4double LowEnergyLimit() const
virtual ~G4LivermorePolarizedGammaConversionModel()
G4LivermorePolarizedGammaConversionModel(const G4ParticleDefinition *p=0, const G4String &nam="LivermorePolarizedGammaConversion")
std::vector< G4Element * > G4ElementVector
std::ostringstream G4ExceptionDescription
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
void InitialiseElementSelectors(const G4ParticleDefinition *, const G4DataVector &)
G4double HighEnergyLimit() const
double dot(const Hep3Vector &) const
std::vector< ExP01TrackerHit * > a
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
static G4double angle[DIM]
G4double GetfCoulomb() const
G4ParticleDefinition * GetDefinition() const
bool isOrthogonal(const Hep3Vector &v, double epsilon=tolerance) const
size_t GetVectorLength() const
const G4ElementVector * GetElementVector() const
#define G4MUTEX_INITIALIZER
double howOrthogonal(const Hep3Vector &v) const
static constexpr double twopi
const XML_Char const XML_Char * data
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
const XML_Char int const XML_Char * value
size_t GetTableSize() const
const G4ThreeVector & GetMomentumDirection() const
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
std::vector< G4EmElementSelector * > * GetElementSelectors()
G4double Value(G4double theEnergy, size_t &lastidx) const
G4double GetlogZ3() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Positron * Positron()
void SetElementSelectors(std::vector< G4EmElementSelector * > *)
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4IonisParamElm * GetIonisation() const
const G4ThreeVector & GetPolarization() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
static constexpr double GeV
static G4Electron * Electron()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
static constexpr double MeV
static constexpr double pi
size_t GetNumberOfElements() const
Hep3Vector cross(const Hep3Vector &) const
void ProposeTrackStatus(G4TrackStatus status)
virtual G4double MinPrimaryEnergy(const G4Material *, const G4ParticleDefinition *, G4double)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
double epsilon(double density, double temperature)
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
G4ParticleChangeForGamma * GetParticleChangeForGamma()
const G4Material * GetMaterial() const