91{
92 static const G4double kAlpha2Pi = CLHEP::twopi*CLHEP::fine_structure_const;
94 const G4int izet = std::max(std::min(fMaxZet, iZet),1);
96
97
99 const SamplingTablePerZ* stZ = fSBSamplingTables[izet];
100
101 const std::size_t gamCutIndx = stZ->fMatCutIndxToGamCutIndx[matCutIndx];
102
103 if (gamCutIndx >= stZ->fNumGammaCuts || stZ->fGammaECuts[gamCutIndx]!=gcut) {
104 G4String msg =
" Gamma cut="+std::to_string(gcut) +
" [MeV] was not found ";
105 msg += "in case of Z = " + std::to_string(iZet) + ". ";
107 msg.c_str());
108 }
109 const G4double lGCut = stZ->fLogGammaECuts[gamCutIndx];
110
112
115 G4int elEnergyIndx = stZ->fMaxElEnergyIndx;
116
117 if (eekin < fElEnergyVect[elEnergyIndx]) {
118 const G4double val = (lElEnergy-fLogMinElEnergy)*fILDeltaElEnergy;
119 elEnergyIndx = (
G4int)val;
121
122 if (fElEnergyVect[elEnergyIndx]<=gcut) {
123
124 pIndxH = (lElEnergy-lGCut)/(fLElEnergyVect[elEnergyIndx+1]-lGCut);
125 isCorner = true;
126 }
127
128 if (rndmEngine->
flat()<pIndxH) {
129 ++elEnergyIndx;
130 } else if (isCorner) {
131
132
133 isSimply = true;
134 }
135 }
136
137 if (!stZ->fTablesPerEnergy[elEnergyIndx]) {
138 return 0.;
139 }
140
141 const STable *st = stZ->fTablesPerEnergy[elEnergyIndx];
142 const std::vector<G4double>& cVect = st->fCumCutValues;
143 const std::vector<STPoint>& pVect = st->fSTable;
144 const G4double minVal = cVect[gamCutIndx];
145
146
147 if (minVal >= 1.) {
148 return 0.;
149 }
150
151 const G4double lCurKappaC = lGCut - leekin;
152 const G4double lUsedKappaC = lGCut - fLElEnergyVect[elEnergyIndx];
153
156
157 do {
160 if (!isSimply) {
161 const G4double cumRV = rndm[0]*(1.-minVal)+minVal;
162
163
164 const G4int cumLIndx = LinSearch(pVect, fNumKappa, cumRV)-1;
165
166
167
168 const STPoint& stPL = pVect[cumLIndx];
172 const G4double cumH = pVect[cumLIndx+1].fCum;
173 const G4double lKL = fLKappaVect[cumLIndx];
174 const G4double lKH = fLKappaVect[cumLIndx+1];
175 const G4double dm1 = (cumRV-cumL)/(cumH-cumL);
176 const G4double dm2 = (1.+pA+pB)*dm1;
177 const G4double dm3 = 1.+dm1*(pA+pB*dm1);
178
179 const G4double lKappa = lKL+dm2/dm3*(lKH-lKL);
180
181 kappa =
G4Exp(lKappa*lCurKappaC/lUsedKappaC);
182 } else {
183
184
185 kappa = 1.-rndm[0]*(1.-gcut/eekin);
186 }
187
188 eGamma = kappa*eekin;
189 const G4double invEGamma = 1./eGamma;
190
191 suppression = 1./(1.+dielSupConst*invEGamma*invEGamma);
192
193 if (!isElectron) {
195 const G4double iBeta1 = (e1 + CLHEP::electron_mass_c2)
196 / std::sqrt(e1*(e1 + 2.*CLHEP::electron_mass_c2));
198 const G4double iBeta2 = (e2 + CLHEP::electron_mass_c2)
199 / std::sqrt(e2*(e2 + 2.*CLHEP::electron_mass_c2));
200 const G4double dum = kAlpha2Pi*zet*(iBeta1 - iBeta2);
201 suppression = (dum > -12.) ? suppression*
G4Exp(dum) : 0.;
202 }
203 } while (rndm[1] > suppression);
204
205
206 return eGamma;
207}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
virtual void flatArray(const int size, double *vect)=0