Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/utils/include/G4VMscModel.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/G4VMscModel.hh (Version 11.3.0) and /processes/electromagnetic/utils/include/G4VMscModel.hh (Version 10.7)


  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 // -------------------------------------------     26 // -------------------------------------------------------------------
 27 //                                                 27 //
 28 // GEANT4 Class header file                        28 // GEANT4 Class header file
 29 //                                                 29 //
 30 //                                                 30 //
 31 // File name:     G4VMscModel                      31 // File name:     G4VMscModel
 32 //                                                 32 //
 33 // Author:        Vladimir Ivanchenko              33 // Author:        Vladimir Ivanchenko
 34 //                                                 34 //
 35 // Creation date: 07.03.2008                       35 // Creation date: 07.03.2008
 36 //                                                 36 //
 37 // Modifications:                                  37 // Modifications:
 38 // 07.04.2009 V.Ivanchenko moved msc methods f     38 // 07.04.2009 V.Ivanchenko moved msc methods from G4VEmModel to G4VMscModel 
 39 // 26.03.2012 V.Ivanchenko added transport x-s     39 // 26.03.2012 V.Ivanchenko added transport x-section pointer and Get?Set methods
 40 //                                                 40 //
 41 // Class Description:                              41 // Class Description:
 42 //                                                 42 //
 43 // General interface to msc models                 43 // General interface to msc models
 44                                                    44 
 45 // -------------------------------------------     45 // -------------------------------------------------------------------
 46 //                                                 46 //
 47 #ifndef G4VMscModel_h                              47 #ifndef G4VMscModel_h
 48 #define G4VMscModel_h 1                            48 #define G4VMscModel_h 1
 49                                                    49 
 50 #include <CLHEP/Units/SystemOfUnits.h>             50 #include <CLHEP/Units/SystemOfUnits.h>
 51                                                    51 
 52 #include "G4VEmModel.hh"                           52 #include "G4VEmModel.hh"
 53 #include "G4MscStepLimitType.hh"                   53 #include "G4MscStepLimitType.hh"
 54 #include "globals.hh"                              54 #include "globals.hh"
 55 #include "G4ThreeVector.hh"                        55 #include "G4ThreeVector.hh"
 56 #include "G4Track.hh"                              56 #include "G4Track.hh"
 57 #include "G4SafetyHelper.hh"                       57 #include "G4SafetyHelper.hh"
                                                   >>  58 #include "G4VEnergyLossProcess.hh"
 58 #include "G4PhysicsTable.hh"                       59 #include "G4PhysicsTable.hh"
 59 #include "G4ThreeVector.hh"                        60 #include "G4ThreeVector.hh"
 60 #include <vector>                                  61 #include <vector>
 61                                                    62 
 62 class G4ParticleChangeForMSC;                      63 class G4ParticleChangeForMSC;
 63 class G4ParticleDefinition;                        64 class G4ParticleDefinition;
 64 class G4VEnergyLossProcess;                    << 
 65                                                    65 
 66 class G4VMscModel : public G4VEmModel              66 class G4VMscModel : public G4VEmModel
 67 {                                                  67 {
 68                                                    68 
 69 public:                                            69 public:
 70                                                    70 
 71   explicit G4VMscModel(const G4String& nam);       71   explicit G4VMscModel(const G4String& nam);
 72                                                    72 
 73   ~G4VMscModel() override;                         73   ~G4VMscModel() override;
 74                                                    74 
 75   virtual G4double ComputeTruePathLengthLimit(     75   virtual G4double ComputeTruePathLengthLimit(const G4Track& track,  
 76                 G4double& stepLimit) = 0;          76                 G4double& stepLimit) = 0;
 77                                                    77 
 78   virtual G4double ComputeGeomPathLength(G4dou     78   virtual G4double ComputeGeomPathLength(G4double truePathLength) = 0;
 79                                                    79 
 80   virtual G4double ComputeTrueStepLength(G4dou     80   virtual G4double ComputeTrueStepLength(G4double geomPathLength) = 0;
 81                                                    81 
 82   virtual G4ThreeVector& SampleScattering(cons     82   virtual G4ThreeVector& SampleScattering(const G4ThreeVector&,
 83             G4double safety) = 0;                  83             G4double safety) = 0;
 84                                                    84 
 85   void InitialiseParameters(const G4ParticleDe     85   void InitialiseParameters(const G4ParticleDefinition*);
 86                                                    86 
 87   void DumpParameters(std::ostream& out) const     87   void DumpParameters(std::ostream& out) const;
 88                                                    88 
 89   // empty method                                  89   // empty method
 90   void SampleSecondaries(std::vector<G4Dynamic     90   void SampleSecondaries(std::vector<G4DynamicParticle*>*,
 91        const G4MaterialCutsCouple*,                91        const G4MaterialCutsCouple*,
 92        const G4DynamicParticle*,                   92        const G4DynamicParticle*,
 93        G4double tmin, G4double tmax) override;     93        G4double tmin, G4double tmax) override;
 94                                                    94 
 95   //==========================================     95   //================================================================
 96   //  Set parameters of multiple scattering mo     96   //  Set parameters of multiple scattering models
 97   //==========================================     97   //================================================================
 98                                                    98  
 99   inline void SetStepLimitType(G4MscStepLimitT     99   inline void SetStepLimitType(G4MscStepLimitType);
100                                                   100 
101   inline void SetLateralDisplasmentFlag(G4bool    101   inline void SetLateralDisplasmentFlag(G4bool val);
102                                                   102 
103   inline void SetRangeFactor(G4double);           103   inline void SetRangeFactor(G4double);
104                                                   104 
105   inline void SetGeomFactor(G4double);            105   inline void SetGeomFactor(G4double);
106                                                   106 
107   inline void SetSkin(G4double);                  107   inline void SetSkin(G4double);
108                                                   108 
109   inline void SetLambdaLimit(G4double);           109   inline void SetLambdaLimit(G4double);
110                                                   110 
111   inline void SetSafetyFactor(G4double);          111   inline void SetSafetyFactor(G4double);
112                                                   112 
113   inline void SetSampleZ(G4bool);                 113   inline void SetSampleZ(G4bool);
114                                                   114 
115   //==========================================    115   //================================================================
116   //  Get/Set access to Physics Tables            116   //  Get/Set access to Physics Tables
117   //==========================================    117   //================================================================
118                                                   118 
119   inline G4VEnergyLossProcess* GetIonisation()    119   inline G4VEnergyLossProcess* GetIonisation() const;
120                                                   120 
121   inline void SetIonisation(G4VEnergyLossProce    121   inline void SetIonisation(G4VEnergyLossProcess*, 
122           const G4ParticleDefinition* part);      122           const G4ParticleDefinition* part);
123                                                   123 
124   //==========================================    124   //================================================================
125   //  Run time methods                            125   //  Run time methods
126   //==========================================    126   //================================================================
127                                                   127 
128 protected:                                        128 protected:
129                                                   129 
130   // initialisation of the ParticleChange for     130   // initialisation of the ParticleChange for the model
131   // initialisation of interface with geometry    131   // initialisation of interface with geometry and ionisation 
132   G4ParticleChangeForMSC*                         132   G4ParticleChangeForMSC* 
133   GetParticleChangeForMSC(const G4ParticleDefi    133   GetParticleChangeForMSC(const G4ParticleDefinition* p = nullptr);
134                                                   134 
135   // convert true length to geometry length       135   // convert true length to geometry length
136   inline G4double ConvertTrueToGeom(G4double&     136   inline G4double ConvertTrueToGeom(G4double& tLength, G4double& gLength);
137                                                   137 
138   // should be set before initialisation       << 
139   inline void SetUseSplineForMSC(G4bool val);  << 
140                                                << 
141 public:                                           138 public:
142                                                   139 
143   // compute safety                               140   // compute safety
144   inline G4double ComputeSafety(const G4ThreeV    141   inline G4double ComputeSafety(const G4ThreeVector& position, 
145         G4double limit= DBL_MAX);                 142         G4double limit= DBL_MAX);
146                                                   143 
147   // compute linear distance to a geometry bou    144   // compute linear distance to a geometry boundary
148   inline G4double ComputeGeomLimit(const G4Tra    145   inline G4double ComputeGeomLimit(const G4Track&, G4double& presafety, 
149            G4double limit);                       146            G4double limit);
150                                                   147 
151   G4double GetDEDX(const G4ParticleDefinition* << 148   inline G4double GetDEDX(const G4ParticleDefinition* part,
152                           G4double kineticEner    149                           G4double kineticEnergy,
153                           const G4MaterialCuts    150                           const G4MaterialCutsCouple* couple);
154                                                << 151   inline G4double GetDEDX(const G4ParticleDefinition* part,
155   G4double GetDEDX(const G4ParticleDefinition* << 
156                           G4double kineticEner    152                           G4double kineticEnergy,
157                           const G4MaterialCuts    153                           const G4MaterialCutsCouple* couple,
158                           G4double logKineticE    154                           G4double logKineticEnergy);
159                                                   155 
160   G4double GetRange(const G4ParticleDefinition << 156   inline G4double GetRange(const G4ParticleDefinition* part,
161                            G4double kineticEne    157                            G4double kineticEnergy,
162                            const G4MaterialCut    158                            const G4MaterialCutsCouple* couple);
163                                                << 159   inline G4double GetRange(const G4ParticleDefinition* part,
164   G4double GetRange(const G4ParticleDefinition << 
165                            G4double kineticEne    160                            G4double kineticEnergy,
166                            const G4MaterialCut    161                            const G4MaterialCutsCouple* couple,
167                            G4double logKinetic    162                            G4double logKineticEnergy);
168                                                   163 
169   G4double GetEnergy(const G4ParticleDefinitio << 164   inline G4double GetEnergy(const G4ParticleDefinition* part,
170           G4double range,                         165           G4double range,
171           const G4MaterialCutsCouple* couple);    166           const G4MaterialCutsCouple* couple);
172                                                   167 
173   // G4MaterialCutsCouple should be defined be    168   // G4MaterialCutsCouple should be defined before call to this method
174   inline                                          169   inline 
175   G4double GetTransportMeanFreePath(const G4Pa    170   G4double GetTransportMeanFreePath(const G4ParticleDefinition* part,
176                                     G4double k    171                                     G4double kinEnergy);
177                                                << 
178   inline                                          172   inline
179   G4double GetTransportMeanFreePath(const G4Pa    173   G4double GetTransportMeanFreePath(const G4ParticleDefinition* part,
180                                     G4double k    174                                     G4double kinEnergy,
181                                     G4double l    175                                     G4double logKinEnergy);
182                                                   176 
183   //  hide assignment operator                    177   //  hide assignment operator
184   G4VMscModel & operator=(const  G4VMscModel &    178   G4VMscModel & operator=(const  G4VMscModel &right) = delete;
185   G4VMscModel(const  G4VMscModel&) = delete;      179   G4VMscModel(const  G4VMscModel&) = delete;
186                                                   180 
187 private:                                          181 private:
188                                                   182 
189   G4SafetyHelper* safetyHelper = nullptr;      << 183   G4SafetyHelper* safetyHelper;
190   G4VEnergyLossProcess* ionisation = nullptr;  << 184   G4VEnergyLossProcess* ionisation;
191   const G4ParticleDefinition* currentPart = nu << 185   const G4ParticleDefinition* currentPart;
192                                                << 186 
193   G4double dedx = 0.0;                         << 187   G4double dedx;
194   G4double localtkin = 0.0;                    << 188   G4double localtkin;
195   G4double localrange = DBL_MAX;               << 189   G4double localrange;
196                                                   190 
197 protected:                                        191 protected:
198                                                   192 
199   G4double facrange = 0.04;                    << 193   G4double facrange;
200   G4double facgeom = 2.5;                      << 194   G4double facgeom;
201   G4double facsafety = 0.6;                    << 195   G4double facsafety;
202   G4double skin = 1.0;                         << 196   G4double skin;
203   G4double dtrl = 0.05;                        << 197   G4double dtrl;
204   G4double lambdalimit;                           198   G4double lambdalimit;
205   G4double geomMin;                               199   G4double geomMin;
206   G4double geomMax;                               200   G4double geomMax;
207                                                   201 
208   G4ThreeVector fDisplacement;                 << 202   G4ThreeVector      fDisplacement;
209   G4MscStepLimitType steppingAlgorithm;           203   G4MscStepLimitType steppingAlgorithm;
210                                                   204 
211   G4bool samplez = false;                      << 205   G4bool   samplez;
212   G4bool latDisplasment = true;                << 206   G4bool   latDisplasment;
213                                                << 
214 private:                                       << 
215                                                   207 
216   G4bool useSpline = true;                     << 
217 };                                                208 };
218                                                   209 
219 //....oooOO0OOooo........oooOO0OOooo........oo    210 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
220 //....oooOO0OOooo........oooOO0OOooo........oo    211 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
221                                                   212 
222 inline void G4VMscModel::SetLateralDisplasment    213 inline void G4VMscModel::SetLateralDisplasmentFlag(G4bool val)
223 {                                                 214 {
224   if(!IsLocked()) { latDisplasment = val; }       215   if(!IsLocked()) { latDisplasment = val; }
225 }                                                 216 }
226                                                   217 
227 //....oooOO0OOooo........oooOO0OOooo........oo    218 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
228                                                   219 
229 inline void G4VMscModel::SetSkin(G4double val)    220 inline void G4VMscModel::SetSkin(G4double val)
230 {                                                 221 {
231   if(!IsLocked()) { skin = val; }                 222   if(!IsLocked()) { skin = val; }
232 }                                                 223 }
233                                                   224 
234 //....oooOO0OOooo........oooOO0OOooo........oo    225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
235                                                   226 
236 inline void G4VMscModel::SetRangeFactor(G4doub    227 inline void G4VMscModel::SetRangeFactor(G4double val)
237 {                                                 228 {
238   if(!IsLocked()) { facrange = val; }             229   if(!IsLocked()) { facrange = val; }
239 }                                                 230 }
240                                                   231 
241 //....oooOO0OOooo........oooOO0OOooo........oo    232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
242                                                   233 
243 inline void G4VMscModel::SetGeomFactor(G4doubl    234 inline void G4VMscModel::SetGeomFactor(G4double val)
244 {                                                 235 {
245   if(!IsLocked()) { facgeom = val; }              236   if(!IsLocked()) { facgeom = val; }
246 }                                                 237 }
247                                                   238 
248 //....oooOO0OOooo........oooOO0OOooo........oo    239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
249                                                   240 
250 inline void G4VMscModel::SetLambdaLimit(G4doub    241 inline void G4VMscModel::SetLambdaLimit(G4double val)
251 {                                                 242 {
252   if(!IsLocked()) { lambdalimit = val; }          243   if(!IsLocked()) { lambdalimit = val; }
253 }                                                 244 }
254                                                   245 
255 //....oooOO0OOooo........oooOO0OOooo........oo    246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
256                                                   247 
257 inline void G4VMscModel::SetSafetyFactor(G4dou    248 inline void G4VMscModel::SetSafetyFactor(G4double val)
258 {                                                 249 {
259   if(!IsLocked()) { facsafety = val; }            250   if(!IsLocked()) { facsafety = val; }
260 }                                                 251 }
261                                                   252 
262 //....oooOO0OOooo........oooOO0OOooo........oo    253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
263                                                   254 
264 inline void G4VMscModel::SetStepLimitType(G4Ms    255 inline void G4VMscModel::SetStepLimitType(G4MscStepLimitType val)
265 {                                                 256 {
266   if(!IsLocked()) { steppingAlgorithm = val; }    257   if(!IsLocked()) { steppingAlgorithm = val; }
267 }                                                 258 }
268                                                   259 
269 //....oooOO0OOooo........oooOO0OOooo........oo    260 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
270                                                   261 
271 inline void G4VMscModel::SetSampleZ(G4bool val    262 inline void G4VMscModel::SetSampleZ(G4bool val)
272 {                                                 263 {
273   if(!IsLocked()) { samplez = val; }              264   if(!IsLocked()) { samplez = val; }
274 }                                                 265 }
275                                                   266 
276 //....oooOO0OOooo........oooOO0OOooo........oo    267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
277                                                   268 
278 inline G4double G4VMscModel::ComputeSafety(con    269 inline G4double G4VMscModel::ComputeSafety(const G4ThreeVector& position, 
279              G4double limit)                      270              G4double limit)
280 {                                                 271 {
281    return safetyHelper->ComputeSafety(position    272    return safetyHelper->ComputeSafety(position, limit);
282 }                                                 273 }
283                                                   274 
284 //....oooOO0OOooo........oooOO0OOooo........oo    275 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
285                                                   276 
286 inline G4double G4VMscModel::ConvertTrueToGeom    277 inline G4double G4VMscModel::ConvertTrueToGeom(G4double& tlength, 
287                  G4double& glength)               278                  G4double& glength)
288 {                                                 279 {
289   glength = ComputeGeomPathLength(tlength);       280   glength = ComputeGeomPathLength(tlength);
290   // should return true length                    281   // should return true length 
291   return tlength;                                 282   return tlength;
292 }                                                 283 }
293                                                   284 
294 //....oooOO0OOooo........oooOO0OOooo........oo    285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
295                                                   286 
296 inline G4double G4VMscModel::ComputeGeomLimit(    287 inline G4double G4VMscModel::ComputeGeomLimit(const G4Track& track, 
297                 G4double& presafety,              288                 G4double& presafety, 
298                 G4double limit)                   289                 G4double limit)
299 {                                                 290 {
300   return safetyHelper->CheckNextStep(             291   return safetyHelper->CheckNextStep(
301           track.GetStep()->GetPreStepPoint()->    292           track.GetStep()->GetPreStepPoint()->GetPosition(),
302     track.GetMomentumDirection(),                 293     track.GetMomentumDirection(),
303     limit, presafety);                            294     limit, presafety);
304 }                                                 295 }
305                                                   296 
306 //....oooOO0OOooo........oooOO0OOooo........oo    297 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
307                                                   298 
                                                   >> 299 inline G4double 
                                                   >> 300 G4VMscModel::GetDEDX(const G4ParticleDefinition* part, G4double kinEnergy,
                                                   >> 301                      const G4MaterialCutsCouple* couple)
                                                   >> 302 {
                                                   >> 303   G4double x;
                                                   >> 304   if (ionisation) {
                                                   >> 305     x = ionisation->GetDEDX(kinEnergy, couple);
                                                   >> 306   } else {
                                                   >> 307     const G4double q = part->GetPDGCharge()*inveplus;
                                                   >> 308     x = dedx*q*q;
                                                   >> 309   }
                                                   >> 310   return x;
                                                   >> 311 }
                                                   >> 312 
                                                   >> 313 inline G4double 
                                                   >> 314 G4VMscModel::GetDEDX(const G4ParticleDefinition* part, G4double kinEnergy,
                                                   >> 315                      const G4MaterialCutsCouple* couple, G4double logKinEnergy)
                                                   >> 316 {
                                                   >> 317   G4double x;
                                                   >> 318   if (ionisation) {
                                                   >> 319     x = ionisation->GetDEDX(kinEnergy, couple, logKinEnergy);
                                                   >> 320   } else {
                                                   >> 321     const G4double q = part->GetPDGCharge()*inveplus;
                                                   >> 322     x = dedx*q*q;
                                                   >> 323   }
                                                   >> 324   return x;
                                                   >> 325 }
                                                   >> 326 
                                                   >> 327 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 328 
                                                   >> 329 inline G4double 
                                                   >> 330 G4VMscModel::GetRange(const G4ParticleDefinition* part,G4double kinEnergy,
                                                   >> 331                       const G4MaterialCutsCouple* couple)
                                                   >> 332 {
                                                   >> 333   //G4cout << "G4VMscModel::GetRange E(MeV)= " << kinEnergy << "  " 
                                                   >> 334   //  << ionisation << "  " << part->GetParticleName()
                                                   >> 335   //  << G4endl;
                                                   >> 336   localtkin  = kinEnergy;
                                                   >> 337   if (ionisation) {
                                                   >> 338     localrange = ionisation->GetRangeForLoss(kinEnergy, couple); 
                                                   >> 339   } else {
                                                   >> 340     const G4double q = part->GetPDGCharge()*inveplus;
                                                   >> 341     localrange = kinEnergy/(dedx*q*q*couple->GetMaterial()->GetDensity()); 
                                                   >> 342   }
                                                   >> 343   //G4cout << "R(mm)= " << localrange << "  "  << ionisation << G4endl;
                                                   >> 344   return localrange;
                                                   >> 345 }
                                                   >> 346 
                                                   >> 347 inline G4double 
                                                   >> 348 G4VMscModel::GetRange(const G4ParticleDefinition* part,G4double kinEnergy, 
                                                   >> 349                       const G4MaterialCutsCouple* couple, G4double logKinEnergy)
                                                   >> 350 {
                                                   >> 351   //G4cout << "G4VMscModel::GetRange E(MeV)= " << kinEnergy << "  " 
                                                   >> 352   //  << ionisation << "  " << part->GetParticleName()
                                                   >> 353   //  << G4endl;
                                                   >> 354   localtkin  = kinEnergy;
                                                   >> 355   if (ionisation) { 
                                                   >> 356     localrange = ionisation->GetRangeForLoss(kinEnergy, couple, logKinEnergy);
                                                   >> 357   } else { 
                                                   >> 358     const G4double q = part->GetPDGCharge()*inveplus;
                                                   >> 359     localrange = kinEnergy/(dedx*q*q*couple->GetMaterial()->GetDensity());
                                                   >> 360   }
                                                   >> 361   //G4cout << "R(mm)= " << localrange << "  "  << ionisation << G4endl;
                                                   >> 362   return localrange;
                                                   >> 363 }
                                                   >> 364 
                                                   >> 365 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 366 
                                                   >> 367 inline G4double 
                                                   >> 368 G4VMscModel::GetEnergy(const G4ParticleDefinition* part,
                                                   >> 369            G4double range, const G4MaterialCutsCouple* couple)
                                                   >> 370 {
                                                   >> 371   G4double e;
                                                   >> 372   //G4cout << "G4VMscModel::GetEnergy R(mm)= " << range << "  " << ionisation
                                                   >> 373   //   << "  Rlocal(mm)= " << localrange << "  Elocal(MeV)= " << localtkin
                                                   >> 374   //   << G4endl;
                                                   >> 375   if(ionisation) { e = ionisation->GetKineticEnergy(range, couple); }
                                                   >> 376   else { 
                                                   >> 377     e = localtkin;
                                                   >> 378     if(localrange > range) {
                                                   >> 379       G4double q = part->GetPDGCharge()*inveplus;
                                                   >> 380       e -= (localrange - range)*dedx*q*q*couple->GetMaterial()->GetDensity(); 
                                                   >> 381     } 
                                                   >> 382   }
                                                   >> 383   return e;
                                                   >> 384 }
                                                   >> 385 
                                                   >> 386 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 387 
308 inline G4VEnergyLossProcess* G4VMscModel::GetI    388 inline G4VEnergyLossProcess* G4VMscModel::GetIonisation() const
309 {                                                 389 {
310   return ionisation;                              390   return ionisation;
311 }                                                 391 }
312                                                   392 
313 //....oooOO0OOooo........oooOO0OOooo........oo    393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
314                                                   394 
315 inline void G4VMscModel::SetIonisation(G4VEner    395 inline void G4VMscModel::SetIonisation(G4VEnergyLossProcess* p,
316                const G4ParticleDefinition* par    396                const G4ParticleDefinition* part)
317 {                                                 397 {
318   ionisation = p;                                 398   ionisation = p;
319   currentPart = part;                             399   currentPart = part;
320 }                                                 400 }
321                                                   401 
322 //....oooOO0OOooo........oooOO0OOooo........oo    402 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
323                                                   403 
324 inline G4double                                   404 inline G4double 
325 G4VMscModel::GetTransportMeanFreePath(const G4    405 G4VMscModel::GetTransportMeanFreePath(const G4ParticleDefinition* part,
326                                       G4double    406                                       G4double ekin)
327 {                                                 407 {
328   G4double x;                                     408   G4double x;
329   if (nullptr != xSectionTable) {              << 409   if (xSectionTable) {
330     x = pFactor*(*xSectionTable)[basedCoupleIn << 410     const G4int idx = CurrentCouple()->GetIndex();
                                                   >> 411     x =  (*xSectionTable)[idx]->Value(ekin, idxTable)/(ekin*ekin);
331   } else {                                        412   } else { 
332     x = pFactor*CrossSectionPerVolume(pBaseMat << 413     x = CrossSectionPerVolume(CurrentCouple()->GetMaterial(), part, ekin, 
                                                   >> 414                               0.0, DBL_MAX); 
333   }                                               415   }
334   return (x > 0.0) ? 1.0/x : DBL_MAX;             416   return (x > 0.0) ? 1.0/x : DBL_MAX;
335 }                                                 417 }
336                                                   418 
337 //....oooOO0OOooo........oooOO0OOooo........oo << 
338                                                << 
339 inline G4double                                   419 inline G4double 
340 G4VMscModel::GetTransportMeanFreePath(const G4    420 G4VMscModel::GetTransportMeanFreePath(const G4ParticleDefinition* part,
341                                       G4double    421                                       G4double ekin, G4double logekin)
342 {                                                 422 {
343   G4double x;                                     423   G4double x;
344   if (nullptr != xSectionTable) {              << 424   if (xSectionTable) {
345     x = pFactor*(*xSectionTable)[basedCoupleIn << 425     const G4int idx = CurrentCouple()->GetIndex();
                                                   >> 426     x =  (*xSectionTable)[idx]->LogVectorValue(ekin, logekin)/(ekin*ekin);
346   } else {                                        427   } else { 
347     x = pFactor*CrossSectionPerVolume(pBaseMat << 428     x = CrossSectionPerVolume(CurrentCouple()->GetMaterial(), part, ekin, 
                                                   >> 429                               0.0, DBL_MAX); 
348   }                                               430   }
349   return (x > 0.0) ? 1.0/x : DBL_MAX;             431   return (x > 0.0) ? 1.0/x : DBL_MAX;
350 }                                                 432 }
351                                                   433 
352 //....oooOO0OOooo........oooOO0OOooo........oo    434 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
353                                                   435 
354 inline void G4VMscModel::SetUseSplineForMSC(G4 << 
355 {                                              << 
356   useSpline = val;                             << 
357 }                                              << 
358                                                << 
359 //....oooOO0OOooo........oooOO0OOooo........oo << 
360                                                << 
361 #endif                                            436 #endif
                                                   >> 437 
362                                                   438