Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EmModelManager.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: G4EmModelManager.hh 72944 2013-08-14 13:43:07Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class header file
31 //
32 // File name: G4EmModelManager
33 //
34 // Author: Vladimir Ivanchenko
35 //
36 // Creation date: 07.05.2002
37 //
38 // Modifications:
39 //
40 // 03-12-02 V.Ivanchenko fix a bug in model selection
41 // 20-01-03 Migrade to cut per region (V.Ivanchenko)
42 // 27-01-03 Make models region aware (V.Ivanchenko)
43 // 13-02-03 The set of models is defined for region (V.Ivanchenko)
44 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenko)
45 // 13-04-03 Add startFromNull (V.Ivanchenko)
46 // 13-05-03 Add calculation of precise range (V.Ivanchenko)
47 // 21-07-03 Add UpdateEmModel method (V.Ivanchenko)
48 // 03-11-03 Substitute STL vector for G4RegionModels (V.Ivanchenko)
49 // 11-04-05 Remove access to fluctuation models (V.Ivanchenko)
50 // 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
51 // 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
52 // 13-05-06 Add GetModel by index method (VI)
53 // 15-03-07 Add maxCutInRange (V.Ivanchenko)
54 // 08-04-08 Simplify Select method for only one G4RegionModel (VI)
55 // 03-08-09 Removed unused members and simplify model search if only one
56 // model is used (VI)
57 // 14-07-11 Use pointer to the vector of cuts and not local copy (VI)
58 //
59 // Class Description:
60 //
61 // It is the unified energy loss process it calculates the continuous
62 // energy loss for charged particles using a set of Energy Loss
63 // models valid for different energy regions. There are a possibility
64 // to create and access to dE/dx and range tables, or to calculate
65 // that information on fly.
66 
67 // -------------------------------------------------------------------
68 //
69 
70 
71 #ifndef G4EmModelManager_h
72 #define G4EmModelManager_h 1
73 
74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
75 
76 #include "globals.hh"
77 #include "G4DataVector.hh"
78 #include "G4EmTableType.hh"
79 #include "G4EmProcessSubType.hh"
80 #include "G4Region.hh"
81 
83 {
84 
85 friend class G4EmModelManager;
86 
87 public:
88 
89 private:
90 
91  G4RegionModels(G4int nMod, std::vector<G4int>& indx,
92  G4DataVector& lowE, const G4Region* reg);
93 
94  ~G4RegionModels();
95 
96  inline G4int SelectIndex(G4double e) const {
97  G4int idx = 0;
98  if (nModelsForRegion>1) {
99  idx = nModelsForRegion;
100  do {--idx;} while (idx > 0 && e <= lowKineticEnergy[idx]);
101  }
102  return theListOfModelIndexes[idx];
103  };
104 
105  inline G4int ModelIndex(G4int n) const {
106  return theListOfModelIndexes[n];
107  };
108 
109  inline G4int NumberOfModels() const {
110  return nModelsForRegion;
111  };
112 
113  inline G4double LowEdgeEnergy(G4int n) const {
114  return lowKineticEnergy[n];
115  };
116 
117  inline const G4Region* Region() const {
118  return theRegion;
119  };
120 
122  G4RegionModels & operator=(const G4RegionModels &right);
123 
124  const G4Region* theRegion;
125  G4int nModelsForRegion;
126  G4int* theListOfModelIndexes;
127  G4double* lowKineticEnergy;
128 
129 };
130 
131 #include "G4VEmModel.hh"
132 #include "G4VEmFluctuationModel.hh"
133 #include "G4DynamicParticle.hh"
134 
135 class G4Region;
137 class G4PhysicsVector;
139 
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
141 
143 {
144 public:
145 
147 
149 
150  void Clear();
151 
152  const G4DataVector* Initialise(const G4ParticleDefinition* part,
153  const G4ParticleDefinition* secPart,
154  G4double minSubRange,
155  G4int verb);
156 
159 
161  G4bool startFromNull = true,
163 
164  G4VEmModel* GetModel(G4int, G4bool ver = false);
165 
167 
168  void UpdateEmModel(const G4String&, G4double, G4double);
169 
170  void DumpModelList(G4int verb);
171 
172  inline G4VEmModel* SelectModel(G4double& energy, size_t& index);
173 
174  inline const G4DataVector* Cuts() const;
175 
176  inline const G4DataVector* SubCutoff() const;
177 
178  inline void SetFluoFlag(G4bool val);
179 
180  inline G4int NumberOfModels() const;
181 
182 private:
183 
184  inline G4double ComputeDEDX(G4VEmModel* model,
185  const G4MaterialCutsCouple*,
186  G4double kinEnergy,
187  G4double cutEnergy,
188  G4double minEnergy);
189 
190  // hide assignment operator
191 
193  G4EmModelManager & operator=(const G4EmModelManager &right);
194 
195 // =====================================================================
196 
197 private:
198 
199  const G4DataVector* theCuts;
200  G4DataVector* theCutsNew;
201  G4DataVector* theSubCuts;
202 
203  std::vector<G4VEmModel*> models;
204  std::vector<G4VEmFluctuationModel*> flucModels;
205  std::vector<const G4Region*> regions;
206  std::vector<G4int> orderOfModels;
207  std::vector<G4int> isUsed;
208 
209  G4int nEmModels;
210  G4int nRegions;
211 
212  std::vector<G4int> idxOfRegionModels;
213  std::vector<G4RegionModels*> setOfRegionModels;
214 
215  G4double maxSubCutInRange;
216 
217  const G4ParticleDefinition* particle;
218 
219  G4int verboseLevel;
220  G4bool severalModels;
221  G4bool fluoFlag;
222 
223  // may be changed in run time
224  G4RegionModels* currRegionModel;
225  G4VEmModel* currModel;
226 };
227 
228 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
229 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
230 
232  size_t& index)
233 {
234  if(severalModels) {
235  if(nRegions > 1) {
236  currRegionModel = setOfRegionModels[idxOfRegionModels[index]];
237  }
238  currModel = models[currRegionModel->SelectIndex(kinEnergy)];
239  }
240  return currModel;
241 }
242 
243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
244 
246 {
247  return theCuts;
248 }
249 
250 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
251 
253 {
254  return theSubCuts;
255 }
256 
257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
258 
260 {
261  fluoFlag = val;
262 }
263 
264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
265 
267 {
268  return nEmModels;
269 }
270 
271 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
272 
273 inline G4double
274 G4EmModelManager::ComputeDEDX(G4VEmModel* model,
275  const G4MaterialCutsCouple* couple,
276  G4double e,
277  G4double cut,
278  G4double emin)
279 {
280  G4double dedx = 0.0;
281  if(model && cut > emin) {
282  dedx = model->ComputeDEDX(couple,particle,e,cut);
283  if(emin > 0.0) {dedx -= model->ComputeDEDX(couple,particle,e,emin);}
284  }
285  return dedx;
286 }
287 
288 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
289 
290 #endif
291 
void UpdateEmModel(const G4String &, G4double, G4double)
const G4DataVector * Cuts() const
G4VEmModel * GetModel(G4int, G4bool ver=false)
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *, const G4Region *)
const G4DataVector * SubCutoff() const
void FillLambdaVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4bool startFromNull=true, G4EmTableType t=fRestricted)
int G4int
Definition: G4Types.hh:78
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
void FillDEDXVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4EmTableType t=fRestricted)
bool G4bool
Definition: G4Types.hh:79
const XML_Char XML_Content * model
const G4int n
void DumpModelList(G4int verb)
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4double minSubRange, G4int verb)
G4int NumberOfModels() const
G4double ComputeDEDX(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
Definition: G4VEmModel.hh:456
G4VEmModel * SelectModel(G4double &energy, size_t &index)
G4EmTableType
void SetFluoFlag(G4bool val)
double G4double
Definition: G4Types.hh:76