Import Geant4 11.2.1 source tree

This commit is contained in:
Gabriele Cosmo
2024-02-16 14:58:45 +01:00
parent 860a2b92bf
commit dda54bbdcf
331 changed files with 48457 additions and 50699 deletions
@@ -60,9 +60,9 @@ void G4GaussXTRadiator::ProcessDescription(std::ostream& out) const
///////////////////////////////////////////////////////////////////////////
//
// The Fabian-Strujinsky (FS) algorithm for integration over XTR angle,
// resolution is about 0.5 mrad
// resolution is about 0.1-0.5 mrad
G4double G4GaussXTRadiator::SpectralXTRdEdxFS(G4double energy)
G4double G4GaussXTRadiator::SpectralXTRdEdx(G4double energy)
{
G4double result, sum = 0., tmp, cof1, cof2, cofMin, cofPHC, theta2, theta2k;
G4int k, kMax, kMin;
@@ -82,7 +82,7 @@ G4double G4GaussXTRadiator::SpectralXTRdEdxFS(G4double energy)
if(cofMin > kMin)
kMin++;
kMax = kMin + 49;
kMax = kMin + fKrange;
if(verboseLevel > 2)
{
@@ -130,88 +130,27 @@ G4double G4GaussXTRadiator::GetStackFactor(G4double energy,
G4double gamma,
G4double varAngle)
{
G4double result, Qa, Qb, Q, Qn, aZa, bZb, aMa, bMb;
G4double Ma, Mb, Za, Zb;
G4double result(0.);
G4double sa = fPlateThick/fAlphaPlate;
G4double sb = fGasThick/fAlphaGas;
Za = GetPlateFormationZone(energy, gamma, varAngle);
aZa = fPlateThick / Za ;
Zb = GetGasFormationZone(energy, gamma, varAngle);
bZb = fGasThick / Zb ;
Ma = GetPlateLinearPhotoAbs(energy);
aMa = fPlateThick * Ma;
Mb = GetGasLinearPhotoAbs(energy);
bMb = fGasThick * Mb;
// Gauss fluctuation of gas gaps according to RMS = sb = b/fAlphaGas
G4double gre, gim, pre, pim;
pre = -0.5 * aMa - sa * sa * ( 4./ Za / Za - Ma*Ma )/8.;
gre = -0.5 * bMb - sb * sb * ( 4./ Zb / Zb - Mb*Mb )/8.;
pim = sa * sa * Ma/2./Za - aZa;
gim = sb * sb * Mb/2./Zb - bZb;
Qa = std::exp(pre);
Qb = std::exp(gre);
// Q = Qa * Qb;
G4complex Ha( Qa * std::cos(pim), Qa * std::sin(pim) );
G4complex Hb( Qb * std::cos(gim), Qb * std::sin(gim) );
G4double hre, him, hnre, hnim;
hre = pre + gre;
him = pim + gim;
G4double nn = G4double(fPlateNumber);
hnre = nn*hre;
hnim = nn*him;
G4complex med( 0., 1.);
G4complex Z1 = GetPlateComplexFZ( energy, gamma, varAngle);
G4complex order1 = -0.5*med*fPlateThick/Z1 - 0.125*sa*sa/Z1/Z1;
Q = std::exp(hre);
Qn = std::exp(hnre);
// G4complex H = Ha * Hb;
G4complex Z2 = GetGasComplexFZ( energy, gamma, varAngle);
G4complex order2 = -0.5*med*fGasThick/Z2 - 0.125*sb*sb/Z2/Z2;
G4complex ordernn = ( order1 + order2 )*nn;
G4complex H( Q * std::cos(him), Q * std::sin(him) );
G4complex Hn( Qn * std::cos(hnim), Qn * std::sin(hnim) );
// G4complex Hs = conj(H);
// G4double sigma, D;
// sigma = aMa * fPlateThick + bMb * fGasThick;
// D = 1.0 / ((1 - Q) * (1 - Q) + 4 * Q * std::sin(0.5 * (aZa + bZb)) * std::sin(0.5 * (aZa + bZb)));
// G4complex F1 = ( 1.0 - Ha ) * ( 1.0 - Hb ) * ( 1.0 - Hs ) * G4double(fPlateNumber) * D;
G4complex Ha = exp( order1 );
G4complex Hb = exp( order2 );
G4complex H = Ha * Hb;
G4complex Hn = exp( ordernn );
G4complex F1 = ( 1.0 - Ha ) * ( 1.0 - Hb ) * nn / ( 1. - H );
// G4complex F2 = ( 1.0 - Ha ) * ( 1.0 - Ha ) * Hb * ( 1.0 - Hs ) * ( 1.0 - Hs ) * (1.0 - std::exp( -0.5 * fPlateNumber * sigma) ) * D * D;
G4complex F2 = ( 1.0 - Ha ) * ( 1.0 - Ha ) * Hb * ( 1. - Hn ) / ( 1. - H ) / ( 1. - H );
G4complex R = (F1 + F2) * OneInterfaceXTRdEdx(energy, gamma, varAngle);
@@ -639,21 +639,16 @@ G4double G4Scintillation::sample_time(G4double tau1, G4double tau2)
{
// tau1: rise time and tau2: decay time
// Loop checking, 07-Aug-2015, Vladimir Ivanchenko
while(true)
{
G4double ran1 = G4UniformRand();
G4double ran2 = G4UniformRand();
G4double t;
// exponential distribution as envelope function: very efficient
G4double d = (tau1 + tau2) / tau2;
// make sure the envelope function is
// always larger than the bi-exponential
G4double t = -1.0 * tau2 * std::log(1. - ran1);
G4double gg = d * single_exp(t, tau2);
if(ran2 <= bi_exp(t, tau1, tau2) / gg)
return t;
do
{
// The exponential distribution as an envelope function: very efficient
t = -1.0 * tau2 * G4Log(1.0 - G4UniformRand());
}
return -1.0;
while (G4UniformRand() > (1.0 - G4Exp(-t/tau1)));
return t;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -87,8 +87,8 @@ G4VXTRenergyLoss::G4VXTRenergyLoss(G4LogicalVolume* anEnvelope,
fTheMaxAngle = 4.e-4;
fTotBin = 50; // number of bins in log scale
fBinTR = 100; // number of bins in TR vectors
fBinTR = 100; // number of bins in TR vectors
fKrange = 229;
// min/max angle2 in log-vectors
fMinThetaTR = 3.0e-9;