Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4EnergyLossForExtrapolator.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4EnergyLossForExtrapolator.hh 97392 2016-06-02 10:10:32Z gcosmo $
27 //
28 //---------------------------------------------------------------------------
29 //
30 // ClassName: G4EnergyLossForExtrapolator
31 //
32 // Description: This class provide calculation of energy loss, fluctuation,
33 // and msc angle
34 //
35 // Author: 09.12.04 V.Ivanchenko
36 //
37 // Modification:
38 // 08-04-05 Rename Propogator -> Extrapolator
39 // 16-03-06 Add muon tables
40 // 21-03-06 Add verbosity defined in the constructor and Initialisation
41 // start only when first public method is called (V.Ivanchenko)
42 // 03-05-06 Remove unused pointer G4Material* from number of methods (VI)
43 // 28-07-07 Add maxEnergyTransfer for computation of energy loss (VI)
44 //
45 //----------------------------------------------------------------------------
46 //
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
50 #ifndef G4EnergyLossForExtrapolator_h
51 #define G4EnergyLossForExtrapolator_h 1
52 
53 #include <vector>
55 
56 #include "globals.hh"
57 #include "G4PhysicsTable.hh"
59 #include "G4Log.hh"
60 
62 class G4Material;
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
66 
68 {
69 public:
70 
71  explicit G4EnergyLossForExtrapolator(G4int verb = 1);
72 
74 
76 
78 
80 
81  G4double EnergyAfterStep(G4double kinEnergy, G4double step,
82  const G4Material*, const G4ParticleDefinition*);
83 
84  G4double EnergyBeforeStep(G4double kinEnergy, G4double step,
85  const G4Material*, const G4ParticleDefinition*);
86 
87  G4double TrueStepLength(G4double kinEnergy, G4double step,
88  const G4Material*, const G4ParticleDefinition* part);
89 
90  inline G4double EnergyAfterStep(G4double kinEnergy, G4double step,
91  const G4Material*,
92  const G4String& particleName);
93 
94  inline G4double EnergyBeforeStep(G4double kinEnergy, G4double step,
95  const G4Material*,
96  const G4String& particleName);
97 
98  inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
99  const G4Material*,
100  const G4ParticleDefinition* part);
101 
102  inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
103  const G4Material*,
104  const G4String& particleName);
105 
106  inline G4double ComputeTrueStep(const G4Material*,
107  const G4ParticleDefinition* part,
108  G4double kinEnergy, G4double stepLength);
109 
110  inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
111  const G4Material*,
112  const G4ParticleDefinition*);
113 
114  inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
115  const G4Material*,
116  const G4String& particleName);
117 
118  inline void SetVerbose(G4int val);
119 
120  inline void SetMinKinEnergy(G4double);
121 
122  inline void SetMaxKinEnergy(G4double);
123 
124  inline void SetMaxEnergyTransfer(G4double);
125 
126 private:
127 
128  void Initialisation();
129 
130  void BuildTables();
131 
132  G4bool SetupKinematics(const G4ParticleDefinition*, const G4Material*,
133  G4double kinEnergy);
134 
135  const G4ParticleDefinition* FindParticle(const G4String& name);
136 
137  inline G4double ComputeValue(G4double x, const G4PhysicsTable* table,
138  size_t idx);
139 
140  inline const G4PhysicsTable* GetPhysicsTable(ExtTableType type) const;
141 
142  // hide assignment operator
145 
146  static G4TablesForExtrapolator* tables;
147 
148  const G4ParticleDefinition* currentParticle;
149  const G4ParticleDefinition* electron;
150  const G4ParticleDefinition* positron;
151  const G4ParticleDefinition* muonPlus;
152  const G4ParticleDefinition* muonMinus;
153  const G4ParticleDefinition* proton;
154 
155  G4String currentParticleName;
156 
157  size_t idxDedxElectron;
158  size_t idxDedxPositron;
159  size_t idxDedxMuon;
160  size_t idxDedxProton;
161  size_t idxRangeElectron;
162  size_t idxRangePositron;
163  size_t idxRangeMuon;
164  size_t idxRangeProton;
165  size_t idxInvRangeElectron;
166  size_t idxInvRangePositron;
167  size_t idxInvRangeMuon;
168  size_t idxInvRangeProton;
169  size_t idxMscElectron;
170 
171  const G4Material* currentMaterial;
172  G4int index;
173 
174  G4double electronDensity;
175  G4double radLength;
176  G4double mass;
177  G4double charge2;
178  G4double kineticEnergy;
179  G4double gam;
180  G4double bg2;
181  G4double beta2;
182  G4double tmax;
183 
184  G4double linLossLimit;
185  G4double emin;
186  G4double emax;
187  G4double maxEnergyTransfer;
188 
189  G4int nbins;
190  G4int nmat;
191  G4int verbose;
192 };
193 
194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
195 
196 inline const G4PhysicsTable*
197 G4EnergyLossForExtrapolator::GetPhysicsTable(ExtTableType type) const
198 {
199  return tables->GetPhysicsTable(type);
200 }
201 
202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
203 
204 inline G4double
206  G4double step,
207  const G4Material* mat,
208  const G4String& name)
209 {
210  return EnergyAfterStep(kinEnergy,step,mat,FindParticle(name));
211 }
212 
213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
214 
215 inline G4double
217  G4double step,
218  const G4Material* mat,
219  const G4String& name)
220 {
221  return EnergyBeforeStep(kinEnergy,step,mat,FindParticle(name));
222 }
223 
224 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
225 
226 inline G4double
228  G4double step,
229  const G4Material* mat,
230  const G4String& name)
231 {
232  return AverageScatteringAngle(kinEnergy,step,mat,FindParticle(name));
233 }
234 
235 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
236 
237 inline G4double
239  G4double step,
240  const G4Material* mat,
241  const G4String& name)
242 {
243  return EnergyDispersion(kinEnergy,step,mat,FindParticle(name));
244 }
245 
246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
247 
249  G4double kinEnergy,
250  G4double stepLength,
251  const G4Material* mat,
252  const G4ParticleDefinition* part)
253 {
254  G4double theta = 0.0;
255  if(SetupKinematics(part, mat, kinEnergy)) {
256  G4double t = stepLength/radLength;
257  G4double y = std::max(0.001, t);
258  theta = 19.23*CLHEP::MeV*std::sqrt(charge2*t)*(1.0 + 0.038*G4Log(y))
259  /(beta2*gam*mass);
260  }
261  return theta;
262 }
263 
264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
265 
266 inline G4double
268  const G4ParticleDefinition* part,
269  G4double kinEnergy,
270  G4double stepLength)
271 {
272  G4double theta = AverageScatteringAngle(kinEnergy,stepLength,mat,part);
273  return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
274 }
275 
276 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
277 
278 inline G4double
280  G4double stepLength,
281  const G4Material* mat,
282  const G4ParticleDefinition* part)
283 {
284  G4double sig2 = 0.0;
285  if(SetupKinematics(part, mat, kinEnergy)) {
286  G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
287  sig2 = (1.0/beta2 - 0.5)
288  *CLHEP::twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
289  }
290  return sig2;
291 }
292 
293 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
294 
295 inline G4double
296 G4EnergyLossForExtrapolator::ComputeValue(G4double x,
297  const G4PhysicsTable* table,
298  size_t idx)
299 {
300  G4double res = 0.0;
301  if(table) { res = ((*table)[index])->Value(x, idx); }
302  return res;
303 }
304 
305 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
306 
308 {
309  verbose = val;
310 }
311 
312 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
313 
315 {
316  emin = val;
317 }
318 
319 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
320 
322 {
323  emax = val;
324 }
325 
326 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
327 
329 {
330  maxEnergyTransfer = val;
331 }
332 
333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
334 
335 #endif
336 
const XML_Char * name
Definition: expat.h:151
G4double EnergyDispersion(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
G4double AverageScatteringAngle(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
const G4PhysicsTable * GetPhysicsTable(ExtTableType type) const
static constexpr double twopi_mc2_rcl2
G4double TrueStepLength(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *part)
int G4int
Definition: G4Types.hh:78
G4double ComputeTrueStep(const G4Material *, const G4ParticleDefinition *part, G4double kinEnergy, G4double stepLength)
bool G4bool
Definition: G4Types.hh:79
static constexpr double MeV
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *)
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition *)
G4double EnergyBeforeStep(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
G4double EnergyAfterStep(G4double kinEnergy, G4double step, const G4Material *, const G4ParticleDefinition *)
G4double G4Log(G4double x)
Definition: G4Log.hh:230
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double ComputeEnergy(G4double range, const G4ParticleDefinition *)
double G4double
Definition: G4Types.hh:76