Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VMultipleScattering.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 // GEANT4 Class header file
31 //
32 //
33 // File name: G4VMultipleScattering
34 //
35 // Author: Vladimir Ivanchenko on base of Laszlo Urban code
36 //
37 // Creation date: 12.03.2002
38 //
39 // Modifications:
40 //
41 // 16-07-03 Update GetRange interface (V.Ivanchenko)
42 //
43 //
44 // Class Description:
45 //
46 // It is the generic process of multiple scattering it includes common
47 // part of calculations for all charged particles
48 //
49 // 26-11-03 bugfix in AlongStepDoIt (L.Urban)
50 // 25-05-04 add protection against case when range is less than steplimit (VI)
51 // 30-06-04 make destructor virtual (V.Ivanchenko)
52 // 27-08-04 Add InitialiseForRun method (V.Ivanchneko)
53 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
54 // 15-04-05 optimize internal interfaces (V.Ivanchenko)
55 // 15-04-05 remove boundary flag (V.Ivanchenko)
56 // 07-10-05 error in a protection in GetContinuousStepLimit corrected (L.Urban)
57 // 27-10-05 introduce virtual function MscStepLimitation() (V.Ivanchenko)
58 // 26-01-06 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
59 // 17-02-06 Save table of transport cross sections not mfp (V.Ivanchenko)
60 // 07-03-06 Move step limit calculation to model (V.Ivanchenko)
61 // 13-05-06 Add method to access model by index (V.Ivanchenko)
62 // 12-02-07 Add get/set skin (V.Ivanchenko)
63 // 27-10-07 Virtual functions moved to source (V.Ivanchenko)
64 // 15-07-08 Reorder class members for further multi-thread development (VI)
65 // 07-04-09 Moved msc methods from G4VEmModel to G4VMscModel (VI)
66 //
67 
68 // -------------------------------------------------------------------
69 //
70 
71 #ifndef G4VMultipleScattering_h
72 #define G4VMultipleScattering_h 1
73 
75 #include "globals.hh"
76 #include "G4Material.hh"
78 #include "G4Track.hh"
79 #include "G4Step.hh"
80 #include "G4EmModelManager.hh"
81 #include "G4VMscModel.hh"
82 #include "G4MscStepLimitType.hh"
83 
86 class G4LossTableManager;
87 class G4SafetyHelper;
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
90 
92 {
93 public:
94 
95  G4VMultipleScattering(const G4String& name = "msc",
97 
98  virtual ~G4VMultipleScattering();
99 
100  //------------------------------------------------------------------------
101  // Virtual methods to be implemented for the concrete model
102  //------------------------------------------------------------------------
103 
104  virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
105 
106  virtual void PrintInfo() = 0;
107 
108 protected:
109 
110  virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
111 
112 public:
113 
114  //------------------------------------------------------------------------
115  // Generic methods common to all ContinuousDiscrete processes
116  //------------------------------------------------------------------------
117 
118  // Initialise for build of tables
120 
121  // Build physics table during initialisation
123 
124  // Print out of generic class parameters
125  void PrintInfoDefinition();
126 
127  // Store PhysicsTable in a file.
128  // Return false in case of failure at I/O
130  const G4String& directory,
131  G4bool ascii = false);
132 
133  // Retrieve Physics from a file.
134  // (return true if the Physics Table can be build by using file)
135  // (return false if the process has no functionality or in case of failure)
136  // File name should is constructed as processName+particleName and the
137  // should be placed under the directory specifed by the argument.
139  const G4String& directory,
140  G4bool ascii);
141 
142  // This is called in the beginning of tracking for a new track
143  void StartTracking(G4Track*);
144 
145  // The function overloads the corresponding function of the base
146  // class.It limits the step near to boundaries only
147  // and invokes the method GetMscContinuousStepLimit at every step.
149  const G4Track&,
150  G4double previousStepSize,
151  G4double currentMinimalStep,
152  G4double& currentSafety,
153  G4GPILSelection* selection);
154 
155  // The function overloads the corresponding function of the base
156  // class.
158  const G4Track&,
159  G4double previousStepSize,
161 
162  // Along step actions
164 
165  // Post step actions
166  G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
167 
168  // This method does not used for tracking, it is intended only for tests
169  G4double ContinuousStepLimit(const G4Track& track,
170  G4double previousStepSize,
171  G4double currentMinimalStep,
172  G4double& currentSafety);
173 
174  //------------------------------------------------------------------------
175  // Specific methods to set, access, modify models
176  //------------------------------------------------------------------------
177 
178  // Select model in run time
179  inline G4VEmModel* SelectModel(G4double kinEnergy, size_t idx);
180 
181 public:
182 
183  // Add model for region, smaller value of order defines which
184  // model will be selected for a given energy interval
185  void AddEmModel(G4int order, G4VEmModel*, const G4Region* region = 0);
186 
187  // Assign a model to a process - obsolete method will be removed
188  void SetModel(G4VMscModel*, G4int index = 1);
189 
190  // return the assigned model - obsolete method will be removed
192 
193  // Assign a model to a process
194  void SetEmModel(G4VMscModel*, G4int index = 1);
195 
196  // return the assigned model
198 
199  // Access to models by index
200  G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
201 
202  //------------------------------------------------------------------------
203  // Get/Set parameters for simulation of multiple scattering
204  //------------------------------------------------------------------------
205 
207 
208  inline G4bool LateralDisplasmentFlag() const;
209  inline void SetLateralDisplasmentFlag(G4bool val);
210 
211  inline G4double Skin() const;
212  inline void SetSkin(G4double val);
213 
214  inline G4double RangeFactor() const;
215  inline void SetRangeFactor(G4double val);
216 
217  inline G4double GeomFactor() const;
218  inline void SetGeomFactor(G4double val);
219 
220  inline G4double PolarAngleLimit() const;
221  inline void SetPolarAngleLimit(G4double val);
222 
223  inline G4MscStepLimitType StepLimitType() const;
224  inline void SetStepLimitType(G4MscStepLimitType val);
225 
226  inline const G4ParticleDefinition* FirstParticle() const;
227 
228  //------------------------------------------------------------------------
229  // Run time methods
230  //------------------------------------------------------------------------
231 
232 protected:
233 
234  // This method is not used for tracking, it returns mean free path value
235  G4double GetMeanFreePath(const G4Track& track,
236  G4double,
237  G4ForceCondition* condition);
238 
239  // This method is not used for tracking, it returns step limit
241  G4double previousStepSize,
242  G4double currentMinimalStep,
243  G4double& currentSafety);
244 
245 private:
246 
247  // hide assignment operator
250 
251  // ======== Parameters of the class fixed at construction =========
252 
253  G4EmModelManager* modelManager;
254  G4LossTableManager* emManager;
255  G4double geomMin;
256 
257  // ======== Parameters of the class fixed at initialisation =======
258 
259  G4SafetyHelper* safetyHelper;
260 
261  std::vector<G4VMscModel*> mscModels;
262  G4int numberOfModels;
263 
264  const G4ParticleDefinition* firstParticle;
265  const G4ParticleDefinition* currParticle;
266 
267  G4MscStepLimitType stepLimit;
268 
269  G4double skin;
270  G4double facrange;
271  G4double facgeom;
272  G4double polarAngleLimit;
273  G4double lowestKinEnergy;
274 
275  G4bool latDisplasment;
276  G4bool isIon;
277 
278  // ======== Cashed values - may be state dependent ================
279 
280 protected:
281 
284 
285 private:
286 
287  // cache
288  G4VMscModel* currentModel;
289  G4VEnergyLossProcess* fIonisation;
290 
291  G4double physStepLimit;
292  G4double tPathLength;
293  G4double gPathLength;
294 
295  G4ThreeVector fNewPosition;
296  G4bool fPositionChanged;
297  G4bool isActive;
298 
299  G4int warn;
300 };
301 
302 // ======== Run time inline methods ================
303 
304 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
305 
306 inline G4VEmModel*
307 G4VMultipleScattering::SelectModel(G4double kinEnergy, size_t coupleIndex)
308 {
309  return modelManager->SelectModel(kinEnergy, coupleIndex);
310 }
311 
312 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
313 
315 {
316  return latDisplasment;
317 }
318 
319 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
320 
322 {
323  latDisplasment = val;
324 }
325 
326 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
327 
329 {
330  return skin;
331 }
332 
333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
334 
336 {
337  if(val < 1.0) { skin = 0.0; }
338  else { skin = val; }
339 }
340 
341 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
342 
344 {
345  return facrange;
346 }
347 
348 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
349 
351 {
352  if(val > 0.0) facrange = val;
353 }
354 
355 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
356 
358 {
359  return facgeom;
360 }
361 
362 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
363 
365 {
366  if(val > 0.0) facgeom = val;
367 }
368 
369 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
370 
372 {
373  return polarAngleLimit;
374 }
375 
376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
377 
379 {
380  if(val < 0.0) { polarAngleLimit = 0.0; }
381  else if(val > CLHEP::pi) { polarAngleLimit = CLHEP::pi; }
382  else { polarAngleLimit = val; }
383 }
384 
385 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
386 
388 {
389  return stepLimit;
390 }
391 
392 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
393 
395 {
396  stepLimit = val;
397  if(val == fMinimal) { facrange = 0.2; }
398 }
399 
400 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
401 
403 {
404  return firstParticle;
405 }
406 
407 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
408 
409 #endif