54G4int G4LivermorePolarizedRayleighModel::maxZ = 100;
56G4VEMDataSet* G4LivermorePolarizedRayleighModel::formFactorData = 0;
60 :
G4VEmModel(nam),fParticleChange(0),isInitialised(false)
63 lowEnergyLimit = 250 * eV;
75 if(verboseLevel > 0) {
76 G4cout <<
"Livermore Polarized Rayleigh is constructed " <<
G4endl
89 for(
G4int i=0; i<maxZ; ++i) {
95 delete formFactorData;
113 if (verboseLevel > 3)
114 G4cout <<
"Calling G4LivermorePolarizedRayleighModel::Initialise()" <<
G4endl;
122 G4String formFactorFile =
"rayl/re-ff-";
124 formFactorData->
LoadData(formFactorFile);
130 char* path = std::getenv(
"G4LEDATA");
135 for(
G4int i=0; i<numOfCouples; ++i)
143 for (
G4int j=0; j<nelm; ++j)
147 else if(Z > maxZ) { Z = maxZ; }
148 if( (!dataCS[Z]) ) { ReadData(Z, path); }
153 if(isInitialised) {
return; }
155 isInitialised =
true;
170void G4LivermorePolarizedRayleighModel::ReadData(
size_t Z,
const char* path)
172 if (verboseLevel > 1)
174 G4cout <<
"Calling ReadData() of G4LivermoreRayleighModel"
178 if(dataCS[Z]) {
return; }
180 const char* datadir = path;
184 datadir = std::getenv(
"G4LEDATA");
187 G4Exception(
"G4LivermoreRayleighModelModel::ReadData()",
"em0006",
189 "Environment variable G4LEDATA not defined");
201 std::ostringstream ostCS;
202 ostCS << datadir <<
"/livermore/rayl/re-cs-" << Z <<
".dat";
203 std::ifstream finCS(ostCS.str().c_str());
205 if( !finCS .is_open() )
208 ed <<
"G4LivermorePolarizedRayleighModel data file <" << ostCS.str().c_str()
209 <<
"> is not opened!" <<
G4endl;
211 ed,
"G4LEDATA version should be G4EMLOW6.27 or later.");
216 if(verboseLevel > 3) {
217 G4cout <<
"File " << ostCS.str()
218 <<
" is opened by G4LivermoreRayleighModel" <<
G4endl;
232 if (verboseLevel > 1)
234 G4cout <<
"G4LivermoreRayleighModel::ComputeCrossSectionPerAtom()"
238 if(GammaEnergy < lowEnergyLimit) {
return 0.0; }
244 if(intZ < 1 || intZ > maxZ) {
return xs; }
253 if(!pv) {
return xs; }
260 }
else if(e >= pv->
Energy(0)) {
261 xs = pv->
Value(e)/(e*e);
289 if (verboseLevel > 3)
290 G4cout <<
"Calling SampleSecondaries() of G4LivermorePolarizedRayleighModel" <<
G4endl;
294 if (photonEnergy0 <= lowEnergyLimit)
310 G4double outcomingPhotonCosTheta = GenerateCosTheta(photonEnergy0, Z);
311 G4double outcomingPhotonPhi = GeneratePhi(outcomingPhotonCosTheta);
312 G4double beta=GeneratePolarizationAngle();
332 zDir=outcomingPhotonCosTheta;
333 xDir=std::sqrt(1-outcomingPhotonCosTheta*outcomingPhotonCosTheta);
335 xDir*=std::cos(outcomingPhotonPhi);
336 yDir*=std::sin(outcomingPhotonPhi);
343 G4ThreeVector outcomingPhotonPolarization(xPrime*std::cos(beta) + yPrime*std::sin(beta));
353G4double G4LivermorePolarizedRayleighModel::GenerateCosTheta(
G4double incomingPhotonEnergy,
G4int zAtom)
const
373 const G4double xFactor = (incomingPhotonEnergy*cm)/(h_Planck*c_light);
381 if (incomingPhotonEnergy > 5.*MeV)
392 fCosTheta = (1.+cosTheta*cosTheta)/2.;
396 x = xFactor*std::sqrt((1.-cosTheta)/2.);
399 fValue = formFactorData->
FindValue(x, zAtom-1);
401 fValue = formFactorData->
FindValue(0., zAtom-1);
414G4double G4LivermorePolarizedRayleighModel::GeneratePhi(
G4double cosTheta)
const
427 sin2Theta=1.-cosTheta*cosTheta;
432 cosPhi = std::cos(phi);
433 phiProbability= 1. - sin2Theta*cosPhi*cosPhi;
442G4double G4LivermorePolarizedRayleighModel::GeneratePolarizationAngle(
void)
const
459 photonPolarization =
photon.GetPolarization();
460 photonMomentumDirection =
photon.GetMomentumDirection();
462 if ((!photonPolarization.
isOrthogonal(photonMomentumDirection, 1e-6)) || photonPolarization.
mag()==0.)
475 photonPolarization=e1+e2;
477 else if (photonPolarization.
howOrthogonal(photonMomentumDirection) != 0.)
482 photonPolarization=photonPolarization.
perpPart(photonMomentumDirection);
485 return photonPolarization.
unit();
496 G4AutoLock l(&LivermorePolarizedRayleighModelMutex);
499 if(!dataCS[Z]) { ReadData(Z); }
std::vector< G4Element * > G4ElementVector
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
Hep3Vector orthogonal() const
Hep3Vector cross(const Hep3Vector &) const
bool isOrthogonal(const Hep3Vector &v, double epsilon=tolerance) const
Hep3Vector perpPart() const
double howOrthogonal(const Hep3Vector &v) const
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
virtual void InitialiseForElement(const G4ParticleDefinition *, G4int Z)
virtual ~G4LivermorePolarizedRayleighModel()
G4LivermorePolarizedRayleighModel(const G4ParticleDefinition *p=0, const G4String &nam="LivermorePolarizedRayleigh")
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
const G4Material * GetMaterial() const
const G4ElementVector * GetElementVector() const
size_t GetNumberOfElements() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposePolarization(const G4ThreeVector &dir)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double Energy(std::size_t index) const
G4double Value(G4double theEnergy, std::size_t &lastidx) const
virtual G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
std::size_t GetVectorLength() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
virtual G4double FindValue(G4double x, G4int componentId=0) const =0
virtual G4bool LoadData(const G4String &fileName)=0
void SetElementSelectors(std::vector< G4EmElementSelector * > *)
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
std::vector< G4EmElementSelector * > * GetElementSelectors()
G4double HighEnergyLimit() const
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
void InitialiseElementSelectors(const G4ParticleDefinition *, const G4DataVector &)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)