170{
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
187
188 if (verboseLevel > 3) {
189 G4cout <<
"G4LivermoreComptonModifiedModel::SampleSecondaries() E(MeV)= "
192 }
193
194
195
197 return ;
198
199 G4double e0m = photonEnergy0 / electron_mass_c2 ;
201
202
206
207 G4double epsilon0Local = 1. / (1. + 2. * e0m);
208 G4double epsilon0Sq = epsilon0Local * epsilon0Local;
210 G4double alpha2 = 0.5 * (1. - epsilon0Sq);
211
212 G4double wlPhoton = h_Planck*c_light/photonEnergy0;
213
214
220
221 do
222 {
224 {
225
228 }
229 else
230 {
231 epsilonSq = epsilon0Sq + (1. - epsilon0Sq) *
G4UniformRand();
232 epsilon = std::sqrt(epsilonSq);
233 }
234
236 sinT2 = oneCosT * (2. - oneCosT);
237 G4double x = std::sqrt(oneCosT/2.) / (wlPhoton/cm);
239 gReject = (1. -
epsilon * sinT2 / (1. + epsilonSq)) * scatteringFunction;
240
242
244 G4double sinTheta = std::sqrt (sinT2);
246 G4double dirx = sinTheta * std::cos(phi);
247 G4double diry = sinTheta * std::sin(phi);
249
250
251
252
253
254
255
256 G4int maxDopplerIterations = 1000;
265 G4double momentum_au_to_nat = 1.992851740*std::pow(10.,-24.);
266 G4double e_mass_kg = 9.10938188 * std::pow(10.,-31.);
269 do
270 {
271 ++iteration;
272
275
276
277
278
279
281
282
283
284
285
286
287
288
289 do {
291 }
while(
Alpha >= (pi/2.0));
292
293 ePAU = pSample / std::cos(
Alpha);
294
295
296
297 G4double ePSI = ePAU * momentum_au_to_nat;
298 G4double u_temp = sqrt( ((ePSI*ePSI)*(vel_c*vel_c)) / ((e_mass_kg*e_mass_kg)*(vel_c*vel_c)+(ePSI*ePSI)))/vel_c;
299 G4double eEIncident = electron_mass_c2 / sqrt( 1 - (u_temp*u_temp));
300
301
302 systemE = eEIncident+photonEnergy0;
303
304 eMax = systemE - bindingE - electron_mass_c2;
305 G4double pDoppler = pSample * fine_structure_const;
306 G4double pDoppler2 = pDoppler * pDoppler;
308 G4double var3 = var2*var2 - pDoppler2;
309 G4double var4 = var2 - pDoppler2 * cosTheta;
310 G4double var = var4*var4 - var3 + pDoppler2 * var3;
311 if (var > 0.)
312 {
314 G4double scale = photonEnergy0 / var3;
315
316 if (
G4UniformRand() < 0.5) { photonE = (var4 - varSqrt) * scale; }
317 else { photonE = (var4 + varSqrt) * scale; }
318 }
319 else
320 {
321 photonE = -1.;
322 }
323 } while ( iteration <= maxDopplerIterations &&
324 (photonE < 0. || photonE > eMax ) );
325
326
327
328 G4double eKineticEnergy = systemE - photonE - bindingE - electron_mass_c2;
329
330
334
335 if(eKineticEnergy < 0.0) {
336 G4cout <<
"Error, kinetic energy of electron less than zero" <<
G4endl;
337 }
338
339 else{
340
341
342
343 G4double E_num = photonEnergy0 - photonE*cosTheta;
344 G4double E_dom = sqrt(photonEnergy0*photonEnergy0 + photonE*photonE -2*photonEnergy0*photonE*cosTheta);
346 G4double sinThetaE = -sqrt((1. - cosThetaE) * (1. + cosThetaE));
347
348 eDirX = sinThetaE * std::cos(phi);
349 eDirY = sinThetaE * std::sin(phi);
350 eDirZ = cosThetaE;
351
353 eDirection.rotateUz(photonDirection0);
355 eDirection,eKineticEnergy) ;
356 fvect->push_back(dp);
357 }
358
359
360
361
362 if (iteration >= maxDopplerIterations)
363 {
364 photonE = photonEoriginal;
365 bindingE = 0.;
366 }
367
368
369
371 photonDirection1.rotateUz(photonDirection0);
373
375
376 if (photonEnergy1 > 0.)
377 {
379
380 if (iteration < maxDopplerIterations)
381 {
383 eDirection.rotateUz(photonDirection0);
385 eDirection,eKineticEnergy) ;
386 fvect->push_back(dp);
387 }
388 }
389 else
390 {
391 photonEnergy1 = 0.;
394 }
395
396
397
398 if(fAtomDeexcitation && iteration < maxDopplerIterations) {
401 size_t nbefore = fvect->size();
405 size_t nafter = fvect->size();
406 if(nafter > nbefore) {
407 for (size_t i=nbefore; i<nafter; ++i) {
408 bindingE -= ((*fvect)[i])->GetKineticEnergy();
409 }
410 }
411 }
412 }
413 if(bindingE < 0.0) { bindingE = 0.0; }
415}
double epsilon(double density, double temperature)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
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)