75 const G4double G4PWATotalXsecZ::fgPWATotalXsecEnergyGrid[]={
77 1.00000000e-04, 1.16591440e-04, 1.35935639e-04, 1.58489319e-04, 1.84784980e-04, 2.15443469e-04, 2.51188643e-04, 2.92864456e-04,
78 3.41454887e-04, 3.98107171e-04, 4.64158883e-04, 5.41169527e-04, 6.30957344e-04, 7.35642254e-04, 8.57695899e-04, 1.00000000e-03,
79 1.16591440e-03, 1.35935639e-03, 1.58489319e-03, 1.84784980e-03, 2.15443469e-03, 2.51188643e-03, 2.92864456e-03, 3.41454887e-03,
80 3.98107171e-03, 4.64158883e-03, 5.41169527e-03, 6.30957344e-03, 7.35642254e-03, 8.57695899e-03, 1.00000000e-02, 1.16591440e-02,
81 1.35935639e-02, 1.58489319e-02, 1.84784980e-02, 2.15443469e-02, 2.51188643e-02, 2.92864456e-02, 3.41454887e-02, 3.98107171e-02,
82 4.64158883e-02, 5.41169527e-02, 6.30957344e-02, 7.35642254e-02, 8.57695899e-02, 1.00000000e-01, 1.16591440e-01, 1.35935639e-01,
83 1.58489319e-01, 1.84784980e-01, 2.15443469e-01, 2.51188643e-01, 2.92864456e-01, 3.41454887e-01, 3.98107171e-01, 4.64158883e-01,
84 5.41169527e-01, 6.30957344e-01, 7.35642254e-01, 8.57695899e-01, 1.00000000e+00, 1.16591440e+00, 1.35935639e+00, 1.58489319e+00,
85 1.84784980e+00, 2.15443469e+00, 2.51188643e+00, 2.92864456e+00, 3.41454887e+00, 3.98107171e+00, 4.64158883e+00, 5.41169527e+00,
86 6.30957344e+00, 7.35642254e+00, 8.57695899e+00, 1.00000000e+01, 1.16591440e+01, 1.35935639e+01, 1.58489319e+01, 1.84784980e+01,
87 2.15443469e+01, 2.51188643e+01, 2.92864456e+01, 3.41454887e+01, 3.98107171e+01, 4.64158883e+01, 5.41169527e+01, 6.30957344e+01,
88 7.35642254e+01, 8.57695899e+01, 1.00000000e+02, 1.16591440e+02, 1.35935639e+02, 1.58489319e+02, 1.84784980e+02, 2.15443469e+02,
89 2.51188643e+02, 2.92864456e+02, 3.41454887e+02, 3.98107171e+02, 4.64158883e+02, 5.41169527e+02, 6.30957344e+02, 7.35642254e+02,
90 8.57695899e+02, 1.00000000e+03
94 G4PWATotalXsecZ::G4PWATotalXsecZ(
G4int Z){
95 G4int nn = fgNumTotalXsecBins*6;
98 fInterpParamA[i] = 0.0;
99 fInterpParamB[i] = 0.0;
101 LoadPWATotalXsecZ(Z);
105 void G4PWATotalXsecZ::LoadPWATotalXsecZ(
G4int Z){
108 char* path = getenv(
"G4LEDATA");
110 G4Exception(
"G4PWATotalXsecZ::LoadPWATotalXsecZ()",
"em0006",
112 "Environment variable G4LEDATA not defined");
116 std::string pathString(path);
117 sprintf(fname,
"%s/msc_GS/xsecs/xsecs_%d",path,Z);
118 std::ifstream infile(fname,std::ios::in);
119 if(!infile.is_open()){
121 sprintf(msgc,
" Total PWA xsection %s not found.",fname);
122 G4Exception(
"G4PWATotalXsecZ::LoadPWATotalXsecZ()",
"em0006",
129 for(
G4int i=0; i<fgNumTotalXsecBins; ++i)
130 for(
G4int j=0; j<7; ++j)
131 if(j==0) infile >> dum;
136 fPWAXsecs[(j-1)*fgNumTotalXsecBins+i] = dummy*
CLHEP::cm2;
141 for(
G4int i=0; i<fgNumTotalXsecBins-1; ++i)
142 for(
G4int k=0; k<6; ++k) {
143 G4int j = k*fgNumTotalXsecBins+i;
147 fInterpParamA[j] =
G4Log(val2/val1)/
G4Log(fgPWATotalXsecEnergyGrid[i+1]/fgPWATotalXsecEnergyGrid[i]);
148 fInterpParamB[j] =
G4Exp(
G4Log(val1) - fInterpParamA[j]*
G4Log(fgPWATotalXsecEnergyGrid[i]));
156 const G4double lne0 = -9.21034037197618e+00;
158 const G4double invlnde = 6.51441722854880e+00;
174 G4int k = j*fgNumTotalXsecBins+elowindex;
175 return G4Exp(
G4Log(energy)*fInterpParamA[k])*fInterpParamB[k];
188 G4int k = j*fgNumTotalXsecBins+elowindex;
189 return G4Exp(
G4Log(energy)*fInterpParamA[k])*fInterpParamB[k];
197 G4PWATotalXsecZ* G4PWATotalXsecTable::fgPWATotalXsecTable[fgNumZet] = {0};
201 for(
G4int i = 0; i < fgNumZet; ++i)
202 if(fgPWATotalXsecTable[i]) {
203 delete fgPWATotalXsecTable[i];
204 fgPWATotalXsecTable[i] = 0;
210 G4int isUsedZ[fgNumZet] ={0};
213 for(
unsigned int imat = 0; imat < theMaterialTable->size(); ++imat) {
214 const G4ElementVector *theElemVect = ((*theMaterialTable)[imat])->GetElementVector();
215 for(
unsigned int ielem = 0; ielem < theElemVect->size(); ++ielem) {
217 zet = zet>fgNumZet ? fgNumZet : zet;
223 for(
G4int i = 0; i < fgNumZet; ++i)
224 if(isUsedZ[i] && !fgPWATotalXsecTable[i])
226 else if(!isUsedZ[i] && fgPWATotalXsecTable[i]) {
227 delete fgPWATotalXsecTable[i];
228 fgPWATotalXsecTable[i] = 0;
std::vector< G4Element * > G4ElementVector
G4double GetHighestEnergy() const
G4double GetLowestEnergy() const
static constexpr double cm2
G4double GetInterpXsec(G4double energy, G4int elowindex, G4int j) const
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
G4int GetPWATotalXsecEnergyBinIndex(G4double energy) const
G4double GetLowestXsecValue(G4int j) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double G4Log(G4double x)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double energy(const ThreeVector &p, const G4double m)
G4double GetHighestXsecValue(G4int j) const