107 for(iMat=0;iMat<numOfCouples;iMat++)
116 if(iMat == numOfCouples)
118 G4Exception(
"G4ForwardXrayTR::G4ForwardXrayTR",
"ForwardXrayTR01",
JustWarning,
"Invalid first material name in G4ForwardXrayTR constructor!");
123 for(iMat=0;iMat<numOfCouples;iMat++)
132 if(iMat == numOfCouples)
134 G4Exception(
"G4ForwardXrayTR::G4ForwardXrayTR",
"ForwardXrayTR02",
JustWarning,
"Invalid second material name in G4ForwardXrayTR constructor!");
191 G4int iMat, jMat, iTkin, iTR, iPlace;
202 for(iMat=0;iMat<numOfCouples;iMat++)
206 for(jMat=0;jMat<numOfCouples;jMat++)
242 for(iTkin=0;iTkin<
fTotBin;iTkin++)
276 for(iTR=
fBinTR-2;iTR>=0;iTR--)
284 energyVector->
PutValue(iTR,energySum);
285 angleVector ->
PutValue(iTR,angleSum);
291 iPlace = fTotBin+iTkin;
320 G4double formationLength1, formationLength2;
321 formationLength1 = 1.0/
325 formationLength2 = 1.0/
329 return (varAngle/energy)*(formationLength1 - formationLength2)
330 *(formationLength1 - formationLength2);
343 G4double x, x2, c, d, f, a2, b2, a4, b4;
356 cof1 = c*c*(0.5/(a2*(x2 +a2)) +0.5*std::log(x2/(x2 +a2))/a4);
357 cof3 = d*d*(0.5/(b2*(x2 +b2)) +0.5*std::log(x2/(x2 +b2))/b4);
358 cof2 = -c*d*(std::log(x2/(x2 +b2))/b2 - std::log(x2/(x2 +a2))/a2)/(a2 - b2) ;
359 return -varAngle*(cof1 + cof2 + cof3);
386 G4double h , sumEven = 0.0 , sumOdd = 0.0;
392 varAngle1 + (2*i - 1)*h );
395 varAngle1 + (2*fSympsonNumber - 1)*h );
399 + 4.0*sumOdd + 2.0*sumEven )/3.0;
416 return ( (a + b)*std::log((x + b)/(x + a))/(a - b)
417 + a/(x + a) + b/(x + b) )/
energy;
445 G4double h , sumEven = 0.0 , sumOdd = 0.0;
457 + 4.0*sumOdd + 2.0*sumEven )/3.0;
471 G4int iMat, jMat, iTkin, iPlace, numOfTR, iTR, iTransfer;
473 G4double energyPos, anglePos, energyTR, theta, phi, dirX, dirY, dirZ;
491 GetLogicalVolume()->GetMaterialCutsCouple();
493 GetLogicalVolume()->GetMaterialCutsCouple();
528 G4double TkinScaled = kinEnergy*massRatio;
529 for(iTkin=0;iTkin<
fTotBin;iTkin++)
531 if(TkinScaled < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))
538 iPlace = fTotBin + iTkin - 1;
571 for(iTR=0;iTR<numOfTR;iTR++)
573 energyPos = (*(*fEnergyDistrTable)(iPlace))(0)*
G4UniformRand();
574 for(iTransfer=0;iTransfer<
fBinTR-1;iTransfer++)
578 energyTR = (*fEnergyDistrTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
582 kinEnergy -= energyTR;
585 anglePos = (*(*fAngleDistrTable)(iPlace))(0)*
G4UniformRand();
586 for(iTransfer=0;iTransfer<fBinTR-1;iTransfer++)
590 theta = std::sqrt((*
fAngleDistrTable)(iPlace)->GetLowEdgeEnergy(iTransfer-1));
595 dirX = std::sin(theta)*std::cos(phi) ;
596 dirY = std::sin(theta)*std::sin(phi) ;
597 dirZ = std::cos(theta) ;
618 W1 = (E2 - TkinScaled)*W;
619 W2 = (TkinScaled - E1)*W;
641 for(iTR=0;iTR<numOfTR;iTR++)
643 energyPos = ((*(*fEnergyDistrTable)(iPlace))(0)*W1+
645 for(iTransfer=0;iTransfer<
fBinTR-1;iTransfer++)
650 energyTR = ((*fEnergyDistrTable)(iPlace)->GetLowEdgeEnergy(iTransfer))*W1+
655 kinEnergy -= energyTR;
658 anglePos = ((*(*fAngleDistrTable)(iPlace))(0)*W1+
660 for(iTransfer=0;iTransfer<fBinTR-1;iTransfer++)
666 GetLowEdgeEnergy(iTransfer-1))*W1+
668 GetLowEdgeEnergy(iTransfer-1))*W2);
673 dirX = std::sin(theta)*std::cos(phi) ;
674 dirY = std::sin(theta)*std::sin(phi) ;
675 dirZ = std::cos(theta) ;
698 G4int iPlace, numOfTR, iTR, iTransfer;
729 iPlace = (iMat*(numOfCouples - 1) + jMat)*
fTotBin + iTkin - 1;
733 iPlace = (iMat*(numOfCouples - 1) + jMat - 1)*
fTotBin + iTkin - 1;
740 numOfTR =
G4Poisson( (*energyVector1)(0) );
747 for(iTR=0;iTR<numOfTR;iTR++)
750 for(iTransfer=0;iTransfer<
fBinTR-1;iTransfer++)
752 if(energyPos >= (*energyVector1)(iTransfer))
break;
768 numOfTR =
G4Poisson( (*energyVector1)(0)*W1 +
769 (*energyVector2)(0)*W2 );
776 G4cout<<
"It is still OK in GetEnergyTR(int,int,int)"<<
G4endl;
777 for(iTR=0;iTR<numOfTR;iTR++)
779 energyPos = ((*energyVector1)(0)*W1+
781 for(iTransfer=0;iTransfer<
fBinTR-1;iTransfer++)
783 if(energyPos >= ((*energyVector1)(iTransfer)*W1+
784 (*energyVector2)(iTransfer)*W2))
break;
787 (energyVector2->GetLowEdgeEnergy(iTransfer))*W2;
static G4double fMaxProtonTkin
G4double AngleDensity(G4double energy, G4double varAngle) const
G4double condition(const G4ErrorSymMatrix &m)
G4double AngleInterval(G4double energy, G4double varAngle1, G4double varAngle2) const
G4long G4Poisson(G4double mean)
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
static constexpr double proton_mass_c2
G4double GetKineticEnergy() const
static G4double fTheMaxEnergyTR
G4double GetEnergyTR(G4int iMat, G4int jMat, G4int iTkin) const
const G4DynamicParticle * GetDynamicParticle() const
static G4double fMinProtonTkin
G4ForwardXrayTR(const G4String &matName1, const G4String &matName2, const G4String &processName="XrayTR")
G4double SpectralDensity(G4double energy, G4double x) const
static constexpr double hbarc
G4StepStatus GetStepStatus() const
const G4String & GetName() const
G4double GetSurfaceTolerance() const
G4double AngleSum(G4double varAngle1, G4double varAngle2) const
G4ParticleDefinition * GetDefinition() const
G4double GetThetaTR(G4int iMat, G4int jMat, G4int iTkin) const
G4double GetLowEdgeEnergy(size_t binNumber) const
G4PhysicsTable * fAngleDistrTable
static G4double fPlasmaCof
static constexpr double twopi
static constexpr double electron_mass_c2
static constexpr double TeV
static G4double fTheMinAngle
G4StepPoint * GetPreStepPoint() const
static G4int fSympsonNumber
G4GLOB_DLL std::ostream G4cout
G4VPhysicalVolume * GetPhysicalVolume() const
size_t GetTableSize() const
G4double GetElectronDensity() const
const G4ThreeVector & GetMomentumDirection() const
Hep3Vector & rotateUz(const Hep3Vector &)
void PutValue(size_t index, G4double theValue)
virtual ~G4ForwardXrayTR()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4PhysicsTable * fEnergyDistrTable
G4double SpectralAngleTRdensity(G4double energy, G4double varAngle) const override
virtual void Initialize(const G4Track &)
static G4ProductionCutsTable * GetProductionCutsTable()
G4double GetPDGMass() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4ParticleDefinition * fPtrGamma
G4double energy(const ThreeVector &p, const G4double m)
void SetNumberOfSecondaries(G4int totSecondaries)
G4double EnergySum(G4double energy1, G4double energy2) const
G4StepPoint * GetPostStepPoint() const
void ProposeEnergy(G4double finalEnergy)
G4ParticleChange aParticleChange
static constexpr double GeV
void AddSecondary(G4Track *aSecondary)
void insertAt(size_t, G4PhysicsVector *)
static G4double fTheMinEnergyTR
G4double GetMeanFreePath(const G4Track &, G4double, G4ForceCondition *condition) override
static constexpr double pi
static G4double fTheMaxAngle
static constexpr double fine_structure_const
G4double GetPDGCharge() const
static constexpr double keV
G4double EnergyInterval(G4double energy1, G4double energy2, G4double varAngle) const
G4PhysicsLogVector * fProtonEnergyVector
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
const std::vector< G4double > * fGammaCutInKineticEnergy
G4double GetStepLength() const
static G4GeometryTolerance * GetInstance()
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
const G4Material * GetMaterial() const