Geant4  10.01.p03
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: G4VMultipleScattering.hh 84827 2014-10-21 12:31:50Z gcosmo $
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 "G4EmParameters.hh"
83 #include "G4MscStepLimitType.hh"
84 
87 class G4LossTableManager;
88 class G4SafetyHelper;
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
91 
93 {
94 public:
95 
96  G4VMultipleScattering(const G4String& name = "msc",
98 
99  virtual ~G4VMultipleScattering();
100 
101  //------------------------------------------------------------------------
102  // Virtual methods to be implemented for the concrete model
103  //------------------------------------------------------------------------
104 
105  virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
106 
107  virtual void PrintInfo() = 0;
108 
109 protected:
110 
111  virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
112 
113 public:
114 
115  //------------------------------------------------------------------------
116  // Generic methods common to all ContinuousDiscrete processes
117  //------------------------------------------------------------------------
118 
119  // Initialise for build of tables
121 
122  // Build physics table during initialisation
124 
125  // Print out of generic class parameters
126  void PrintInfoDefinition();
127 
128  // Store PhysicsTable in a file.
129  // Return false in case of failure at I/O
131  const G4String& directory,
132  G4bool ascii = false);
133 
134  // Retrieve Physics from a file.
135  // (return true if the Physics Table can be build by using file)
136  // (return false if the process has no functionality or in case of failure)
137  // File name should is constructed as processName+particleName and the
138  // should be placed under the directory specifed by the argument.
140  const G4String& directory,
141  G4bool ascii);
142 
143  // This is called in the beginning of tracking for a new track
144  void StartTracking(G4Track*);
145 
146  // The function overloads the corresponding function of the base
147  // class.It limits the step near to boundaries only
148  // and invokes the method GetMscContinuousStepLimit at every step.
150  const G4Track&,
151  G4double previousStepSize,
152  G4double currentMinimalStep,
153  G4double& currentSafety,
154  G4GPILSelection* selection);
155 
156  // The function overloads the corresponding function of the base
157  // class.
159  const G4Track&,
160  G4double previousStepSize,
162 
163  // Along step actions
165 
166  // Post step actions
167  G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
168 
169  // This method does not used for tracking, it is intended only for tests
170  G4double ContinuousStepLimit(const G4Track& track,
171  G4double previousStepSize,
172  G4double currentMinimalStep,
173  G4double& currentSafety);
174 
175  //------------------------------------------------------------------------
176  // Specific methods to set, access, modify models
177  //------------------------------------------------------------------------
178 
179  // Select model in run time
180  inline G4VEmModel* SelectModel(G4double kinEnergy, size_t idx);
181 
182 public:
183 
184  // Add model for region, smaller value of order defines which
185  // model will be selected for a given energy interval
186  void AddEmModel(G4int order, G4VEmModel*, const G4Region* region = 0);
187 
188  // Assign a model to a process
189  void SetEmModel(G4VMscModel*, G4int index = 1);
190 
191  // return the assigned model
192  G4VMscModel* EmModel(G4int index = 1) const;
193 
194  // Access to models by index
195  G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
196 
197  //------------------------------------------------------------------------
198  // Get/Set parameters for simulation of multiple scattering
199  //------------------------------------------------------------------------
200 
202 
203  inline G4bool LateralDisplasmentFlag() const;
204  inline void SetLateralDisplasmentFlag(G4bool val);
205 
206  inline G4double Skin() const;
207  inline void SetSkin(G4double val);
208 
209  inline G4double RangeFactor() const;
210  inline void SetRangeFactor(G4double val);
211 
212  inline G4double GeomFactor() const;
213  //inline void SetGeomFactor(G4double val);
214 
215  inline G4double PolarAngleLimit() const;
216  // inline void SetPolarAngleLimit(G4double val);
217 
218  inline G4MscStepLimitType StepLimitType() const;
219  inline void SetStepLimitType(G4MscStepLimitType val);
220 
221  inline G4double LowestKinEnergy() const;
222  inline void SetLowestKinEnergy(G4double val);
223 
224  inline const G4ParticleDefinition* FirstParticle() const;
225 
226  //inline void SetDisplacementBeyondSafety(G4bool val);
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 
256 
257  // ======== Parameters of the class fixed at initialisation =======
258 
260 
261  std::vector<G4VMscModel*> mscModels;
263 
266 
268 
271 
277 
278  // ======== Cashed values - may be state dependent ================
279 
280 protected:
281 
283 
284 private:
285 
286  // cache
289 
293 
299 };
300 
301 // ======== Run time inline methods ================
302 
303 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
304 
305 inline G4VEmModel*
306 G4VMultipleScattering::SelectModel(G4double kinEnergy, size_t coupleIndex)
307 {
308  return modelManager->SelectModel(kinEnergy, coupleIndex);
309 }
310 
311 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
312 
314 {
315  return latDisplacement;
316 }
317 
318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
319 
321 {
322  latDisplacement = val;
323  actLatDisp = true;
324 }
325 
326 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
327 
329 {
330  return theParameters->MscSkin();
331 }
332 
333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
334 
336 {
338 }
339 
340 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
341 
343 {
344  return facrange;
345 }
346 
347 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
348 
350 {
351  if(val > 0.0 && val < 1.0) {
352  facrange = val;
353  actFacRange = true;
354  }
355 }
356 
357 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
358 
360 {
361  return theParameters->MscGeomFactor();
362 }
363 
364 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
365 
367 {
368  return theParameters->MscThetaLimit();
369 }
370 
371 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
372 
374 {
375  return stepLimit;
376 }
377 
378 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
379 
381 {
382  stepLimit = val;
383  if(val == fMinimal) {
384  facrange = 0.2;
385  actFacRange = true;
386  }
387  actStepLimit = true;
388 }
389 
390 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
391 
393 {
394  return lowestKinEnergy;
395 }
396 
397 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
398 
400 {
401  lowestKinEnergy = val;
402 }
403 
404 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
405 
407 {
408  return firstParticle;
409 }
410 
411 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
412 
413 #endif
G4double condition(const G4ErrorSymMatrix &m)
G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii)
G4VEmModel * SelectModel(G4double kinEnergy, size_t idx)
G4EmModelManager * modelManager
CLHEP::Hep3Vector G4ThreeVector
void SetLateralDisplasmentFlag(G4bool val)
G4double MscGeomFactor() const
G4String name
Definition: TRTMaterials.hh:40
G4double MscThetaLimit() const
G4double GetMeanFreePath(const G4Track &track, G4double, G4ForceCondition *condition)
G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4ForceCondition *condition)
void SetEmModel(G4VMscModel *, G4int index=1)
const G4ParticleDefinition * FirstParticle() const
G4double PolarAngleLimit() const
int G4int
Definition: G4Types.hh:78
G4VEnergyLossProcess * fIonisation
G4VMultipleScattering(const G4String &name="msc", G4ProcessType type=fElectromagnetic)
const G4ParticleDefinition * currParticle
G4MscStepLimitType StepLimitType() const
G4ParticleChangeForMSC fParticleChange
G4double LowestKinEnergy() const
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
bool G4bool
Definition: G4Types.hh:79
G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false)
Definition: G4Step.hh:76
G4LossTableManager * emManager
G4bool LateralDisplasmentFlag() const
virtual G4bool IsApplicable(const G4ParticleDefinition &p)=0
G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &)
G4double ContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimalStep, G4double &currentSafety)
const G4ParticleDefinition * firstParticle
G4MscStepLimitType
void AddEmModel(G4int order, G4VEmModel *, const G4Region *region=0)
G4VMultipleScattering & operator=(const G4VMultipleScattering &right)
virtual void InitialiseProcess(const G4ParticleDefinition *)=0
G4VEmModel * SelectModel(G4double &energy, size_t &index)
G4MscStepLimitType stepLimit
virtual void PrintInfo()=0
double G4double
Definition: G4Types.hh:76
void BuildPhysicsTable(const G4ParticleDefinition &)
G4ForceCondition
void SetRangeFactor(G4double val)
G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4double currentMinimalStep, G4double &currentSafety, G4GPILSelection *selection)
G4VMscModel * EmModel(G4int index=1) const
G4double MscSkin() const
std::vector< G4VMscModel * > mscModels
void SetLowestKinEnergy(G4double val)
G4double GetContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimalStep, G4double &currentSafety)
G4GPILSelection
void SetStepLimitType(G4MscStepLimitType val)
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false) const
void PreparePhysicsTable(const G4ParticleDefinition &)
void SetMscSkin(G4double val)
G4ProcessType
void SetIonisation(G4VEnergyLossProcess *)