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

#include <G4GSMottCorrection.hh>

Public Member Functions

 G4GSMottCorrection (G4bool iselectron=true)
 
 ~G4GSMottCorrection ()
 
void Initialise ()
 
void GetMottCorrectionFactors (G4double logekin, G4double beta2, G4int matindx, G4double &mcToScr, G4double &mcToQ1, G4double &mcToG2PerG1)
 
G4double GetMottRejectionValue (G4double logekin, G4double G4beta2, G4double q1, G4double cost, G4int matindx, G4int &ekindx, G4int &deltindx)
 

Static Public Member Functions

static G4int GetMaxZet ()
 

Detailed Description

Definition at line 87 of file G4GSMottCorrection.hh.

Constructor & Destructor Documentation

◆ G4GSMottCorrection()

G4GSMottCorrection::G4GSMottCorrection ( G4bool iselectron = true)

Definition at line 72 of file G4GSMottCorrection.cc.

72 : fIsElectron(iselectron) {
73 // init grids related data member values
74 fMaxEkin = CLHEP::electron_mass_c2*(1./std::sqrt(1.-gMaxBeta2)-1.);
75 fLogMinEkin = G4Log(gMinEkin);
76 fInvLogDelEkin = (gNumEkin-gNumBeta2)/G4Log(gMidEkin/gMinEkin);
77 G4double pt2 = gMidEkin*(gMidEkin+2.0*CLHEP::electron_mass_c2);
78 fMinBeta2 = pt2/(pt2+CLHEP::electron_mass_c2*CLHEP::electron_mass_c2);
79 fInvDelBeta2 = (gNumBeta2-1.)/(gMaxBeta2-fMinBeta2);
80 fInvDelDelta = (gNumDelta-1.)/gMaxDelta;
81 fInvDelAngle = gNumAngle-1.;
82}
G4double G4Log(G4double x)
Definition G4Log.hh:227
double G4double
Definition G4Types.hh:83

◆ ~G4GSMottCorrection()

G4GSMottCorrection::~G4GSMottCorrection ( )

Definition at line 85 of file G4GSMottCorrection.cc.

85 {
86 ClearMCDataPerElement();
87 ClearMCDataPerMaterial();
88}

Member Function Documentation

◆ GetMaxZet()

static G4int G4GSMottCorrection::GetMaxZet ( )
inlinestatic

Definition at line 101 of file G4GSMottCorrection.hh.

101{ return gMaxZet; }

◆ GetMottCorrectionFactors()

void G4GSMottCorrection::GetMottCorrectionFactors ( G4double logekin,
G4double beta2,
G4int matindx,
G4double & mcToScr,
G4double & mcToQ1,
G4double & mcToG2PerG1 )

Definition at line 91 of file G4GSMottCorrection.cc.

92 {
93 G4int ekinIndxLow = 0;
94 G4double remRfaction = 0.;
95 if (beta2>=gMaxBeta2) {
96 ekinIndxLow = gNumEkin - 1;
97 // remRfaction = -1.
98 } else if (beta2>=fMinBeta2) { // linear interpolation on \beta^2
99 remRfaction = (beta2 - fMinBeta2) * fInvDelBeta2;
100 ekinIndxLow = (G4int)remRfaction;
101 remRfaction -= ekinIndxLow;
102 ekinIndxLow += (gNumEkin - gNumBeta2);
103 } else if (logekin>=fLogMinEkin) {
104 remRfaction = (logekin - fLogMinEkin) * fInvLogDelEkin;
105 ekinIndxLow = (G4int)remRfaction;
106 remRfaction -= ekinIndxLow;
107 } // the defaults otherwise i.e. use the lowest energy values when ekin is smaller than the minum ekin
108 //
109 DataPerEkin *perEkinLow = fMCDataPerMaterial[matindx]->fDataPerEkin[ekinIndxLow];
110 mcToScr = perEkinLow->fMCScreening;
111 mcToQ1 = perEkinLow->fMCFirstMoment;
112 mcToG2PerG1 = perEkinLow->fMCSecondMoment;
113 if (remRfaction>0.) {
114 DataPerEkin *perEkinHigh = fMCDataPerMaterial[matindx]->fDataPerEkin[ekinIndxLow+1];
115 mcToScr += remRfaction*(perEkinHigh->fMCScreening - perEkinLow->fMCScreening);
116 mcToQ1 += remRfaction*(perEkinHigh->fMCFirstMoment - perEkinLow->fMCFirstMoment);
117 mcToG2PerG1 += remRfaction*(perEkinHigh->fMCSecondMoment - perEkinLow->fMCSecondMoment);
118 }
119}
int G4int
Definition G4Types.hh:85

