Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/utils/include/G4VMultipleScattering.hh

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/utils/include/G4VMultipleScattering.hh (Version 11.3.0) and /processes/electromagnetic/utils/include/G4VMultipleScattering.hh (Version 9.0.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 // $Id: G4VMultipleScattering.hh,v 1.46 2007/06/11 14:56:51 vnivanch Exp $
                                                   >>  27 // GEANT4 tag $Name: geant4-09-00-patch-01 $
 26 //                                                 28 //
 27 // -------------------------------------------     29 // -------------------------------------------------------------------
 28 //                                                 30 //
 29 // GEANT4 Class header file                        31 // GEANT4 Class header file
 30 //                                                 32 //
 31 //                                                 33 //
 32 // File name:     G4VMultipleScattering            34 // File name:     G4VMultipleScattering
 33 //                                                 35 //
 34 // Author:        Vladimir Ivanchenko on base      36 // Author:        Vladimir Ivanchenko on base of Laszlo Urban code
 35 //                                                 37 //
 36 // Creation date: 12.03.2002                       38 // Creation date: 12.03.2002
 37 //                                                 39 //
 38 // Modifications:                                  40 // Modifications:
 39 //                                                 41 //
 40 // 16-07-03 Update GetRange interface (V.Ivanc     42 // 16-07-03 Update GetRange interface (V.Ivanchenko)
                                                   >>  43 //
                                                   >>  44 //
                                                   >>  45 // Class Description:
                                                   >>  46 //
                                                   >>  47 // It is the generic process of multiple scattering it includes common
                                                   >>  48 // part of calculations for all charged particles
                                                   >>  49 //
 41 // 26-11-03 bugfix in AlongStepDoIt (L.Urban)      50 // 26-11-03 bugfix in AlongStepDoIt (L.Urban)
 42 // 25-05-04 add protection against case when r     51 // 25-05-04 add protection against case when range is less than steplimit (VI)
                                                   >>  52 // 30-06-04 make destructor virtual (V.Ivanchenko)
 43 // 27-08-04 Add InitialiseForRun method (V.Iva     53 // 27-08-04 Add InitialiseForRun method (V.Ivanchneko)
 44 // 08-11-04 Migration to new interface of Stor     54 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
                                                   >>  55 // 15-04-05 optimize internal interfaces (V.Ivanchenko)
 45 // 15-04-05 remove boundary flag (V.Ivanchenko     56 // 15-04-05 remove boundary flag (V.Ivanchenko)
 46 // 07-10-05 error in a protection in GetContin     57 // 07-10-05 error in a protection in GetContinuousStepLimit corrected (L.Urban)
 47 // 27-10-05 introduce virtual function MscStep     58 // 27-10-05 introduce virtual function MscStepLimitation() (V.Ivanchenko)
 48 // 26-01-06 Rename GetRange -> GetRangeFromRes     59 // 26-01-06 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
 49 // 17-02-06 Save table of transport cross sect     60 // 17-02-06 Save table of transport cross sections not mfp (V.Ivanchenko)
 50 // 07-03-06 Move step limit calculation to mod     61 // 07-03-06 Move step limit calculation to model (V.Ivanchenko)
 51 // 13-05-06 Add method to access model by inde     62 // 13-05-06 Add method to access model by index (V.Ivanchenko)
 52 // 12-02-07 Add get/set skin (V.Ivanchenko)        63 // 12-02-07 Add get/set skin (V.Ivanchenko)
 53 // 27-10-07 Virtual functions moved to source  << 
 54 // 15-07-08 Reorder class members for further  << 
 55 // 07-04-09 Moved msc methods from G4VEmModel  << 
 56 //                                             << 
 57 // Class Description:                          << 
 58 //                                                 64 //
 59 // It is the generic process of multiple scatt << 
 60 // part of calculations for all charged partic << 
 61                                                    65 
 62 // -------------------------------------------     66 // -------------------------------------------------------------------
 63 //                                                 67 //
 64                                                    68 
 65 #ifndef G4VMultipleScattering_h                    69 #ifndef G4VMultipleScattering_h
 66 #define G4VMultipleScattering_h 1                  70 #define G4VMultipleScattering_h 1
 67                                                    71 
 68 #include "G4VContinuousDiscreteProcess.hh"         72 #include "G4VContinuousDiscreteProcess.hh"
                                                   >>  73 #include "G4LossTableManager.hh"
 69 #include "globals.hh"                              74 #include "globals.hh"
 70 #include "G4Material.hh"                           75 #include "G4Material.hh"
                                                   >>  76 #include "G4MaterialCutsCouple.hh"
 71 #include "G4ParticleChangeForMSC.hh"               77 #include "G4ParticleChangeForMSC.hh"
 72 #include "G4Track.hh"                              78 #include "G4Track.hh"
 73 #include "G4Step.hh"                               79 #include "G4Step.hh"
 74 #include "G4EmModelManager.hh"                     80 #include "G4EmModelManager.hh"
 75 #include "G4VMscModel.hh"                      <<  81 #include "G4VEmModel.hh"
 76 #include "G4EmParameters.hh"                   << 
 77 #include "G4MscStepLimitType.hh"                   82 #include "G4MscStepLimitType.hh"
 78                                                    83 
 79 class G4ParticleDefinition;                        84 class G4ParticleDefinition;
 80 class G4VEnergyLossProcess;                    <<  85 class G4DataVector;
 81 class G4LossTableManager;                      <<  86 class G4PhysicsTable;
 82 class G4SafetyHelper;                          <<  87 class G4PhysicsVector;
 83                                                    88 
 84 //....oooOO0OOooo........oooOO0OOooo........oo     89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 85                                                    90 
 86 class G4VMultipleScattering : public G4VContin     91 class G4VMultipleScattering : public G4VContinuousDiscreteProcess
 87 {                                                  92 {
 88 public:                                            93 public:
 89                                                    94 
 90   explicit G4VMultipleScattering(const G4Strin <<  95   G4VMultipleScattering(const G4String& name = "msc",
 91                                  G4ProcessType <<  96                               G4ProcessType type = fElectromagnetic);
 92                                                    97 
 93   ~G4VMultipleScattering() override;           <<  98   virtual ~G4VMultipleScattering();
 94                                                    99 
 95   //------------------------------------------    100   //------------------------------------------------------------------------
 96   // Virtual methods to be implemented for the    101   // Virtual methods to be implemented for the concrete model
 97   //------------------------------------------    102   //------------------------------------------------------------------------
 98                                                   103 
 99   void ProcessDescription(std::ostream& outFil << 104   virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
                                                   >> 105     // True for all charged particles
100                                                   106 
101   virtual void InitialiseProcess(const G4Parti << 107   virtual void PrintInfo() = 0;
102                                                << 
103   // Print out of generic class parameters     << 
104   void StreamInfo(std::ostream& outFile, const << 
105                   G4bool rst = false) const;   << 
106                                                   108 
107 protected:                                        109 protected:
108                                                   110 
109   virtual void StreamProcessInfo(std::ostream& << 111   virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
110                                                   112 
                                                   >> 113   //------------------------------------------------------------------------
                                                   >> 114   // Methods with standard implementation; may be overwritten if needed
                                                   >> 115   //------------------------------------------------------------------------
111 public:                                           116 public:
112                                                   117 
113   //------------------------------------------    118   //------------------------------------------------------------------------
114   // Generic methods common to all ContinuousD    119   // Generic methods common to all ContinuousDiscrete processes
115   //------------------------------------------    120   //------------------------------------------------------------------------
116                                                   121 
117   // Initialise for build of tables               122   // Initialise for build of tables
118   void PreparePhysicsTable(const G4ParticleDef << 123   virtual void PreparePhysicsTable(const G4ParticleDefinition&);
119                                                << 124   
120   // Build physics table during initialisation    125   // Build physics table during initialisation
121   void BuildPhysicsTable(const G4ParticleDefin << 126   virtual void BuildPhysicsTable(const G4ParticleDefinition&);
                                                   >> 127 
                                                   >> 128   // Print out of generic class parameters
                                                   >> 129   void PrintInfoDefinition();
                                                   >> 130 
                                                   >> 131   inline virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
                                                   >> 132 
                                                   >> 133   inline virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
122                                                   134 
123   // Store PhysicsTable in a file.                135   // Store PhysicsTable in a file.
124   // Return false in case of failure at I/O       136   // Return false in case of failure at I/O
125   G4bool StorePhysicsTable(const G4ParticleDef    137   G4bool StorePhysicsTable(const G4ParticleDefinition*,
126                            const G4String& dir    138                            const G4String& directory,
127                            G4bool ascii = fals << 139                                  G4bool ascii = false);
128                                                   140 
129   // Retrieve Physics from a file.                141   // Retrieve Physics from a file.
130   // (return true if the Physics Table can be     142   // (return true if the Physics Table can be build by using file)
131   // (return false if the process has no funct    143   // (return false if the process has no functionality or in case of failure)
132   // File name should is constructed as proces    144   // File name should is constructed as processName+particleName and the
133   // should be placed under the directory spec << 145   // should be placed under the directory specifed by the argument.
134   G4bool RetrievePhysicsTable(const G4Particle    146   G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
135                               const G4String&     147                               const G4String& directory,
136                               G4bool ascii) ov << 148                                     G4bool ascii);
                                                   >> 149 
                                                   >> 150   //------------------------------------------------------------------------
                                                   >> 151   // Specific methods for multiple scattering
                                                   >> 152   //------------------------------------------------------------------------
137                                                   153 
138   // This is called in the beginning of tracki << 154   // Build empty Physics Vector
139   void StartTracking(G4Track*) override;       << 155   G4PhysicsVector* PhysicsVector(const G4MaterialCutsCouple*);
140                                                   156 
141   // The function overloads the corresponding     157   // The function overloads the corresponding function of the base
142   // class.It limits the step near to boundari    158   // class.It limits the step near to boundaries only
143   // and invokes the method GetMscContinuousSt    159   // and invokes the method GetMscContinuousStepLimit at every step.
144   G4double AlongStepGetPhysicalInteractionLeng << 160   inline virtual G4double AlongStepGetPhysicalInteractionLength(
145                                         const  << 161                                             const G4Track&,
146                                         G4doub << 162                                                   G4double  previousStepSize,
147                                         G4doub << 163                                                   G4double  currentMinimalStep,
148                                         G4doub << 164                                                   G4double& currentSafety,
149                                         G4GPIL << 165                                                   G4GPILSelection* selection);
150                                                   166 
151   // The function overloads the corresponding     167   // The function overloads the corresponding function of the base
152   // class.                                       168   // class.
153   G4double PostStepGetPhysicalInteractionLengt << 169   inline virtual G4double PostStepGetPhysicalInteractionLength(
154                                       const G4 << 170                                             const G4Track&,
155                                       G4double << 171               G4double  previousStepSize,
156                                       G4ForceC << 172               G4ForceCondition* condition);
157                                                << 
158   // Along step actions                        << 
159   G4VParticleChange* AlongStepDoIt(const G4Tra << 
160                                                   173 
161   // This method does not used for tracking, i    174   // This method does not used for tracking, it is intended only for tests
162   G4double ContinuousStepLimit(const G4Track&  << 175   inline virtual G4double ContinuousStepLimit(const G4Track& track,
163                                G4double previo << 176                 G4double previousStepSize,
164                                G4double curren << 177                 G4double currentMinimalStep,
165                                G4double& curre << 178                 G4double& currentSafety);
166                                                << 
167   // hide assignment operator                  << 
168   G4VMultipleScattering(G4VMultipleScattering  << 
169   G4VMultipleScattering & operator=(const G4VM << 
170                                                   179 
171   //------------------------------------------    180   //------------------------------------------------------------------------
172   // Specific methods to set, access, modify m << 181   // Specific methods to build and access Physics Tables
173   //------------------------------------------    182   //------------------------------------------------------------------------
174                                                   183 
175   // Select model in run time                  << 184   inline void SetBinning(G4int nbins);
176   inline G4VEmModel* SelectModel(G4double kinE << 185   inline G4int Binning() const;
177                                                   186 
178 public:                                        << 187   inline void SetMinKinEnergy(G4double e);
                                                   >> 188   inline G4double MinKinEnergy() const;
                                                   >> 189     // Print out of the class parameters
179                                                   190 
180   // Add model for region, smaller value of or << 191   inline void SetMaxKinEnergy(G4double e);
181   // model will be selected for a given energy << 192   inline G4double MaxKinEnergy() const;
182   void AddEmModel(G4int order, G4VMscModel*, c << 
183                                                << 
184   // Assign a model to a process local list, t << 
185   // the derived process should execute AddEmM << 
186   void SetEmModel(G4VMscModel*, G4int idx = 0) << 
187                                                << 
188   // return a model from the local list        << 
189   inline G4VMscModel* EmModel(size_t index = 0 << 
190                                                   193 
191   // Access to run time models                 << 194   inline void SetBuildLambdaTable(G4bool val);
192   inline G4int NumberOfModels() const;         << 
193                                                   195 
194   inline G4VMscModel* GetModelByIndex(G4int id << 196   inline G4PhysicsTable* LambdaTable() const;
195                                                   197 
196   //------------------------------------------    198   //------------------------------------------------------------------------
197   // Get/Set parameters for simulation of mult << 199   // Define and access particle type 
198   //------------------------------------------    200   //------------------------------------------------------------------------
199                                                   201 
200   inline G4bool LateralDisplasmentFlag() const << 202   inline const G4ParticleDefinition* Particle() const;
201                                                << 203   inline void SetParticle(const G4ParticleDefinition*);
202   inline G4double Skin() const;                << 204 
203                                                << 205   //------------------------------------------------------------------------
204   inline G4double RangeFactor() const;         << 206   // Specific methods to set, access, modify models
205                                                << 207   //------------------------------------------------------------------------
206   inline G4double GeomFactor() const;          << 208 
207                                                << 209   void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
208   inline G4double PolarAngleLimit() const;     << 210 
                                                   >> 211   inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idxRegion) const;
                                                   >> 212 
                                                   >> 213   // Access to models
                                                   >> 214   inline G4VEmModel* GetModelByIndex(G4int idx = 0);
                                                   >> 215 
                                                   >> 216   //------------------------------------------------------------------------
                                                   >> 217   // Parameters for simulation of multiple scattering
                                                   >> 218   //------------------------------------------------------------------------
                                                   >> 219 
                                                   >> 220   inline void SetLateralDisplasmentFlag(G4bool val);
                                                   >> 221      // lateral displacement to be/not to be computed
                                                   >> 222 
                                                   >> 223   inline void SetSkin(G4double val);
                                                   >> 224      // skin parameter
                                                   >> 225 
                                                   >> 226   inline void SetRangeFactor(G4double val);
                                                   >> 227      // FactorRange parameter
                                                   >> 228 
                                                   >> 229   inline void SetGeomFactor(G4double val);
                                                   >> 230      // FactorRange parameter
209                                                   231 
210   inline G4bool UseBaseMaterial() const;       << 
211                                                << 
212   inline G4MscStepLimitType StepLimitType() co << 
213   inline void SetStepLimitType(G4MscStepLimitT    232   inline void SetStepLimitType(G4MscStepLimitType val);
                                                   >> 233      // FactorRange parameter
214                                                   234 
215   inline G4double LowestKinEnergy() const;     << 235 protected:
216   inline void SetLowestKinEnergy(G4double val) << 
217                                                   236 
218   inline const G4ParticleDefinition* FirstPart << 237   // This method is used for tracking, it returns mean free path value
                                                   >> 238   inline virtual G4double GetMeanFreePath(const G4Track& track,
                                                   >> 239             G4double,
                                                   >> 240             G4ForceCondition* condition);
219                                                   241 
220   //------------------------------------------    242   //------------------------------------------------------------------------
221   // Run time methods                             243   // Run time methods
222   //------------------------------------------    244   //------------------------------------------------------------------------
223                                                   245 
224 protected:                                     << 246   inline G4double GetLambda(const G4ParticleDefinition* p, G4double& kineticEnergy);
225                                                   247 
226   // This method is not used for tracking, it  << 248   // This method is used for tracking, it returns step limit
227   G4double GetMeanFreePath(const G4Track& trac << 249   inline G4double GetMscContinuousStepLimit(const G4Track& track,
228                            G4double,           << 250                                         G4double previousStepSize,
229                            G4ForceCondition* c << 251                                         G4double currentMinimalStep,
                                                   >> 252                                         G4double& currentSafety);
230                                                   253 
231   // This method is not used for tracking, it     254   // This method is not used for tracking, it returns step limit
232   G4double GetContinuousStepLimit(const G4Trac << 255   inline virtual G4double GetContinuousStepLimit(const G4Track& track,
233                                   G4double pre << 256                                         G4double previousStepSize,
234                                   G4double cur << 257                                         G4double currentMinimalStep,
235                                   G4double& cu << 258                                         G4double& currentSafety);
236                                                   259 
237 private:                                       << 260   inline G4VEmModel* SelectModel(G4double kinEnergy);
                                                   >> 261   // Select concrete model
238                                                   262 
239   // ======== Parameters of the class fixed at << 263   inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const; 
                                                   >> 264   // Return current G4MaterialCutsCouple
240                                                   265 
241   G4EmModelManager*           modelManager;    << 266   inline void DefineMaterial(const G4MaterialCutsCouple* couple);
242   G4LossTableManager*         emManager;       << 267   // define current material
243   G4EmParameters*             theParameters;   << 
244                                                   268 
245   // ======== Parameters of the class fixed at << 269   //------------------------------------------------------------------------
                                                   >> 270   // Parameters for simulation of multiple scattering
                                                   >> 271   //------------------------------------------------------------------------
246                                                   272 
247   G4SafetyHelper*             safetyHelper = n << 273   inline G4double Skin() const;
248   const G4ParticleDefinition* firstParticle =  << 
249   const G4ParticleDefinition* currParticle = n << 
250                                                << 
251   std::vector<G4VMscModel*>   mscModels;       << 
252                                                   274 
253   G4double                    facrange = 0.04; << 275   inline G4double RangeFactor() const;
254   G4double                    lowestKinEnergy; << 
255                                                   276 
256   // ======== Cached values - may be state dep << 277   inline G4double GeomFactor() const;
                                                   >> 278 
                                                   >> 279   inline G4MscStepLimitType StepLimitType() const;
                                                   >> 280 
                                                   >> 281   inline G4bool LateralDisplasmentFlag() const;
                                                   >> 282 
                                                   >> 283 private:
                                                   >> 284 
                                                   >> 285   // hide  assignment operator
                                                   >> 286 
                                                   >> 287   G4VMultipleScattering(G4VMultipleScattering &);
                                                   >> 288   G4VMultipleScattering & operator=(const G4VMultipleScattering &right);
                                                   >> 289 
                                                   >> 290   // =====================================================================
257                                                   291 
258 protected:                                        292 protected:
259                                                   293 
                                                   >> 294   G4GPILSelection             valueGPILSelectionMSC;
260   G4ParticleChangeForMSC      fParticleChange;    295   G4ParticleChangeForMSC      fParticleChange;
261                                                   296 
262 private:                                          297 private:
263                                                   298 
264   G4ThreeVector               fNewPosition;    << 299   G4EmModelManager*           modelManager;
265   G4ThreeVector               fNewDirection;   << 300   G4VEmModel*                 currentModel;
                                                   >> 301   G4PhysicsTable*             theLambdaTable;
266                                                   302 
267   G4VMscModel*                currentModel = n << 303   // cache
268   G4VEnergyLossProcess*       fIonisation = nu << 304   const G4ParticleDefinition* firstParticle;
                                                   >> 305   const G4ParticleDefinition* currentParticle;
                                                   >> 306   const G4MaterialCutsCouple* currentCouple;
                                                   >> 307   size_t                      currentMaterialIndex;
                                                   >> 308 
                                                   >> 309   G4int                       nBins;
                                                   >> 310 
                                                   >> 311   G4MscStepLimitType          stepLimit;
                                                   >> 312 
                                                   >> 313   G4double                    minKinEnergy;
                                                   >> 314   G4double                    maxKinEnergy;
                                                   >> 315   G4double                    skin;
                                                   >> 316   G4double                    facrange;
                                                   >> 317   G4double                    facgeom;
269                                                   318 
270   G4double                    geomMin;         << 319   G4bool                      latDisplasment;
271   G4double                    minDisplacement2 << 320   G4bool                      buildLambdaTable;
272   G4double                    physStepLimit =  << 
273   G4double                    tPathLength = 0. << 
274   G4double                    gPathLength = 0. << 
275                                                << 
276   G4MscStepLimitType          stepLimit = fUse << 
277   G4int                       numberOfModels = << 
278                                                << 
279   G4bool                      latDisplacement  << 
280   G4bool                      isIon = false;   << 
281   G4bool                      fPositionChanged << 
282   G4bool                      isActive = false << 
283   G4bool                      baseMat = false; << 
284 };                                                321 };
285                                                   322 
286 // ======== Run time inline methods ========== << 323 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 324 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 325 
                                                   >> 326 inline void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* couple)
                                                   >> 327 {
                                                   >> 328   if(couple != currentCouple) {
                                                   >> 329     currentCouple   = couple;
                                                   >> 330     currentMaterialIndex = couple->GetIndex();
                                                   >> 331   }
                                                   >> 332 }
287                                                   333 
288 //....oooOO0OOooo........oooOO0OOooo........oo    334 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
289                                                   335 
290 inline G4VEmModel*                             << 336 inline G4double G4VMultipleScattering::PostStepGetPhysicalInteractionLength(
291 G4VMultipleScattering::SelectModel(G4double ki << 337               const G4Track&, G4double, G4ForceCondition* condition)
292 {                                                 338 {
293   return modelManager->SelectModel(kinEnergy,  << 339   *condition = Forced;
                                                   >> 340   return DBL_MAX;
294 }                                                 341 }
295                                                   342 
296 //....oooOO0OOooo........oooOO0OOooo........oo    343 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
297                                                   344 
298 inline  G4bool G4VMultipleScattering::LateralD << 345 inline G4double G4VMultipleScattering::GetMeanFreePath(
                                                   >> 346               const G4Track&, G4double, G4ForceCondition* condition)
                                                   >> 347 {
                                                   >> 348   *condition = Forced;
                                                   >> 349   return DBL_MAX;
                                                   >> 350 }
                                                   >> 351 
                                                   >> 352 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 353 
                                                   >> 354 inline G4double G4VMultipleScattering::AlongStepGetPhysicalInteractionLength(
                                                   >> 355                              const G4Track& track,
                                                   >> 356                              G4double previousStepSize,
                                                   >> 357                              G4double currentMinimalStep,
                                                   >> 358                              G4double& currentSafety,
                                                   >> 359                              G4GPILSelection* selection)
299 {                                                 360 {
300   return latDisplacement;                      << 361   // get Step limit proposed by the process
                                                   >> 362   valueGPILSelectionMSC = NotCandidateForSelection;
                                                   >> 363   G4double steplength = GetMscContinuousStepLimit(track,previousStepSize,
                                                   >> 364                                               currentMinimalStep,currentSafety);
                                                   >> 365   // G4cout << "StepLimit= " << steplength << G4endl;
                                                   >> 366   // set return value for G4GPILSelection
                                                   >> 367   *selection = valueGPILSelectionMSC;
                                                   >> 368   return  steplength;
301 }                                                 369 }
302                                                   370 
303 //....oooOO0OOooo........oooOO0OOooo........oo    371 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
304                                                   372 
305 inline  G4double G4VMultipleScattering::Skin() << 373 inline G4double G4VMultipleScattering::GetMscContinuousStepLimit(
                                                   >> 374                                           const G4Track& track,
                                                   >> 375                                                 G4double,
                                                   >> 376                                                 G4double currentMinimalStep,
                                                   >> 377                                                 G4double&)
306 {                                                 378 {
307   return theParameters->MscSkin();             << 379   G4double x = currentMinimalStep;
                                                   >> 380   G4double e = track.GetKineticEnergy();
                                                   >> 381   DefineMaterial(track.GetMaterialCutsCouple());
                                                   >> 382   currentModel = SelectModel(e);
                                                   >> 383   if(x > 0.0 && e > 0.0) {
                                                   >> 384     G4double tPathLength = 
                                                   >> 385       currentModel->ComputeTruePathLengthLimit(track, theLambdaTable, x);
                                                   >> 386     if (tPathLength < x) valueGPILSelectionMSC = CandidateForSelection;
                                                   >> 387     x = currentModel->ComputeGeomPathLength(tPathLength);  
                                                   >> 388     //  G4cout << "tPathLength= " << tPathLength
                                                   >> 389     //         << " stepLimit= " << x 
                                                   >> 390     //        << " currentMinimalStep= " << currentMinimalStep<< G4endl;
                                                   >> 391   }
                                                   >> 392   return x;
308 }                                                 393 }
309                                                   394 
310 //....oooOO0OOooo........oooOO0OOooo........oo    395 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
311                                                   396 
312 inline  G4double G4VMultipleScattering::RangeF << 397 inline G4double G4VMultipleScattering::GetContinuousStepLimit(
                                                   >> 398                                        const G4Track& track,
                                                   >> 399                                        G4double previousStepSize,
                                                   >> 400                                        G4double currentMinimalStep,
                                                   >> 401                                        G4double& currentSafety)
313 {                                                 402 {
314   return facrange;                             << 403   return GetMscContinuousStepLimit(track,previousStepSize,currentMinimalStep,
                                                   >> 404                                       currentSafety);
315 }                                                 405 }
316                                                   406 
317 //....oooOO0OOooo........oooOO0OOooo........oo    407 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
318                                                   408 
319 inline  G4double G4VMultipleScattering::GeomFa << 409 inline G4double G4VMultipleScattering::ContinuousStepLimit(
                                                   >> 410                                        const G4Track& track,
                                                   >> 411                                        G4double previousStepSize,
                                                   >> 412                                        G4double currentMinimalStep,
                                                   >> 413                                        G4double& currentSafety)
320 {                                                 414 {
321   return theParameters->MscGeomFactor();       << 415   return GetMscContinuousStepLimit(track,previousStepSize,currentMinimalStep,
                                                   >> 416                                       currentSafety);
322 }                                                 417 }
323                                                   418 
324 //....oooOO0OOooo........oooOO0OOooo........oo    419 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
325                                                   420 
326 inline  G4double G4VMultipleScattering::PolarA << 421 inline G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p, G4double& e)
327 {                                                 422 {
328   return theParameters->MscThetaLimit();       << 423   G4double x;
                                                   >> 424   if(theLambdaTable) {
                                                   >> 425     G4bool b;
                                                   >> 426     x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
                                                   >> 427   } else {
                                                   >> 428     x = currentModel->CrossSection(currentCouple,p,e);
                                                   >> 429   }
                                                   >> 430   if(x > DBL_MIN) x = 1./x;
                                                   >> 431   else            x = DBL_MAX; 
                                                   >> 432   return x;
329 }                                                 433 }
330                                                   434 
331 //....oooOO0OOooo........oooOO0OOooo........oo    435 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
332                                                   436 
333 inline G4MscStepLimitType G4VMultipleScatterin << 437 inline G4VParticleChange* G4VMultipleScattering::AlongStepDoIt(
                                                   >> 438                                                         const G4Track&,
                                                   >> 439                                                         const G4Step& step)
334 {                                                 440 {
335   return stepLimit;                            << 441   fParticleChange.ProposeTrueStepLength(
                                                   >> 442     currentModel->ComputeTrueStepLength(step.GetStepLength()));
                                                   >> 443   return &fParticleChange;
336 }                                                 444 }
337                                                   445 
338 //....oooOO0OOooo........oooOO0OOooo........oo    446 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
339                                                   447 
340 inline void G4VMultipleScattering::SetStepLimi << 448 inline G4VParticleChange* G4VMultipleScattering::PostStepDoIt(const G4Track& track,
                                                   >> 449                     const G4Step& step)
                                                   >> 450 {
                                                   >> 451   fParticleChange.Initialize(track);
                                                   >> 452   std::vector<G4DynamicParticle*>* p=0;
                                                   >> 453   currentModel->SampleSecondaries(p, currentCouple,
                                                   >> 454           track.GetDynamicParticle(),
                                                   >> 455           step.GetStepLength(),
                                                   >> 456           step.GetPostStepPoint()->GetSafety());
                                                   >> 457   return &fParticleChange;
                                                   >> 458 }
                                                   >> 459 
                                                   >> 460 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 461 
                                                   >> 462 inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy)
                                                   >> 463 {
                                                   >> 464   return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
                                                   >> 465 }
                                                   >> 466 
                                                   >> 467 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 468 
                                                   >> 469 inline G4VEmModel* G4VMultipleScattering::SelectModelForMaterial(
                                                   >> 470                                            G4double kinEnergy, size_t& idxRegion) const
341 {                                                 471 {
342   theParameters->SetMscStepLimitType(val);     << 472   return modelManager->SelectModel(kinEnergy, idxRegion);
343 }                                                 473 }
344                                                   474 
345 //....oooOO0OOooo........oooOO0OOooo........oo    475 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
346                                                   476 
347 inline G4double G4VMultipleScattering::LowestK << 477 inline void G4VMultipleScattering::SetBinning(G4int nbins)
348 {                                                 478 {
349   return lowestKinEnergy;                      << 479   nBins = nbins;
350 }                                                 480 }
351                                                   481 
352 //....oooOO0OOooo........oooOO0OOooo........oo    482 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
353                                                   483 
354 inline void G4VMultipleScattering::SetLowestKi << 484 inline G4int G4VMultipleScattering::Binning() const
355 {                                                 485 {
356   lowestKinEnergy = val;                       << 486   return nBins;
357 }                                                 487 }
358                                                   488 
359 //....oooOO0OOooo........oooOO0OOooo........oo    489 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
360                                                   490 
361 inline const G4ParticleDefinition* G4VMultiple << 491 inline void G4VMultipleScattering::SetMinKinEnergy(G4double e)
362 {                                                 492 {
363   return firstParticle;                        << 493   minKinEnergy = e;
364 }                                                 494 }
365                                                   495 
366 //....oooOO0OOooo........oooOO0OOooo........oo    496 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
367                                                   497 
368 inline G4VMscModel* G4VMultipleScattering::EmM << 498 inline G4double G4VMultipleScattering::MinKinEnergy() const
369 {                                                 499 {
370   return (index < mscModels.size()) ? mscModel << 500   return minKinEnergy;
371 }                                                 501 }
372                                                   502 
373 //....oooOO0OOooo........oooOO0OOooo........oo    503 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
374                                                   504 
375 inline G4int G4VMultipleScattering::NumberOfMo << 505 inline void G4VMultipleScattering::SetMaxKinEnergy(G4double e)
376 {                                                 506 {
377   return numberOfModels;                       << 507   maxKinEnergy = e;
378 }                                                 508 }
379                                                   509 
380 //....oooOO0OOooo........oooOO0OOooo........oo    510 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
381                                                   511 
382 inline G4VMscModel*                            << 512 inline G4double G4VMultipleScattering::MaxKinEnergy() const
383 G4VMultipleScattering::GetModelByIndex(G4int i << 
384 {                                                 513 {
385   // static cast is possible inside this class << 514   return maxKinEnergy;
386   return static_cast<G4VMscModel*>(modelManage << 
387 }                                                 515 }
388                                                   516 
389 //....oooOO0OOooo........oooOO0OOooo........oo    517 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
390                                                   518 
391 inline G4bool G4VMultipleScattering::UseBaseMa << 519 inline  G4bool G4VMultipleScattering::LateralDisplasmentFlag() const
                                                   >> 520 {
                                                   >> 521   return latDisplasment;
                                                   >> 522 }
                                                   >> 523 
                                                   >> 524 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 525 
                                                   >> 526 inline  void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val)
                                                   >> 527 {
                                                   >> 528   latDisplasment = val;
                                                   >> 529 }
                                                   >> 530 
                                                   >> 531 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 532 
                                                   >> 533 inline  G4double G4VMultipleScattering::Skin() const
                                                   >> 534 {
                                                   >> 535   return skin;
                                                   >> 536 }
                                                   >> 537 
                                                   >> 538 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 539 
                                                   >> 540 inline  void G4VMultipleScattering::SetSkin(G4double val)
                                                   >> 541 {
                                                   >> 542   if(val <= 0.99999) {
                                                   >> 543     skin = 0.0;
                                                   >> 544     stepLimit = fUseSafety;
                                                   >> 545   } else {
                                                   >> 546     skin = val;
                                                   >> 547     stepLimit = fUseDistanceToBoundary;
                                                   >> 548   }
                                                   >> 549 }
                                                   >> 550 
                                                   >> 551 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 552 
                                                   >> 553 inline  G4double G4VMultipleScattering::RangeFactor() const
                                                   >> 554 {
                                                   >> 555   return facrange;
                                                   >> 556 }
                                                   >> 557 
                                                   >> 558 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 559 
                                                   >> 560 inline  void G4VMultipleScattering::SetRangeFactor(G4double val)
                                                   >> 561 {
                                                   >> 562   if(val > 0.0) facrange = val;
                                                   >> 563 }
                                                   >> 564 
                                                   >> 565 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 566 
                                                   >> 567 inline  G4double G4VMultipleScattering::GeomFactor() const
                                                   >> 568 {
                                                   >> 569   return facgeom;
                                                   >> 570 }
                                                   >> 571 
                                                   >> 572 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 573 
                                                   >> 574 inline  void G4VMultipleScattering::SetGeomFactor(G4double val)
                                                   >> 575 {
                                                   >> 576   if(val > 0.0) facgeom = val;
                                                   >> 577 }
                                                   >> 578 
                                                   >> 579 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 580 
                                                   >> 581 inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const
                                                   >> 582 {
                                                   >> 583   return stepLimit;
                                                   >> 584 }
                                                   >> 585 
                                                   >> 586 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 587 
                                                   >> 588 inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val) 
                                                   >> 589 {
                                                   >> 590   stepLimit = val;
                                                   >> 591   if(val == fMinimal) {
                                                   >> 592     skin = 0;
                                                   >> 593     facrange = 0.2;
                                                   >> 594   } else if(val == fUseSafety) {
                                                   >> 595     skin = 0;
                                                   >> 596   }
                                                   >> 597 }
                                                   >> 598 
                                                   >> 599 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 600 
                                                   >> 601 inline  void G4VMultipleScattering::SetBuildLambdaTable(G4bool val)
                                                   >> 602 {
                                                   >> 603    buildLambdaTable = val;
                                                   >> 604 }
                                                   >> 605 
                                                   >> 606 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 607 
                                                   >> 608 inline  const G4ParticleDefinition* G4VMultipleScattering::Particle() const
                                                   >> 609 {
                                                   >> 610   return currentParticle;
                                                   >> 611 }
                                                   >> 612 
                                                   >> 613 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 614 
                                                   >> 615 inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
                                                   >> 616 {
                                                   >> 617   return theLambdaTable;
                                                   >> 618 }
                                                   >> 619 
                                                   >> 620 inline 
                                                   >> 621 const G4MaterialCutsCouple* G4VMultipleScattering::CurrentMaterialCutsCouple() const
                                                   >> 622 {
                                                   >> 623   return currentCouple;
                                                   >> 624 } 
                                                   >> 625 
                                                   >> 626 inline G4VEmModel* G4VMultipleScattering::GetModelByIndex(G4int idx)
392 {                                                 627 {
393   return baseMat;                              << 628   return modelManager->GetModel(idx);
394 }                                                 629 }
395                                                   630 
396 //....oooOO0OOooo........oooOO0OOooo........oo    631 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
397                                                   632 
398 #endif                                            633 #endif
399                                                   634