Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VEnergyLoss.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 //
27 // $Id$
28 //
29 //
30 // ------------------------------------------------------------
31 // 26.10.01 static inline functions moved to .cc file (mma)
32 // 08.11.01 some static methods,data members are not static L.Urban
33 // 15.01.03 Migrade to cut per region (V.Ivanchenko)
34 // ------------------------------------------------------------
35 //
36 // Class Description
37 //
38 // General service class for the energy loss classes
39 //
40 // It contains code needed to compute the range tables,
41 // time tables, the inverse range tables and some auxiliary
42 // tables.
43 // The energy loss fluctuation code is here,too.
44 //
45 // All the EnergyLoss classes are inherited from G4VEnergyLoss
46 // class.
47 //
48 
49 // -----------------------------------------------------------
50 // created on 28 January 2000 by L. Urban
51 // -----------------------------------------------------------
52 
53 #ifndef G4VEnergyLoss_h
54 #define G4VEnergyLoss_h 1
55 
56 #include "globals.hh"
57 #include "G4ios.hh"
58 #include "Randomize.hh"
59 #include "G4Poisson.hh"
60 #include "G4Electron.hh"
62 #include "G4PhysicsLogVector.hh"
63 #include "G4PhysicsLinearVector.hh"
64 #include "G4MaterialCutsCouple.hh"
65 
67 
69 {
70  public:
71 
73 
74  virtual ~G4VEnergyLoss();
75 
76  virtual G4double GetContinuousStepLimit(const G4Track& track,
77  G4double previousStepSize,
78  G4double currentMinimumStep,
79  G4double& currentSafety) = 0 ;
80 
81  virtual G4VParticleChange* AlongStepDoIt(const G4Track& track,
82  const G4Step& Step) = 0 ;
83 
84  virtual G4double GetMeanFreePath(const G4Track& track,
85  G4double previousStepSize,
87 
88  virtual G4VParticleChange* PostStepDoIt(const G4Track& track,
89  const G4Step& Step) = 0;
90 
91 
92 
93  protected:// with description
94 
95  // code for the energy loss fluctuation
96 
98  const G4MaterialCutsCouple* couple,
99  G4double ChargeSquare,
100  G4double MeanLoss,
101  G4double step);
102 
103  // Build range table starting from the DEDXtable
105  BuildRangeTable(G4PhysicsTable* theDEDXTable,
106  G4PhysicsTable* theRangeTable,
107  G4double Tmin,G4double Tmax,G4int nbin);
108 
109  // Build time tables starting from the DEDXtable
111  BuildLabTimeTable(G4PhysicsTable* theDEDXTable,
112  G4PhysicsTable* theLabTimeTable,
113  G4double Tmin,G4double Tmax,G4int nbin);
114 
116  BuildProperTimeTable(G4PhysicsTable* theDEDXTable,
117  G4PhysicsTable* ProperTimeTable,
118  G4double Tmin,G4double Tmax,G4int nbin);
119 
120  // Build tables of coefficients needed for inverting the range table
122  BuildRangeCoeffATable(G4PhysicsTable* theRangeTable,
123  G4PhysicsTable* theCoeffATable,
124  G4double Tmin,G4double Tmax,G4int nbin);
126  BuildRangeCoeffBTable(G4PhysicsTable* theRangeTable,
127  G4PhysicsTable* theCoeffBTable,
128  G4double Tmin,G4double Tmax,G4int nbin);
130  BuildRangeCoeffCTable(G4PhysicsTable* theRangeTable,
131  G4PhysicsTable* theCoeffCTable,
132  G4double Tmin,G4double Tmax,G4int nbin);
133 
134  // Invert range table
136  BuildInverseRangeTable(G4PhysicsTable* theRangeTable,
137  G4PhysicsTable* theRangeCoeffATable,
138  G4PhysicsTable* theRangeCoeffBTable,
139  G4PhysicsTable* theRangeCoeffCTable,
140  G4PhysicsTable* theInverseRangeTable,
141  G4double Tmin,G4double Tmax,G4int nbin);
142 
143  private:
144 
145  void BuildRangeVector(G4PhysicsTable* theDEDXTable,
146  G4double Tmin,G4double Tmax,G4int nbin,
147  G4int materialIndex,G4PhysicsLogVector* rangeVector);
148 
149  G4double RangeIntLin(G4PhysicsVector* physicsVector,G4int nbin);
150 
151  G4double RangeIntLog(G4PhysicsVector* physicsVector,G4int nbin);
152 
153  void BuildLabTimeVector(G4PhysicsTable* theDEDXTable,
154  G4double Tmin,G4double Tmax,G4int nbin,
155  G4int materialIndex,G4PhysicsLogVector* rangeVector);
156 
157  void BuildProperTimeVector(G4PhysicsTable* theDEDXTable,
158  G4double Tmin,G4double Tmax,G4int nbin,
159  G4int materialIndex,G4PhysicsLogVector* rangeVector);
160 
161  G4double LabTimeIntLog(G4PhysicsVector* physicsVector,G4int nbin);
162 
163  G4double ProperTimeIntLog(G4PhysicsVector* physicsVector,G4int nbin);
164 
165  void InvertRangeVector(G4PhysicsTable* theRangeTable,
166  G4PhysicsTable* theRangeCoeffATable,
167  G4PhysicsTable* theRangeCoeffBTable,
168  G4PhysicsTable* theRangeCoeffCTable,
169  G4double Tmin,G4double Tmax,G4int nbin,
170  G4int materialIndex,G4PhysicsLogVector* rangeVector);
171 
172 
173  protected:
174 
176 
177  private:
178 
179  // data members to speed up the fluctuation calculation
180  const G4Material* lastMaterial;
181  G4int imat;
182  G4double f1Fluct,f2Fluct,e1Fluct,e2Fluct,rateFluct,ipotFluct;
183  G4double e1LogFluct,e2LogFluct,ipotLogFluct;
184 
185  const G4int nmaxCont1,nmaxCont2 ;
186 
187  // for some integration routines
188  G4double taulow,tauhigh,ltaulow,ltauhigh;
189 
190  // static part of the class
191 
192  public: // With description
193 
194  static void SetRndmStep(G4bool value);
195  // use / do not use randomisation in energy loss steplimit
196  // ( default = no randomisation)
197 
198  static void SetEnlossFluc(G4bool value);
199  // compute energy loss with/without fluctuation
200  // ( default : with fluctuation)
201 
202  static void SetSubSec(G4bool value);
203  // switch on/off the generation of the subcutoff secondaries
204  // ( default = no subcutoff secondary generation )
205 
206  static void SetMinDeltaCutInRange(G4double value);
207  // sets minimal cut value for the subcutoff secondaries
208  // (i.e. the kinetic energy of these secondaries can not be
209  // smaller than the energy corresponds to MinDeltaCutInRange).
210 
211 
212  static void SetStepFunction (G4double c1, G4double c2);
213  // sets values for data members used to compute the step limit:
214  // dRoverRange : max. relative range change in one step,
215  // finalRange : if range <= finalRange --> last step for the particle.
216 
217 
218  protected: // With description
219 
220  static G4bool EqualCutVectors( G4double* vec1, G4double* vec2 );
221  static G4double* CopyCutVectors( G4double* dest, G4double* source );
223 
224  // data members
225  protected:
226 
227  static G4double dRoverRange; // dRoverRange is the maximum allowed
228  // deltarange/range in one Step
229  static G4double finalRange; // final step before stopping
230  static G4double finalRangeRequested; //from UI command
231  static G4double c1lim,c2lim,c3lim ; // coeffs for computing steplimit
232 
233  static G4bool rndmStepFlag; // control the randomization of the step
234  static G4bool EnlossFlucFlag; // control the energy loss fluctuation
235  static G4bool subSecFlag; // control the generation of subcutoff delta
236 
237  static G4double MinDeltaCutInRange; // minimum cut for delta rays
240 
242 
244 };
245 
246 #endif
247 
248 
249