74 const G4int arrayDim = 980;
81 betaArray[2] = arrayDim - 1;
84 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;
93 char* path = getenv(
"G4LEDATA");
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",
114 G4float aRead=0,cRead=0, beta=0;
115 for(
G4int i=0 ; i<arrayDim ;i++){
117 infile >> beta >> aRead >> cRead;
118 aMajorantSurfaceParameterTable[i][level] = aRead;
119 cMajorantSurfaceParameterTable[i][level] = cRead;
140 G4double beta = std::sqrt((gamma - 1)*(gamma + 1))/gamma;
153 PhotoElectronGetMajorantSurfaceAandCParameters(shellId, beta, &aBeta, &cBeta);
157 PhotoElectronGeneratePhiAndTheta(shellId, beta, aBeta, cBeta, &phi, &theta);
161 PhotoElectronRotationMatrix(direction, polarization);
164 fLocalDirection = PhotoElectronComputeFinalDirection(rotation, theta, phi);
170 G4PhotoElectricAngularGeneratorPolarized::PhotoElectronGeneratePhiAndTheta(
178 G4double crossSectionMajorantFunctionValue = 0;
195 theta=std::sqrt(((
G4Exp(rand2*std::log(1+cBeta*
pi*
pi)))-1)/cBeta);
196 crossSectionMajorantFunctionValue =
197 CrossSectionMajorantFunction(theta, cBeta);
198 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);
210 maxBeta=rand3*aBeta*crossSectionMajorantFunctionValue;
213 if(crossSectionValue < 0.0) { crossSectionValue = maxBeta; }
215 }
while(maxBeta > crossSectionValue || theta >
CLHEP::pi);
222 G4PhotoElectricAngularGeneratorPolarized::CrossSectionMajorantFunction(
226 G4double crossSectionMajorantFunctionValue = 0;
227 crossSectionMajorantFunctionValue = theta/(1+cBeta*theta*theta);
228 return crossSectionMajorantFunctionValue;
232 G4PhotoElectricAngularGeneratorPolarized::DSigmaKshellGavrila1959(
239 G4double sqrtOneBeta2 = std::sqrt(oneBeta2);
240 G4double oneBeta2_to_3_2 = std::pow(oneBeta2,1.5);
241 G4double cosTheta = std::cos(theta);
242 G4double sinTheta2 = std::sin(theta)*std::sin(theta);
243 G4double cosPhi2 = std::cos(phi)*std::cos(phi);
244 G4double oneBetaCosTheta = 1-beta*cosTheta;
249 firstTerm = sinTheta2*cosPhi2/std::pow(oneBetaCosTheta,4)-(1 - sqrtOneBeta2)/(2*oneBeta2) *
250 (sinTheta2 * cosPhi2)/std::pow(oneBetaCosTheta,3) + (1-sqrtOneBeta2)*
251 (1-sqrtOneBeta2)/(4*oneBeta2_to_3_2) * sinTheta2/std::pow(oneBetaCosTheta,3);
253 secondTerm = std::sqrt(1 - sqrtOneBeta2)/(std::pow(2.,3.5)*beta2*std::pow(oneBetaCosTheta,2.5)) *
254 (4*beta2/sqrtOneBeta2 * sinTheta2*cosPhi2/oneBetaCosTheta + 4*beta/oneBeta2 * cosTheta * cosPhi2
255 - 4*(1-sqrtOneBeta2)/oneBeta2 *(1+cosPhi2) - beta2 * (1-sqrtOneBeta2)/oneBeta2 * sinTheta2/oneBetaCosTheta
256 + 4*beta2*(1-sqrtOneBeta2)/oneBeta2_to_3_2 - 4*beta*(1-sqrtOneBeta2)*(1-sqrtOneBeta2)/oneBeta2_to_3_2 * cosTheta)
257 + (1-sqrtOneBeta2)/(4*beta2*oneBetaCosTheta*oneBetaCosTheta) * (beta/oneBeta2 - 2/oneBeta2 * cosTheta * cosPhi2 +
258 (1-sqrtOneBeta2)/oneBeta2_to_3_2 * cosTheta - beta * (1-sqrtOneBeta2)/oneBeta2_to_3_2);
268 G4PhotoElectricAngularGeneratorPolarized::DSigmaL1shellGavrila(
275 G4double sqrtOneBeta2 = std::sqrt(oneBeta2);
276 G4double oneBeta2_to_3_2=std::pow(oneBeta2,1.5);
277 G4double cosTheta = std::cos(theta);
278 G4double sinTheta2 =std::sin(theta)*std::sin(theta);
279 G4double cosPhi2 = std::cos(phi)*std::cos(phi);
280 G4double oneBetaCosTheta = 1-beta*cosTheta;
286 firstTerm = sinTheta2*cosPhi2/std::pow(oneBetaCosTheta,4)-(1 - sqrtOneBeta2)/(2*oneBeta2)
287 * (sinTheta2 * cosPhi2)/std::pow(oneBetaCosTheta,3) + (1-sqrtOneBeta2)*
288 (1-sqrtOneBeta2)/(4*oneBeta2_to_3_2) * sinTheta2/std::pow(oneBetaCosTheta,3);
290 secondTerm = std::sqrt(1 - sqrtOneBeta2)/(std::pow(2.,3.5)*beta2*std::pow(oneBetaCosTheta,2.5)) *
291 (4*beta2/sqrtOneBeta2 * sinTheta2*cosPhi2/oneBetaCosTheta + 4*beta/oneBeta2 * cosTheta * cosPhi2
292 - 4*(1-sqrtOneBeta2)/oneBeta2 *(1+cosPhi2) - beta2 * (1-sqrtOneBeta2)/oneBeta2 * sinTheta2/oneBetaCosTheta
293 + 4*beta2*(1-sqrtOneBeta2)/oneBeta2_to_3_2 - 4*beta*(1-sqrtOneBeta2)*(1-sqrtOneBeta2)/oneBeta2_to_3_2 * cosTheta)
294 + (1-sqrtOneBeta2)/(4*beta2*oneBetaCosTheta*oneBetaCosTheta) * (beta/oneBeta2 - 2/oneBeta2 * cosTheta * cosPhi2 +
295 (1-sqrtOneBeta2)/oneBeta2_to_3_2*cosTheta - beta*(1-sqrtOneBeta2)/oneBeta2_to_3_2);
303 G4PhotoElectricAngularGeneratorPolarized::PhotoElectronRotationMatrix(
312 if(!(polarization.
isOrthogonal(direction,kTolerance)) || mS == 0){
320 c.
setX(std::cos(angle)*(a0.
x())+std::sin(angle)*b0.
x());
321 c.
setY(std::cos(angle)*(a0.
y())+std::sin(angle)*b0.
y());
322 c.
setZ(std::cos(angle)*(a0.
z())+std::sin(angle)*b0.
z());
323 polarization2 = c.
unit();
324 mS = polarization2.
mag();
329 polarization2 = polarization
330 - polarization.
dot(direction)/direction.
dot(direction) * direction;
335 polarization2 = polarization2/mS;
344 G4PhotoElectricAngularGeneratorPolarized::PhotoElectronGetMajorantSurfaceAandCParameters(
G4int shellId,
G4double beta,
G4double *majorantSurfaceParameterA,
G4double *majorantSurfaceParameterC)
const
353 if(shellId > 0) { level = 1; }
356 bStep = betaArray[1];
357 indexMax = (
G4int)betaArray[2];
368 aBeta =
std::max(aMajorantSurfaceParameterTable[k][level],aMajorantSurfaceParameterTable[k+1][level]);
370 aBeta =
std::max(aMajorantSurfaceParameterTable[k-1][level],aMajorantSurfaceParameterTable[k][level]);
372 aBeta =
std::max(aMajorantSurfaceParameterTable[k-1][level],aMajorantSurfaceParameterTable[k][level]);
373 aBeta =
std::max(aBeta,aMajorantSurfaceParameterTable[k+1][level]);
377 cBeta =
std::max(cMajorantSurfaceParameterTable[k][level],cMajorantSurfaceParameterTable[k+1][level]);
378 else if(k == indexMax)
379 cBeta =
std::max(cMajorantSurfaceParameterTable[k-1][level],cMajorantSurfaceParameterTable[k][level]);
381 cBeta =
std::max(cMajorantSurfaceParameterTable[k-1][level],cMajorantSurfaceParameterTable[k][level]);
382 cBeta =
std::max(cBeta,cMajorantSurfaceParameterTable[k+1][level]);
385 *majorantSurfaceParameterA = aBeta;
386 *majorantSurfaceParameterC = cBeta;
399 G4ThreeVector outgoingDirection = rotation*samplingDirection;
400 return outgoingDirection;
406 G4cout <<
"Polarized Photoelectric Angular Generator" <<
G4endl;
407 G4cout <<
"PhotoElectric Electron Angular Generator based on the general Gavrila photoelectron angular distribution" <<
G4endl;
408 G4cout <<
"Includes polarization effects for K and L1 atomic shells, according to Gavrilla (1959, 1961)." <<
G4endl;
409 G4cout <<
"For higher shells the L1 cross-section is used." <<
G4endl;
410 G4cout <<
"(see Physics Reference Manual) \n" <<
G4endl;
CLHEP::Hep3Vector G4ThreeVector
double dot(const Hep3Vector &) const
static G4double angle[DIM]
bool isOrthogonal(const Hep3Vector &v, double epsilon=tolerance) const
virtual G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double eKinEnergy, G4int shellId, const G4Material *mat=0)
double howOrthogonal(const Hep3Vector &v) const
static constexpr double twopi
static constexpr double electron_mass_c2
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4ThreeVector PerpendicularVector(const G4ThreeVector &a) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
const G4ThreeVector & GetPolarization() const
static constexpr double pi
~G4PhotoElectricAngularGeneratorPolarized()
Hep3Vector cross(const Hep3Vector &) const
G4ThreeVector fLocalDirection
G4PhotoElectricAngularGeneratorPolarized()
static constexpr double fine_structure_const
void PrintGeneratorInformation() const
static constexpr double pi