Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AdjointPhotoElectricModel Class Reference

#include <G4AdjointPhotoElectricModel.hh>

+ Inheritance diagram for G4AdjointPhotoElectricModel:

Public Member Functions

 G4AdjointPhotoElectricModel ()
 
 ~G4AdjointPhotoElectricModel () override
 
void SampleSecondaries (const G4Track &aTrack, G4bool isScatProjToProj, G4ParticleChange *fParticleChange) override
 
G4double AdjointCrossSection (const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool isScatProjToProj) override
 
G4double AdjointCrossSectionPerAtom (const G4Element *anElement, G4double electronEnergy)
 
 G4AdjointPhotoElectricModel (G4AdjointPhotoElectricModel &)=delete
 
G4AdjointPhotoElectricModeloperator= (const G4AdjointPhotoElectricModel &right)=delete
 
- Public Member Functions inherited from G4VEmAdjointModel
 G4VEmAdjointModel (const G4String &nam)
 
virtual ~G4VEmAdjointModel ()
 
virtual void SampleSecondaries (const G4Track &aTrack, G4bool isScatProjToProj, G4ParticleChange *fParticleChange)=0
 
virtual G4double AdjointCrossSection (const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool isScatProjToProj)
 
virtual G4double DiffCrossSectionPerAtomPrimToSecond (G4double kinEnergyProj, G4double kinEnergyProd, G4double Z, G4double A=0.)
 
virtual G4double DiffCrossSectionPerAtomPrimToScatPrim (G4double kinEnergyProj, G4double kinEnergyScatProj, G4double Z, G4double A=0.)
 
virtual G4double DiffCrossSectionPerVolumePrimToSecond (const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyProd)
 
virtual G4double DiffCrossSectionPerVolumePrimToScatPrim (const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyScatProj)
 
virtual G4double GetSecondAdjEnergyMaxForScatProjToProj (G4double primAdjEnergy)
 
virtual G4double GetSecondAdjEnergyMinForScatProjToProj (G4double primAdjEnergy, G4double tcut=0.)
 
virtual G4double GetSecondAdjEnergyMaxForProdToProj (G4double primAdjEnergy)
 
virtual G4double GetSecondAdjEnergyMinForProdToProj (G4double primAdjEnergy)
 
