177{
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
194
195 if (verboseLevel > 3) {
196 G4cout <<
"G4LivermoreComptonModifiedModel::SampleSecondaries() E(MeV)= "
199 }
200
201
202 if (photonEnergy0 <= lowEnergyLimit)
203 {
207 return ;
208 }
209
210 G4double e0m = photonEnergy0 / electron_mass_c2 ;
212
213
217
218 G4double epsilon0Local = 1. / (1. + 2. * e0m);
219 G4double epsilon0Sq = epsilon0Local * epsilon0Local;
220 G4double alpha1 = -std::log(epsilon0Local);
221 G4double alpha2 = 0.5 * (1. - epsilon0Sq);
222
223 G4double wlPhoton = h_Planck*c_light/photonEnergy0;
224
225
231
232 do
233 {
235 {
236
238 epsilonSq = epsilon * epsilon;
239 }
240 else
241 {
242 epsilonSq = epsilon0Sq + (1. - epsilon0Sq) *
G4UniformRand();
243 epsilon = std::sqrt(epsilonSq);
244 }
245
246 oneCosT = (1. - epsilon) / ( epsilon * e0m);
247 sinT2 = oneCosT * (2. - oneCosT);
248 G4double x = std::sqrt(oneCosT/2.) / (wlPhoton/cm);
250 gReject = (1. - epsilon * sinT2 / (1. + epsilonSq)) * scatteringFunction;
251
253
255 G4double sinTheta = std::sqrt (sinT2);
257 G4double dirx = sinTheta * std::cos(phi);
258 G4double diry = sinTheta * std::sin(phi);
260
261
262
263
264
265
266
267 G4int maxDopplerIterations = 1000;
269 G4double photonEoriginal = epsilon * photonEnergy0;
276 G4double momentum_au_to_nat = 1.992851740*std::pow(10.,-24.);
277 G4double e_mass_kg = 9.10938188 * std::pow(10.,-31.);
280 do
281 {
282 ++iteration;
283
286
287
288
289
290
292
293
294
295
296
297
298
299
300 do {
302 }
while(
Alpha >= (pi/2.0));
303
304 ePAU = pSample / std::cos(
Alpha);
305
306
307
308 G4double ePSI = ePAU * momentum_au_to_nat;
309 G4double u_temp = sqrt( ((ePSI*ePSI)*(vel_c*vel_c)) / ((e_mass_kg*e_mass_kg)*(vel_c*vel_c)+(ePSI*ePSI)))/vel_c;
310 G4double eEIncident = electron_mass_c2 / sqrt( 1 - (u_temp*u_temp));
311
312
313 systemE = eEIncident+photonEnergy0;
314
315 eMax = systemE - bindingE - electron_mass_c2;
316 G4double pDoppler = pSample * fine_structure_const;
317 G4double pDoppler2 = pDoppler * pDoppler;
319 G4double var3 = var2*var2 - pDoppler2;
320 G4double var4 = var2 - pDoppler2 * cosTheta;
321 G4double var = var4*var4 - var3 + pDoppler2 * var3;
322 if (var > 0.)
323 {
325 G4double scale = photonEnergy0 / var3;
326
327 if (
G4UniformRand() < 0.5) { photonE = (var4 - varSqrt) * scale; }
328 else { photonE = (var4 + varSqrt) * scale; }
329 }
330 else
331 {
332 photonE = -1.;
333 }
334 } while ( iteration <= maxDopplerIterations &&
335 (photonE < 0. || photonE > eMax ) );
336
337
338
339 G4double eKineticEnergy = systemE - photonE - bindingE - electron_mass_c2;
340
341
345
346 if(eKineticEnergy < 0.0) {
347 G4cout <<
"Error, kinetic energy of electron less than zero" <<
G4endl;
348 }
349
350 else{
351
352
353
354 G4double E_num = photonEnergy0 - photonE*cosTheta;
355 G4double E_dom = sqrt(photonEnergy0*photonEnergy0 + photonE*photonE -2*photonEnergy0*photonE*cosTheta);
357 G4double sinThetaE = -sqrt((1. - cosThetaE) * (1. + cosThetaE));
358
359 eDirX = sinThetaE * std::cos(phi);
360 eDirY = sinThetaE * std::sin(phi);
361 eDirZ = cosThetaE;
362
364 eDirection.rotateUz(photonDirection0);
366 eDirection,eKineticEnergy) ;
367 fvect->push_back(dp);
368 }
369
370
371
372
373 if (iteration >= maxDopplerIterations)
374 {
375 photonE = photonEoriginal;
376 bindingE = 0.;
377 }
378
379
380
382 photonDirection1.rotateUz(photonDirection0);
384
386
387 if (photonEnergy1 > 0.)
388 {
390
391 if (iteration < maxDopplerIterations)
392 {
394 eDirection.rotateUz(photonDirection0);
396 eDirection,eKineticEnergy) ;
397 fvect->push_back(dp);
398 }
399 }
400 else
401 {
402 photonEnergy1 = 0.;
405 }
406
407
408
409 if(fAtomDeexcitation && iteration < maxDopplerIterations) {
412 size_t nbefore = fvect->size();
416 size_t nafter = fvect->size();
417 if(nafter > nbefore) {
418 for (size_t i=nbefore; i<nafter; ++i) {
419 bindingE -= ((*fvect)[i])->GetKineticEnergy();
420 }
421 }
422 }
423 }
424 if(bindingE < 0.0) { bindingE = 0.0; }
426}
G4double RandomSelectMomentum(G4int Z, G4int shellIndex) const
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static G4Electron * Electron()
const G4Material * GetMaterial() const
const G4String & GetName() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double BindingEnergy(G4int Z, G4int shellIndex) const
G4int SelectRandomShell(G4int Z) const
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
virtual G4double FindValue(G4double x, G4int componentId=0) const =0
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)