420{
421
422
423
424
425
426
427
428
429
430
431
432
433
434 if (verboseLevel > 3)
435 G4cout <<
"Calling SamplingSecondaries() of G4PenelopeRayleighModel" <<
G4endl;
436
438
439 if (photonEnergy0 <= fIntrinsicLowEnergyLimit)
440 {
444 return ;
445 }
446
448
450
451
452
453
454
455 if (!pMaxTable || !samplingTable || !logAtomicCrossSection || !atomicFormFactor ||
456 !logFormFactorTable)
457 {
458
459
460 fLocalTable = true;
461 if (!logAtomicCrossSection)
462 logAtomicCrossSection = new std::map<G4int,G4PhysicsFreeVector*>;
463 if (!atomicFormFactor)
464 atomicFormFactor = new std::map<G4int,G4PhysicsFreeVector*>;
465 if (!logFormFactorTable)
466 logFormFactorTable = new std::map<const G4Material*,G4PhysicsFreeVector*>;
467 if (!pMaxTable)
468 pMaxTable = new std::map<const G4Material*,G4PhysicsFreeVector*>;
469 if (!samplingTable)
470 samplingTable = new std::map<const G4Material*,G4PenelopeSamplingData*>;
471 }
472
473 if (!samplingTable->count(theMat))
474 {
475
476
477 if (verboseLevel > 0)
478 {
479
481 ed << "Unable to find the samplingTable data for " <<
483 ed <<
"This can happen only in Unit Tests" <<
G4endl;
484 G4Exception(
"G4PenelopeRayleighModel::SampleSecondaries()",
486 }
488
491 {
492 G4int iZ = theElementVector->at(j)->GetZasInt();
493 if (!logAtomicCrossSection->count(iZ))
494 {
495 lock.lock();
496 ReadDataFile(iZ);
497 lock.unlock();
498 }
499 }
500 lock.lock();
501
502 if (!logFormFactorTable->count(theMat))
503 BuildFormFactorTable(theMat);
504
505
506 if (!(samplingTable->count(theMat)))
507 InitializeSamplingAlgorithm(theMat);
508
509
510 if (!pMaxTable->count(theMat))
511 GetPMaxTable(theMat);
512 lock.unlock();
513 }
514
515
516
519
521
522
523 G4double qmax = 2.0*photonEnergy0/electron_mass_c2;
524
525 if (qmax < 1e-10)
526 {
528 do
529 {
530 loopAgain = false;
532 G4double G = 0.5*(1+cosTheta*cosTheta);
534 loopAgain = true;
535 }while(loopAgain);
536 }
537 else
538 {
540 G4double LastQ2inTheTable = theDataTable->
GetX(nData-1);
541 G4double q2max = std::min(qmax*qmax,LastQ2inTheTable);
542
546
547
548
549
550 do{
551 loopAgain = false;
554
555
556 if (xx > q2max)
557 loopAgain = true;
558 cosTheta = 1.0-2.0*xx/q2max;
559 G4double G = 0.5*(1+cosTheta*cosTheta);
561 loopAgain = true;
562 }while(loopAgain);
563 }
564
565 G4double sinTheta = std::sqrt(1-cosTheta*cosTheta);
566
567
569 G4double dirX = sinTheta*std::cos(phi);
570 G4double dirY = sinTheta*std::sin(phi);
572
573
575
576 photonDirection1.rotateUz(photonDirection0);
579
580 return;
581}
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
size_t GetNumberOfStoredPoints()
G4double GetX(size_t index)
G4double SampleValue(G4double rndm)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)