◆ GetMottRejectionValue()

double G4GSMottCorrection::GetMottRejectionValue ( G4double logekin,
G4double G4beta2,
G4double q1,
G4double cost,
G4int matindx,
G4int & ekindx,
G4int & deltindx )

Definition at line 123 of file G4GSMottCorrection.cc.

124 {
125 G4double val = 1.0;
126 G4double delta = q1/(0.5+q1);
127 // check if converged to 1 for all angles => accept cost
128 if (delta>=gMaxDelta) {
129 return val;
130 }
131 //
132 // check if kinetic energy index needs to be determined
133 if (ekindx<0) {
134 G4int ekinIndxLow = 0;
135 G4double probIndxHigh = 0.; // will be the prob. of taking the ekinIndxLow+1 bin
136 if (beta2>gMaxBeta2) {
137 ekinIndxLow = gNumEkin - 1;
138 // probIndxHigh = -1.
139 } else if (beta2>=fMinBeta2) { // linear interpolation on \beta^2
140 probIndxHigh = (beta2 - fMinBeta2) * fInvDelBeta2;
141 ekinIndxLow = (G4int)probIndxHigh;
142 probIndxHigh -= ekinIndxLow;
143 ekinIndxLow += (gNumEkin - gNumBeta2);
144 } else if (logekin>fLogMinEkin) { // linear interpolation on \ln(E_{kin})
145 probIndxHigh = (logekin - fLogMinEkin) * fInvLogDelEkin;
146 ekinIndxLow = (G4int)probIndxHigh;
147 probIndxHigh -= ekinIndxLow;
148 } // the defaults otherwise i.e. use the lowest energy values when ekin is smaller than the minum ekin
149 //
150 // check if need to take the higher ekin index
151 if (G4UniformRand()<probIndxHigh) {
152 ++ekinIndxLow;
153 }
154 // set kinetic energy grid index
155 ekindx = ekinIndxLow;
156 }
157 // check if delta value index needs to be determined (note: in case of single scattering deltindx will be set to 0 by
158 // by the caller but the ekindx will be -1: kinetic energy index is not known but the delta index is known)
159 if (deltindx<0) {
160 // note: delta is for sure < gMaxDelta at this point ( and minimum delta value is 0)
161 G4double probIndxHigh = delta*fInvDelDelta; // will be the prob. of taking the deltIndxLow+1 bin
162 G4int deltIndxLow = (G4int)probIndxHigh;
163 probIndxHigh -= deltIndxLow;
164 // check if need to take the higher delta index
165 if (G4UniformRand()<probIndxHigh) {
166 ++deltIndxLow;
167 }
168 // set the delta value grid index
169 deltindx = deltIndxLow;
170 }
171 //
172 // get the corresponding distribution
173 DataPerDelta *perDelta = fMCDataPerMaterial[matindx]->fDataPerEkin[ekindx]->fDataPerDelta[deltindx];
174 //
175 // determine lower index of the angular bin
176 G4double ang = std::sqrt(0.5*(1.-cost)); // sin(0.5\theta) in [0,1]
177 G4double remRfaction = ang*fInvDelAngle;
178 G4int angIndx = (G4int)remRfaction;
179 remRfaction -= angIndx;
180 if (angIndx<gNumAngle-2) { // normal case: linear interpolation
181 val = remRfaction*(perDelta->fRejFuntion[angIndx+1]-perDelta->fRejFuntion[angIndx]) + perDelta->fRejFuntion[angIndx];
182 } else { // last bin
183 G4double dum = ang-1.+1./fInvDelAngle;
184 val = perDelta->fSA + dum*(perDelta->fSB + dum*(perDelta->fSC + dum*perDelta->fSD));
185 }
186 return val;
187}
#define G4UniformRand()
Definition Randomize.hh:52

◆ Initialise()

void G4GSMottCorrection::Initialise ( )

Definition at line 190 of file G4GSMottCorrection.cc.

190 {
191 // load Mott-correction data for each elements that belongs to materials that are used in the detector
192 InitMCDataPerElement();
193 // clrea Mott-correction data per material
194 ClearMCDataPerMaterial();
195 // initialise Mott-correction data for the materials that are used in the detector
196 InitMCDataPerMaterials();
197}

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