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.3)


  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.62 2009/10/29 17:56:04 vnivanch Exp $
                                                   >>  27 // GEANT4 tag $Name: geant4-09-03 $
 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      64 // 27-10-07 Virtual functions moved to source (V.Ivanchenko)
 54 // 15-07-08 Reorder class members for further      65 // 15-07-08 Reorder class members for further multi-thread development (VI)
 55 // 07-04-09 Moved msc methods from G4VEmModel      66 // 07-04-09 Moved msc methods from G4VEmModel to G4VMscModel (VI) 
 56 //                                                 67 //
 57 // Class Description:                          << 
 58 //                                             << 
 59 // It is the generic process of multiple scatt << 
 60 // part of calculations for all charged partic << 
 61                                                    68 
 62 // -------------------------------------------     69 // -------------------------------------------------------------------
 63 //                                                 70 //
 64                                                    71 
 65 #ifndef G4VMultipleScattering_h                    72 #ifndef G4VMultipleScattering_h
 66 #define G4VMultipleScattering_h 1                  73 #define G4VMultipleScattering_h 1
 67                                                    74 
 68 #include "G4VContinuousDiscreteProcess.hh"         75 #include "G4VContinuousDiscreteProcess.hh"
 69 #include "globals.hh"                              76 #include "globals.hh"
 70 #include "G4Material.hh"                           77 #include "G4Material.hh"
                                                   >>  78 #include "G4MaterialCutsCouple.hh"
 71 #include "G4ParticleChangeForMSC.hh"               79 #include "G4ParticleChangeForMSC.hh"
 72 #include "G4Track.hh"                              80 #include "G4Track.hh"
 73 #include "G4Step.hh"                               81 #include "G4Step.hh"
 74 #include "G4EmModelManager.hh"                     82 #include "G4EmModelManager.hh"
 75 #include "G4VMscModel.hh"                          83 #include "G4VMscModel.hh"
 76 #include "G4EmParameters.hh"                   << 
 77 #include "G4MscStepLimitType.hh"                   84 #include "G4MscStepLimitType.hh"
 78                                                    85 
 79 class G4ParticleDefinition;                        86 class G4ParticleDefinition;
 80 class G4VEnergyLossProcess;                    <<  87 class G4DataVector;
 81 class G4LossTableManager;                      <<  88 class G4PhysicsTable;
 82 class G4SafetyHelper;                          <<  89 class G4PhysicsVector;
 83                                                    90 
 84 //....oooOO0OOooo........oooOO0OOooo........oo     91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 85                                                    92 
 86 class G4VMultipleScattering : public G4VContin     93 class G4VMultipleScattering : public G4VContinuousDiscreteProcess
 87 {                                                  94 {
 88 public:                                            95 public:
 89                                                    96 
 90   explicit G4VMultipleScattering(const G4Strin <<  97   G4VMultipleScattering(const G4String& name = "msc",
 91                                  G4ProcessType <<  98       G4ProcessType type = fElectromagnetic);
 92                                                    99 
 93   ~G4VMultipleScattering() override;           << 100   virtual ~G4VMultipleScattering();
 94                                                   101 
 95   //------------------------------------------    102   //------------------------------------------------------------------------
 96   // Virtual methods to be implemented for the    103   // Virtual methods to be implemented for the concrete model
 97   //------------------------------------------    104   //------------------------------------------------------------------------
 98                                                   105 
 99   void ProcessDescription(std::ostream& outFil << 106   virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
100                                                << 
101   virtual void InitialiseProcess(const G4Parti << 
102                                                   107 
103   // Print out of generic class parameters     << 108   virtual void PrintInfo() = 0;
104   void StreamInfo(std::ostream& outFile, const << 
105                   G4bool rst = false) const;   << 
106                                                   109 
107 protected:                                        110 protected:
108                                                   111 
109   virtual void StreamProcessInfo(std::ostream& << 112   virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
110                                                   113 
111 public:                                           114 public:
112                                                   115 
113   //------------------------------------------    116   //------------------------------------------------------------------------
114   // Generic methods common to all ContinuousD    117   // Generic methods common to all ContinuousDiscrete processes
115   //------------------------------------------    118   //------------------------------------------------------------------------
116                                                   119 
117   // Initialise for build of tables               120   // Initialise for build of tables
118   void PreparePhysicsTable(const G4ParticleDef << 121   void PreparePhysicsTable(const G4ParticleDefinition&);
119                                                << 122   
120   // Build physics table during initialisation    123   // Build physics table during initialisation
121   void BuildPhysicsTable(const G4ParticleDefin << 124   void BuildPhysicsTable(const G4ParticleDefinition&);
                                                   >> 125 
                                                   >> 126   // Print out of generic class parameters
                                                   >> 127   void PrintInfoDefinition();
122                                                   128 
123   // Store PhysicsTable in a file.                129   // Store PhysicsTable in a file.
124   // Return false in case of failure at I/O       130   // Return false in case of failure at I/O
125   G4bool StorePhysicsTable(const G4ParticleDef    131   G4bool StorePhysicsTable(const G4ParticleDefinition*,
126                            const G4String& dir    132                            const G4String& directory,
127                            G4bool ascii = fals << 133          G4bool ascii = false);
128                                                   134 
129   // Retrieve Physics from a file.                135   // Retrieve Physics from a file.
130   // (return true if the Physics Table can be     136   // (return true if the Physics Table can be build by using file)
131   // (return false if the process has no funct    137   // (return false if the process has no functionality or in case of failure)
132   // File name should is constructed as proces    138   // File name should is constructed as processName+particleName and the
133   // should be placed under the directory spec << 139   // should be placed under the directory specifed by the argument.
134   G4bool RetrievePhysicsTable(const G4Particle    140   G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
135                               const G4String&     141                               const G4String& directory,
136                               G4bool ascii) ov << 142             G4bool ascii);
137                                                << 
138   // This is called in the beginning of tracki << 
139   void StartTracking(G4Track*) override;       << 
140                                                   143 
141   // The function overloads the corresponding     144   // The function overloads the corresponding function of the base
142   // class.It limits the step near to boundari    145   // class.It limits the step near to boundaries only
143   // and invokes the method GetMscContinuousSt    146   // and invokes the method GetMscContinuousStepLimit at every step.
144   G4double AlongStepGetPhysicalInteractionLeng    147   G4double AlongStepGetPhysicalInteractionLength(
145                                         const  << 148                                             const G4Track&,
146                                         G4doub << 149               G4double  previousStepSize,
147                                         G4doub << 150               G4double  currentMinimalStep,
148                                         G4doub << 151               G4double& currentSafety,
149                                         G4GPIL << 152               G4GPILSelection* selection);
150                                                   153 
151   // The function overloads the corresponding     154   // The function overloads the corresponding function of the base
152   // class.                                       155   // class.
153   G4double PostStepGetPhysicalInteractionLengt << 156   inline G4double PostStepGetPhysicalInteractionLength(
154                                       const G4 << 157                                             const G4Track&,
155                                       G4double << 158               G4double  previousStepSize,
156                                       G4ForceC << 159               G4ForceCondition* condition);
157                                                   160 
158   // Along step actions                           161   // Along step actions
159   G4VParticleChange* AlongStepDoIt(const G4Tra << 162   inline G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
                                                   >> 163 
                                                   >> 164   // Post step actions
                                                   >> 165   inline G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
160                                                   166 
161   // This method does not used for tracking, i    167   // This method does not used for tracking, it is intended only for tests
162   G4double ContinuousStepLimit(const G4Track&  << 168   inline G4double ContinuousStepLimit(const G4Track& track,
163                                G4double previo << 169               G4double previousStepSize,
164                                G4double curren << 170               G4double currentMinimalStep,
165                                G4double& curre << 171               G4double& currentSafety);
166                                                << 172 
167   // hide assignment operator                  << 173   //------------------------------------------------------------------------
168   G4VMultipleScattering(G4VMultipleScattering  << 174   // Specific methods to build and access Physics Tables
169   G4VMultipleScattering & operator=(const G4VM << 175   //------------------------------------------------------------------------
                                                   >> 176 
                                                   >> 177   // Build empty Physics Vector
                                                   >> 178   G4PhysicsVector* PhysicsVector(const G4MaterialCutsCouple*);
                                                   >> 179 
                                                   >> 180   inline void SetBinning(G4int nbins);
                                                   >> 181   inline G4int Binning() const;
                                                   >> 182 
                                                   >> 183   inline void SetMinKinEnergy(G4double e);
                                                   >> 184   inline G4double MinKinEnergy() const;
                                                   >> 185 
                                                   >> 186   inline void SetMaxKinEnergy(G4double e);
                                                   >> 187   inline G4double MaxKinEnergy() const;
                                                   >> 188 
                                                   >> 189   inline void SetBuildLambdaTable(G4bool val);
                                                   >> 190 
                                                   >> 191   inline G4PhysicsTable* LambdaTable() const;
                                                   >> 192 
                                                   >> 193   // access particle type 
                                                   >> 194   inline const G4ParticleDefinition* Particle() const;
170                                                   195 
171   //------------------------------------------    196   //------------------------------------------------------------------------
172   // Specific methods to set, access, modify m    197   // Specific methods to set, access, modify models
173   //------------------------------------------    198   //------------------------------------------------------------------------
174                                                   199 
                                                   >> 200 protected:
175   // Select model in run time                     201   // Select model in run time
176   inline G4VEmModel* SelectModel(G4double kinE << 202   inline G4VEmModel* SelectModel(G4double kinEnergy);
177                                                   203 
178 public:                                           204 public:
                                                   >> 205   // Select model in run time
                                                   >> 206   inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 
                                                   >> 207               size_t& idxRegion) const;
179                                                   208 
180   // Add model for region, smaller value of or    209   // Add model for region, smaller value of order defines which
181   // model will be selected for a given energy    210   // model will be selected for a given energy interval  
182   void AddEmModel(G4int order, G4VMscModel*, c << 211   void AddEmModel(G4int order, G4VEmModel*, const G4Region* region = 0);
183                                                   212 
184   // Assign a model to a process local list, t << 213   // Assign a model to a process
185   // the derived process should execute AddEmM << 214   void SetModel(G4VMscModel*, G4int index = 1);
186   void SetEmModel(G4VMscModel*, G4int idx = 0) << 
187                                                   215   
188   // return a model from the local list        << 216   // return the assigned model
189   inline G4VMscModel* EmModel(size_t index = 0 << 217   G4VMscModel* Model(G4int index = 1);
190                                                << 
191   // Access to run time models                 << 
192   inline G4int NumberOfModels() const;         << 
193                                                   218 
194   inline G4VMscModel* GetModelByIndex(G4int id << 219   // Access to models by index
                                                   >> 220   G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
195                                                   221 
196   //------------------------------------------    222   //------------------------------------------------------------------------
197   // Get/Set parameters for simulation of mult    223   // Get/Set parameters for simulation of multiple scattering
198   //------------------------------------------    224   //------------------------------------------------------------------------
199                                                   225 
200   inline G4bool LateralDisplasmentFlag() const    226   inline G4bool LateralDisplasmentFlag() const;
201                                                << 227   inline void SetLateralDisplasmentFlag(G4bool val);
                                                   >> 228 
202   inline G4double Skin() const;                   229   inline G4double Skin() const;
203                                                << 230   inline void SetSkin(G4double val);
                                                   >> 231 
204   inline G4double RangeFactor() const;            232   inline G4double RangeFactor() const;
205                                                << 233   inline void SetRangeFactor(G4double val);
                                                   >> 234 
206   inline G4double GeomFactor() const;             235   inline G4double GeomFactor() const;
207                                                << 236   inline void SetGeomFactor(G4double val);
                                                   >> 237 
208   inline G4double PolarAngleLimit() const;        238   inline G4double PolarAngleLimit() const;
                                                   >> 239   inline void SetPolarAngleLimit(G4double val);
209                                                   240 
210   inline G4bool UseBaseMaterial() const;       << 
211                                                << 
212   inline G4MscStepLimitType StepLimitType() co    241   inline G4MscStepLimitType StepLimitType() const;
213   inline void SetStepLimitType(G4MscStepLimitT    242   inline void SetStepLimitType(G4MscStepLimitType val);
214                                                   243 
215   inline G4double LowestKinEnergy() const;     << 
216   inline void SetLowestKinEnergy(G4double val) << 
217                                                << 
218   inline const G4ParticleDefinition* FirstPart << 
219                                                << 
220   //------------------------------------------    244   //------------------------------------------------------------------------
221   // Run time methods                             245   // Run time methods
222   //------------------------------------------    246   //------------------------------------------------------------------------
223                                                   247 
224 protected:                                        248 protected:
225                                                   249 
226   // This method is not used for tracking, it     250   // This method is not used for tracking, it returns mean free path value
227   G4double GetMeanFreePath(const G4Track& trac    251   G4double GetMeanFreePath(const G4Track& track,
228                            G4double,           << 252          G4double,
229                            G4ForceCondition* c << 253          G4ForceCondition* condition);
230                                                   254 
231   // This method is not used for tracking, it     255   // This method is not used for tracking, it returns step limit
232   G4double GetContinuousStepLimit(const G4Trac    256   G4double GetContinuousStepLimit(const G4Track& track,
233                                   G4double pre << 257           G4double previousStepSize,
234                                   G4double cur << 258           G4double currentMinimalStep,
235                                   G4double& cu << 259           G4double& currentSafety);
                                                   >> 260 
                                                   >> 261   // This method returns inversed transport cross section
                                                   >> 262   inline G4double GetLambda(const G4ParticleDefinition* p, 
                                                   >> 263           G4double& kineticEnergy);
                                                   >> 264 
                                                   >> 265   // defines current material in run time
                                                   >> 266   inline void DefineMaterial(const G4MaterialCutsCouple* couple);
                                                   >> 267 
                                                   >> 268   inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const; 
236                                                   269 
237 private:                                          270 private:
238                                                   271 
                                                   >> 272   // hide  assignment operator
                                                   >> 273   G4VMultipleScattering(G4VMultipleScattering &);
                                                   >> 274   G4VMultipleScattering & operator=(const G4VMultipleScattering &right);
                                                   >> 275 
239   // ======== Parameters of the class fixed at    276   // ======== Parameters of the class fixed at construction =========
240                                                   277 
241   G4EmModelManager*           modelManager;       278   G4EmModelManager*           modelManager;
242   G4LossTableManager*         emManager;       << 279   G4bool                      buildLambdaTable;
243   G4EmParameters*             theParameters;   << 
244                                                   280 
245   // ======== Parameters of the class fixed at    281   // ======== Parameters of the class fixed at initialisation =======
246                                                   282 
247   G4SafetyHelper*             safetyHelper = n << 
248   const G4ParticleDefinition* firstParticle =  << 
249   const G4ParticleDefinition* currParticle = n << 
250                                                << 
251   std::vector<G4VMscModel*>   mscModels;          283   std::vector<G4VMscModel*>   mscModels;
252                                                   284 
253   G4double                    facrange = 0.04; << 285   G4PhysicsTable*             theLambdaTable;
254   G4double                    lowestKinEnergy; << 286   const G4ParticleDefinition* firstParticle;
                                                   >> 287 
                                                   >> 288   G4MscStepLimitType          stepLimit;
255                                                   289 
256   // ======== Cached values - may be state dep << 290   G4double                    minKinEnergy;
                                                   >> 291   G4double                    maxKinEnergy;
                                                   >> 292   G4double                    skin;
                                                   >> 293   G4double                    facrange;
                                                   >> 294   G4double                    facgeom;
                                                   >> 295   G4double                    polarAngleLimit;
                                                   >> 296 
                                                   >> 297   G4int                       nBins;
                                                   >> 298 
                                                   >> 299   G4bool                      latDisplasment;
                                                   >> 300   G4bool                      isIon;
                                                   >> 301 
                                                   >> 302   // ======== Cashed values - may be state dependent ================
257                                                   303 
258 protected:                                        304 protected:
259                                                   305 
                                                   >> 306   G4GPILSelection             valueGPILSelectionMSC;
260   G4ParticleChangeForMSC      fParticleChange;    307   G4ParticleChangeForMSC      fParticleChange;
261                                                   308 
262 private:                                          309 private:
263                                                   310 
264   G4ThreeVector               fNewPosition;    << 311   G4VMscModel*                currentModel;
265   G4ThreeVector               fNewDirection;   << 
266                                                   312 
267   G4VMscModel*                currentModel = n << 313   // cache
268   G4VEnergyLossProcess*       fIonisation = nu << 314   const G4ParticleDefinition* currentParticle;
                                                   >> 315   const G4MaterialCutsCouple* currentCouple;
                                                   >> 316   size_t                      currentMaterialIndex;
269                                                   317 
270   G4double                    geomMin;         << 
271   G4double                    minDisplacement2 << 
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 };                                                318 };
285                                                   319 
286 // ======== Run time inline methods ========== << 320 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 321 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 322 
                                                   >> 323 inline G4double G4VMultipleScattering::ContinuousStepLimit(
                                                   >> 324                                        const G4Track& track,
                                                   >> 325                                        G4double previousStepSize,
                                                   >> 326                                        G4double currentMinimalStep,
                                                   >> 327                                        G4double& currentSafety)
                                                   >> 328 {
                                                   >> 329   return GetContinuousStepLimit(track,previousStepSize,currentMinimalStep,
                                                   >> 330         currentSafety);
                                                   >> 331 }
                                                   >> 332 
                                                   >> 333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 334 
                                                   >> 335 inline void G4VMultipleScattering::SetBinning(G4int nbins)
                                                   >> 336 {
                                                   >> 337   nBins = nbins;
                                                   >> 338 }
                                                   >> 339 
                                                   >> 340 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 341 
                                                   >> 342 inline G4int G4VMultipleScattering::Binning() const
                                                   >> 343 {
                                                   >> 344   return nBins;
                                                   >> 345 }
                                                   >> 346 
                                                   >> 347 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 348 
                                                   >> 349 inline void G4VMultipleScattering::SetMinKinEnergy(G4double e)
                                                   >> 350 {
                                                   >> 351   minKinEnergy = e;
                                                   >> 352 }
                                                   >> 353 
                                                   >> 354 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 355 
                                                   >> 356 inline G4double G4VMultipleScattering::MinKinEnergy() const
                                                   >> 357 {
                                                   >> 358   return minKinEnergy;
                                                   >> 359 }
                                                   >> 360 
                                                   >> 361 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 362 
                                                   >> 363 inline void G4VMultipleScattering::SetMaxKinEnergy(G4double e)
                                                   >> 364 {
                                                   >> 365   maxKinEnergy = e;
                                                   >> 366 }
                                                   >> 367 
                                                   >> 368 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 369 
                                                   >> 370 inline G4double G4VMultipleScattering::MaxKinEnergy() const
                                                   >> 371 {
                                                   >> 372   return maxKinEnergy;
                                                   >> 373 }
                                                   >> 374 
                                                   >> 375 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 376 
                                                   >> 377 inline  void G4VMultipleScattering::SetBuildLambdaTable(G4bool val)
                                                   >> 378 {
                                                   >> 379   buildLambdaTable = val;
                                                   >> 380 }
287                                                   381 
288 //....oooOO0OOooo........oooOO0OOooo........oo    382 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
289                                                   383 
290 inline G4VEmModel*                             << 384 inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
291 G4VMultipleScattering::SelectModel(G4double ki << 
292 {                                                 385 {
293   return modelManager->SelectModel(kinEnergy,  << 386   return theLambdaTable;
                                                   >> 387 }
                                                   >> 388 
                                                   >> 389 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 390 
                                                   >> 391 inline  const G4ParticleDefinition* G4VMultipleScattering::Particle() const
                                                   >> 392 {
                                                   >> 393   return currentParticle;
                                                   >> 394 }
                                                   >> 395 
                                                   >> 396 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 397 
                                                   >> 398 inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy)
                                                   >> 399 {
                                                   >> 400   return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
                                                   >> 401 }
                                                   >> 402 
                                                   >> 403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 404 
                                                   >> 405 inline G4VEmModel* G4VMultipleScattering::SelectModelForMaterial(
                                                   >> 406        G4double kinEnergy, size_t& idxRegion) const
                                                   >> 407 {
                                                   >> 408   return modelManager->SelectModel(kinEnergy, idxRegion);
294 }                                                 409 }
295                                                   410 
296 //....oooOO0OOooo........oooOO0OOooo........oo    411 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
297                                                   412 
298 inline  G4bool G4VMultipleScattering::LateralD    413 inline  G4bool G4VMultipleScattering::LateralDisplasmentFlag() const
299 {                                                 414 {
300   return latDisplacement;                      << 415   return latDisplasment;
                                                   >> 416 }
                                                   >> 417 
                                                   >> 418 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 419 
                                                   >> 420 inline  void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val)
                                                   >> 421 {
                                                   >> 422   latDisplasment = val;
301 }                                                 423 }
302                                                   424 
303 //....oooOO0OOooo........oooOO0OOooo........oo    425 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
304                                                   426 
305 inline  G4double G4VMultipleScattering::Skin()    427 inline  G4double G4VMultipleScattering::Skin() const
306 {                                                 428 {
307   return theParameters->MscSkin();             << 429   return skin;
                                                   >> 430 }
                                                   >> 431 
                                                   >> 432 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 433 
                                                   >> 434 inline  void G4VMultipleScattering::SetSkin(G4double val)
                                                   >> 435 {
                                                   >> 436   if(val < 1.0) skin = 0.0;
                                                   >> 437   else          skin = val;
308 }                                                 438 }
309                                                   439 
310 //....oooOO0OOooo........oooOO0OOooo........oo    440 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
311                                                   441 
312 inline  G4double G4VMultipleScattering::RangeF    442 inline  G4double G4VMultipleScattering::RangeFactor() const
313 {                                                 443 {
314   return facrange;                                444   return facrange;
315 }                                                 445 }
316                                                   446 
317 //....oooOO0OOooo........oooOO0OOooo........oo    447 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
318                                                   448 
                                                   >> 449 inline  void G4VMultipleScattering::SetRangeFactor(G4double val)
                                                   >> 450 {
                                                   >> 451   if(val > 0.0) facrange = val;
                                                   >> 452 }
                                                   >> 453 
                                                   >> 454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 455 
319 inline  G4double G4VMultipleScattering::GeomFa    456 inline  G4double G4VMultipleScattering::GeomFactor() const
320 {                                                 457 {
321   return theParameters->MscGeomFactor();       << 458   return facgeom;
322 }                                                 459 }
323                                                   460 
324 //....oooOO0OOooo........oooOO0OOooo........oo    461 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
325                                                   462 
326 inline  G4double G4VMultipleScattering::PolarA << 463 inline  void G4VMultipleScattering::SetGeomFactor(G4double val)
327 {                                                 464 {
328   return theParameters->MscThetaLimit();       << 465   if(val > 0.0) facgeom = val;
329 }                                                 466 }
330                                                   467 
331 //....oooOO0OOooo........oooOO0OOooo........oo    468 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
332                                                   469 
333 inline G4MscStepLimitType G4VMultipleScatterin << 470 inline  G4double G4VMultipleScattering::PolarAngleLimit() const
334 {                                                 471 {
335   return stepLimit;                            << 472   return polarAngleLimit;
336 }                                                 473 }
337                                                   474 
338 //....oooOO0OOooo........oooOO0OOooo........oo    475 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
339                                                   476 
340 inline void G4VMultipleScattering::SetStepLimi << 477 inline  void G4VMultipleScattering::SetPolarAngleLimit(G4double val)
341 {                                                 478 {
342   theParameters->SetMscStepLimitType(val);     << 479   if(val < 0.0)     polarAngleLimit = 0.0;
                                                   >> 480   else if(val > pi) polarAngleLimit = pi;
                                                   >> 481   else              polarAngleLimit = val;
343 }                                                 482 }
344                                                   483 
345 //....oooOO0OOooo........oooOO0OOooo........oo    484 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
346                                                   485 
347 inline G4double G4VMultipleScattering::LowestK << 486 inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const
348 {                                                 487 {
349   return lowestKinEnergy;                      << 488   return stepLimit;
350 }                                                 489 }
351                                                   490 
352 //....oooOO0OOooo........oooOO0OOooo........oo    491 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
353                                                   492 
354 inline void G4VMultipleScattering::SetLowestKi << 493 inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val) 
355 {                                                 494 {
356   lowestKinEnergy = val;                       << 495   stepLimit = val;
                                                   >> 496   if(val == fMinimal) facrange = 0.2;
357 }                                                 497 }
358                                                   498 
359 //....oooOO0OOooo........oooOO0OOooo........oo    499 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
360                                                   500 
361 inline const G4ParticleDefinition* G4VMultiple << 501 inline 
                                                   >> 502 G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p, 
                                                   >> 503             G4double& e)
362 {                                                 504 {
363   return firstParticle;                        << 505   G4double x;
                                                   >> 506   if(theLambdaTable) {
                                                   >> 507     x = ((*theLambdaTable)[currentMaterialIndex])->Value(e);
                                                   >> 508   } else {
                                                   >> 509     x = currentModel->CrossSection(currentCouple,p,e);
                                                   >> 510   }
                                                   >> 511   if(x > DBL_MIN) x = 1./x;
                                                   >> 512   else            x = DBL_MAX; 
                                                   >> 513   return x;
364 }                                                 514 }
365                                                   515 
366 //....oooOO0OOooo........oooOO0OOooo........oo    516 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
367                                                   517 
368 inline G4VMscModel* G4VMultipleScattering::EmM << 518 inline 
                                                   >> 519 void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* couple)
369 {                                                 520 {
370   return (index < mscModels.size()) ? mscModel << 521   if(couple != currentCouple) {
                                                   >> 522     currentCouple   = couple;
                                                   >> 523     currentMaterialIndex = couple->GetIndex();
                                                   >> 524   }
371 }                                                 525 }
372                                                   526 
373 //....oooOO0OOooo........oooOO0OOooo........oo    527 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
374                                                   528 
375 inline G4int G4VMultipleScattering::NumberOfMo << 529 inline const G4MaterialCutsCouple* 
                                                   >> 530 G4VMultipleScattering::CurrentMaterialCutsCouple() const
                                                   >> 531 {
                                                   >> 532   return currentCouple;
                                                   >> 533 } 
                                                   >> 534 
                                                   >> 535 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 536 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 537 
                                                   >> 538 // Follwoing methods are virtual, they are inlined because they applied at
                                                   >> 539 // each simulation step and some compilers may inline these methods
                                                   >> 540 
                                                   >> 541 inline G4double 
                                                   >> 542 G4VMultipleScattering::PostStepGetPhysicalInteractionLength(
                                                   >> 543               const G4Track&, G4double, G4ForceCondition* condition)
376 {                                                 544 {
377   return numberOfModels;                       << 545   *condition = Forced;
                                                   >> 546   return DBL_MAX;
378 }                                                 547 }
379                                                   548 
380 //....oooOO0OOooo........oooOO0OOooo........oo    549 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
381                                                   550 
382 inline G4VMscModel*                            << 551 inline G4VParticleChange* 
383 G4VMultipleScattering::GetModelByIndex(G4int i << 552 G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
384 {                                                 553 {
385   // static cast is possible inside this class << 554   if(currentModel->IsActive(track.GetKineticEnergy())) {
386   return static_cast<G4VMscModel*>(modelManage << 555     fParticleChange.ProposeTrueStepLength(currentModel->ComputeTrueStepLength(step.GetStepLength()));
                                                   >> 556   }
                                                   >> 557   return &fParticleChange;
387 }                                                 558 }
388                                                   559 
389 //....oooOO0OOooo........oooOO0OOooo........oo    560 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
390                                                   561 
391 inline G4bool G4VMultipleScattering::UseBaseMa << 562 inline G4VParticleChange* 
                                                   >> 563 G4VMultipleScattering::PostStepDoIt(const G4Track& track, const G4Step& step)
392 {                                                 564 {
393   return baseMat;                              << 565   fParticleChange.Initialize(track);
                                                   >> 566   if(currentModel->IsActive(track.GetKineticEnergy())) {
                                                   >> 567     currentModel->SampleScattering(track.GetDynamicParticle(),
                                                   >> 568            step.GetPostStepPoint()->GetSafety());
                                                   >> 569   }
                                                   >> 570   return &fParticleChange;
394 }                                                 571 }
395                                                   572 
396 //....oooOO0OOooo........oooOO0OOooo........oo    573 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
397                                                   574 
398 #endif                                            575 #endif
399                                                   576