Import Geant4 11.2.0 source tree
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4Log.hh"
|
||||
|
||||
G4BaierKatkov::G4BaierKatkov()
|
||||
{
|
||||
@@ -40,6 +41,10 @@ G4BaierKatkov::G4BaierKatkov()
|
||||
//Do not worry if the maximal energy > particle energy
|
||||
//this elements of spectrum with non-physical energies
|
||||
//will not be processed (they will be 0)
|
||||
|
||||
G4cout << " "<< G4endl;
|
||||
G4cout << "G4BaierKatkov model is activated."<< G4endl;
|
||||
G4cout << " "<< G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -106,7 +111,7 @@ void G4BaierKatkov::SetSpectrumEnergyRange(G4double emin,
|
||||
fMaxPhotonEnergy = emax;
|
||||
fNBinsSpectrum = numberOfBins;
|
||||
|
||||
fLogEmaxdEmin = std::log(fMaxPhotonEnergy/fMinPhotonEnergy);
|
||||
fLogEmaxdEmin = G4Log(fMaxPhotonEnergy/fMinPhotonEnergy);
|
||||
|
||||
//in initializing fNPhotonsPerBin
|
||||
fNPhotonsPerBin.resize(fNBinsSpectrum);
|
||||
@@ -140,13 +145,100 @@ void G4BaierKatkov::SetSpectrumEnergyRange(G4double emin,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4BaierKatkov::AddStatisticsInPhotonEnergyRegion(G4double emin,
|
||||
G4double emax,
|
||||
G4int timesPhotonStatistics)
|
||||
{
|
||||
|
||||
if(timesPhotonStatistics<=1)
|
||||
{
|
||||
G4cout << "G4BaierKatkov model, "
|
||||
"function AddStatisticsInPhotonEnergyRegion("
|
||||
<< emin/CLHEP::MeV << " MeV, "
|
||||
<< emax/CLHEP::MeV << " MeV, "
|
||||
<< timesPhotonStatistics << ")" << G4endl;
|
||||
G4cout << "Warning: the statistics factor cannot be <=1." << G4endl;
|
||||
G4cout << "The statistics was not added." << G4endl;
|
||||
G4cout << " "<< G4endl;
|
||||
}
|
||||
else if(fMinPhotonEnergy>emin)
|
||||
{
|
||||
G4cout << "G4BaierKatkov model, "
|
||||
"function AddStatisticsInPhotonEnergyRegion("
|
||||
<< emin/CLHEP::MeV << " MeV, "
|
||||
<< emax/CLHEP::MeV << " MeV, "
|
||||
<< timesPhotonStatistics << ")" << G4endl;
|
||||
G4cout << "Warning: the minimal energy inserted is less then "
|
||||
"the minimal energy cut of the spectrum: "
|
||||
<< fMinPhotonEnergy/CLHEP::MeV << " MeV." << G4endl;
|
||||
G4cout << "The statistics was not added." << G4endl;
|
||||
G4cout << " "<< G4endl;
|
||||
}
|
||||
else if(emax-emin<DBL_EPSILON)
|
||||
{
|
||||
G4cout << "G4BaierKatkov model, "
|
||||
"function AddStatisticsInPhotonEnergyRegion("
|
||||
<< emin/CLHEP::MeV << " MeV, "
|
||||
<< emax/CLHEP::MeV << " MeV, "
|
||||
<< timesPhotonStatistics << ")" << G4endl;
|
||||
G4cout << "Warning: the maximal energy <= the minimal energy." << G4endl;
|
||||
G4cout << "The statistics was not added." << G4endl;
|
||||
G4cout << " "<< G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4bool setrange = true;
|
||||
G4double logAddRangeEmindEmin = G4Log(emin/fMinPhotonEnergy);
|
||||
G4double logAddRangeEmaxdEmin = G4Log(emax/fMinPhotonEnergy);
|
||||
|
||||
G4int nAddRange = (G4int)fTimesPhotonStatistics.size();
|
||||
for (G4int j=0;j<nAddRange;j++)
|
||||
{
|
||||
if((logAddRangeEmindEmin>=fLogAddRangeEmindEmin[j]&&
|
||||
logAddRangeEmindEmin< fLogAddRangeEmaxdEmin[j])||
|
||||
(logAddRangeEmaxdEmin> fLogAddRangeEmindEmin[j]&&
|
||||
logAddRangeEmaxdEmin<=fLogAddRangeEmaxdEmin[j])||
|
||||
(logAddRangeEmindEmin<=fLogAddRangeEmindEmin[j]&&
|
||||
logAddRangeEmaxdEmin>=fLogAddRangeEmaxdEmin[j]))
|
||||
{
|
||||
G4cout << "G4BaierKatkov model, "
|
||||
"function AddStatisticsInPhotonEnergyRegion("
|
||||
<< emin/CLHEP::MeV << " MeV, "
|
||||
<< emax/CLHEP::MeV << " MeV, "
|
||||
<< timesPhotonStatistics << ")" << G4endl;
|
||||
G4cout << "Warning: the energy range intersects another "
|
||||
"added energy range." << G4endl;
|
||||
G4cout << "The statistics was not added." << G4endl;
|
||||
G4cout << " "<< G4endl;
|
||||
setrange = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (setrange)
|
||||
{
|
||||
fLogAddRangeEmindEmin.push_back(logAddRangeEmindEmin);
|
||||
fLogAddRangeEmaxdEmin.push_back(logAddRangeEmaxdEmin);
|
||||
fTimesPhotonStatistics.push_back(timesPhotonStatistics);
|
||||
|
||||
G4cout << "G4BaierKatkov model: increasing the statistics of photon sampling "
|
||||
"in Baier-Katkov with a factor of "
|
||||
<< timesPhotonStatistics << G4endl;
|
||||
G4cout << "in the energy spectrum range: ("
|
||||
<< emin/CLHEP::MeV << " MeV, "
|
||||
<< emax/CLHEP::MeV << " MeV)" << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4BaierKatkov::SetPhotonSamplingParameters(G4double ekin,
|
||||
G4double minPhotonAngleX,
|
||||
G4double maxPhotonAngleX,
|
||||
G4double minPhotonAngleY,
|
||||
G4double maxPhotonAngleY)
|
||||
{
|
||||
fLogEdEmin = std::log(ekin/fMinPhotonEnergy);
|
||||
fLogEdEmin = G4Log(ekin/fMinPhotonEnergy);
|
||||
fMeanPhotonAngleX = (maxPhotonAngleX+minPhotonAngleX)/2.;
|
||||
fParamPhotonAngleX = (maxPhotonAngleX-minPhotonAngleX)/2.;
|
||||
fMeanPhotonAngleY = (maxPhotonAngleY+minPhotonAngleY)/2.;
|
||||
@@ -161,28 +253,77 @@ void G4BaierKatkov::GeneratePhotonSampling()
|
||||
fPhotonAngleInIntegralX.clear();
|
||||
fPhotonAngleInIntegralY.clear();
|
||||
fPhotonAngleNormCoef.clear();
|
||||
fInsideVirtualCollimator.clear();
|
||||
fIBinsSpectrum.clear();
|
||||
|
||||
G4double ksi=0.;
|
||||
G4double rho=1.;
|
||||
G4double rhocut=15.;//radial angular cut of the distribution
|
||||
G4double norm=std::atan(rhocut*rhocut)*
|
||||
CLHEP::pi*fParamPhotonAngleX*fParamPhotonAngleY;
|
||||
std::vector<G4int> moreStatistics;
|
||||
moreStatistics.resize(fTimesPhotonStatistics.size());
|
||||
std::fill(moreStatistics.begin(), moreStatistics.end(), 0);
|
||||
G4int nAddRange = (G4int)fTimesPhotonStatistics.size();
|
||||
|
||||
//sampling of the energy and the angles of a photon emission
|
||||
//sampling of the energy of a photon emission
|
||||
//(integration variables, Monte Carlo integration)
|
||||
for (G4int j=0;j<fNMCPhotons;j++)
|
||||
{
|
||||
ksi = G4UniformRand();
|
||||
ksi = G4UniformRand()*fLogEdEmin;
|
||||
fIBinsSpectrum.push_back((G4int)std::trunc(
|
||||
ksi*fNBinsSpectrum*fLogEdEmin/fLogEmaxdEmin));
|
||||
ksi*fNBinsSpectrum/fLogEmaxdEmin));
|
||||
//we consider also the energy outside the spectrum output range
|
||||
//(E>Emax => fLogEdEmin>fLogEmaxdEmin)
|
||||
//in this case we don't count the photon in the spectrum output
|
||||
if(fIBinsSpectrum[j]<fNBinsSpectrum) {fNPhotonsPerBin[fIBinsSpectrum[j]]+=1;}
|
||||
|
||||
fPhotonEnergyInIntegral.push_back(fMinPhotonEnergy*std::exp(fLogEdEmin*ksi));
|
||||
fPhotonEnergyInIntegral.push_back(fMinPhotonEnergy*std::exp(ksi));
|
||||
|
||||
fPhotonAngleNormCoef.push_back(1.);
|
||||
|
||||
for (G4int j2=0;j2<nAddRange;j2++)
|
||||
{
|
||||
if(ksi>fLogAddRangeEmindEmin[j2]&&
|
||||
ksi<fLogAddRangeEmaxdEmin[j2])
|
||||
{
|
||||
//calculating the current statistics in this region
|
||||
//to increase it proportionally
|
||||
moreStatistics[j2]+=1;
|
||||
fPhotonAngleNormCoef[j]/=fTimesPhotonStatistics[j2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (G4int j2=0;j2<nAddRange;j2++)
|
||||
{
|
||||
G4int totalAddRangeStatistics = moreStatistics[j2]*fTimesPhotonStatistics[j2];
|
||||
for (G4int j=moreStatistics[j2];j<totalAddRangeStatistics;j++)
|
||||
{
|
||||
ksi = fLogAddRangeEmindEmin[j2]+
|
||||
G4UniformRand()*(std::min(fLogAddRangeEmaxdEmin[j2],fLogEdEmin)-
|
||||
fLogAddRangeEmindEmin[j2]);
|
||||
fIBinsSpectrum.push_back((G4int)std::trunc(
|
||||
ksi*fNBinsSpectrum/fLogEmaxdEmin));
|
||||
/* //we consider also the energy outside the spectrum output range
|
||||
//(E>Emax => fLogEdEmin>fLogEmaxdEmin)
|
||||
//in this case we don't count the photon in the spectrum output
|
||||
if(fIBinsSpectrum.back()<fNBinsSpectrum)
|
||||
{fNPhotonsPerBin[fIBinsSpectrum.back()]+=1;}*/
|
||||
|
||||
fPhotonEnergyInIntegral.push_back(fMinPhotonEnergy*std::exp(ksi));
|
||||
|
||||
fPhotonAngleNormCoef.push_back(1./fTimesPhotonStatistics[j2]);
|
||||
}
|
||||
}
|
||||
|
||||
G4double rho=1.;
|
||||
const G4double rhocut=15.;//radial angular cut of the distribution
|
||||
G4double norm=std::atan(rhocut*rhocut)*
|
||||
CLHEP::pi*fParamPhotonAngleX*fParamPhotonAngleY;
|
||||
|
||||
//sampling of the angles of a photon emission
|
||||
//(integration variables, Monte Carlo integration)
|
||||
G4int nmctotal = (G4int)fPhotonEnergyInIntegral.size();
|
||||
for (G4int j=0;j<nmctotal;j++)
|
||||
{
|
||||
//photon distribution with long tails (useful to not exclude particle angles
|
||||
//after a strong single scattering)
|
||||
//at ellipsescale < 1 => half of statistics of photons
|
||||
@@ -199,11 +340,40 @@ void G4BaierKatkov::GeneratePhotonSampling()
|
||||
fPhotonAngleInIntegralY.push_back(fMeanPhotonAngleY+
|
||||
fParamPhotonAngleY*
|
||||
rho*std::sin(CLHEP::twopi*ksi));
|
||||
fPhotonAngleNormCoef.push_back((1.+rho*rho*rho*rho)*norm);
|
||||
fPhotonAngleNormCoef[j]*=(1.+rho*rho*rho*rho)*norm;
|
||||
|
||||
//test if the photon with these angles enter the virtual collimator
|
||||
//(doesn't influence the Geant4 simulations,
|
||||
//but only the accumulation of fTotalSpectrum
|
||||
fInsideVirtualCollimator.push_back(fVirtualCollimatorAngularDiameter >
|
||||
std::sqrt(fPhotonAngleInIntegralX[j]*
|
||||
fPhotonAngleInIntegralX[j]+
|
||||
fPhotonAngleInIntegralY[j]*
|
||||
fPhotonAngleInIntegralY[j]));
|
||||
}
|
||||
//reinitialize the vector of radiation CDF for each photon
|
||||
fPhotonProductionCDF.resize(fNMCPhotons+1);// 0 element is equal to 0
|
||||
fPhotonProductionCDF.resize(nmctotal+1);//0 element equal to 0
|
||||
std::fill(fPhotonProductionCDF.begin(), fPhotonProductionCDF.end(), 0.);
|
||||
|
||||
//if we have additional photons
|
||||
if (nmctotal>fNMCPhotons)
|
||||
{
|
||||
//reinitialize intermediate integrals with zeros again
|
||||
fFa.resize(nmctotal);
|
||||
fSs.resize(nmctotal);
|
||||
fSc.resize(nmctotal);
|
||||
fSsx.resize(nmctotal);
|
||||
fSsy.resize(nmctotal);
|
||||
fScx.resize(nmctotal);
|
||||
fScy.resize(nmctotal);
|
||||
std::fill(fFa.begin(), fFa.end(), 0.);
|
||||
std::fill(fSs.begin(), fSs.end(), 0.);
|
||||
std::fill(fSc.begin(), fSc.end(), 0.);
|
||||
std::fill(fSsx.begin(), fSsx.end(), 0.);
|
||||
std::fill(fSsy.begin(), fSsy.end(), 0.);
|
||||
std::fill(fScx.begin(), fScx.end(), 0.);
|
||||
std::fill(fScy.begin(), fScy.end(), 0.);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -270,13 +440,17 @@ G4double G4BaierKatkov::RadIntegral(G4double etotal, G4double mass,
|
||||
G4double e2 = etotal*etotal;
|
||||
G4double gammaInverse2 = mass*mass/(etotal*etotal);// 1/gamma^2 of
|
||||
//the radiating charge particle
|
||||
G4double coefNormLogdNMC = fLogEdEmin/fNMCPhotons;
|
||||
G4double coefNormLogdNMC = fLogEdEmin/fNMCPhotons;//here fNMCPhotons is correct,
|
||||
//additional photons have been already
|
||||
//taken into account in weights
|
||||
G4double coefNorm = CLHEP::fine_structure_const/(8*(CLHEP::pi2))*coefNormLogdNMC;
|
||||
G4double e2pluseprime2 = 0.;//e2pluseprime2 =e2+eprime2
|
||||
G4double coefNormom2deprime2 = 0.; //coefNormom2deprime2 = coefNorm*om2/eprime2;
|
||||
G4double gammaInverse2om = 0.; //gammaInverse2*om
|
||||
|
||||
for (G4int j=0;j<fNMCPhotons;j++)
|
||||
std::size_t nmctotal = fPhotonEnergyInIntegral.size();
|
||||
for (std::size_t j=0;j<nmctotal;j++)
|
||||
//the final number of photons may be different from fNMCPhotons
|
||||
{
|
||||
om = fPhotonEnergyInIntegral[j];
|
||||
eprime=etotal-om; //E'=E-omega
|
||||
@@ -342,7 +516,8 @@ G4double G4BaierKatkov::RadIntegral(G4double etotal, G4double mass,
|
||||
//we consider also the energy outside the spectrum output range
|
||||
//(E>Emax => fLogEdEmin>fLogEmaxdEmin)
|
||||
//in this case we don't count the photon in the spectrum output
|
||||
if(fIBinsSpectrum[j]<fNBinsSpectrum)
|
||||
//we fill the spectrum only in case of the angles inside the virtual collimator
|
||||
if((fIBinsSpectrum[j]<fNBinsSpectrum)&&fInsideVirtualCollimator[j])
|
||||
{fSpectrum[fIBinsSpectrum[j]] += totalRadiationProbabilityPhj/
|
||||
(om*coefNormLogdNMC);}
|
||||
|
||||
@@ -381,13 +556,15 @@ G4bool G4BaierKatkov::SetPhotonProductionParameters(G4double etotal, G4double ma
|
||||
//Generally ksi = G4UniformRand() is ok, but
|
||||
//we use as a correction for the case
|
||||
//when the radiation probability becomes too high (> 0.1)
|
||||
G4double ksi = -std::log(G4UniformRand());
|
||||
G4double ksi = -G4Log(G4UniformRand());
|
||||
|
||||
if (ksi< fTotalRadiationProbabilityAlongTrajectory.back()) // photon produced
|
||||
{
|
||||
G4double ksi1 = G4UniformRand()*fTotalRadiationProbabilityAlongTrajectory.back();
|
||||
|
||||
//randomly choosing the photon to be produced from the sampling list
|
||||
//according to the probabilities calculated in the Baier-Katkov integral
|
||||
G4int iphoton = FindVectorIndex(fPhotonProductionCDF,ksi)-1;//index of
|
||||
G4int iphoton = FindVectorIndex(fPhotonProductionCDF,ksi1)-1;//index of
|
||||
//a photon produced
|
||||
|
||||
//energy of the photon produced
|
||||
@@ -406,7 +583,7 @@ G4bool G4BaierKatkov::SetPhotonProductionParameters(G4double etotal, G4double ma
|
||||
momentumDirectionZ);
|
||||
|
||||
//random calculation of the radiation point index (iNode)
|
||||
ksi = G4UniformRand()*fTotalRadiationProbabilityAlongTrajectory.back();
|
||||
//ksi = G4UniformRand()*fTotalRadiationProbabilityAlongTrajectory.back();
|
||||
|
||||
//sort fTotalRadiationProbabilityAlongTrajectory
|
||||
//(increasing but oscillating function => non-monotonic)
|
||||
@@ -524,8 +701,8 @@ G4bool G4BaierKatkov::DoRadiation(G4double etotal, G4double mass,
|
||||
//set the angular limits at the start of the trajectory part
|
||||
if(fImin0==0)
|
||||
{
|
||||
//radiation within the angle = +-4/gamma ("4" - just an empirical number)
|
||||
G4double radiationAngleLimit=4*mass/etotal;
|
||||
//radiation within the angle = +-fRadiationAngleFactor/gamma
|
||||
G4double radiationAngleLimit=fRadiationAngleFactor*mass/etotal;
|
||||
|
||||
SetPhotonSamplingParameters(etotal-mass,
|
||||
*std::min_element(fParticleAnglesX.begin(),
|
||||
@@ -558,9 +735,11 @@ G4bool G4BaierKatkov::DoRadiation(G4double etotal, G4double mass,
|
||||
if(fTotalRadiationProbability>fSinglePhotonRadiationProbabilityLimit||
|
||||
flagEndTrajectory)
|
||||
{
|
||||
fItrajectories += 1; //count this trajectory !!!correction 19.07.2023
|
||||
|
||||
flagPhotonProduced = SetPhotonProductionParameters(etotal,mass);
|
||||
|
||||
fItrajectories += 1; //count this trajectory
|
||||
// correction 19.07.2023 fItrajectories += 1; //count this trajectory
|
||||
|
||||
//reinitialize intermediate integrals fFa, fSs, fSc, fSsx, fSsy, fScx, fScy;
|
||||
//reset radiation integral internal variables to defaults;
|
||||
|
||||
@@ -129,7 +129,8 @@ void G4ChannelingFastSimCrystalData::SetMaterialProperties(const G4Material *cry
|
||||
fVmax2=2.*fVmax;
|
||||
|
||||
//read the on-zero minimal potential inside the crystal,
|
||||
//necessary for angle recalculation for entrance/exit through the crystal lateral surface
|
||||
//necessary for angle recalculation for entrance/exit through
|
||||
//the crystal lateral surface
|
||||
vfilein >> fVMinCrystal;
|
||||
fVMinCrystal*=eV;
|
||||
|
||||
@@ -316,6 +317,9 @@ G4ThreeVector G4ChannelingFastSimCrystalData::CoordinatesFromBoxToLattice
|
||||
x = x0*fCosMiscutAngle - z0*fSinMiscutAngle;
|
||||
y = y0;
|
||||
z = x0*fSinMiscutAngle + z0*fCosMiscutAngle;
|
||||
|
||||
//for crystalline undulator
|
||||
if(fCU){x-=GetCUx(z);}
|
||||
}
|
||||
|
||||
//calculation of coordinates within a channel (periodic cell)
|
||||
@@ -358,6 +362,9 @@ G4ThreeVector G4ChannelingFastSimCrystalData::CoordinatesFromLatticeToBox(
|
||||
}
|
||||
else
|
||||
{
|
||||
//for crystalline undulator
|
||||
if(fCU){x+=GetCUx(z);}
|
||||
|
||||
//for straight crystal
|
||||
x0 = x*fCosMiscutAngle + z*fSinMiscutAngle;
|
||||
y0 = y;
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ChannelingFastSimModel::G4ChannelingFastSimModel(const G4String& modelName, G4Region* envelope)
|
||||
G4ChannelingFastSimModel::G4ChannelingFastSimModel(const G4String& modelName,
|
||||
G4Region* envelope)
|
||||
: G4VFastSimulationModel(modelName, envelope)
|
||||
{
|
||||
}
|
||||
@@ -115,7 +116,8 @@ G4bool G4ChannelingFastSimModel::ModelTrigger(const G4FastTrack& fastTrack)
|
||||
modelTrigger = (crystallogic->GetSolid()->
|
||||
Inside(xyz0)==kInside) &&
|
||||
momentumDirection.z()>0. &&
|
||||
std::abs(angle) < GetLindhardAngleNumberHighLimit(particleDefinitionID) *
|
||||
std::abs(angle) <
|
||||
GetLindhardAngleNumberHighLimit(particleDefinitionID) *
|
||||
fCrystalData->GetLindhardAngle(etotal,mass);
|
||||
}
|
||||
|
||||
@@ -233,13 +235,13 @@ void G4ChannelingFastSimModel::DoIt(const G4FastTrack& fastTrack,
|
||||
|
||||
//trajectory calculation:
|
||||
//Runge-Cutt "3/8"
|
||||
//fCrystalData->GetCurv()*fCrystalData->GetCorrectionZ() is due to dependence of
|
||||
//fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ() is due to dependence of
|
||||
//the radius on x; GetCurv gets 1/R for the central ("central plane/axis")
|
||||
|
||||
//first step
|
||||
kvx1=fCrystalData->Ex(x,y);
|
||||
x1=x+tx*dzd3;
|
||||
tx1=tx+(kvx1-fCrystalData->GetCurv()*fCrystalData->GetCorrectionZ())*dzd3;
|
||||
tx1=tx+(kvx1-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dzd3;
|
||||
if (fCrystalData->GetModel()==2)
|
||||
{
|
||||
kvy1=fCrystalData->Ey(x,y);
|
||||
@@ -250,8 +252,8 @@ void G4ChannelingFastSimModel::DoIt(const G4FastTrack& fastTrack,
|
||||
//second step
|
||||
kvx2=fCrystalData->Ex(x1,y1);
|
||||
x2=x-tx*dzd3+tx1*dz;
|
||||
tx2=tx-(kvx1-fCrystalData->GetCurv()*fCrystalData->GetCorrectionZ())*dzd3+
|
||||
(kvx2-fCrystalData->GetCurv()*fCrystalData->GetCorrectionZ())*dz;
|
||||
tx2=tx-(kvx1-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dzd3+
|
||||
(kvx2-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dz;
|
||||
if (fCrystalData->GetModel()==2)
|
||||
{
|
||||
kvy2=fCrystalData->Ey(x1,y1);
|
||||
@@ -262,7 +264,7 @@ void G4ChannelingFastSimModel::DoIt(const G4FastTrack& fastTrack,
|
||||
//third step
|
||||
kvx3=fCrystalData->Ex(x2,y2);
|
||||
x3=x+(tx-tx1+tx2)*dz;
|
||||
tx3=tx+(kvx1-kvx2+kvx3-fCrystalData->GetCurv()*fCrystalData->GetCorrectionZ())*dz;
|
||||
tx3=tx+(kvx1-kvx2+kvx3-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dz;
|
||||
if (fCrystalData->GetModel()==2)
|
||||
{
|
||||
kvy3=fCrystalData->Ey(x2,y2);
|
||||
@@ -274,7 +276,7 @@ void G4ChannelingFastSimModel::DoIt(const G4FastTrack& fastTrack,
|
||||
kvx4=fCrystalData->Ex(x3,y3);
|
||||
x4=x+(tx+3.*tx1+3.*tx2+tx3)*dzd8;
|
||||
tx4=tx+(kvx1+3.*kvx2+3.*kvx3+kvx4)*dzd8-
|
||||
fCrystalData->GetCurv()*fCrystalData->GetCorrectionZ()*dz;
|
||||
fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ()*dz;
|
||||
if (fCrystalData->GetModel()==2)
|
||||
{
|
||||
kvy4=fCrystalData->Ey(x3,y3);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "G4VChannelingFastSimCrystalData.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4Log.hh"
|
||||
|
||||
G4VChannelingFastSimCrystalData::G4VChannelingFastSimCrystalData()
|
||||
{
|
||||
@@ -44,15 +45,21 @@ void G4VChannelingFastSimCrystalData::SetGeometryParameters
|
||||
{
|
||||
G4int crystalID = crystallogic->GetInstanceID();
|
||||
|
||||
//set bending angle if the volume exists in the list, otherwise default = 0
|
||||
//set bending angle if the it exists in the list, otherwise default = 0
|
||||
(fMapBendingAngle.count(crystalID) > 0)
|
||||
? SetBendingAngle(fMapBendingAngle[crystalID],crystallogic)
|
||||
: SetBendingAngle(0.,crystallogic);
|
||||
|
||||
//set miscut angle if the volume exists in the list, otherwise default = 0
|
||||
//set miscut angle if the it exists in the list, otherwise default = 0
|
||||
(fMapMiscutAngle.count(crystalID) > 0)
|
||||
? SetMiscutAngle(fMapMiscutAngle[crystalID],crystallogic)
|
||||
: SetMiscutAngle(0.,crystallogic);
|
||||
|
||||
//set crystalline undulator parameters if they exist in the list,
|
||||
//otherwise default = G4ThreeVector(0,0,0).
|
||||
(fMapCUAmplitudePeriodPhase.count(crystalID) > 0)
|
||||
? SetCUParameters(fMapCUAmplitudePeriodPhase[crystalID],crystallogic)
|
||||
: SetCUParameters(G4ThreeVector(0.,0.,0.),crystallogic);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -78,6 +85,12 @@ void G4VChannelingFastSimCrystalData::SetBendingAngle(G4double tetab,
|
||||
fBendingAngle=std::abs(tetab);
|
||||
if (fBendingAngle<0.000001)//no bending less then 1 urad
|
||||
{
|
||||
if(fBendingAngle>DBL_EPSILON)
|
||||
{
|
||||
G4cout << "Channeling model: volume " << crystallogic->GetName() << G4endl;
|
||||
G4cout << "Warning: bending angle is lower than 1 urad => set to 0" << G4endl;
|
||||
}
|
||||
|
||||
fBent=0;
|
||||
fBendingAngle=0.;
|
||||
fBendingR=0.;//just for convenience (infinity in reality)
|
||||
@@ -85,8 +98,7 @@ void G4VChannelingFastSimCrystalData::SetBendingAngle(G4double tetab,
|
||||
fBendingRsquare=0.;
|
||||
fCurv=0.;
|
||||
|
||||
G4cout << "Channeling model: volume " << crystallogic->GetName() << G4endl;
|
||||
G4cout << "Warning: bending angle is lower than 1 urad => set to 0" << G4endl;
|
||||
fCorrectionZ = 1.;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -129,6 +141,72 @@ void G4VChannelingFastSimCrystalData::SetMiscutAngle(G4double tetam,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VChannelingFastSimCrystalData::SetCrystallineUndulatorParameters(
|
||||
G4double amplitude,
|
||||
G4double period,
|
||||
G4double phase,
|
||||
const G4LogicalVolume *crystallogic)
|
||||
{
|
||||
if (amplitude<DBL_EPSILON||period<DBL_EPSILON)
|
||||
{
|
||||
amplitude = 0.;
|
||||
period=0.;
|
||||
phase=0.;
|
||||
G4cout << "Channeling model: volume " << crystallogic->GetName() << G4endl;
|
||||
G4cout << "Warning: The crystalline undulator parameters are out of range "
|
||||
"=> the crystalline undulator mode switched off" << G4endl;
|
||||
}
|
||||
|
||||
SetCUParameters(G4ThreeVector(amplitude,period,phase),crystallogic);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VChannelingFastSimCrystalData::SetCUParameters(
|
||||
const G4ThreeVector &litudePeriodPhase,
|
||||
const G4LogicalVolume *crystallogic)
|
||||
{
|
||||
G4int crystalID = crystallogic->GetInstanceID();
|
||||
|
||||
//set the crystalline undulator parameters for this logical volume
|
||||
fMapCUAmplitudePeriodPhase[crystalID]=amplitudePeriodPhase;
|
||||
fCUAmplitude=amplitudePeriodPhase.x();
|
||||
G4double period = amplitudePeriodPhase.y();
|
||||
fCUPhase = amplitudePeriodPhase.z();
|
||||
|
||||
//if the amplidude of the crystalline undulator is 0 => no undulator
|
||||
if(fCUAmplitude>DBL_EPSILON&&period>DBL_EPSILON)
|
||||
{
|
||||
//crystalline undulator flag
|
||||
fCU = true;
|
||||
|
||||
fCUK = CLHEP::twopi/period;
|
||||
|
||||
if(fBendingAngle>DBL_EPSILON)
|
||||
{
|
||||
//bent and periodically bent crystal are not compatible
|
||||
SetBendingAngle(0,crystallogic);
|
||||
|
||||
G4cout << "Channeling model: volume " << crystallogic->GetName() << G4endl;
|
||||
G4cout << "Warning: crystalline undulator is not compatible with "
|
||||
"a bent crystal mode => setting bending angle to 0." << G4endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fCU = false;
|
||||
fCUAmplitude = 0.;
|
||||
fCUK = 0.;
|
||||
fCUPhase = 0.;
|
||||
fMapCUAmplitudePeriodPhase[crystalID] = G4ThreeVector(0.,0.,0.);
|
||||
}
|
||||
|
||||
fCUK2 = fCUK*fCUK;
|
||||
fCUAmplitudeK = fCUAmplitude*fCUK;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VChannelingFastSimCrystalData::SetParticleProperties(G4double etotal,
|
||||
G4double mass,
|
||||
G4double charge,
|
||||
@@ -286,7 +364,7 @@ G4ThreeVector G4VChannelingFastSimCrystalData::CoulombAtomicScattering(
|
||||
G4double aa1=1.+aa;
|
||||
|
||||
// crystal, with scattering suppression
|
||||
G4double tetamsi=e1*(std::log(aa1)+
|
||||
G4double tetamsi=e1*(G4Log(aa1)+
|
||||
(1.-std::exp(-aa*fBB[ielement]))/aa1+
|
||||
fBBDEXP[ielement]*
|
||||
(expint(fBB[ielement]*aa1)-fE1XBbb[ielement]));
|
||||
@@ -297,7 +375,7 @@ G4ThreeVector G4VChannelingFastSimCrystalData::CoulombAtomicScattering(
|
||||
// *(ln(1+a)+(1-exp(-a*b))/(1+a)+(1+b)*exp(b)*(E1XB(b*(1+a))-E1XB(b)))
|
||||
|
||||
ksi=G4UniformRand();
|
||||
t=std::sqrt(-tetamsi*std::log(ksi));
|
||||
t=std::sqrt(-tetamsi*G4Log(ksi));
|
||||
|
||||
ksi=G4UniformRand();
|
||||
|
||||
@@ -312,7 +390,7 @@ G4ThreeVector G4VChannelingFastSimCrystalData::CoulombAtomicScattering(
|
||||
// (calculation of a distance, at which another single scattering can happen)
|
||||
ksi=G4UniformRand();
|
||||
|
||||
zss=-std::log(ksi)*step/(e1*(1./teta122-1./fTetamax12[ielement]));
|
||||
zss=-G4Log(ksi)*step/(e1*(1./teta122-1./fTetamax12[ielement]));
|
||||
G4double tt;
|
||||
|
||||
// At some step several single scattering can occur.
|
||||
@@ -353,7 +431,7 @@ G4ThreeVector G4VChannelingFastSimCrystalData::CoulombAtomicScattering(
|
||||
// (calculation of a distance, at which another single scattering can happen)
|
||||
ksi=G4UniformRand();
|
||||
|
||||
zss=-std::log(ksi)*step/(e1*(1./teta122-1./fTetamax12[ielement]));
|
||||
zss=-G4Log(ksi)*step/(e1*(1./teta122-1./fTetamax12[ielement]));
|
||||
}
|
||||
//********************************************
|
||||
return G4ThreeVector(tx,ty,0.);
|
||||
@@ -388,7 +466,7 @@ G4ThreeVector G4VChannelingFastSimCrystalData::CoulombElectronScattering(
|
||||
// simulation of scattering length (by the same way single scattering by nucleus
|
||||
ksi=G4UniformRand();
|
||||
|
||||
zss=-1.0*std::log(ksi)/(fK3*electronDensity)/(1./eMinIonization-1./fTmax);
|
||||
zss=-1.0*G4Log(ksi)/(fK3*electronDensity)/(1./eMinIonization-1./fTmax);
|
||||
|
||||
//********************************************
|
||||
// if at a step a single scattering occur
|
||||
@@ -417,7 +495,7 @@ G4ThreeVector G4VChannelingFastSimCrystalData::CoulombElectronScattering(
|
||||
// (by the same way single scattering by nucleus
|
||||
ksi=G4UniformRand();
|
||||
|
||||
zss=-1.0*std::log(ksi)/(fK3*electronDensity)/(1./eMinIonization-1./fTmax);
|
||||
zss=-1.0*G4Log(ksi)/(fK3*electronDensity)/(1./eMinIonization-1./fTmax);
|
||||
}
|
||||
//********************************************
|
||||
}
|
||||
@@ -431,7 +509,7 @@ G4double G4VChannelingFastSimCrystalData::IonizationLosses(G4double dz,
|
||||
{
|
||||
G4double elosses = 0.;
|
||||
if (fHadron) {elosses=fKD[ielement]/fV2*
|
||||
(std::log(fMe2Gamma*fV2/fI0[ielement]/fGamma) - fV2)*dz;}
|
||||
(G4Log(fMe2Gamma*fV2/fI0[ielement]/fGamma) - fV2)*dz;}
|
||||
return elosses;
|
||||
}
|
||||
|
||||
@@ -465,7 +543,7 @@ else if (X<=1.)
|
||||
if (std::abs(R)<=std::abs(E1)*1.0e-15) {break;}
|
||||
}
|
||||
|
||||
E1=-0.5772156649015328-std::log(X)+X*E1;
|
||||
E1=-0.5772156649015328-G4Log(X)+X*E1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user