Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4LossTableManager.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$
27 //
28 //
29 // -------------------------------------------------------------------
30 //
31 // GEANT4 Class header file
32 //
33 //
34 // File name: G4LossTableManager
35 //
36 // Author: Vladimir Ivanchenko on base of G4LossTables class
37 // and Maria Grazia Pia ideas
38 //
39 // Creation date: 03.01.2002
40 //
41 // Modifications:
42 //
43 // 20-01-03 Migrade to cut per region (V.Ivanchenko)
44 // 17-02-03 Fix problem of store/restore tables for ions (V.Ivanchenko)
45 // 10-03-03 Add Ion registration (V.Ivanchenko)
46 // 25-03-03 Add deregistration (V.Ivanchenko)
47 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenko)
48 // 02-04-03 Change messenger (V.Ivanchenko)
49 // 23-07-03 Add exchange with G4EnergyLossTables (V.Ivanchenko)
50 // 05-10-03 Add G4VEmProcesses registration (V.Ivanchenko)
51 // 17-10-03 Add SetParameters method (V.Ivanchenko)
52 // 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
53 // 14-01-04 Activate precise range calculation (V.Ivanchenko)
54 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
55 // 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
56 // 20-01-06 Introduce GetSubDEDX method (VI)
57 // 26-01-06 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
58 // 10-05-06 Add methods SetMscStepLimitation, FacRange and MscFlag (VI)
59 // 22-05-06 Add methods Set/Get bremsTh (VI)
60 // 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
61 // 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko)
62 // 12-04-10 Added PreparePhsyicsTables and BuildPhysicsTables entries (V.Ivanchenko)
63 //
64 // Class Description:
65 //
66 // A utility static class, responsable for the energy loss tables
67 // for each particle
68 //
69 // Energy loss processes have to register their tables with this
70 // class. The responsibility of creating and deleting the tables
71 // remains with the energy loss classes.
72 
73 // -------------------------------------------------------------------
74 //
75 
76 #ifndef G4LossTableManager_h
77 #define G4LossTableManager_h 1
78 
79 #include <map>
80 #include <vector>
81 #include "globals.hh"
82 #include "G4VEnergyLossProcess.hh"
83 #include "G4EnergyLossTables.hh"
84 
85 class G4PhysicsTable;
90 class G4VEmProcess;
91 class G4EmCorrections;
92 class G4EmSaturation;
93 class G4EmConfigurator;
94 class G4ElectronIonPair;
95 class G4LossTableBuilder;
97 class G4Region;
98 
100 {
101 
102 public:
103 
104  static G4LossTableManager* Instance();
105 
107 
108  //-------------------------------------------------
109  // called from destructor
110  //-------------------------------------------------
111 
112  void Clear();
113 
114  //-------------------------------------------------
115  // initialisation before a new run
116  //-------------------------------------------------
117 
118  void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
120 
121  void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
122  G4VEmProcess* p);
123 
124  void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
126 
127  void BuildPhysicsTable(const G4ParticleDefinition* aParticle);
128 
129  void BuildPhysicsTable(const G4ParticleDefinition* aParticle,
131 
132  //-------------------------------------------------
133  // Run time access to DEDX, range, energy for a given particle,
134  // energy, and G4MaterialCutsCouple
135  //-------------------------------------------------
136 
138  const G4ParticleDefinition *aParticle,
139  G4double kineticEnergy,
140  const G4MaterialCutsCouple *couple);
141 
143  const G4ParticleDefinition *aParticle,
144  G4double kineticEnergy,
145  const G4MaterialCutsCouple *couple);
146 
148  const G4ParticleDefinition *aParticle,
149  G4double kineticEnergy,
150  const G4MaterialCutsCouple *couple);
151 
153  const G4ParticleDefinition *aParticle,
154  G4double kineticEnergy,
155  const G4MaterialCutsCouple *couple);
156 
158  const G4ParticleDefinition *aParticle,
159  G4double kineticEnergy,
160  const G4MaterialCutsCouple *couple);
161 
163  const G4ParticleDefinition *aParticle,
164  G4double range,
165  const G4MaterialCutsCouple *couple);
166 
168  const G4MaterialCutsCouple *couple,
169  const G4DynamicParticle* dp,
170  G4double& length);
171 
172  //-------------------------------------------------
173  // Methods to be called only at initialisation
174  //-------------------------------------------------
175 
177 
179 
181 
183 
184  void Register(G4VEmProcess* p);
185 
186  void DeRegister(G4VEmProcess* p);
187 
188  void Register(G4VEmModel* p);
189 
190  void DeRegister(G4VEmModel* p);
191 
193 
195 
196  void RegisterIon(const G4ParticleDefinition* aParticle,
198 
199  void RegisterExtraParticle(const G4ParticleDefinition* aParticle,
201 
202  void SetLossFluctuations(G4bool val);
203 
204  void SetSubCutoff(G4bool val, const G4Region* r=0);
205 
206  void SetIntegral(G4bool val);
207 
208  void SetRandomStep(G4bool val);
209 
210  void SetMinSubRange(G4double val);
211 
212  void SetMinEnergy(G4double val);
213 
214  void SetMaxEnergy(G4double val);
215 
217 
218  void SetMaxEnergyForMuons(G4double val);
219 
220  void SetDEDXBinning(G4int val);
221 
223 
224  void SetLambdaBinning(G4int val);
225 
227 
228  void SetStepFunction(G4double v1, G4double v2);
229 
230  void SetBuildCSDARange(G4bool val);
231 
232  void SetLPMFlag(G4bool val);
233 
234  void SetSplineFlag(G4bool val);
235 
236  void SetLinearLossLimit(G4double val);
237 
238  void SetBremsstrahlungTh(G4double val);
239 
241 
242  void SetVerbose(G4int val);
243 
244  //-------------------------------------------------
245  // Access methods
246  //-------------------------------------------------
247 
249 
250  G4bool BuildCSDARange() const;
251 
252  G4bool LPMFlag() const;
253 
254  G4bool SplineFlag() const;
255 
256  G4double BremsstrahlungTh() const;
257 
259 
260  G4double MinKinEnergy() const;
261 
262  G4double MaxKinEnergy() const;
263 
264  const std::vector<G4VEnergyLossProcess*>& GetEnergyLossProcessVector();
265 
266  const std::vector<G4VEmProcess*>& GetEmProcessVector();
267 
268  const std::vector<G4VMultipleScattering*>& GetMultipleScatteringVector();
269 
271 
273 
275 
277 
279 
281 
283 
285 
286 private:
287 
288  //-------------------------------------------------
289  // Private methods and members
290  //-------------------------------------------------
291 
293 
294  G4VEnergyLossProcess* BuildTables(const G4ParticleDefinition* aParticle);
295 
296  void CopyTables(const G4ParticleDefinition* aParticle,
298 
299  void ParticleHaveNoLoss(const G4ParticleDefinition* aParticle);
300 
301  void SetParameters(const G4ParticleDefinition* aParticle,
303 
304  void CopyDEDXTables();
305 
307  G4LossTableManager & operator=(const G4LossTableManager &right);
308 
309  static G4LossTableManager* theInstance;
310 
311  typedef const G4ParticleDefinition* PD;
312 
313  std::map<PD,G4VEnergyLossProcess*,std::less<PD> > loss_map;
314 
315  std::vector<G4VEnergyLossProcess*> loss_vector;
316  std::vector<PD> part_vector;
317  std::vector<PD> base_part_vector;
318  std::vector<G4bool> tables_are_built;
319  std::vector<G4bool> isActive;
320  std::vector<G4PhysicsTable*> dedx_vector;
321  std::vector<G4PhysicsTable*> range_vector;
322  std::vector<G4PhysicsTable*> inv_range_vector;
323  std::vector<G4VMultipleScattering*> msc_vector;
324  std::vector<G4VEmProcess*> emp_vector;
325  std::vector<G4VEmModel*> mod_vector;
326  std::vector<G4VEmFluctuationModel*> fmod_vector;
327 
328  // cash
329  G4VEnergyLossProcess* currentLoss;
330  PD currentParticle;
331  PD theElectron;
332  PD firstParticle;
333 
334  G4int n_loss;
335  G4int run;
336 
337  G4bool all_tables_are_built;
338  G4bool startInitialisation;
339 
340  G4bool lossFluctuationFlag;
341  G4bool subCutoffFlag;
342  G4bool rndmStepFlag;
343  G4bool integral;
344  G4bool integralActive;
345  G4bool buildCSDARange;
346  G4bool minEnergyActive;
347  G4bool maxEnergyActive;
348  G4bool maxEnergyForMuonsActive;
349  G4bool stepFunctionActive;
350  G4bool flagLPM;
351  G4bool splineFlag;
352 
353  G4double minSubRange;
354  G4double maxRangeVariation;
355  G4double maxFinalStep;
356  G4double minKinEnergy;
357  G4double maxKinEnergy;
358  G4double maxKinEnergyForMuons;
359  G4double bremsTh;
360  G4double factorForAngleLimit;
361 
362  G4LossTableBuilder* tableBuilder;
363  G4EnergyLossMessenger* theMessenger;
364  G4EmCorrections* emCorrections;
365  G4EmSaturation* emSaturation;
366  G4EmConfigurator* emConfigurator;
367  G4ElectronIonPair* emElectronIonPair;
368  G4VAtomDeexcitation* atomDeexcitation;
369 
370  G4int nbinsLambda;
371  G4int nbinsPerDecade;
372  G4int verbose;
373 
374 };
375 
376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
377 
378 #endif
379