81 for(iMat = 0; iMat < numOfCouples; ++iMat)
91 if(iMat == numOfCouples)
93 G4Exception(
"G4ForwardXrayTR::G4ForwardXrayTR",
"ForwardXrayTR01",
95 "Invalid first material name in G4ForwardXrayTR constructor!");
101 for(iMat = 0; iMat < numOfCouples; ++iMat)
111 if(iMat == numOfCouples)
114 "G4ForwardXrayTR::G4ForwardXrayTR",
"ForwardXrayTR02",
JustWarning,
115 "Invalid second material name in G4ForwardXrayTR constructor!");
154 out <<
"Simulation of forward X-ray transition radiation generated by\n"
155 "relativistic charged particles crossing the interface between\n"
170 G4int iMat, jMat, iTkin, iTR, iPlace;
180 for(iMat = 0; iMat < numOfCouples;
186 for(jMat = 0; jMat < numOfCouples; ++jMat)
222 for(iTkin = 0; iTkin <
fTotBin; ++iTkin)
248 energyVector->PutValue(
fBinTR - 1, energySum);
249 angleVector->PutValue(
fBinTR - 1, angleSum);
251 for(iTR =
fBinTR - 2; iTR >= 0; --iTR)
255 energyVector->GetLowEdgeEnergy(iTR + 1));
259 angleVector->GetLowEdgeEnergy(iTR + 1));
261 energyVector->PutValue(iTR, energySum);
262 angleVector->PutValue(iTR, angleSum);
293 G4double formationLength1, formationLength2;
298 return (varAngle / energy) * (formationLength1 - formationLength2) *
299 (formationLength1 - formationLength2);
306 G4double x, x2, c, d, f, a2, b2, a4, b4;
317 cof1 = c * c * (0.5 / (a2 * (x2 + a2)) + 0.5 * std::log(x2 / (x2 + a2)) / a4);
318 cof3 = d * d * (0.5 / (b2 * (x2 + b2)) + 0.5 * std::log(x2 / (x2 + b2)) / b4);
320 (std::log(x2 / (x2 + b2)) / b2 - std::log(x2 / (x2 + a2)) / a2) /
322 return -varAngle * (cof1 + cof2 + cof3);
340 G4double h, sumEven = 0.0, sumOdd = 0.0;
367 return ((a + b) * std::log((x + b) / (x + a)) / (a - b) + a / (x + a) +
388 G4double h, sumEven = 0.0, sumOdd = 0.0;
412 G4int iMat, jMat, iTkin, iPlace, numOfTR, iTR, iTransfer;
414 G4double energyPos, anglePos, energyTR, theta, phi, dirX, dirY, dirZ;
471 G4double chargeSq = charge * charge;
475 G4double TkinScaled = kinEnergy * massRatio;
476 for(iTkin = 0; iTkin <
fTotBin; ++iTkin)
478 if(TkinScaled < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))
507 for(iTR = 0; iTR < numOfTR; ++iTR)
509 energyPos = (*(*fEnergyDistrTable)(iPlace))(0) *
G4UniformRand();
510 for(iTransfer = 0; iTransfer <
fBinTR - 1; ++iTransfer)
515 energyTR = (*fEnergyDistrTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
517 kinEnergy -= energyTR;
520 anglePos = (*(*fAngleDistrTable)(iPlace))(0) *
G4UniformRand();
521 for(iTransfer = 0; iTransfer <
fBinTR - 1; ++iTransfer)
530 dirX = std::sin(theta) * std::cos(phi);
531 dirY = std::sin(theta) * std::sin(phi);
532 dirZ = std::cos(theta);
540 aSecondaryTrack->SetParentID(aTrack.
GetTrackID());
541 aSecondaryTrack->SetCreatorModelID(
secID);
557 W1 = (E2 - TkinScaled) *
W;
558 W2 = (TkinScaled - E1) *
W;
563 ((*(*fEnergyDistrTable)(iPlace + 1))(0) +
574 for(iTR = 0; iTR < numOfTR; ++iTR)
576 energyPos = ((*(*fEnergyDistrTable)(iPlace))(0) * W1 +
579 for(iTransfer = 0; iTransfer <
fBinTR - 1; ++iTransfer)
587 ((*fEnergyDistrTable)(iPlace)->GetLowEdgeEnergy(iTransfer)) * W1 +
591 kinEnergy -= energyTR;
594 anglePos = ((*(*fAngleDistrTable)(iPlace))(0) * W1 +
597 for(iTransfer = 0; iTransfer <
fBinTR - 1; ++iTransfer)
610 dirX = std::sin(theta) * std::cos(phi);
611 dirY = std::sin(theta) * std::sin(phi);
612 dirZ = std::cos(theta);
636 G4int iPlace, numOfTR, iTR, iTransfer;
671 iPlace = (iMat * (numOfCouples - 1) + jMat) *
fTotBin + iTkin - 1;
675 iPlace = (iMat * (numOfCouples - 1) + jMat - 1) *
fTotBin + iTkin - 1;
689 for(iTR = 0; iTR < numOfTR; ++iTR)
692 for(iTransfer = 0; iTransfer <
fBinTR - 1; ++iTransfer)
694 if(energyPos >= (*energyVector1)(iTransfer))
711 numOfTR = (
G4int)
G4Poisson((*energyVector1)(0) * W1 + (*energyVector2)(0) * W2);
718 G4cout <<
"It is still OK in GetEnergyTR(int,int,int)" <<
G4endl;
719 for(iTR = 0; iTR < numOfTR; ++iTR)
721 energyPos = ((*energyVector1)(0) * W1 + (*energyVector2)(0) * W2) *
723 for(iTransfer = 0; iTransfer <
fBinTR - 1; ++iTransfer)
725 if(energyPos >= ((*energyVector1)(iTransfer) *W1 +
726 (*energyVector2)(iTransfer) *W2))
730 (energyVector2->GetLowEdgeEnergy(iTransfer)) * W2;
G4double condition(const G4ErrorSymMatrix &m)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4long G4Poisson(G4double mean)
G4GLOB_DLL std::ostream G4cout
Hep3Vector & rotateUz(const Hep3Vector &)
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static constexpr G4double fPlasmaCof
G4double SpectralDensity(G4double energy, G4double x) const
static constexpr G4int fTotBin
G4ForwardXrayTR(const G4String &matName1, const G4String &matName2, const G4String &processName="XrayTR")
static G4double GetMinProtonTkin()
G4double EnergyInterval(G4double energy1, G4double energy2, G4double varAngle) const
static constexpr G4double fTheMaxEnergyTR
G4double EnergySum(G4double energy1, G4double energy2) const
static G4int GetSympsonNumber()
static constexpr G4int fBinTR
static constexpr G4double fCofTR
static G4double GetMaxProtonTkin()
static constexpr G4double fTheMinAngle
const std::vector< G4double > * fGammaCutInKineticEnergy
G4PhysicsTable * fEnergyDistrTable
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
G4PhysicsTable * fAngleDistrTable
G4double AngleDensity(G4double energy, G4double varAngle) const
static constexpr G4double fTheMinEnergyTR
static constexpr G4int fSympsonNumber
G4double GetEnergyTR(G4int iMat, G4int jMat, G4int iTkin) const
static constexpr G4double fMaxProtonTkin
static constexpr G4double fTheMaxAngle
static constexpr G4double fMinProtonTkin
G4double AngleInterval(G4double energy, G4double varAngle1, G4double varAngle2) const
G4double GetThetaTR(G4int iMat, G4int jMat, G4int iTkin) const
G4PhysicsLogVector * fProtonEnergyVector
G4ParticleDefinition * fPtrGamma
G4double SpectralAngleTRdensity(G4double energy, G4double varAngle) const override
void ProcessDescription(std::ostream &) const override
G4double AngleSum(G4double varAngle1, G4double varAngle2) const
G4double GetMeanFreePath(const G4Track &, G4double, G4ForceCondition *condition) override
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
const G4Material * GetMaterial() const
G4double GetElectronDensity() const
const G4String & GetName() const
void AddSecondary(G4Track *aSecondary)
void Initialize(const G4Track &) override
void ProposeEnergy(G4double finalEnergy)
G4double GetPDGMass() const
G4double GetPDGCharge() const
static G4int GetModelID(const G4int modelIndex)
void insertAt(std::size_t, G4PhysicsVector *)
G4double GetLowEdgeEnergy(const std::size_t index) const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
const std::vector< G4double > * GetEnergyCutsVector(std::size_t pcIdx) const
static G4ProductionCutsTable * GetProductionCutsTable()
G4StepStatus GetStepStatus() const
const G4TouchableHandle & GetTouchableHandle() const
G4VPhysicalVolume * GetPhysicalVolume() const
G4StepPoint * GetPreStepPoint() const
G4StepPoint * GetPostStepPoint() const
const G4ThreeVector & GetPosition() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4double GetGlobalTime() const
const G4DynamicParticle * GetDynamicParticle() const
void SetCreatorModelID(const G4int id)
G4double GetStepLength() const
void SetParentID(const G4int aValue)
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void SetNumberOfSecondaries(G4int totSecondaries)
G4LogicalVolume * GetLogicalVolume() const
G4ParticleChange aParticleChange