62 nShellLimit(100), fDeexcitationActive(
false), isInitialised(
false),
63 fAtomDeexcitation(nullptr)
81 G4cout <<
"Livermore Polarized PhotoElectric is constructed "
112 G4cout <<
"Calling G4LivermorePolarizedPhotoElectricGDModel::Initialise()" <<
G4endl;
124 char* path = std::getenv(
"G4LEDATA");
130 for(
G4int i=0; i<numOfCouples; ++i) {
137 for (
G4int j=0; j<nelm; ++j) {
147 G4cout <<
"Loaded cross section files for LivermorePhotoElectric model"
162 G4cout <<
"LivermorePolarizedPhotoElectric model is initialized " <<
G4endl
176 G4cout <<
"G4LivermorePolarizedPhotoElectricGDModel::ComputeCrossSectionPerAtom():"
177 <<
" Z= " << ZZ <<
" R(keV)= " << GammaEnergy/
keV <<
G4endl;
181 if(Z < 1 || Z >=
maxZ) {
return cs; }
191 if (GammaEnergy < (*(
fParam[Z]))[idx-1]) { GammaEnergy = (*(
fParam[
Z]))[idx-1]; }
198 if(GammaEnergy >= (*(
fParam[Z]))[0]) {
204 }
else if (GammaEnergy >= (*(
fParam[Z]))[1]) {
212 G4cout <<
"LivermorePolarizedPhotoElectricGDModel: E(keV)= " << GammaEnergy/
keV
213 <<
" Z= " << Z <<
" cross(barn)= " << cs/
barn <<
G4endl;
222 std::vector<G4DynamicParticle*>* fvect,
229 G4cout <<
"Calling SampleSecondaries() of G4LivermorePolarizedPhotoElectricGDModel"
235 G4cout <<
"G4LivermorePolarizedPhotoElectricGDModel::SampleSecondaries() Egamma(keV)= "
264 if(!(gammaPolarization0.
isOrthogonal(photonDirection, 1
e-6))||(gammaPolarization0.
mag()==0))
305 if(photonEnergy >= (*(
fParam[Z]))[0]) {
318 for(shellIdx=0; shellIdx<
nn; ++shellIdx) {
319 idx = shellIdx*6 + 2;
320 if(photonEnergy > (*(
fParam[Z]))[idx-1]) {
324 if(cs >= cs0) {
break; }
327 if(shellIdx >= nn) { shellIdx = nn-1; }
335 if(photonEnergy >= (*(
fParam[Z]))[1]) {
341 for(
size_t j=0; j<
nn; ++j) {
343 if(photonEnergy > (*(
fParam[Z]))[6*shellIdx+1]) {
346 if(cs <= 0.0 || j+1 == nn) {
break; }
367 if(photonEnergy < bindingEnergy) {
379 G4double sintheta = sqrt(1. - costheta*costheta);
389 fvect->push_back(electron);
396 G4int nbefore = fvect->size();
399 G4int nafter = fvect->size();
400 if(nafter > nbefore) {
402 for (
G4int j=nbefore; j<nafter; ++j) {
404 G4double e = ((*fvect)[j])->GetKineticEnergy();
405 if(esec + e > edep) {
408 ((*fvect)[j])->SetKineticEnergy(e);
411 for (
G4int jj=nafter-1; jj>j; --jj) {
435 G4cout <<
"Calling ReadData() of G4LivermorePolarizedPhotoElectricGDModel"
441 const char* datadir = path;
445 datadir = std::getenv(
"G4LEDATA");
448 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
450 "Environment variable G4LEDATA not defined");
459 std::ostringstream ost;
460 ost << datadir <<
"/livermore/phot/pe-cs-" << Z <<
".dat";
461 std::ifstream
fin(ost.str().c_str());
462 if( !
fin.is_open()) {
464 ed <<
"G4LivermorePolarizedPhotoElectricGDModel data file <" << ost.str().c_str()
465 <<
"> is not opened!" <<
G4endl;
466 G4Exception(
"G4LivermorePolarizedPhotoElectricGDModel::ReadData()",
468 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
472 <<
" is opened by G4LivermorePolarizedPhotoElectricGDModel" <<
G4endl;}
478 fParam[
Z] =
new std::vector<G4double>;
484 std::ostringstream ost1;
485 ost1 << datadir <<
"/livermore/phot/pe-" << Z <<
".dat";
486 std::ifstream fin1(ost1.str().c_str());
487 if( !fin1.is_open()) {
489 ed <<
"G4LivermorePolarizedPhotoElectricGDModel data file <" << ost1.str().c_str()
490 <<
"> is not opened!" <<
G4endl;
491 G4Exception(
"G4LivermorePolarizedPhotoElectricGDModel::ReadData()",
493 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
497 G4cout <<
"File " << ost1.str().c_str()
498 <<
" is opened by G4LivermorePolarizedPhotoElectricGDModel" <<
G4endl;
501 if(fin1.fail()) {
return; }
502 if(0 > n1 || n1 >=
INT_MAX) { n1 = 0; }
505 if(fin1.fail()) {
return; }
506 if(0 > n2 || n2 >=
INT_MAX) { n2 = 0; }
509 if(fin1.fail()) {
return; }
515 for(
G4int j=0; j<6; ++j) {
517 if(0 == j) { x *=
MeV; }
530 std::ostringstream ost2;
531 ost2 << datadir <<
"/livermore/phot/pe-ss-cs-" << Z <<
".dat";
532 std::ifstream fin2(ost2.str().c_str());
533 if( !fin2.is_open()) {
535 ed <<
"G4LivermorePolarizedPhotoElectricGDModel data file <" << ost2.str().c_str()
536 <<
"> is not opened!" <<
G4endl;
537 G4Exception(
"G4LivermorePolarizedPhotoElectricGDModel::ReadData()",
539 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
543 G4cout <<
"File " << ost2.str().c_str()
544 <<
" is opened by G4LivermorePolarizedPhotoElectricGDModel" <<
G4endl;
549 for(
G4int i=0; i<n2; ++i) {
550 fin2 >> x >> y >> n3 >> n4;
552 for(
G4int j=0; j<n3; ++j) {
566 std::ostringstream ost3;
567 ost3 << datadir <<
"/livermore/phot/pe-le-cs-" << Z <<
".dat";
568 std::ifstream fin3(ost3.str().c_str());
569 if( !fin3.is_open()) {
571 ed <<
"G4LivermorePolarizedPhotoElectricGDModel data file <" << ost3.str().c_str()
572 <<
"> is not opened!" <<
G4endl;
573 G4Exception(
"G4LivermorePolarizedPhotoElectricGDModel::ReadData()",
575 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
579 G4cout <<
"File " << ost3.str().c_str()
580 <<
" is opened by G4LivermorePolarizedPhotoElectricGDModel" <<
G4endl;
597 G4double gamma = 1. + energyE/masarep;
600 G4double beta = sqrt((gamma2 - 1.)/gamma2);
604 G4double g1 = 0.5*beta*gamma*(gamma-1.)*(gamma-2.);
608 G4double grejectmax = 2.*(g1+1./alfa);
613 onemcost = 2.*alfa*(2.*rand1 + alfap2 * sqrt(rand1))/
614 (alfap2*alfap2 - 4.*rand1);
615 greject = (2. - onemcost)*(g1+1./(alfa+onemcost));
618 while (rand2*grejectmax > greject);
632 G4double beta = sqrt((gamma2 - 1.)/gamma2);
634 G4double d = (2./(k*gamma*(1-beta*costheta))-1)*(1/k);
647 phiprob = 1 +2*d*cos(phi)*cos(phi);
649 while (rnd2*norm_factor > phiprob);
686 c.
setX(std::cos(angle)*(a0.
x())+std::sin(angle)*b0.
x());
687 c.
setY(std::cos(angle)*(a0.
y())+std::sin(angle)*b0.
y());
688 c.
setZ(std::cos(angle)*(a0.
z())+std::sin(angle)*b0.
z());
713 return gammaPolarization - gammaPolarization.
dot(gammaDirection)/gammaDirection.
dot(gammaDirection) * gammaDirection;
735 direction1 = (direction_x*Axis_X0 + direction_y*Axis_Y0 + direction_z*Axis_Z0).unit();
747 G4AutoLock l(&LivermorePolarizedPhotoElectricGDModelMutex);