Geant4 11.1.1
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 71 of file G4GSMottCorrection.cc.

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

◆ ~G4GSMottCorrection()

G4GSMottCorrection::~G4GSMottCorrection ( )

Definition at line 84 of file G4GSMottCorrection.cc.

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

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 90 of file G4GSMottCorrection.cc.

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

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

◆ Initialise()

void G4GSMottCorrection::Initialise ( )

Definition at line 189 of file G4GSMottCorrection.cc.

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

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