74 const G4int arrayDim = 980;
81 betaArray[2] = arrayDim - 1;
85 for(
G4int level = 0; level < 2; level++){
86 char nameChar0[100] =
"ftab0.dat";
87 char nameChar1[100] =
"ftab1.dat";
90 if(level == 0) filename = nameChar0;
91 if(level == 1) filename = nameChar1;
96 G4String excep =
"G4EMDataSet - G4LEDATA environment variable not set";
97 G4Exception(
"G4PhotoElectricAngularGeneratorPolarized::G4PhotoElectricAngularGeneratorPolarized",
103 G4String dirFile = pathString +
"/photoelectric_angular/" + filename;
104 std::ifstream infile(dirFile);
105 if (!infile.is_open())
107 G4String excep =
"data file: " + dirFile +
" not found";
108 G4Exception(
"G4PhotoElectricAngularGeneratorPolarized::G4PhotoElectricAngularGeneratorPolarized",
115 G4float aRead=0,cRead=0, beta=0;
116 for(
G4int i=0 ; i<arrayDim ;++i){
117 infile >> beta >> aRead >> cRead;
118 aMajorantSurfaceParameterTable[i][level] = aRead;
119 cMajorantSurfaceParameterTable[i][level] = cRead;
143 G4double gamma = 1 + eKinEnergy/electron_mass_c2;
144 G4double beta = std::sqrt((gamma - 1)*(gamma + 1))/gamma;
157 PhotoElectronGetMajorantSurfaceAandCParameters(shellId, beta, &aBeta, &cBeta);
161 PhotoElectronGeneratePhiAndTheta(shellId, beta, aBeta, cBeta, &phi, &theta);
165 PhotoElectronRotationMatrix(direction, polarization);
168 fLocalDirection = PhotoElectronComputeFinalDirection(rotation, theta, phi);
176G4PhotoElectricAngularGeneratorPolarized::PhotoElectronGeneratePhiAndTheta(
184 G4double crossSectionMajorantFunctionValue = 0;
197 theta=std::sqrt(((
G4Exp(rand2*std::log(1+cBeta*pi*pi)))-1)/cBeta);
198 crossSectionMajorantFunctionValue =
199 CrossSectionMajorantFunction(theta, cBeta);
200 crossSectionValue = DSigmaKshellGavrila1959(beta, theta, phi);
203 theta = std::sqrt(((
G4Exp(rand2*std::log(1+cBeta*pi*pi)))-1)/cBeta);
204 crossSectionMajorantFunctionValue =
205 CrossSectionMajorantFunction(theta, cBeta);
206 crossSectionValue = DSigmaL1shellGavrila(beta, theta, phi);
209 maxBeta=rand3*aBeta*crossSectionMajorantFunctionValue;
210 if(crossSectionValue < 0.0) { crossSectionValue = maxBeta; }
212 }
while(maxBeta > crossSectionValue || theta > CLHEP::pi);
221G4PhotoElectricAngularGeneratorPolarized::CrossSectionMajorantFunction(
225 G4double crossSectionMajorantFunctionValue = 0;
226 crossSectionMajorantFunctionValue = theta/(1+cBeta*theta*theta);
227 return crossSectionMajorantFunctionValue;
233G4PhotoElectricAngularGeneratorPolarized::DSigmaKshellGavrila1959(
240 G4double sqrtOneBeta2 = std::sqrt(oneBeta2);
241 G4double oneBeta2_to_3_2 = std::pow(oneBeta2,1.5);
242 G4double cosTheta = std::cos(theta);
243 G4double sinTheta2 = std::sin(theta)*std::sin(theta);
244 G4double cosPhi2 = std::cos(phi)*std::cos(phi);
245 G4double oneBetaCosTheta = 1-beta*cosTheta;
250 firstTerm = sinTheta2*cosPhi2/std::pow(oneBetaCosTheta,4)-(1 - sqrtOneBeta2)/(2*oneBeta2) *
251 (sinTheta2 * cosPhi2)/std::pow(oneBetaCosTheta,3) + (1-sqrtOneBeta2)*
252 (1-sqrtOneBeta2)/(4*oneBeta2_to_3_2) * sinTheta2/std::pow(oneBetaCosTheta,3);
254 secondTerm = std::sqrt(1 - sqrtOneBeta2)/(std::pow(2.,3.5)*beta2*std::pow(oneBetaCosTheta,2.5)) *
255 (4*beta2/sqrtOneBeta2 * sinTheta2*cosPhi2/oneBetaCosTheta + 4*beta/oneBeta2 * cosTheta * cosPhi2
256 - 4*(1-sqrtOneBeta2)/oneBeta2 *(1+cosPhi2) - beta2 * (1-sqrtOneBeta2)/oneBeta2 * sinTheta2/oneBetaCosTheta
257 + 4*beta2*(1-sqrtOneBeta2)/oneBeta2_to_3_2 - 4*beta*(1-sqrtOneBeta2)*(1-sqrtOneBeta2)/oneBeta2_to_3_2 * cosTheta)
258 + (1-sqrtOneBeta2)/(4*beta2*oneBetaCosTheta*oneBetaCosTheta) * (beta/oneBeta2 - 2/oneBeta2 * cosTheta * cosPhi2 +
259 (1-sqrtOneBeta2)/oneBeta2_to_3_2 * cosTheta - beta * (1-sqrtOneBeta2)/oneBeta2_to_3_2);
261 dsigma = ( firstTerm*(1-pi*fine_structure_const/beta) + secondTerm*(pi*fine_structure_const) )*std::sin(theta);
269G4PhotoElectricAngularGeneratorPolarized::DSigmaL1shellGavrila(
276 G4double sqrtOneBeta2 = std::sqrt(oneBeta2);
277 G4double oneBeta2_to_3_2=std::pow(oneBeta2,1.5);
278 G4double cosTheta = std::cos(theta);
279 G4double sinTheta2 =std::sin(theta)*std::sin(theta);
280 G4double cosPhi2 = std::cos(phi)*std::cos(phi);
281 G4double oneBetaCosTheta = 1-beta*cosTheta;
287 firstTerm = sinTheta2*cosPhi2/std::pow(oneBetaCosTheta,4)-(1 - sqrtOneBeta2)/(2*oneBeta2)
288 * (sinTheta2 * cosPhi2)/std::pow(oneBetaCosTheta,3) + (1-sqrtOneBeta2)*
289 (1-sqrtOneBeta2)/(4*oneBeta2_to_3_2) * sinTheta2/std::pow(oneBetaCosTheta,3);
291 secondTerm = std::sqrt(1 - sqrtOneBeta2)/(std::pow(2.,3.5)*beta2*std::pow(oneBetaCosTheta,2.5)) *
292 (4*beta2/sqrtOneBeta2 * sinTheta2*cosPhi2/oneBetaCosTheta + 4*beta/oneBeta2 * cosTheta * cosPhi2
293 - 4*(1-sqrtOneBeta2)/oneBeta2 *(1+cosPhi2) - beta2 * (1-sqrtOneBeta2)/oneBeta2 * sinTheta2/oneBetaCosTheta
294 + 4*beta2*(1-sqrtOneBeta2)/oneBeta2_to_3_2 - 4*beta*(1-sqrtOneBeta2)*(1-sqrtOneBeta2)/oneBeta2_to_3_2 * cosTheta)
295 + (1-sqrtOneBeta2)/(4*beta2*oneBetaCosTheta*oneBetaCosTheta) * (beta/oneBeta2 - 2/oneBeta2 * cosTheta * cosPhi2 +
296 (1-sqrtOneBeta2)/oneBeta2_to_3_2*cosTheta - beta*(1-sqrtOneBeta2)/oneBeta2_to_3_2);
298 dsigma = ( firstTerm*(1-pi*fine_structure_const/beta) + secondTerm*(pi*fine_structure_const) )*std::sin(theta) / 8.;
306G4PhotoElectricAngularGeneratorPolarized::PhotoElectronRotationMatrix(
315 if(!(polarization.
isOrthogonal(direction,kTolerance)) || mS == 0){
323 c.
setX(std::cos(angle)*(
a0.x())+std::sin(angle)*b0.
x());
324 c.
setY(std::cos(angle)*(
a0.y())+std::sin(angle)*b0.
y());
325 c.
setZ(std::cos(angle)*(
a0.z())+std::sin(angle)*b0.
z());
326 polarization2 = c.
unit();
327 mS = polarization2.
mag();
332 polarization2 = polarization
333 - polarization.
dot(direction)/direction.
dot(direction) * direction;
338 polarization2 = polarization2/mS;
349G4PhotoElectricAngularGeneratorPolarized::PhotoElectronGetMajorantSurfaceAandCParameters(
G4int shellId,
G4double beta,
G4double *majorantSurfaceParameterA,
G4double *majorantSurfaceParameterC)
const
357 if(shellId > 0) { level = 1; }
360 bStep = betaArray[1];
361 indexMax = (
G4int)betaArray[2];
372 aBeta = std::max(aMajorantSurfaceParameterTable[k][level],aMajorantSurfaceParameterTable[k+1][level]);
374 aBeta = std::max(aMajorantSurfaceParameterTable[k-1][level],aMajorantSurfaceParameterTable[k][level]);
376 aBeta = std::max(aMajorantSurfaceParameterTable[k-1][level],aMajorantSurfaceParameterTable[k][level]);
377 aBeta = std::max(aBeta,aMajorantSurfaceParameterTable[k+1][level]);
381 cBeta = std::max(cMajorantSurfaceParameterTable[k][level],cMajorantSurfaceParameterTable[k+1][level]);
382 else if(k == indexMax)
383 cBeta = std::max(cMajorantSurfaceParameterTable[k-1][level],cMajorantSurfaceParameterTable[k][level]);
385 cBeta = std::max(cMajorantSurfaceParameterTable[k-1][level],cMajorantSurfaceParameterTable[k][level]);
386 cBeta = std::max(cBeta,cMajorantSurfaceParameterTable[k+1][level]);
389 *majorantSurfaceParameterA = aBeta;
390 *majorantSurfaceParameterC = cBeta;
405 G4ThreeVector outgoingDirection = rotation*samplingDirection;
406 return outgoingDirection;
414 G4cout <<
"Polarized Photoelectric Angular Generator" <<
G4endl;
415 G4cout <<
"PhotoElectric Electron Angular Generator based on the general Gavrila photoelectron angular distribution" <<
G4endl;
416 G4cout <<
"Includes polarization effects for K and L1 atomic shells, according to Gavrilla (1959, 1961)." <<
G4endl;
417 G4cout <<
"For higher shells the L1 cross-section is used." <<
G4endl;
418 G4cout <<
"(see Physics Reference Manual) \n" <<
G4endl;
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
Hep3Vector cross(const Hep3Vector &) const
double dot(const Hep3Vector &) const
bool isOrthogonal(const Hep3Vector &v, double epsilon=tolerance) const
double howOrthogonal(const Hep3Vector &v) const
const G4ThreeVector & GetMomentumDirection() const
const G4ThreeVector & GetPolarization() const
G4ThreeVector PerpendicularVector(const G4ThreeVector &a) const
void PrintGeneratorInformation() const override
G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double eKinEnergy, G4int shellId, const G4Material *mat=nullptr) override
~G4PhotoElectricAngularGeneratorPolarized()
G4PhotoElectricAngularGeneratorPolarized()
G4ThreeVector fLocalDirection