63 nShellLimit(100), fDeexcitationActive(false), isInitialised(false),
64 fAtomDeexcitation(nullptr)
82 G4cout <<
"Livermore Polarized PhotoElectric is constructed "
113 G4cout <<
"Calling G4LivermorePolarizedPhotoElectricGDModel::Initialise()" <<
G4endl;
125 char* path = getenv(
"G4LEDATA");
131 for(
G4int i=0; i<numOfCouples; ++i) {
138 for (
G4int j=0; j<nelm; ++j) {
148 G4cout <<
"Loaded cross section files for LivermorePhotoElectric model"
163 G4cout <<
"LivermorePolarizedPhotoElectric model is initialized " <<
G4endl
177 G4cout <<
"G4LivermorePolarizedPhotoElectricGDModel::ComputeCrossSectionPerAtom():"
178 <<
" Z= " << ZZ <<
" R(keV)= " << GammaEnergy/
keV <<
G4endl;
182 if(Z < 1 || Z >=
maxZ) {
return cs; }
192 if (GammaEnergy < (*(
fParam[Z]))[idx-1]) { GammaEnergy = (*(
fParam[
Z]))[idx-1]; }
199 if(GammaEnergy >= (*(
fParam[Z]))[0]) {
205 }
else if (GammaEnergy >= (*(
fParam[Z]))[1]) {
213 G4cout <<
"LivermorePolarizedPhotoElectricGDModel: E(keV)= " << GammaEnergy/
keV
214 <<
" Z= " << Z <<
" cross(barn)= " << cs/
barn <<
G4endl;
223 std::vector<G4DynamicParticle*>* fvect,
230 G4cout <<
"Calling SampleSecondaries() of G4LivermorePolarizedPhotoElectricGDModel"
236 G4cout <<
"G4LivermorePolarizedPhotoElectricGDModel::SampleSecondaries() Egamma(keV)= "
265 if(!(gammaPolarization0.
isOrthogonal(photonDirection, 1
e-6))||(gammaPolarization0.
mag()==0))
306 if(photonEnergy >= (*(
fParam[Z]))[0]) {
311 G4int idx = nn*6 - 4;
319 for(shellIdx=0; shellIdx<
nn; ++shellIdx) {
320 idx = shellIdx*6 + 2;
321 if(photonEnergy > (*(
fParam[Z]))[idx-1]) {
325 if(cs >= cs0) {
break; }
328 if(shellIdx >= nn) { shellIdx = nn-1; }
336 if(photonEnergy >= (*(
fParam[Z]))[1]) {
342 for(
size_t j=0; j<
nn; ++j) {
344 if(photonEnergy > (*(
fParam[Z]))[6*shellIdx+1]) {
347 if(cs <= 0.0 || j+1 == nn) {
break; }
368 if(photonEnergy < bindingEnergy) {
380 G4double sintheta = sqrt(1. - costheta*costheta);
390 fvect->push_back(electron);
397 G4int nbefore = fvect->size();
400 G4int nafter = fvect->size();
401 if(nafter > nbefore) {
403 for (
G4int j=nbefore; j<nafter; ++j) {
405 G4double e = ((*fvect)[j])->GetKineticEnergy();
406 if(esec + e > edep) {
409 ((*fvect)[j])->SetKineticEnergy(e);
412 for (
G4int jj=nafter-1; jj>j; --jj) {
436 G4cout <<
"Calling ReadData() of G4LivermorePolarizedPhotoElectricGDModel"
442 const char* datadir = path;
446 datadir = getenv(
"G4LEDATA");
449 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
451 "Environment variable G4LEDATA not defined");
460 std::ostringstream ost;
461 ost << datadir <<
"/livermore/phot/pe-cs-" << Z <<
".dat";
462 std::ifstream
fin(ost.str().c_str());
463 if( !
fin.is_open()) {
465 ed <<
"G4LivermorePolarizedPhotoElectricGDModel data file <" << ost.str().c_str()
466 <<
"> is not opened!" <<
G4endl;
467 G4Exception(
"G4LivermorePolarizedPhotoElectricGDModel::ReadData()",
469 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
473 <<
" is opened by G4LivermorePolarizedPhotoElectricGDModel" <<
G4endl;}
479 fParam[
Z] =
new std::vector<G4double>;
485 std::ostringstream ost1;
486 ost1 << datadir <<
"/livermore/phot/pe-" << Z <<
".dat";
487 std::ifstream fin1(ost1.str().c_str());
488 if( !fin1.is_open()) {
490 ed <<
"G4LivermorePolarizedPhotoElectricGDModel data file <" << ost1.str().c_str()
491 <<
"> is not opened!" <<
G4endl;
492 G4Exception(
"G4LivermorePolarizedPhotoElectricGDModel::ReadData()",
494 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
498 G4cout <<
"File " << ost1.str().c_str()
499 <<
" is opened by G4LivermorePolarizedPhotoElectricGDModel" <<
G4endl;
502 if(fin1.fail()) {
return; }
503 if(0 > n1 || n1 >=
INT_MAX) { n1 = 0; }
506 if(fin1.fail()) {
return; }
507 if(0 > n2 || n2 >=
INT_MAX) { n2 = 0; }
510 if(fin1.fail()) {
return; }
515 for(
G4int i=0; i<n1; ++i) {
516 for(
G4int j=0; j<6; ++j) {
518 if(0 == j) { x *=
MeV; }
531 std::ostringstream ost2;
532 ost2 << datadir <<
"/livermore/phot/pe-ss-cs-" << Z <<
".dat";
533 std::ifstream fin2(ost2.str().c_str());
534 if( !fin2.is_open()) {
536 ed <<
"G4LivermorePolarizedPhotoElectricGDModel data file <" << ost2.str().c_str()
537 <<
"> is not opened!" <<
G4endl;
538 G4Exception(
"G4LivermorePolarizedPhotoElectricGDModel::ReadData()",
540 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
544 G4cout <<
"File " << ost2.str().c_str()
545 <<
" is opened by G4LivermorePolarizedPhotoElectricGDModel" <<
G4endl;
550 for(
G4int i=0; i<n2; ++i) {
551 fin2 >> x >> y >> n3 >> n4;
553 for(
G4int j=0; j<n3; ++j) {
567 std::ostringstream ost3;
568 ost3 << datadir <<
"/livermore/phot/pe-le-cs-" << Z <<
".dat";
569 std::ifstream fin3(ost3.str().c_str());
570 if( !fin3.is_open()) {
572 ed <<
"G4LivermorePolarizedPhotoElectricGDModel data file <" << ost3.str().c_str()
573 <<
"> is not opened!" <<
G4endl;
574 G4Exception(
"G4LivermorePolarizedPhotoElectricGDModel::ReadData()",
576 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
580 G4cout <<
"File " << ost3.str().c_str()
581 <<
" is opened by G4LivermorePolarizedPhotoElectricGDModel" <<
G4endl;
595 G4double rand1,rand2,onemcost,greject;
598 G4double gamma = 1. + energyE/masarep;
605 G4double g1 = 0.5*beta*gamma*(gamma-1.)*(gamma-2.);
609 G4double grejectmax = 2.*(g1+1./alfa);
614 onemcost = 2.*alfa*(2.*rand1 + alfap2 * sqrt(rand1))/
615 (alfap2*alfap2 - 4.*rand1);
616 greject = (2. - onemcost)*(g1+1./(alfa+onemcost));
619 while (rand2*grejectmax > greject);
635 G4double d = (2./(k*gamma*(1-beta*costheta))-1)*(1/k);
648 phiprob = 1 +2*d*cos(phi)*cos(phi);
650 while (rnd2*norm_factor > phiprob);
687 c.
setX(std::cos(angle)*(a0.
x())+std::sin(angle)*b0.
x());
688 c.
setY(std::cos(angle)*(a0.
y())+std::sin(angle)*b0.
y());
689 c.
setZ(std::cos(angle)*(a0.
z())+std::sin(angle)*b0.
z());
714 return gammaPolarization - gammaPolarization.
dot(gammaDirection)/gammaDirection.
dot(gammaDirection) * gammaDirection;
736 direction1 = (direction_x*Axis_X0 + direction_y*Axis_Y0 + direction_z*Axis_Z0).unit();
748 G4AutoLock l(&LivermorePolarizedPhotoElectricGDModelMutex);
std::vector< G4double > fSandiaCof
CLHEP::Hep3Vector G4ThreeVector
static G4int fNShells[99]
std::ostringstream G4ExceptionDescription
std::vector< ExP01TrackerHit * > a
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
G4VAtomDeexcitation * AtomDeexcitation()
static constexpr double MeV
static constexpr double keV
G4double SetPhi(G4double, G4double, G4double)
Float_t x1[n_points_granero]
virtual void ScaleVector(G4double factorE, G4double factorV)
const G4ThreeVector & GetMomentumDirection() const
const G4ElementVector * GetElementVector() const
void ReadData(G4int Z, const char *path=0)
void SetProposedKineticEnergy(G4double proposedKinEnergy)
double dot(const Hep3Vector &) const
G4ThreeVector GetRandomPolarization(G4ThreeVector &direction0)
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
bool isOrthogonal(const Hep3Vector &v, double epsilon=tolerance) const
static G4LPhysicsFreeVector * fCrossSectionLE[99]
void PutValues(size_t index, G4double e, G4double dataValue)
void SystemOfRefChange(G4ThreeVector &direction0, G4ThreeVector &direction1, G4ThreeVector &polarization0)
void SetDeexcitationFlag(G4bool val)
#define G4MUTEX_INITIALIZER
G4int GetComponentID(G4int Z, size_t idx)
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
static G4Material * fWater
static constexpr double electron_mass_c2
G4ParticleDefinition * theGamma
G4ThreeVector SetPerpendicularVector(G4ThreeVector &a)
static constexpr double twopi
G4bool IsFluoActive() const
static std::vector< G4double > * fParam[99]
G4ParticleChangeForGamma * fParticleChange
static constexpr double eV
G4double SetCosTheta(G4double)
double howOrthogonal(const Hep3Vector &v) const
G4LivermorePolarizedPhotoElectricGDModel(const G4String &nam="LivermorePolarizedPhotoElectric")
static G4Electron * Electron()
size_t GetTableSize() const
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
Hep3Vector cross(const Hep3Vector &) const
static G4ElementData * fShellCrossSection
virtual G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
double epsilon(double density, double temperature)
static G4ProductionCutsTable * GetProductionCutsTable()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
const G4ThreeVector & GetPolarization() const
std::vector< G4Element * > G4ElementVector
static G4int fNShellsUsed[99]
G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy)
void InitialiseForComponent(G4int Z, G4int nComponents=0)
static constexpr double barn
G4double GetKineticEnergy() const
G4ParticleDefinition * theElectron
G4GLOB_DLL std::ostream G4cout
G4ThreeVector GetPerpendicularPolarization(const G4ThreeVector &direction0, const G4ThreeVector &polarization0) const
G4VAtomDeexcitation * fAtomDeexcitation
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
static G4LossTableManager * Instance()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
const G4Material * GetMaterial() const
G4ParticleChangeForGamma * GetParticleChangeForGamma()
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4bool fDeexcitationActive
Float_t x2[n_points_geant4]
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
G4double bindingEnergy(G4int A, G4int Z)
void ProposeTrackStatus(G4TrackStatus status)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
const G4Material * GetBaseMaterial() const
virtual G4double Value(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy)
static G4double fWaterEnergyLimit
virtual ~G4LivermorePolarizedPhotoElectricGDModel()
virtual void InitialiseForElement(const G4ParticleDefinition *, G4int Z)
size_t GetNumberOfElements() const
static G4LPhysicsFreeVector * fCrossSection[99]
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)