387{
388
389
390
391
392
393
394
395
396
397
398
399
400
401 if (fVerboseLevel > 3)
402 G4cout <<
"Calling SamplingSecondaries() of G4PenelopeRayleighModel" <<
G4endl;
403
405
406 if (photonEnergy0 <= fIntrinsicLowEnergyLimit)
407 {
411 return ;
412 }
413
415
417
418
419
420
421 if (!fPMaxTable || !fSamplingTable || !fLogFormFactorTable)
422 {
423
424
425 fLocalTable = true;
426 if (!fLogFormFactorTable)
427 fLogFormFactorTable = new std::map<const G4Material*,G4PhysicsFreeVector*>;
428 if (!fPMaxTable)
429 fPMaxTable = new std::map<const G4Material*,G4PhysicsFreeVector*>;
430 if (!fSamplingTable)
431 fSamplingTable = new std::map<const G4Material*,G4PenelopeSamplingData*>;
432 }
433
434 if (!fSamplingTable->count(theMat))
435 {
436
437
438 if (fVerboseLevel > 0)
439 {
440
442 ed << "Unable to find the fSamplingTable data for " <<
444 ed <<
"This can happen only in Unit Tests" <<
G4endl;
445 G4Exception(
"G4PenelopeRayleighModel::SampleSecondaries()",
447 }
449
452 {
453 G4int iZ = theElementVector->at(j)->GetZasInt();
454 if (!fLogAtomicCrossSection[iZ])
455 {
456 lock.lock();
457 ReadDataFile(iZ);
458 lock.unlock();
459 }
460 }
461 lock.lock();
462
463 if (!fLogFormFactorTable->count(theMat))
464 BuildFormFactorTable(theMat);
465
466
467 if (!(fSamplingTable->count(theMat)))
468 InitializeSamplingAlgorithm(theMat);
469
470
471 if (!fPMaxTable->count(theMat))
472 GetPMaxTable(theMat);
473 lock.unlock();
474 }
475
476
479
481
482
483 G4double qmax = 2.0*photonEnergy0/electron_mass_c2;
484
485 if (qmax < 1e-10)
486 {
488 do
489 {
490 loopAgain = false;
492 G4double G = 0.5*(1+cosTheta*cosTheta);
494 loopAgain = true;
495 }while(loopAgain);
496 }
497 else
498 {
500 G4double LastQ2inTheTable = theDataTable->
GetX(nData-1);
501 G4double q2max = std::min(qmax*qmax,LastQ2inTheTable);
502
506
507
508
509
510 do{
511 loopAgain = false;
514
515
516 if (xx > q2max)
517 loopAgain = true;
518 cosTheta = 1.0-2.0*xx/q2max;
519 G4double G = 0.5*(1+cosTheta*cosTheta);
521 loopAgain = true;
522 }while(loopAgain);
523 }
524
525 G4double sinTheta = std::sqrt(1-cosTheta*cosTheta);
526
527
529 G4double dirX = sinTheta*std::cos(phi);
530 G4double dirY = sinTheta*std::sin(phi);
532
533
535
536 photonDirection1.rotateUz(photonDirection0);
539
540 return;
541}
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
size_t GetNumberOfStoredPoints()
G4double GetX(size_t index)
G4double SampleValue(G4double rndm)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)