void DefineCurrentMaterial (const G4MaterialCutsCouple *couple)
 
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerAtomForSecond (G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
 
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerAtomForScatProj (G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
 
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerVolumeForSecond (G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
 
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerVolumeForScatProj (G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
 
void SetCSMatrices (std::vector< G4AdjointCSMatrix * > *Vec1CSMatrix, std::vector< G4AdjointCSMatrix * > *Vec2CSMatrix)
 
G4ParticleDefinitionGetAdjointEquivalentOfDirectPrimaryParticleDefinition ()
 
G4ParticleDefinitionGetAdjointEquivalentOfDirectSecondaryParticleDefinition ()
 
G4double GetHighEnergyLimit ()
 
G4double GetLowEnergyLimit ()
 
void SetHighEnergyLimit (G4double aVal)
 
void SetLowEnergyLimit (G4double aVal)
 
void DefineDirectEMModel (G4VEmModel *aModel)
 
void SetAdjointEquivalentOfDirectPrimaryParticleDefinition (G4ParticleDefinition *aPart)
 
void SetAdjointEquivalentOfDirectSecondaryParticleDefinition (G4ParticleDefinition *aPart)
 
void SetSecondPartOfSameType (G4bool aBool)
 
G4bool GetSecondPartOfSameType ()
 
void SetUseMatrix (G4bool aBool)
 
void SetUseMatrixPerElement (G4bool aBool)
 
void SetUseOnlyOneMatrixForAllElements (G4bool aBool)
 
void SetApplyCutInRange (G4bool aBool)
 
G4bool GetUseMatrix ()
 
G4bool GetUseMatrixPerElement ()
 
G4bool GetUseOnlyOneMatrixForAllElements ()
 
G4bool GetApplyCutInRange ()
 
G4String GetName ()
 
virtual void SetCSBiasingFactor (G4double aVal)
 
void SetCorrectWeightForPostStepInModel (G4bool aBool)
 
void SetAdditionalWeightCorrectionFactorForPostStepOutsideModel (G4double factor)
 
 G4VEmAdjointModel (G4VEmAdjointModel &)=delete
 
G4VEmAdjointModeloperator= (const G4VEmAdjointModel &right)=delete
 

Protected Member Functions

void CorrectPostStepWeight (G4ParticleChange *fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy, G4bool isScatProjToProj) override
 
- Protected Member Functions inherited from G4VEmAdjointModel
G4double DiffCrossSectionFunction1 (G4double kinEnergyProj)
 
G4double DiffCrossSectionFunction2 (G4double kinEnergyProj)
 
G4double SampleAdjSecEnergyFromCSMatrix (std::size_t MatrixIndex, G4double prim_energy, G4bool isScatProjToProj)
 
G4double SampleAdjSecEnergyFromCSMatrix (G4double prim_energy, G4bool isScatProjToProj)
 
void SelectCSMatrix (G4bool isScatProjToProj)
 
virtual G4double SampleAdjSecEnergyFromDiffCrossSectionPerAtom (G4double prim_energy, G4bool isScatProjToProj)
 
virtual void CorrectPostStepWeight (G4ParticleChange *fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy, G4bool isScatProjToProj)
 

Additional Inherited Members

- Protected Attributes inherited from G4VEmAdjointModel
G4AdjointCSManagerfCSManager
 
G4VEmModelfDirectModel = nullptr
 
const G4String fName
 
G4MaterialfSelectedMaterial = nullptr
 
G4MaterialfCurrentMaterial = nullptr
 
G4MaterialCutsCouplefCurrentCouple = nullptr
 
G4ParticleDefinitionfAdjEquivDirectPrimPart = nullptr
 
G4ParticleDefinitionfAdjEquivDirectSecondPart = nullptr
 
G4ParticleDefinitionfDirectPrimaryPart = nullptr
 
std::vector< G4AdjointCSMatrix * > * fCSMatrixProdToProjBackScat = nullptr
 
std::vector< G4AdjointCSMatrix * > * fCSMatrixProjToProjBackScat = nullptr
 
std::vector< G4doublefElementCSScatProjToProj
 
std::vector< G4doublefElementCSProdToProj
 
G4double fKinEnergyProdForIntegration = 0.
 
G4double fKinEnergyScatProjForIntegration = 0.
 
G4double fLastCS = 0.
 
G4double fLastAdjointCSForScatProjToProj = 0.
 
G4double fLastAdjointCSForProdToProj = 0.
 
G4double fPreStepEnergy = 0.
 
G4double fTcutPrim = 0.
 
G4double fTcutSecond = 0.
 
G4double fHighEnergyLimit = 0.
 
G4double fLowEnergyLimit = 0.
 
G4double fCsBiasingFactor = 1.
 
G4double fOutsideWeightFactor = 1.
 
G4int fASelectedNucleus = 0
 
G4int fZSelectedNucleus = 0
 
std::size_t fCSMatrixUsed = 0
 
G4bool fSecondPartSameType = false
 
G4bool fInModelWeightCorr
 
G4bool fApplyCutInRange = true
 
G4bool fUseMatrix = false
 
G4bool fUseMatrixPerElement = false
 
G4bool fOneMatrixForAllElements = false
 

Detailed Description

Definition at line 53 of file G4AdjointPhotoElectricModel.hh.

Constructor & Destructor Documentation

◆ G4AdjointPhotoElectricModel() [1/2]

G4AdjointPhotoElectricModel::G4AdjointPhotoElectricModel ( )

Definition at line 39 of file G4AdjointPhotoElectricModel.cc.

40 : G4VEmAdjointModel("AdjointPEEffect")
41
42{
43 SetUseMatrix(false);
44 SetApplyCutInRange(false);
45
49 fSecondPartSameType = false;
51}
static G4AdjointElectron * AdjointElectron()
static G4AdjointGamma * AdjointGamma()
static G4Gamma * Gamma()
Definition: G4Gamma.cc:85
G4ParticleDefinition * fAdjEquivDirectSecondPart
void SetUseMatrix(G4bool aBool)
G4ParticleDefinition * fAdjEquivDirectPrimPart
G4VEmModel * fDirectModel
G4ParticleDefinition * fDirectPrimaryPart
void SetApplyCutInRange(G4bool aBool)

◆ ~G4AdjointPhotoElectricModel()

G4AdjointPhotoElectricModel::~G4AdjointPhotoElectricModel ( )
override

Definition at line 54 of file G4AdjointPhotoElectricModel.cc.

54{}

◆ G4AdjointPhotoElectricModel() [2/2]

G4AdjointPhotoElectricModel::G4AdjointPhotoElectricModel ( G4AdjointPhotoElectricModel )
delete

Member Function Documentation

◆ AdjointCrossSection()

G4double G4AdjointPhotoElectricModel::AdjointCrossSection ( const G4MaterialCutsCouple aCouple,
G4double  primEnergy,
G4bool  isScatProjToProj 
)
overridevirtual

Reimplemented from G4VEmAdjointModel.

Definition at line 165 of file G4AdjointPhotoElectricModel.cc.

168{
169 if(isScatProjToProj)
170 return 0.;
171
172 G4double totBiasedAdjointCS = 0.;
173 if(aCouple != fCurrentCouple || fCurrenteEnergy != electronEnergy)
174 {
175 fTotAdjointCS = 0.;
176 DefineCurrentMaterialAndElectronEnergy(aCouple, electronEnergy);
177 const G4ElementVector* theElementVector =
179 const G4double* theAtomNumDensityVector =
181 size_t nelm = fCurrentMaterial->GetNumberOfElements();
182 for(fIndexElement = 0; fIndexElement < nelm; ++fIndexElement)
183 {
184 fTotAdjointCS += AdjointCrossSectionPerAtom(
185 (*theElementVector)[fIndexElement], electronEnergy) *
186 theAtomNumDensityVector[fIndexElement];
187 fXsec[fIndexElement] = fTotAdjointCS;
188 }
189
190 totBiasedAdjointCS = std::min(fTotAdjointCS, 0.01);
191 fFactorCSBiasing = totBiasedAdjointCS / fTotAdjointCS;
192 }
193 return totBiasedAdjointCS;
194}
std::vector< const G4Element * > G4ElementVector
double G4double
Definition: G4Types.hh:83
G4double AdjointCrossSectionPerAtom(const G4Element *anElement, G4double electronEnergy)
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:185
size_t GetNumberOfElements() const
Definition: G4Material.hh:181
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:201
G4MaterialCutsCouple * fCurrentCouple
G4Material * fCurrentMaterial

Referenced by SampleSecondaries().

◆ AdjointCrossSectionPerAtom()

G4double G4AdjointPhotoElectricModel::AdjointCrossSectionPerAtom ( const G4Element anElement,
G4double  electronEnergy 
)

Definition at line 197 of file G4AdjointPhotoElectricModel.cc.

199{
200 G4int nShells = anElement->GetNbOfAtomicShells();
201 G4double Z = anElement->GetZ();
202 G4double gammaEnergy = electronEnergy + anElement->GetAtomicShell(0);
204 G4Gamma::Gamma(), gammaEnergy, Z, 0., 0., 0.);
205 G4double adjointCS = 0.;
206 if(CS > 0.)
207 adjointCS += CS / gammaEnergy;
208 fShellProb[fIndexElement][0] = adjointCS;
209 for(G4int i = 1; i < nShells; ++i)
210 {
211 G4double Bi1 = anElement->GetAtomicShell(i - 1);
212 G4double Bi = anElement->GetAtomicShell(i);
213 if(electronEnergy < Bi1 - Bi)
214 {
215 gammaEnergy = electronEnergy + Bi;
217 gammaEnergy, Z, 0., 0., 0.);
218 if(CS > 0.)
219 adjointCS += CS / gammaEnergy;
220 }
221 fShellProb[fIndexElement][i] = adjointCS;
222 }
223 adjointCS *= electronEnergy;
224 return adjointCS;
225}
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
G4double GetZ() const
Definition: G4Element.hh:131
G4int GetNbOfAtomicShells() const
Definition: G4Element.hh:147
G4double GetAtomicShell(G4int index) const
Definition: G4Element.cc:372
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0., G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:284

Referenced by AdjointCrossSection().

◆ CorrectPostStepWeight()

void G4AdjointPhotoElectricModel::CorrectPostStepWeight ( G4ParticleChange fParticleChange,
G4double  old_weight,
G4double  adjointPrimKinEnergy,
G4double  projectileKinEnergy,
G4bool  isScatProjToProj 
)
overrideprotectedvirtual

Reimplemented from G4VEmAdjointModel.

Definition at line 147 of file G4AdjointPhotoElectricModel.cc.

150{
151 G4double new_weight = old_weight;
152
153 G4double w_corr =
155 fFactorCSBiasing;
156 w_corr *= fPostStepAdjointCS / fPreStepAdjointCS;
157
158 new_weight *= w_corr * projectileKinEnergy / adjointPrimKinEnergy;
159 fParticleChange->SetParentWeightByProcess(false);
160 fParticleChange->SetSecondaryWeightByProcess(false);
161 fParticleChange->ProposeParentWeight(new_weight);
162}
G4double GetPostStepWeightCorrection()
static G4AdjointCSManager * GetAdjointCSManager()
void SetSecondaryWeightByProcess(G4bool)
void SetParentWeightByProcess(G4bool)
void ProposeParentWeight(G4double finalWeight)

Referenced by SampleSecondaries().

◆ operator=()

G4AdjointPhotoElectricModel & G4AdjointPhotoElectricModel::operator= ( const G4AdjointPhotoElectricModel right)
delete

◆ SampleSecondaries()

void G4AdjointPhotoElectricModel::SampleSecondaries ( const G4Track aTrack,
G4bool  isScatProjToProj,
G4ParticleChange fParticleChange 
)
overridevirtual

Implements G4VEmAdjointModel.

Definition at line 57 of file G4AdjointPhotoElectricModel.cc.

60{
61 if(isScatProjToProj)
62 return;
63
64 // Compute the fTotAdjointCS vectors if not already done for the current
65 // couple and electron energy
66 const G4DynamicParticle* aDynPart = aTrack.GetDynamicParticle();
67 G4double electronEnergy = aDynPart->GetKineticEnergy();
68 G4ThreeVector electronDirection = aDynPart->GetMomentumDirection();
69 fPreStepAdjointCS =
70 fTotAdjointCS; // The last computed CS was at pre step point
71 AdjointCrossSection(aTrack.GetMaterialCutsCouple(), electronEnergy,
72 isScatProjToProj);
73 fPostStepAdjointCS = fTotAdjointCS;
74
75 // Sample element
76 const G4ElementVector* theElementVector =
79 G4double rand_CS = G4UniformRand() * fXsec[nelm - 1];
80 for(fIndexElement = 0; fIndexElement < nelm - 1; ++fIndexElement)
81 {
82 if(rand_CS < fXsec[fIndexElement])
83 break;
84 }
85
86 // Sample shell and binding energy
87 G4int nShells = (*theElementVector)[fIndexElement]->GetNbOfAtomicShells();
88 rand_CS = fShellProb[fIndexElement][nShells - 1] * G4UniformRand();
89 G4int i;
90 for(i = 0; i < nShells - 1; ++i)
91 {
92 if(rand_CS < fShellProb[fIndexElement][i])
93 break;
94 }
95 G4double gammaEnergy =
96 electronEnergy + (*theElementVector)[fIndexElement]->GetAtomicShell(i);
97
98 // Sample cos theta
99 // Copy of the G4PEEfectFluoModel cos theta sampling method
100 // ElecCosThetaDistribution. This method cannot be used directly from
101 // G4PEEffectFluoModel because it is a friend method.
102 G4double cos_theta = 1.;
103 G4double gamma = 1. + electronEnergy / electron_mass_c2;
104 if(gamma <= 5.)
105 {
106 G4double beta = std::sqrt(gamma * gamma - 1.) / gamma;
107 G4double b = 0.5 * gamma * (gamma - 1.) * (gamma - 2.);
108
109 G4double rndm, term, greject, grejsup;
110 if(gamma < 2.)
111 grejsup = gamma * gamma * (1. + b - beta * b);
112 else
113 grejsup = gamma * gamma * (1. + b + beta * b);
114
115 do
116 {
117 rndm = 1. - 2. * G4UniformRand();
118 cos_theta = (rndm + beta) / (rndm * beta + 1.);
119 term = 1. - beta * cos_theta;
120 greject = (1. - cos_theta * cos_theta) * (1. + b * term) / (term * term);
121 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
122 } while(greject < G4UniformRand() * grejsup);
123 }
124
125 // direction of the adjoint gamma electron
126 G4double sin_theta = std::sqrt(1. - cos_theta * cos_theta);
127 G4double phi = twopi * G4UniformRand();
128 G4double dirx = sin_theta * std::cos(phi);
129 G4double diry = sin_theta * std::sin(phi);
130 G4double dirz = cos_theta;
131 G4ThreeVector adjoint_gammaDirection(dirx, diry, dirz);
132 adjoint_gammaDirection.rotateUz(electronDirection);
133
134 // Weight correction
135 CorrectPostStepWeight(fParticleChange, aTrack.GetWeight(), electronEnergy,
136 gammaEnergy, isScatProjToProj);
137
138 // Create secondary and modify fParticleChange
139 G4DynamicParticle* anAdjointGamma = new G4DynamicParticle(
140 G4AdjointGamma::AdjointGamma(), adjoint_gammaDirection, gammaEnergy);
141
142 fParticleChange->ProposeTrackStatus(fStopAndKill);
143 fParticleChange->AddSecondary(anAdjointGamma);
144}
@ fStopAndKill
#define G4UniformRand()
Definition: Randomize.hh:52
void CorrectPostStepWeight(G4ParticleChange *fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy, G4bool isScatProjToProj) override
G4double AdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool isScatProjToProj) override
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
void AddSecondary(G4Track *aSecondary)
G4double GetWeight() const
const G4DynamicParticle * GetDynamicParticle() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void ProposeTrackStatus(G4TrackStatus status)

The documentation for this class was generated from the following files: