Geant4 Cross Reference

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


  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: G4VEnergyLossProcess.hh,v 1.83 2008/09/12 16:19:01 vnivanch Exp $
                                                   >>  27 // GEANT4 tag $Name:
 26 //                                                 28 //
 27 // -------------------------------------------     29 // -------------------------------------------------------------------
 28 //                                                 30 //
 29 // GEANT4 Class header file                        31 // GEANT4 Class header file
 30 //                                                 32 //
 31 //                                                 33 //
 32 // File name:     G4VEnergyLossProcess             34 // File name:     G4VEnergyLossProcess
 33 //                                                 35 //
 34 // Author:        Vladimir Ivanchenko on base      36 // Author:        Vladimir Ivanchenko on base of Laszlo Urban code
 35 //                                                 37 //
 36 // Creation date: 03.01.2002                       38 // Creation date: 03.01.2002
 37 //                                                 39 //
 38 // Modifications: Vladimir Ivanchenko          <<  40 // Modifications:
                                                   >>  41 //
                                                   >>  42 // 26-12-02 Secondary production moved to derived classes (V.Ivanchenko)
                                                   >>  43 // 20-01-03 Migrade to cut per region (V.Ivanchenko)
                                                   >>  44 // 24-01-03 Make models region aware (V.Ivanchenko)
                                                   >>  45 // 05-02-03 Fix compilation warnings (V.Ivanchenko)
                                                   >>  46 // 13-02-03 SubCutoffProcessors defined for regions (V.Ivanchenko)
                                                   >>  47 // 17-02-03 Fix problem of store/restore tables (V.Ivanchenko)
                                                   >>  48 // 26-02-03 Region dependent step limit (V.Ivanchenko)
                                                   >>  49 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenko)
                                                   >>  50 // 09-04-03 Fix problem of negative range limit for non integral (V.Ivanchenko)
                                                   >>  51 // 13-05-03 Add calculation of precise range (V.Ivanchenko)
                                                   >>  52 // 21-07-03 Add UpdateEmModel method (V.Ivanchenko)
                                                   >>  53 // 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
                                                   >>  54 // 14-01-04 Activate precise range calculation (V.Ivanchenko)
                                                   >>  55 // 10-03-04 Fix problem of step limit calculation (V.Ivanchenko)
                                                   >>  56 // 30-06-04 make destructor virtual (V.Ivanchenko)
                                                   >>  57 // 05-07-04 fix problem of GenericIons seen at small cuts (V.Ivanchenko)
                                                   >>  58 // 03-08-04 Add DEDX table to all processes for control on integral range(VI)
                                                   >>  59 // 06-08-04 Clear up names of member functions (V.Ivanchenko)
                                                   >>  60 // 27-08-04 Add NeedBuildTables method (V.Ivanchneko)
                                                   >>  61 // 09-09-04 Bug fix for the integral mode with 2 peaks (V.Ivanchneko)
                                                   >>  62 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
                                                   >>  63 // 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
                                                   >>  64 // 11-04-05 Use MaxSecondaryEnergy from a model (V.Ivanchenko)
                                                   >>  65 // 10-01-05 Remove SetStepLimits (V.Ivanchenko)
                                                   >>  66 // 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
                                                   >>  67 // 13-01-06 Remove AddSubCutSecondaries and cleanup (V.Ivantchenko)
                                                   >>  68 // 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
                                                   >>  69 // 26-01-06 Add public method GetCSDARange (V.Ivanchenko)
                                                   >>  70 // 22-03-06 Add SetDynamicMassCharge (V.Ivanchenko)
                                                   >>  71 // 23-03-06 Use isIonisation flag (V.Ivanchenko)
                                                   >>  72 // 13-05-06 Add method to access model by index (V.Ivanchenko)
                                                   >>  73 // 14-01-07 add SetEmModel(index) and SetFluctModel() (mma)
                                                   >>  74 // 15-01-07 Add separate ionisation tables and reorganise get/set methods for
                                                   >>  75 //          dedx tables (V.Ivanchenko)
                                                   >>  76 // 13-03-07 use SafetyHelper instead of navigator (V.Ivanchenko)
                                                   >>  77 // 27-07-07 use stl vector for emModels instead of C-array (V.Ivanchenko)
                                                   >>  78 // 25-09-07 More accurate handling zero xsect in 
                                                   >>  79 //          PostStepGetPhysicalInteractionLength (V.Ivanchenko)
                                                   >>  80 // 27-10-07 Virtual functions moved to source (V.Ivanchenko)
                                                   >>  81 // 15-07-08 Reorder class members for further multi-thread development (VI)
 39 //                                                 82 //
 40 // Class Description:                              83 // Class Description:
 41 //                                                 84 //
 42 // It is the unified energy loss process it ca     85 // It is the unified energy loss process it calculates the continuous
 43 // energy loss for charged particles using a s     86 // energy loss for charged particles using a set of Energy Loss
 44 // models valid for different energy regions.      87 // models valid for different energy regions. There are a possibility
 45 // to create and access to dE/dx and range tab     88 // to create and access to dE/dx and range tables, or to calculate
 46 // that information on fly.                        89 // that information on fly.
 47                                                    90 
 48 // -------------------------------------------     91 // -------------------------------------------------------------------
 49 //                                                 92 //
 50                                                    93 
 51 #ifndef G4VEnergyLossProcess_h                     94 #ifndef G4VEnergyLossProcess_h
 52 #define G4VEnergyLossProcess_h 1                   95 #define G4VEnergyLossProcess_h 1
 53                                                    96 
 54 #include "G4VContinuousDiscreteProcess.hh"         97 #include "G4VContinuousDiscreteProcess.hh"
 55 #include "globals.hh"                              98 #include "globals.hh"
 56 #include "G4Material.hh"                           99 #include "G4Material.hh"
 57 #include "G4MaterialCutsCouple.hh"                100 #include "G4MaterialCutsCouple.hh"
 58 #include "G4Track.hh"                             101 #include "G4Track.hh"
 59 #include "G4EmModelManager.hh"                    102 #include "G4EmModelManager.hh"
                                                   >> 103 #include "G4UnitsTable.hh"
 60 #include "G4ParticleChangeForLoss.hh"             104 #include "G4ParticleChangeForLoss.hh"
 61 #include "G4EmTableType.hh"                       105 #include "G4EmTableType.hh"
 62 #include "G4EmSecondaryParticleType.hh"        << 
 63 #include "G4PhysicsTable.hh"                      106 #include "G4PhysicsTable.hh"
 64 #include "G4PhysicsVector.hh"                     107 #include "G4PhysicsVector.hh"
 65                                                   108 
 66 class G4Step;                                     109 class G4Step;
 67 class G4ParticleDefinition;                       110 class G4ParticleDefinition;
 68 class G4EmParameters;                          << 
 69 class G4VEmModel;                                 111 class G4VEmModel;
 70 class G4VEmFluctuationModel;                      112 class G4VEmFluctuationModel;
 71 class G4DataVector;                               113 class G4DataVector;
 72 class G4Region;                                   114 class G4Region;
 73 class G4SafetyHelper;                             115 class G4SafetyHelper;
 74 class G4VAtomDeexcitation;                     << 
 75 class G4VSubCutProducer;                       << 
 76 class G4EmBiasingManager;                      << 
 77 class G4LossTableManager;                      << 
 78 class G4EmDataHandler;                         << 
 79                                                   116 
 80 //....oooOO0OOooo........oooOO0OOooo........oo    117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 81                                                   118 
 82 class G4VEnergyLossProcess : public G4VContinu    119 class G4VEnergyLossProcess : public G4VContinuousDiscreteProcess
 83 {                                                 120 {
 84 public:                                           121 public:
 85                                                   122 
 86   G4VEnergyLossProcess(const G4String& name =     123   G4VEnergyLossProcess(const G4String& name = "EnergyLoss",
 87                        G4ProcessType type = fE << 124            G4ProcessType type = fElectromagnetic);
 88                                                   125 
 89   ~G4VEnergyLossProcess() override;            << 126   virtual ~G4VEnergyLossProcess();
 90                                                   127 
 91   //------------------------------------------    128   //------------------------------------------------------------------------
 92   // Virtual methods to be implemented in conc    129   // Virtual methods to be implemented in concrete processes
 93   //------------------------------------------    130   //------------------------------------------------------------------------
 94                                                   131 
 95 protected:                                     << 132   virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
                                                   >> 133   
                                                   >> 134   virtual void PrintInfo() = 0;
 96                                                   135 
 97   // description of specific process parameter << 136 protected:
 98   virtual void StreamProcessInfo(std::ostream& << 
 99                                                   137 
100   virtual void InitialiseEnergyLossProcess(con    138   virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
101                                            con    139                                            const G4ParticleDefinition*) = 0;
102                                                   140 
103 public:                                        << 141   //------------------------------------------------------------------------
                                                   >> 142   // Methods with standard implementation; may be overwritten if needed 
                                                   >> 143   //------------------------------------------------------------------------
                                                   >> 144 
                                                   >> 145 protected:
104                                                   146 
105   // used as low energy limit LambdaTable      << 
106   virtual G4double MinPrimaryEnergy(const G4Pa    147   virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
107                                     const G4Ma << 148             const G4Material*, G4double cut);
108                                                   149 
109   // print documentation in html format        << 150   //------------------------------------------------------------------------
110   void ProcessDescription(std::ostream& outFil << 151   // Virtual methods common to all EM ContinuousDiscrete processes
                                                   >> 152   // Further inheritance is not assumed 
                                                   >> 153   //------------------------------------------------------------------------
111                                                   154 
112   // prepare all tables                        << 155 public:
113   void PreparePhysicsTable(const G4ParticleDef << 
114                                                   156 
115   // build all tables                          << 157   void PrintInfoDefinition();
116   void BuildPhysicsTable(const G4ParticleDefin << 
117                                                   158 
118   // build a table                             << 159   void PreparePhysicsTable(const G4ParticleDefinition&);
119   G4PhysicsTable* BuildDEDXTable(G4EmTableType << 
120                                                   160 
121   // build a table                             << 161   void BuildPhysicsTable(const G4ParticleDefinition&);
122   G4PhysicsTable* BuildLambdaTable(G4EmTableTy << 
123                                                   162 
124   // Called before tracking of each new G4Trac << 163   G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
125   void StartTracking(G4Track*) override;       << 164              G4double  previousStepSize,
                                                   >> 165              G4double  currentMinimumStep,
                                                   >> 166              G4double& currentSafety,
                                                   >> 167              G4GPILSelection* selection);
126                                                   168 
127   // Step limit from AlongStep                 << 169   G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
128   G4double AlongStepGetPhysicalInteractionLeng << 170             G4double   previousStepSize,
129                                   const G4Trac << 171             G4ForceCondition* condition);
130                                   G4double  pr << 
131                                   G4double  cu << 
132                                   G4double& cu << 
133                                   G4GPILSelect << 
134                                                << 
135   // Step limit from cross section             << 
136   G4double PostStepGetPhysicalInteractionLengt << 
137                                   const G4Trac << 
138                                   G4double pre << 
139                                   G4ForceCondi << 
140                                                   172 
141   // AlongStep computations                    << 173   G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
142   G4VParticleChange* AlongStepDoIt(const G4Tra << 
143                                                   174 
144   // PostStep sampling of secondaries          << 175   G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
145   G4VParticleChange* PostStepDoIt(const G4Trac << 
146                                                   176 
147   // Store all PhysicsTable in files.          << 177   // Store PhysicsTable in a file.
148   // Return false in case of any fatal failure << 178   // Return false in case of failure at I/O
149   G4bool StorePhysicsTable(const G4ParticleDef    179   G4bool StorePhysicsTable(const G4ParticleDefinition*,
150                            const G4String& dir    180                            const G4String& directory,
151                            G4bool ascii = fals << 181          G4bool ascii = false);
152                                                   182 
153   // Retrieve all Physics from a files.        << 183   // Retrieve Physics from a file.
154   // Return true if all the Physics Table are  << 184   // (return true if the Physics Table can be build by using file)
155   // Return false if any fatal failure.        << 185   // (return false if the process has no functionality or in case of failure)
                                                   >> 186   // File name should is constructed as processName+particleName and the
                                                   >> 187   // should be placed under the directory specifed by the argument.
156   G4bool RetrievePhysicsTable(const G4Particle    188   G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
157                               const G4String&     189                               const G4String& directory,
158                               G4bool ascii) ov << 190             G4bool ascii);
159                                                   191 
160 private:                                       << 192 protected:
161                                                   193 
162   // summary printout after initialisation     << 194   G4double GetMeanFreePath(const G4Track& track,
163   void StreamInfo(std::ostream& out, const G4P << 195          G4double previousStepSize,
164                   G4bool rst=false) const;     << 196          G4ForceCondition* condition);
                                                   >> 197 
                                                   >> 198   G4double GetContinuousStepLimit(const G4Track& track,
                                                   >> 199           G4double previousStepSize,
                                                   >> 200           G4double currentMinimumStep,
                                                   >> 201           G4double& currentSafety);
165                                                   202 
166   //------------------------------------------    203   //------------------------------------------------------------------------
167   // Public interface to cross section, mfp an << 204   // Specific methods for along/post step EM processes 
168   // These methods are not used in run time    << 
169   //------------------------------------------    205   //------------------------------------------------------------------------
170                                                   206 
171 public:                                           207 public:
172                                                   208 
173   // access to dispersion of restricted energy << 209   void AddCollaborativeProcess(G4VEnergyLossProcess*);
                                                   >> 210 
                                                   >> 211   void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&, 
                                                   >> 212                                G4VEmModel* model, G4int matIdx,
                                                   >> 213              G4double& extraEdep); 
                                                   >> 214 
174   G4double GetDEDXDispersion(const G4MaterialC    215   G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
175                              const G4DynamicPa << 216            const G4DynamicParticle* dp,
176                              G4double length); << 217            G4double length);
177                                                   218 
178   // Access to cross section table             << 219   //------------------------------------------------------------------------
179   G4double CrossSectionPerVolume(G4double kine << 220   // Specific methods to build and access Physics Tables
180                                  const G4Mater << 221   //------------------------------------------------------------------------
181   G4double CrossSectionPerVolume(G4double kine << 
182                                  const G4Mater << 
183                                  G4double logK << 
184                                                   222 
185   // access to cross section                   << 223   G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
186   G4double MeanFreePath(const G4Track& track); << 
187                                                   224 
188   // access to step limit                      << 225   G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
189   G4double ContinuousStepLimit(const G4Track&  << 
190                                G4double previo << 
191                                G4double curren << 
192                                G4double& curre << 
193                                                   226 
194 protected:                                     << 227   void SetDEDXTable(G4PhysicsTable* p, G4EmTableType tType);
                                                   >> 228   void SetCSDARangeTable(G4PhysicsTable* pRange);
                                                   >> 229   void SetRangeTableForLoss(G4PhysicsTable* p);
                                                   >> 230   void SetInverseRangeTable(G4PhysicsTable* p);
                                                   >> 231   void SetSecondaryRangeTable(G4PhysicsTable* p);
195                                                   232 
196   // implementation of the pure virtual method << 233   void SetLambdaTable(G4PhysicsTable* p);
197   G4double GetMeanFreePath(const G4Track& trac << 234   void SetSubLambdaTable(G4PhysicsTable* p);
198                            G4double previousSt << 
199                            G4ForceCondition* c << 
200                                                   235 
201   // implementation of the pure virtual method << 236   // Binning for dEdx, range, inverse range and labda tables
202   G4double GetContinuousStepLimit(const G4Trac << 237   inline void SetDEDXBinning(G4int nbins);
203                                   G4double pre << 238   inline void SetLambdaBinning(G4int nbins);
204                                   G4double cur << 
205                                   G4double& cu << 
206                                                   239 
207   // creation of an empty vector for cross sec << 240   // Binning for dEdx, range, and inverse range tables
208   G4PhysicsVector* LambdaPhysicsVector(const G << 241   inline void SetDEDXBinningForCSDARange(G4int nbins);
209                                        G4doubl << 
210                                                   242 
211   inline std::size_t CurrentMaterialCutsCouple << 243   // Min kinetic energy for tables
                                                   >> 244   inline void SetMinKinEnergy(G4double e);
                                                   >> 245   inline G4double MinKinEnergy() const;
212                                                   246 
213   //------------------------------------------ << 247   // Max kinetic energy for tables
214   // Specific methods to set, access, modify m << 248   inline void SetMaxKinEnergy(G4double e);
215   //------------------------------------------ << 249   inline G4double MaxKinEnergy() const;
216                                                   250 
217   // Select model in run time                  << 251   // Max kinetic energy for tables
218   inline void SelectModel(G4double kinEnergy); << 252   inline void SetMaxKinEnergyForCSDARange(G4double e);
219                                                   253 
220 public:                                        << 254   // Access to specific tables
221   // Select model by energy and couple index   << 255   inline G4PhysicsTable* DEDXTable() const;
222   // Not for run time processing               << 256   inline G4PhysicsTable* DEDXTableForSubsec() const;
223   inline G4VEmModel* SelectModelForMaterial(G4 << 257   inline G4PhysicsTable* DEDXunRestrictedTable() const;
224                                             st << 258   inline G4PhysicsTable* IonisationTable() const;
225                                                << 259   inline G4PhysicsTable* IonisationTableForSubsec() const;
226   // Add EM model coupled with fluctuation mod << 260   inline G4PhysicsTable* CSDARangeTable() const;
227   // of order defines which pair of models wil << 261   inline G4PhysicsTable* RangeTableForLoss() const;
228   // energy interval                           << 262   inline G4PhysicsTable* InverseRangeTable() const;
229   void AddEmModel(G4int, G4VEmModel*,          << 263   inline G4PhysicsTable* LambdaTable();
230                   G4VEmFluctuationModel* fluc  << 264   inline G4PhysicsTable* SubLambdaTable();
231                   const G4Region* region = nul << 
232                                                << 
233   // Assign a model to a process local list, t << 
234   // the derived process should execute AddEmM << 
235   void SetEmModel(G4VEmModel*, G4int index=0); << 
236                                                   265 
237   // Access to models                          << 266   // Return values for given G4MaterialCutsCouple
238   inline std::size_t NumberOfModels() const;   << 267   inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);
239                                                << 268   inline G4double GetDEDXForSubsec(G4double& kineticEnergy, 
240   // Return a model from the local list        << 269            const G4MaterialCutsCouple*);
241   inline G4VEmModel* EmModel(std::size_t index << 270   inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
242                                                << 271   inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
243   // Access to models from G4EmModelManager li << 272   inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);
244   inline G4VEmModel* GetModelByIndex(std::size << 273   inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);
                                                   >> 274   inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);
                                                   >> 275 
                                                   >> 276   inline G4bool TablesAreBuilt() const;
245                                                   277 
246   // Assign a fluctuation model to a process   << 
247   inline void SetFluctModel(G4VEmFluctuationMo << 
248                                                << 
249   // Return the assigned fluctuation model     << 
250   inline G4VEmFluctuationModel* FluctModel() c << 
251                                                << 
252   //------------------------------------------    278   //------------------------------------------------------------------------
253   // Define and access particle type              279   // Define and access particle type 
254   //------------------------------------------    280   //------------------------------------------------------------------------
255                                                   281 
256 protected:                                     << 
257   inline void SetParticle(const G4ParticleDefi << 
258   inline void SetSecondaryParticle(const G4Par << 
259                                                << 
260 public:                                        << 
261   inline void SetBaseParticle(const G4Particle    282   inline void SetBaseParticle(const G4ParticleDefinition* p);
262   inline const G4ParticleDefinition* Particle(    283   inline const G4ParticleDefinition* Particle() const;
263   inline const G4ParticleDefinition* BaseParti    284   inline const G4ParticleDefinition* BaseParticle() const;
264   inline const G4ParticleDefinition* Secondary    285   inline const G4ParticleDefinition* SecondaryParticle() const;
265                                                   286 
266   // hide  assignment operator                 << 
267   G4VEnergyLossProcess(G4VEnergyLossProcess &) << 
268   G4VEnergyLossProcess & operator=(const G4VEn << 
269                                                << 
270   //------------------------------------------    287   //------------------------------------------------------------------------
271   // Get/set parameters to configure the proce << 288   // Specific methods to set, access, modify models
272   //------------------------------------------    289   //------------------------------------------------------------------------
273                                                   290 
274   // Add subcut processor for the region       << 291   // Add EM model coupled with fluctuation model for the region
275   void ActivateSubCutoff(const G4Region* regio << 292   inline void AddEmModel(G4int, G4VEmModel*, 
                                                   >> 293        G4VEmFluctuationModel* fluc = 0,
                                                   >> 294        const G4Region* region = 0);
                                                   >> 295 
                                                   >> 296   // Assign a model to a process
                                                   >> 297   inline void SetEmModel(G4VEmModel*, G4int index=1);
                                                   >> 298   
                                                   >> 299   // return the assigned model
                                                   >> 300   inline G4VEmModel* EmModel(G4int index=1);
                                                   >> 301   
                                                   >> 302   // Assign a fluctuation model to a process
                                                   >> 303   inline void SetFluctModel(G4VEmFluctuationModel*);
                                                   >> 304   
                                                   >> 305   // return the assigned fluctuation model
                                                   >> 306   inline G4VEmFluctuationModel* FluctModel();
                                                   >> 307     
                                                   >> 308   // Define new energy range for the model identified by the name
                                                   >> 309   inline void UpdateEmModel(const G4String&, G4double, G4double);
276                                                   310 
277   // Activate biasing                          << 311   // Access to models
278   void SetCrossSectionBiasingFactor(G4double f << 312   inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
279                                                   313 
280   void ActivateForcedInteraction(G4double leng << 314   inline G4int NumberOfModels();
281                                  const G4Strin << 
282                                  G4bool flag = << 
283                                                   315 
284   void ActivateSecondaryBiasing(const G4String << 316   //------------------------------------------------------------------------
285                                 G4double energ << 317   // Get/set parameters used for simulation of energy loss
                                                   >> 318   //------------------------------------------------------------------------
286                                                   319 
287   inline void SetLossFluctuations(G4bool val);    320   inline void SetLossFluctuations(G4bool val);
288                                                << 321   inline void SetRandomStep(G4bool val);
289   inline void SetSpline(G4bool val);           << 322   inline void SetIntegral(G4bool val);
290   inline void SetCrossSectionType(G4CrossSecti << 323   inline G4bool IsIntegral() const;
291   inline G4CrossSectionType CrossSectionType() << 
292                                                   324 
293   // Set/Get flag "isIonisation"                  325   // Set/Get flag "isIonisation"
294   void SetIonisation(G4bool val);              << 326   inline void SetIonisation(G4bool val);
295   inline G4bool IsIonisationProcess() const;      327   inline G4bool IsIonisationProcess() const;
296                                                   328 
297   // Redefine parameteters for stepping contro    329   // Redefine parameteters for stepping control
298   void SetLinearLossLimit(G4double val);       << 330   //
299   void SetStepFunction(G4double v1, G4double v << 331   inline void SetLinearLossLimit(G4double val);
300   void SetLowestEnergyLimit(G4double);         << 332   inline void SetMinSubRange(G4double val);
                                                   >> 333   inline void SetStepFunction(G4double v1, G4double v2);
                                                   >> 334   inline void SetLambdaFactor(G4double val);
                                                   >> 335 
                                                   >> 336 
                                                   >> 337   // Add subcutoff option for the region
                                                   >> 338   void ActivateSubCutoff(G4bool val, const G4Region* region = 0);
301                                                   339 
302   inline G4int NumberOfSubCutoffRegions() cons    340   inline G4int NumberOfSubCutoffRegions() const;
303                                                   341 
                                                   >> 342   // Activate deexcitation code
                                                   >> 343   virtual void ActivateDeexcitation(G4bool, const G4Region* region = 0);
                                                   >> 344 
304   //------------------------------------------    345   //------------------------------------------------------------------------
305   // Specific methods to path Physics Tables t << 346   // Public interface to helper functions 
306   //------------------------------------------    347   //------------------------------------------------------------------------
307                                                   348 
308   void SetDEDXTable(G4PhysicsTable* p, G4EmTab << 349   inline 
309   void SetCSDARangeTable(G4PhysicsTable* pRang << 350   G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idx) const;
310   void SetRangeTableForLoss(G4PhysicsTable* p) << 
311   void SetInverseRangeTable(G4PhysicsTable* p) << 
312   void SetLambdaTable(G4PhysicsTable* p);      << 
313                                                   351 
314   void SetTwoPeaksXS(std::vector<G4TwoPeaksXS* << 352   inline G4double MeanFreePath(const G4Track& track);
315   void SetEnergyOfCrossSectionMax(std::vector< << 353 
                                                   >> 354   inline G4double ContinuousStepLimit(const G4Track& track,
                                                   >> 355               G4double previousStepSize,
                                                   >> 356               G4double currentMinimumStep,
                                                   >> 357               G4double& currentSafety);
316                                                   358 
317   //------------------------------------------    359   //------------------------------------------------------------------------
318   // Specific methods to define custom Physics << 360   // Run time method for simulation of ionisation
319   //------------------------------------------    361   //------------------------------------------------------------------------
320                                                   362 
321   // Binning for dEdx, range, inverse range an << 363   // sample range at the end of a step
322   void SetDEDXBinning(G4int nbins);            << 364   inline G4double SampleRange();
323                                                   365 
324   // Min kinetic energy for tables             << 366   // Set scaling parameters for ions is needed to G4EmCalculator
325   void SetMinKinEnergy(G4double e);            << 367   inline void SetDynamicMassCharge(G4double massratio, G4double charge2ratio);
326   inline G4double MinKinEnergy() const;        << 
327                                                   368 
328   // Max kinetic energy for tables             << 369   // Access to cross section table
329   void SetMaxKinEnergy(G4double e);            << 370   G4double CrossSectionPerVolume(G4double kineticEnergy,
330   inline G4double MaxKinEnergy() const;        << 371          const G4MaterialCutsCouple* couple);
331                                                   372 
332   // Biasing parameters                        << 373 protected:
333   inline G4double CrossSectionBiasingFactor()  << 
334                                                   374 
335   // Return values for given G4MaterialCutsCou << 375   G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, 
336   inline G4double GetDEDX(G4double kineticEner << 376                G4double cut);
337   inline G4double GetCSDADEDX(G4double kinetic << 
338                               const G4Material << 
339   inline G4double GetDEDX(G4double kineticEner << 
340                           G4double logKineticE << 
341   inline G4double GetRange(G4double kineticEne << 
342   inline G4double GetRange(G4double kineticEne << 
343                            G4double logKinetic << 
344   inline G4double GetCSDARange(G4double kineti << 
345                                const G4Materia << 
346   inline G4double GetKineticEnergy(G4double ra << 
347                                    const G4Mat << 
348   inline G4double GetLambda(G4double kineticEn << 
349   inline G4double GetLambda(G4double kineticEn << 
350                             G4double logKineti << 
351                                                   377 
352   inline G4bool TablesAreBuilt() const;        << 378   inline G4ParticleChangeForLoss* GetParticleChange();
353                                                   379 
354   // Access to specific tables                 << 380   inline void SetParticle(const G4ParticleDefinition* p);
355   inline G4PhysicsTable* DEDXTable() const;    << 
356   inline G4PhysicsTable* DEDXunRestrictedTable << 
357   inline G4PhysicsTable* IonisationTable() con << 
358   inline G4PhysicsTable* CSDARangeTable() cons << 
359   inline G4PhysicsTable* RangeTableForLoss() c << 
360   inline G4PhysicsTable* InverseRangeTable() c << 
361   inline G4PhysicsTable* LambdaTable() const;  << 
362   inline std::vector<G4TwoPeaksXS*>* TwoPeaksX << 
363   inline std::vector<G4double>* EnergyOfCrossS << 
364                                                   381 
365   inline G4bool UseBaseMaterial() const;       << 382   inline void SetSecondaryParticle(const G4ParticleDefinition* p);
366                                                   383 
367   //------------------------------------------ << 384   inline void SelectModel(G4double kinEnergy);
368   // Run time method for simulation of ionisat << 
369   //------------------------------------------ << 
370                                                   385 
371   // access atom on which interaction happens  << 386   inline size_t CurrentMaterialCutsCoupleIndex() const;
372   const G4Element* GetCurrentElement() const;  << 
373                                                   387 
374   // Set scaling parameters for ions is needed << 388   inline G4double GetCurrentRange() const;
375   void SetDynamicMassCharge(G4double massratio << 
376                                                   389 
377 private:                                          390 private:
378                                                   391 
379   void FillSecondariesAlongStep(G4double weigh << 392   //------------------------------------------------------------------------
                                                   >> 393   // Management of tables
                                                   >> 394   //------------------------------------------------------------------------
                                                   >> 395 
                                                   >> 396   void Clear();
380                                                   397 
381   void PrintWarning(const G4String&, G4double  << 398   G4bool StoreTable(const G4ParticleDefinition* p, 
                                                   >> 399         G4PhysicsTable*, G4bool ascii,
                                                   >> 400         const G4String& directory, 
                                                   >> 401         const G4String& tname);
                                                   >> 402 
                                                   >> 403   G4bool RetrieveTable(const G4ParticleDefinition* p, 
                                                   >> 404            G4PhysicsTable*, G4bool ascii,
                                                   >> 405            const G4String& directory, 
                                                   >> 406            const G4String& tname, 
                                                   >> 407            G4bool mandatory);
382                                                   408 
383   // define material and indexes                  409   // define material and indexes
384   inline void DefineMaterial(const G4MaterialC    410   inline void DefineMaterial(const G4MaterialCutsCouple* couple);
385                                                   411 
386   //------------------------------------------ << 412   // Returnd values for scaled energy using mass of the base particle
387   // Compute values using scaling relation, ma << 413   //
388   //------------------------------------------ << 414   inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy);
389   inline G4double GetDEDXForScaledEnergy(G4dou << 415   inline G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy);
390   inline G4double GetDEDXForScaledEnergy(G4dou << 416   inline G4double GetIonisationForScaledEnergy(G4double scaledKinEnergy);
391                                          G4dou << 417   inline G4double GetSubIonisationForScaledEnergy(G4double scaledKinEnergy);
392   inline G4double GetIonisationForScaledEnergy << 418   inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy);
393   inline G4double GetScaledRangeForScaledEnerg << 419   inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy);
394   inline G4double GetScaledRangeForScaledEnerg << 420   inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
395                                                << 
396                                                << 
397   inline G4double GetLimitScaledRangeForScaled << 
398   inline G4double GetLimitScaledRangeForScaled << 
399                                                << 
400                                                << 
401   inline G4double ScaledKinEnergyForLoss(G4dou    421   inline G4double ScaledKinEnergyForLoss(G4double range);
402   inline G4double GetLambdaForScaledEnergy(G4d << 422   inline void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy);
403   inline G4double GetLambdaForScaledEnergy(G4d << 
404                                            G4d << 
405                                                << 
406   inline G4double LogScaledEkin(const G4Track& << 
407                                                << 
408   void ComputeLambdaForScaledEnergy(G4double s << 
409                                     const G4Tr << 
410                                                << 
411   G4bool IsRegionForCubcutProcessor(const G4Tr << 
412                                                   423 
413 protected:                                     << 424   // hide  assignment operator
414                                                   425 
415   G4ParticleChangeForLoss     fParticleChange; << 426   G4VEnergyLossProcess(G4VEnergyLossProcess &);
416   const G4Material*           currentMaterial  << 427   G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right);
417   const G4MaterialCutsCouple* currentCouple =  << 
418                                                   428 
419 private:                                       << 429   // ======== Parameters of the class fixed at construction =========
420                                                   430 
421   G4LossTableManager*         lManager;        << 
422   G4EmModelManager*           modelManager;       431   G4EmModelManager*           modelManager;
423   G4VEmModel*                 currentModel = n << 
424   G4EmBiasingManager*         biasManager = nu << 
425   G4SafetyHelper*             safetyHelper;       432   G4SafetyHelper*             safetyHelper;
426   G4EmParameters*             theParameters;   << 
427   G4VEmFluctuationModel*      fluctModel = nul << 
428   G4VAtomDeexcitation*        atomDeexcitation << 
429   G4VSubCutProducer*          subcutProducer = << 
430                                                << 
431   const G4ParticleDefinition* particle = nullp << 
432   const G4ParticleDefinition* baseParticle = n << 
433   const G4ParticleDefinition* secondaryParticl << 
434   G4EmDataHandler* theData = nullptr;          << 
435                                                << 
436   G4PhysicsTable* theDEDXTable = nullptr;      << 
437   G4PhysicsTable* theDEDXunRestrictedTable = n << 
438   G4PhysicsTable* theIonisationTable = nullptr << 
439   G4PhysicsTable* theRangeTableForLoss = nullp << 
440   G4PhysicsTable* theCSDARangeTable = nullptr; << 
441   G4PhysicsTable* theInverseRangeTable = nullp << 
442   G4PhysicsTable* theLambdaTable = nullptr;    << 
443                                                << 
444   std::vector<const G4Region*>* scoffRegions = << 
445   std::vector<G4VEmModel*>*     emModels = nul << 
446   const std::vector<G4int>*     theDensityIdx  << 
447   const std::vector<G4double>*  theDensityFact << 
448   const G4DataVector*           theCuts = null << 
449                                                   433 
450   std::vector<G4double>* theEnergyOfCrossSecti << 434   const G4ParticleDefinition* secondaryParticle;
451   std::vector<G4TwoPeaksXS*>* fXSpeaks = nullp << 435   const G4ParticleDefinition* theElectron;
                                                   >> 436   const G4ParticleDefinition* thePositron;
                                                   >> 437   const G4ParticleDefinition* theGenericIon;
                                                   >> 438 
                                                   >> 439   G4PhysicsVector*            vstrag;
                                                   >> 440 
                                                   >> 441   // ======== Parameters of the class fixed at initialisation =======
                                                   >> 442 
                                                   >> 443   std::vector<G4VEmModel*>              emModels;
                                                   >> 444   G4VEmFluctuationModel*                fluctModel;
                                                   >> 445   std::vector<const G4Region*>          scoffRegions;
                                                   >> 446   G4int                                 nSCoffRegions;
                                                   >> 447   G4int*                                idxSCoffRegions;
                                                   >> 448 
                                                   >> 449   std::vector<G4VEnergyLossProcess*>    scProcesses;
                                                   >> 450   G4int                                 nProcesses;
                                                   >> 451 
                                                   >> 452   // tables and vectors
                                                   >> 453   G4PhysicsTable*             theDEDXTable;
                                                   >> 454   G4PhysicsTable*             theDEDXSubTable;
                                                   >> 455   G4PhysicsTable*             theDEDXunRestrictedTable;
                                                   >> 456   G4PhysicsTable*             theIonisationTable;
                                                   >> 457   G4PhysicsTable*             theIonisationSubTable;
                                                   >> 458   G4PhysicsTable*             theRangeTableForLoss;
                                                   >> 459   G4PhysicsTable*             theCSDARangeTable;
                                                   >> 460   G4PhysicsTable*             theSecondaryRangeTable;
                                                   >> 461   G4PhysicsTable*             theInverseRangeTable;
                                                   >> 462   G4PhysicsTable*             theLambdaTable;
                                                   >> 463   G4PhysicsTable*             theSubLambdaTable;
                                                   >> 464   G4double*                   theDEDXAtMaxEnergy;
                                                   >> 465   G4double*                   theRangeAtMaxEnergy;
                                                   >> 466   G4double*                   theEnergyOfCrossSectionMax;
                                                   >> 467   G4double*                   theCrossSectionMax;
                                                   >> 468 
                                                   >> 469   const G4DataVector*         theCuts;
                                                   >> 470   const G4DataVector*         theSubCuts;
                                                   >> 471 
                                                   >> 472   const G4ParticleDefinition* baseParticle;
                                                   >> 473 
                                                   >> 474   G4int    nBins;
                                                   >> 475   G4int    nBinsCSDA;
452                                                   476 
453   G4double lowestKinEnergy;                       477   G4double lowestKinEnergy;
454   G4double minKinEnergy;                          478   G4double minKinEnergy;
455   G4double maxKinEnergy;                          479   G4double maxKinEnergy;
456   G4double maxKinEnergyCSDA;                      480   G4double maxKinEnergyCSDA;
457                                                   481 
458   G4double linLossLimit = 0.01;                << 482   G4double linLossLimit;
459   G4double dRoverRange = 0.2;                  << 483   G4double minSubRange;
                                                   >> 484   G4double dRoverRange;
460   G4double finalRange;                            485   G4double finalRange;
461   G4double lambdaFactor = 0.8;                 << 486   G4double lambdaFactor;
462   G4double invLambdaFactor;                    << 487 
463   G4double biasFactor = 1.0;                   << 488   G4bool   lossFluctuationFlag;
464                                                << 489   G4bool   rndmStepFlag;
465   G4double massRatio = 1.0;                    << 490   G4bool   tablesAreBuilt;
466   G4double logMassRatio = 0.0;                 << 491   G4bool   integral;
467   G4double fFactor = 1.0;                      << 492   G4bool   isIon;
468   G4double reduceFactor = 1.0;                 << 493   G4bool   isIonisation;
469   G4double chargeSqRatio = 1.0;                << 494   G4bool   useSubCutoff;
470   G4double fRange = 0.0;                       << 
471   G4double fRangeEnergy = 0.0;                 << 
472                                                   495 
473 protected:                                        496 protected:
474                                                   497 
475   G4double preStepLambda = 0.0;                << 498   G4ParticleChangeForLoss          fParticleChange;
476   G4double preStepKinEnergy = 0.0;             << 
477   G4double preStepScaledEnergy = 0.0;          << 
478   G4double mfpKinEnergy = 0.0;                 << 
479                                                   499 
480   std::size_t currentCoupleIndex = 0;          << 500   // ======== Cashed values - may be state dependent ================
481                                                   501 
482 private:                                          502 private:
483                                                   503 
484   G4int nBins;                                 << 504   std::vector<G4DynamicParticle*>  secParticles;
485   G4int nBinsCSDA;                             << 505   std::vector<G4Track*>            scTracks;
486   G4int numberOfModels = 0;                    << 506 
487   G4int nSCoffRegions = 0;                     << 507   const G4ParticleDefinition* particle;
488   G4int secID = _DeltaElectron;                << 508 
489   G4int tripletID = _TripletElectron;          << 509   G4VEmModel*                 currentModel;
490   G4int biasID = _DeltaEBelowCut;              << 510   const G4Material*           currentMaterial;
491   G4int epixeID = _ePIXE;                      << 511   const G4MaterialCutsCouple* currentCouple;
492   G4int gpixeID = _GammaPIXE;                  << 512   size_t                      currentMaterialIndex;
493   G4int mainSecondaries = 1;                   << 513 
494                                                << 514   G4int    nWarnings;
495   std::size_t basedCoupleIndex = 0;            << 515 
496   std::size_t coupleIdxRange = 0;              << 516   G4double massRatio;
497   std::size_t idxDEDX = 0;                     << 517   G4double reduceFactor;
498   std::size_t idxDEDXunRestricted = 0;         << 518   G4double chargeSqRatio;
499   std::size_t idxIonisation = 0;               << 519 
500   std::size_t idxRange = 0;                    << 520   G4double preStepLambda;
501   std::size_t idxCSDA = 0;                     << 521   G4double fRange;
502   std::size_t idxSecRange = 0;                 << 522   G4double preStepKinEnergy;
503   std::size_t idxInverseRange = 0;             << 523   G4double preStepScaledEnergy;
504   std::size_t idxLambda = 0;                   << 524   G4double mfpKinEnergy;
505                                                << 525 
506   G4GPILSelection aGPILSelection;              << 526   G4GPILSelection  aGPILSelection;
507   G4CrossSectionType fXSType = fEmOnePeak;     << 
508                                                << 
509   G4bool lossFluctuationFlag = true;           << 
510   G4bool useCutAsFinalRange = false;           << 
511   G4bool tablesAreBuilt = false;               << 
512   G4bool spline = true;                        << 
513   G4bool isIon = false;                        << 
514   G4bool isIonisation = false;                 << 
515   G4bool useDeexcitation = false;              << 
516   G4bool biasFlag = false;                     << 
517   G4bool weightFlag = false;                   << 
518   G4bool isMaster = false;                     << 
519   G4bool baseMat = false;                      << 
520   G4bool actLinLossLimit = false;              << 
521   G4bool actLossFluc = false;                  << 
522   G4bool actBinning = false;                   << 
523   G4bool actMinKinEnergy = false;              << 
524   G4bool actMaxKinEnergy = false;              << 
525                                                   527 
526   std::vector<G4DynamicParticle*> secParticles << 
527   std::vector<G4Track*> scTracks;              << 
528 };                                                528 };
529                                                   529 
530 // ======== Run time inline methods ========== << 530 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 531 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
531                                                   532 
532 inline std::size_t G4VEnergyLossProcess::Curre << 533 inline void G4VEnergyLossProcess::DefineMaterial(
                                                   >> 534             const G4MaterialCutsCouple* couple)
533 {                                                 535 {
534   return currentCoupleIndex;                   << 536   if(couple != currentCouple) {
                                                   >> 537     currentCouple   = couple;
                                                   >> 538     currentMaterial = couple->GetMaterial();
                                                   >> 539     currentMaterialIndex = couple->GetIndex();
                                                   >> 540     mfpKinEnergy = DBL_MAX;
                                                   >> 541   }
535 }                                                 542 }
536                                                   543 
537 //....oooOO0OOooo........oooOO0OOooo........oo    544 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
538                                                   545 
539 inline void G4VEnergyLossProcess::SelectModel( << 546 inline G4double G4VEnergyLossProcess::GetDEDX(G4double& kineticEnergy,
                                                   >> 547                                         const G4MaterialCutsCouple* couple)
540 {                                                 548 {
541   currentModel = modelManager->SelectModel(kin << 549   DefineMaterial(couple);
542   currentModel->SetCurrentCouple(currentCouple << 550   return GetDEDXForScaledEnergy(kineticEnergy*massRatio);
543 }                                                 551 }
544                                                   552 
545 //....oooOO0OOooo........oooOO0OOooo........oo    553 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
546                                                   554 
547 inline G4VEmModel* G4VEnergyLossProcess::Selec << 555 inline G4double G4VEnergyLossProcess::GetDEDXForSubsec(G4double& kineticEnergy,
548                    G4double kinEnergy, std::si << 556                                         const G4MaterialCutsCouple* couple)
549 {                                                 557 {
550   return modelManager->SelectModel(kinEnergy,  << 558   DefineMaterial(couple);
                                                   >> 559   return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio);
551 }                                                 560 }
552                                                   561 
553 //....oooOO0OOooo........oooOO0OOooo........oo    562 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
554                                                   563 
555 inline void                                    << 564 inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
556 G4VEnergyLossProcess::DefineMaterial(const G4M << 
557 {                                                 565 {
558   if(couple != currentCouple) {                << 566   G4bool b;
559     currentCouple = couple;                    << 567   G4double x = 
560     currentMaterial = couple->GetMaterial();   << 568     ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
561     basedCoupleIndex = currentCoupleIndex = co << 569   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
562     fFactor = chargeSqRatio*biasFactor;        << 570   return x;
563     mfpKinEnergy = DBL_MAX;                    << 
564     idxLambda = 0;                             << 
565     if(baseMat) {                              << 
566       basedCoupleIndex = (*theDensityIdx)[curr << 
567       fFactor *= (*theDensityFactor)[currentCo << 
568     }                                          << 
569     reduceFactor = 1.0/(fFactor*massRatio);    << 
570   }                                            << 
571 }                                                 571 }
572                                                   572 
573 //....oooOO0OOooo........oooOO0OOooo........oo    573 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
574                                                   574 
575 inline G4double G4VEnergyLossProcess::GetDEDXF << 575 inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)
576 {                                                 576 {
577   /*                                           << 577   G4bool b;
578   G4cout << "G4VEnergyLossProcess::GetDEDX: Id << 578   G4double x = 
579            << basedCoupleIndex << " E(MeV)= "  << 579     ((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
580          << " Emin= " << minKinEnergy << "  Fa << 580   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
581          << "  " << theDEDXTable << G4endl; */ << 
582   G4double x = fFactor*(*theDEDXTable)[basedCo << 
583   if(e < minKinEnergy) { x *= std::sqrt(e/minK << 
584   return x;                                       581   return x;
585 }                                                 582 }
586                                                   583 
587 //....oooOO0OOooo........oooOO0OOooo........oo    584 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
588                                                   585 
589 inline                                         << 586 inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)
590 G4double G4VEnergyLossProcess::GetDEDXForScale << 
591 {                                                 587 {
592   /*                                           << 588   G4bool b;
593   G4cout << "G4VEnergyLossProcess::GetDEDX: Id << 589   G4double x = 0.0;
594            << basedCoupleIndex << " E(MeV)= "  << 590   //  if(theIonisationTable) {
595          << " Emin= " << minKinEnergy << "  Fa << 591   x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b))
596          << "  " << theDEDXTable << G4endl; */ << 592     *chargeSqRatio;
597   G4double x = fFactor*(*theDEDXTable)[basedCo << 593   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
598   if(e < minKinEnergy) { x *= std::sqrt(e/minK << 594   //}
599   return x;                                       595   return x;
600 }                                                 596 }
601                                                   597 
602 //....oooOO0OOooo........oooOO0OOooo........oo    598 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
603                                                   599 
604 inline G4double G4VEnergyLossProcess::GetIonis << 600 inline 
                                                   >> 601 G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e)
605 {                                                 602 {
606   G4double x =                                 << 603   G4bool b;
607     fFactor*(*theIonisationTable)[basedCoupleI << 604   G4double x = 0.0;
608   if(e < minKinEnergy) { x *= std::sqrt(e/minK << 605   //if(theIonisationSubTable) {
                                                   >> 606   x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b))
                                                   >> 607     *chargeSqRatio;
                                                   >> 608   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
                                                   >> 609   //}
609   return x;                                       610   return x;
610 }                                                 611 }
611                                                   612 
612 //....oooOO0OOooo........oooOO0OOooo........oo    613 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
613                                                   614 
614 inline G4double G4VEnergyLossProcess::GetScale << 615 inline G4double G4VEnergyLossProcess::GetRange(G4double& kineticEnergy,
                                                   >> 616                                          const G4MaterialCutsCouple* couple)
615 {                                                 617 {
616   //G4cout << "G4VEnergyLossProcess::GetScaled << 618   G4double x = fRange;
617   //         << basedCoupleIndex << " E(MeV)=  << 619   if(kineticEnergy != preStepKinEnergy || couple != currentCouple) { 
618   //         << " lastIdx= " << lastIdx << "   << 620     DefineMaterial(couple);
619   if(currentCoupleIndex != coupleIdxRange || f << 621     if(theCSDARangeTable)
620     coupleIdxRange = currentCoupleIndex;       << 622       x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)
621     fRangeEnergy = e;                          << 623   * reduceFactor;
622     fRange = reduceFactor*((*theRangeTableForL << 624     else if(theRangeTableForLoss)
623     if (fRange < 0.0) { fRange = 0.0; }        << 625       x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
624     else if (e < minKinEnergy) { fRange *= std << 
625   }                                               626   }
626   //G4cout << "G4VEnergyLossProcess::GetScaled << 627   return x;
627   //         << basedCoupleIndex << " E(MeV)=  << 
628   //         << " R=  " << computedRange << "  << 
629   return fRange;                               << 
630 }                                                 628 }
631                                                   629 
632 inline G4double                                << 630 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
633 G4VEnergyLossProcess::GetScaledRangeForScaledE << 631 
                                                   >> 632 inline G4double G4VEnergyLossProcess::GetCSDARange(
                                                   >> 633        G4double& kineticEnergy, const G4MaterialCutsCouple* couple)
634 {                                                 634 {
635   //G4cout << "G4VEnergyLossProcess::GetScaled << 635   DefineMaterial(couple);
636   //         << basedCoupleIndex << " E(MeV)=  << 636   G4double x = DBL_MAX;
637   //         << " lastIdx= " << lastIdx << "   << 637   if(theCSDARangeTable)
638   if(currentCoupleIndex != coupleIdxRange || f << 638     x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)
639     coupleIdxRange = currentCoupleIndex;       << 639       * reduceFactor;
640     fRangeEnergy = e;                          << 640   return x;
641     fRange = reduceFactor*((*theRangeTableForL << 641 }
642     if (fRange < 0.0) { fRange = 0.0; }        << 642 
643     else if (e < minKinEnergy) { fRange *= std << 643 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 644 
                                                   >> 645 inline G4double G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(
                                                   >> 646     G4double e)
                                                   >> 647 {
                                                   >> 648   G4bool b;
                                                   >> 649   G4double x;
                                                   >> 650 
                                                   >> 651   if (e < maxKinEnergyCSDA) {
                                                   >> 652     x = ((*theCSDARangeTable)[currentMaterialIndex])->GetValue(e, b);
                                                   >> 653     if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
                                                   >> 654   } else {
                                                   >> 655     x = theRangeAtMaxEnergy[currentMaterialIndex] +
                                                   >> 656          (e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[currentMaterialIndex];
644   }                                               657   }
645   //G4cout << "G4VEnergyLossProcess::GetScaled << 658   return x;
646   //         << basedCoupleIndex << " E(MeV)=  << 
647   //         << " R=  " << fRange << "  " << t << 
648   return fRange;                               << 
649 }                                                 659 }
650                                                   660 
651 //....oooOO0OOooo........oooOO0OOooo........oo    661 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
652                                                   662 
653 inline G4double                                << 663 inline G4double G4VEnergyLossProcess::GetRangeForLoss(
654 G4VEnergyLossProcess::GetLimitScaledRangeForSc << 664                 G4double& kineticEnergy,
                                                   >> 665     const G4MaterialCutsCouple* couple)
655 {                                                 666 {
656   G4double x = ((*theCSDARangeTable)[basedCoup << 667   DefineMaterial(couple);
657   if (x < 0.0) { x = 0.0; }                    << 668   G4double x = DBL_MAX;
658   else if (e < minKinEnergy) { x *= std::sqrt( << 669   if(theRangeTableForLoss) 
                                                   >> 670     x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
                                                   >> 671   //  G4cout << "Range from " << GetProcessName() 
                                                   >> 672   //         << "  e= " << kineticEnergy << " r= " << x << G4endl;
659   return x;                                       673   return x;
660 }                                                 674 }
661                                                   675 
662 //....oooOO0OOooo........oooOO0OOooo........oo    676 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
663                                                   677 
664 inline G4double                                << 678 inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
665 G4VEnergyLossProcess::GetLimitScaledRangeForSc << 
666                                                << 
667 {                                                 679 {
668   G4double x = ((*theCSDARangeTable)[basedCoup << 680   G4bool b;
669   if (x < 0.0) { x = 0.0; }                    << 681   G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b);
670   else if (e < minKinEnergy) { x *= std::sqrt( << 682   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
671   return x;                                       683   return x;
672 }                                                 684 }
673                                                   685 
674 //....oooOO0OOooo........oooOO0OOooo........oo    686 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
675                                                   687 
                                                   >> 688 inline G4double G4VEnergyLossProcess::GetKineticEnergy(
                                                   >> 689                 G4double& range,
                                                   >> 690     const G4MaterialCutsCouple* couple)
                                                   >> 691 {
                                                   >> 692   DefineMaterial(couple);
                                                   >> 693   G4double r = range/reduceFactor;
                                                   >> 694   G4double e = ScaledKinEnergyForLoss(r)/massRatio;
                                                   >> 695   return e;
                                                   >> 696 }
                                                   >> 697 
                                                   >> 698 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 699 
676 inline G4double G4VEnergyLossProcess::ScaledKi    700 inline G4double G4VEnergyLossProcess::ScaledKinEnergyForLoss(G4double r)
677 {                                                 701 {
678   //G4cout << "G4VEnergyLossProcess::GetEnergy << 702   G4PhysicsVector* v = (*theInverseRangeTable)[currentMaterialIndex];
679   //         << basedCoupleIndex << " R(mm)= " << 703   G4double rmin = v->GetLowEdgeEnergy(0);
680   //         << theInverseRangeTable << G4endl << 
681   G4PhysicsVector* v = (*theInverseRangeTable) << 
682   G4double rmin = v->Energy(0);                << 
683   G4double e = 0.0;                               704   G4double e = 0.0; 
684   if(r >= rmin) { e = v->Value(r, idxInverseRa << 705   if(r >= rmin) {
685   else if(r > 0.0) {                           << 706     G4bool b;
                                                   >> 707     e = v->GetValue(r, b);
                                                   >> 708   } else if(r > 0.0) {
686     G4double x = r/rmin;                          709     G4double x = r/rmin;
687     e = minKinEnergy*x*x;                         710     e = minKinEnergy*x*x;
688   }                                               711   }
689   return e;                                       712   return e;
690 }                                                 713 }
691                                                   714 
692 //....oooOO0OOooo........oooOO0OOooo........oo    715 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
693                                                   716 
                                                   >> 717 inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
                                                   >> 718             const G4MaterialCutsCouple* couple)
                                                   >> 719 {
                                                   >> 720   DefineMaterial(couple);
                                                   >> 721   G4double x = 0.0;
                                                   >> 722   if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
                                                   >> 723   return x;
                                                   >> 724 }
                                                   >> 725 
                                                   >> 726 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 727 
694 inline G4double G4VEnergyLossProcess::GetLambd    728 inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e)
695 {                                                 729 {
696   return fFactor*((*theLambdaTable)[basedCoupl << 730   G4bool b;
                                                   >> 731   return 
                                                   >> 732     chargeSqRatio*(((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
                                                   >> 733 }
                                                   >> 734 
                                                   >> 735 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 736 
                                                   >> 737 inline void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
                                                   >> 738 {
                                                   >> 739   mfpKinEnergy  = theEnergyOfCrossSectionMax[currentMaterialIndex];
                                                   >> 740   if (e <= mfpKinEnergy) {
                                                   >> 741     preStepLambda = GetLambdaForScaledEnergy(e);
                                                   >> 742 
                                                   >> 743   } else {
                                                   >> 744     G4double e1 = e*lambdaFactor;
                                                   >> 745     if(e1 > mfpKinEnergy) {
                                                   >> 746       preStepLambda  = GetLambdaForScaledEnergy(e);
                                                   >> 747       G4double preStepLambda1 = GetLambdaForScaledEnergy(e1);
                                                   >> 748       if(preStepLambda1 > preStepLambda) {
                                                   >> 749         mfpKinEnergy = e1;
                                                   >> 750         preStepLambda = preStepLambda1;
                                                   >> 751       }
                                                   >> 752     } else {
                                                   >> 753       preStepLambda = chargeSqRatio*theCrossSectionMax[currentMaterialIndex];
                                                   >> 754     }
                                                   >> 755   }
697 }                                                 756 }
698                                                   757 
699 //....oooOO0OOooo........oooOO0OOooo........oo    758 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
700                                                   759 
701 inline G4double                                << 760 inline G4double G4VEnergyLossProcess::ContinuousStepLimit(
702 G4VEnergyLossProcess::GetLambdaForScaledEnergy << 761          const G4Track& track, G4double x, G4double y, G4double& z)
703 {                                                 762 {
704   return fFactor*((*theLambdaTable)[basedCoupl << 763   G4GPILSelection sel;
                                                   >> 764   return AlongStepGetPhysicalInteractionLength(track, x, y, z, &sel);
705 }                                                 765 }
706                                                   766 
707 //....oooOO0OOooo........oooOO0OOooo........oo    767 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
708                                                   768 
709 inline G4double G4VEnergyLossProcess::LogScale << 769 inline G4double G4VEnergyLossProcess::SampleRange()
710 {                                                 770 {
711   return track.GetDynamicParticle()->GetLogKin << 771   G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass();
                                                   >> 772   G4bool b;
                                                   >> 773   G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b));
                                                   >> 774   G4double x = fRange + G4RandGauss::shoot(0.0,s);
                                                   >> 775   if(x > 0.0) fRange = x;
                                                   >> 776   return fRange;
712 }                                                 777 }
713                                                   778 
714 //....oooOO0OOooo........oooOO0OOooo........oo    779 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
715                                                   780 
716 inline G4double                                << 781 inline G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
717 G4VEnergyLossProcess::GetDEDX(G4double kinEner << 
718                               const G4Material << 
719 {                                                 782 {
720   DefineMaterial(couple);                      << 783   DefineMaterial(track.GetMaterialCutsCouple());
721   return GetDEDXForScaledEnergy(kinEnergy*mass << 784   preStepLambda = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
                                                   >> 785   G4double x = DBL_MAX;
                                                   >> 786   if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
                                                   >> 787   return x;
722 }                                                 788 }
723                                                   789 
724 //....oooOO0OOooo........oooOO0OOooo........oo    790 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
725                                                   791 
726 inline G4double                                << 792 inline G4double G4VEnergyLossProcess::MinPrimaryEnergy(
727 G4VEnergyLossProcess::GetDEDX(G4double kinEner << 793                 const G4ParticleDefinition*, const G4Material*, G4double cut)
728                               const G4Material << 
729                               G4double logKinE << 
730 {                                                 794 {
731   DefineMaterial(couple);                      << 795   return cut;
732   return GetDEDXForScaledEnergy(kinEnergy*mass << 
733 }                                                 796 }
734                                                   797 
735 //....oooOO0OOooo........oooOO0OOooo........oo    798 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
736                                                   799 
737 inline G4double                                << 800 inline void G4VEnergyLossProcess::SelectModel(G4double kinEnergy)
738 G4VEnergyLossProcess::GetRange(G4double kinEne << 
739                                const G4Materia << 
740 {                                                 801 {
741   DefineMaterial(couple);                      << 802   currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex);
742   return GetScaledRangeForScaledEnergy(kinEner << 
743 }                                                 803 }
744                                                   804 
745 //....oooOO0OOooo........oooOO0OOooo........oo    805 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
746                                                   806 
747 inline G4double                                << 807 inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial(
748 G4VEnergyLossProcess::GetRange(G4double kinEne << 808                    G4double kinEnergy, size_t& idx) const
749                                const G4Materia << 
750                                G4double logKin << 
751 {                                                 809 {
752   DefineMaterial(couple);                      << 810   return modelManager->SelectModel(kinEnergy, idx);
753   return GetScaledRangeForScaledEnergy(kinEner << 
754 }                                                 811 }
755                                                   812 
756 //....oooOO0OOooo........oooOO0OOooo........oo    813 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
757                                                   814 
758 inline G4double                                << 815 inline G4ParticleChangeForLoss* G4VEnergyLossProcess::GetParticleChange()
759 G4VEnergyLossProcess::GetCSDARange(G4double ki << 
760                                    const G4Mat << 
761 {                                                 816 {
762   DefineMaterial(couple);                      << 817   return &fParticleChange;
763   return (nullptr == theCSDARangeTable) ? DBL_ << 
764     GetLimitScaledRangeForScaledEnergy(kinetic << 
765 }                                                 818 }
766                                                   819 
767 //....oooOO0OOooo........oooOO0OOooo........oo    820 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
768                                                   821 
769 inline G4double                                << 822 inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const
770 G4VEnergyLossProcess::GetKineticEnergy(G4doubl << 
771                                        const G << 
772 {                                                 823 {
773   DefineMaterial(couple);                      << 824   return particle;
774   return ScaledKinEnergyForLoss(range/reduceFa << 
775 }                                                 825 }
776                                                   826 
777 //....oooOO0OOooo........oooOO0OOooo........oo    827 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
778                                                   828 
779 inline G4double                                << 829 inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const
780 G4VEnergyLossProcess::GetLambda(G4double kinEn << 
781                                 const G4Materi << 
782 {                                                 830 {
783   DefineMaterial(couple);                      << 831   return baseParticle;
784   return (nullptr != theLambdaTable) ?         << 
785     GetLambdaForScaledEnergy(kinEnergy*massRat << 
786 }                                                 832 }
787                                                   833 
788 //....oooOO0OOooo........oooOO0OOooo........oo    834 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
789                                                   835 
790 inline G4double                                << 836 inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const
791 G4VEnergyLossProcess::GetLambda(G4double kinEn << 
792                                 const G4Materi << 
793                                 G4double logKi << 
794 {                                                 837 {
795   DefineMaterial(couple);                      << 838   return secondaryParticle;
796   return (nullptr != theLambdaTable) ?         << 
797     GetLambdaForScaledEnergy(kinEnergy*massRat << 
798     :  0.0;                                    << 
799 }                                                 839 }
800                                                   840 
801 // ======== Get/Set inline methods used at ini << 841 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
802                                                   842 
803 inline void G4VEnergyLossProcess::SetFluctMode << 843 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const
804 {                                                 844 {
805   fluctModel = p;                              << 845   return theDEDXTable;
806 }                                                 846 }
807                                                   847 
808 //....oooOO0OOooo........oooOO0OOooo........oo    848 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
809                                                   849 
810 inline G4VEmFluctuationModel* G4VEnergyLossPro << 850 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const
811 {                                                 851 {
812   return fluctModel;                           << 852   return theDEDXSubTable;
813 }                                                 853 }
814                                                   854 
815 //....oooOO0OOooo........oooOO0OOooo........oo    855 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
816                                                   856 
817 inline void G4VEnergyLossProcess::SetParticle( << 857 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const
818 {                                                 858 {
819   particle = p;                                << 859   return theDEDXunRestrictedTable;
820 }                                                 860 }
821                                                   861 
822 //....oooOO0OOooo........oooOO0OOooo........oo    862 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
823                                                   863 
824 inline void                                    << 864 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const
825 G4VEnergyLossProcess::SetSecondaryParticle(con << 
826 {                                                 865 {
827   secondaryParticle = p;                       << 866   G4PhysicsTable* t = theDEDXTable;
                                                   >> 867   if(theIonisationTable) t = theIonisationTable; 
                                                   >> 868   return t;
828 }                                                 869 }
829                                                   870 
830 //....oooOO0OOooo........oooOO0OOooo........oo    871 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
831                                                   872 
832 inline void                                    << 873 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const
833 G4VEnergyLossProcess::SetBaseParticle(const G4 << 
834 {                                                 874 {
835   baseParticle = p;                            << 875   G4PhysicsTable* t = theDEDXSubTable;
                                                   >> 876   if(theIonisationSubTable) t = theIonisationSubTable; 
                                                   >> 877   return t;
836 }                                                 878 }
837                                                   879 
838 //....oooOO0OOooo........oooOO0OOooo........oo    880 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
839                                                   881 
840 inline const G4ParticleDefinition* G4VEnergyLo << 882 inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const
841 {                                                 883 {
842   return particle;                             << 884   return theCSDARangeTable;
843 }                                                 885 }
844                                                   886 
845 //....oooOO0OOooo........oooOO0OOooo........oo    887 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
846                                                   888 
847 inline const G4ParticleDefinition* G4VEnergyLo << 889 inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const
848 {                                                 890 {
849   return baseParticle;                         << 891   return theRangeTableForLoss;
                                                   >> 892 }
                                                   >> 893 
                                                   >> 894 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 895 
                                                   >> 896 inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const
                                                   >> 897 {
                                                   >> 898   return theInverseRangeTable;
850 }                                                 899 }
851                                                   900 
852 //....oooOO0OOooo........oooOO0OOooo........oo    901 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
853                                                   902 
854 inline const G4ParticleDefinition*             << 903 inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable()
855 G4VEnergyLossProcess::SecondaryParticle() cons << 
856 {                                                 904 {
857   return secondaryParticle;                    << 905   return theLambdaTable;
858 }                                                 906 }
859                                                   907 
860 //....oooOO0OOooo........oooOO0OOooo........oo    908 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
861                                                   909 
862 inline void G4VEnergyLossProcess::SetLossFluct << 910 inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable()
863 {                                                 911 {
864   lossFluctuationFlag = val;                   << 912   return theSubLambdaTable;
865   actLossFluc = true;                          << 913 }
                                                   >> 914 
                                                   >> 915 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 916   
                                                   >> 917 inline G4bool G4VEnergyLossProcess::IsIntegral() const 
                                                   >> 918 {
                                                   >> 919   return integral;
866 }                                                 920 }
867                                                   921 
868 //....oooOO0OOooo........oooOO0OOooo........oo    922 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
869                                                   923 
870 inline void G4VEnergyLossProcess::SetSpline(G4 << 924 inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const 
871 {                                                 925 {
872   spline = val;                                << 926   return currentMaterialIndex;
873 }                                                 927 }
874                                                   928 
875 //....oooOO0OOooo........oooOO0OOooo........oo    929 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
876                                                   930 
877 inline void G4VEnergyLossProcess::SetCrossSect << 931 inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
                                                   >> 932                                                        G4double charge2ratio)
878 {                                                 933 {
879   fXSType = val;                               << 934   massRatio     = massratio;
                                                   >> 935   chargeSqRatio = charge2ratio;
                                                   >> 936   reduceFactor  = 1.0/(chargeSqRatio*massRatio);
880 }                                                 937 }
881                                                   938 
882 //....oooOO0OOooo........oooOO0OOooo........oo    939 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
883                                                   940   
884 inline G4CrossSectionType G4VEnergyLossProcess << 941 inline G4double G4VEnergyLossProcess::GetCurrentRange() const
885 {                                                 942 {
886   return fXSType;                              << 943   return fRange;
887 }                                                 944 }
888                                                   945 
889 //....oooOO0OOooo........oooOO0OOooo........oo    946 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
890                                                   947 
891 inline G4bool G4VEnergyLossProcess::IsIonisati << 948 inline
                                                   >> 949 void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p, 
                                                   >> 950               G4VEmFluctuationModel* fluc,
                                                   >> 951               const G4Region* region)
892 {                                                 952 {
893   return isIonisation;                         << 953   modelManager->AddEmModel(order, p, fluc, region);
                                                   >> 954   if(p) p->SetParticleChange(pParticleChange, fluc);
894 }                                                 955 }
895                                                   956 
896 //....oooOO0OOooo........oooOO0OOooo........oo    957 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
897                                                   958 
898 inline G4int G4VEnergyLossProcess::NumberOfSub << 959 inline 
                                                   >> 960 G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx, G4bool ver)
899 {                                                 961 {
900   return nSCoffRegions;                        << 962   return modelManager->GetModel(idx, ver);
901 }                                                 963 }
902                                                   964 
903 //....oooOO0OOooo........oooOO0OOooo........oo    965 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
904                                                   966 
905 inline G4double G4VEnergyLossProcess::MinKinEn << 967 inline G4int G4VEnergyLossProcess::NumberOfModels()
906 {                                                 968 {
907   return minKinEnergy;                         << 969   return modelManager->NumberOfModels();
908 }                                                 970 }
909                                                   971 
910 //....oooOO0OOooo........oooOO0OOooo........oo    972 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
911                                                   973 
912 inline G4double G4VEnergyLossProcess::MaxKinEn << 974 inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)
913 {                                                 975 {
914   return maxKinEnergy;                         << 976   G4int n = emModels.size();
                                                   >> 977   if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}
                                                   >> 978   emModels[index] = p;
                                                   >> 979 }
                                                   >> 980 
                                                   >> 981 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 982 
                                                   >> 983 inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index)
                                                   >> 984 {
                                                   >> 985   G4VEmModel* p = 0;
                                                   >> 986   if(index >= 0 && index <  G4int(emModels.size())) p = emModels[index];
                                                   >> 987   return p;
                                                   >> 988 }
                                                   >> 989 
                                                   >> 990 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 991 
                                                   >> 992 inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)
                                                   >> 993 {
                                                   >> 994   fluctModel = p;
                                                   >> 995 }
                                                   >> 996 
                                                   >> 997 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 998 
                                                   >> 999 inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()
                                                   >> 1000 {
                                                   >> 1001   return fluctModel;
                                                   >> 1002 }
                                                   >> 1003 
                                                   >> 1004 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1005 
                                                   >> 1006 inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam, 
                                                   >> 1007             G4double emin, G4double emax)
                                                   >> 1008 {
                                                   >> 1009   modelManager->UpdateEmModel(nam, emin, emax);
                                                   >> 1010 }
                                                   >> 1011 
                                                   >> 1012 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1013 
                                                   >> 1014 inline void G4VEnergyLossProcess::SetIntegral(G4bool val)
                                                   >> 1015 {
                                                   >> 1016   integral = val;
                                                   >> 1017 }
                                                   >> 1018 
                                                   >> 1019 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1020 
                                                   >> 1021 inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p)
                                                   >> 1022 {
                                                   >> 1023   particle = p;
915 }                                                 1024 }
916                                                   1025 
917 //....oooOO0OOooo........oooOO0OOooo........oo    1026 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
918                                                   1027 
919 inline G4double G4VEnergyLossProcess::CrossSec << 1028 inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p)
920 {                                                 1029 {
921   return biasFactor;                           << 1030   baseParticle = p;
                                                   >> 1031 }
                                                   >> 1032 
                                                   >> 1033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1034 
                                                   >> 1035 inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
                                                   >> 1036 {
                                                   >> 1037   secondaryParticle = p;
                                                   >> 1038 }
                                                   >> 1039 
                                                   >> 1040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1041 
                                                   >> 1042 inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
                                                   >> 1043 {
                                                   >> 1044   linLossLimit = val;
                                                   >> 1045 }
                                                   >> 1046 
                                                   >> 1047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1048 
                                                   >> 1049 inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
                                                   >> 1050 {
                                                   >> 1051   lossFluctuationFlag = val;
                                                   >> 1052 }
                                                   >> 1053 
                                                   >> 1054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1055 
                                                   >> 1056 inline void G4VEnergyLossProcess::SetRandomStep(G4bool val)
                                                   >> 1057 {
                                                   >> 1058   rndmStepFlag = val;
                                                   >> 1059 }
                                                   >> 1060 
                                                   >> 1061 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1062 
                                                   >> 1063 inline void G4VEnergyLossProcess::SetMinSubRange(G4double val)
                                                   >> 1064 {
                                                   >> 1065   minSubRange = val;
922 }                                                 1066 }
923                                                   1067 
924 //....oooOO0OOooo........oooOO0OOooo........oo    1068 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
925                                                   1069 
926 inline G4bool G4VEnergyLossProcess::TablesAreB    1070 inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const
927 {                                                 1071 {
928   return tablesAreBuilt;                       << 1072   return  tablesAreBuilt;
929 }                                                 1073 }
930                                                   1074 
931 //....oooOO0OOooo........oooOO0OOooo........oo    1075 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
932                                                   1076 
933 inline G4PhysicsTable* G4VEnergyLossProcess::D << 1077 inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const
934 {                                                 1078 {
935   return theDEDXTable;                         << 1079   return nSCoffRegions;
936 }                                                 1080 }
937                                                   1081 
938 //....oooOO0OOooo........oooOO0OOooo........oo    1082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
939                                                   1083 
940 inline G4PhysicsTable* G4VEnergyLossProcess::D << 1084 inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins)
941 {                                                 1085 {
942   return theDEDXunRestrictedTable;             << 1086   nBins = nbins;
943 }                                                 1087 }
944                                                   1088 
945 //....oooOO0OOooo........oooOO0OOooo........oo    1089 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
946                                                   1090 
947 inline G4PhysicsTable* G4VEnergyLossProcess::I << 1091 inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins)
948 {                                                 1092 {
949   return theIonisationTable;                   << 1093   nBins = nbins;
950 }                                                 1094 }
951                                                   1095 
952 //....oooOO0OOooo........oooOO0OOooo........oo    1096 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
953                                                   1097 
954 inline G4PhysicsTable* G4VEnergyLossProcess::C << 1098 inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins)
955 {                                                 1099 {
956   return theCSDARangeTable;                    << 1100   nBinsCSDA = nbins;
957 }                                                 1101 }
958                                                   1102 
959 //....oooOO0OOooo........oooOO0OOooo........oo    1103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
960                                                   1104 
961 inline G4PhysicsTable* G4VEnergyLossProcess::R << 1105 inline G4double G4VEnergyLossProcess::MinKinEnergy() const
962 {                                                 1106 {
963   return theRangeTableForLoss;                 << 1107   return minKinEnergy;
964 }                                                 1108 }
965                                                   1109 
966 //....oooOO0OOooo........oooOO0OOooo........oo    1110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
967                                                   1111 
968 inline G4PhysicsTable* G4VEnergyLossProcess::I << 1112 inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e)
969 {                                                 1113 {
970   return theInverseRangeTable;                 << 1114   minKinEnergy = e;
971 }                                                 1115 }
972                                                   1116 
973 //....oooOO0OOooo........oooOO0OOooo........oo    1117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
974                                                   1118 
975 inline G4PhysicsTable* G4VEnergyLossProcess::L << 1119 inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e)
976 {                                                 1120 {
977   return theLambdaTable;                       << 1121   maxKinEnergy = e;
                                                   >> 1122   if(e < maxKinEnergyCSDA) maxKinEnergyCSDA = e;
978 }                                                 1123 }
979                                                   1124 
980 //....oooOO0OOooo........oooOO0OOooo........oo    1125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
981                                                   1126 
982 inline G4bool G4VEnergyLossProcess::UseBaseMat << 1127 inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e)
983 {                                                 1128 {
984   return baseMat;                              << 1129   maxKinEnergyCSDA = e;
985 }                                                 1130 }
986                                                   1131 
987 //....oooOO0OOooo........oooOO0OOooo........oo    1132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
988                                                   1133 
989 inline std::vector<G4double>*                  << 1134 inline G4double G4VEnergyLossProcess::MaxKinEnergy() const
990 G4VEnergyLossProcess::EnergyOfCrossSectionMax( << 
991 {                                                 1135 {
992   return theEnergyOfCrossSectionMax;           << 1136   return maxKinEnergy;
993 }                                                 1137 }
994                                                   1138 
995 //....oooOO0OOooo........oooOO0OOooo........oo    1139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
996                                                   1140 
997 inline std::vector<G4TwoPeaksXS*>* G4VEnergyLo << 1141 inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val)
998 {                                                 1142 {
999   return fXSpeaks;                             << 1143   if(val > 0.0 && val <= 1.0) lambdaFactor = val;
1000 }                                                1144 }
1001                                                  1145 
1002 //....oooOO0OOooo........oooOO0OOooo........o    1146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1003                                                  1147 
1004 inline std::size_t G4VEnergyLossProcess::Numb << 1148 inline void G4VEnergyLossProcess::SetIonisation(G4bool val)
1005 {                                                1149 {
1006   return numberOfModels;                      << 1150   isIonisation = val;
                                                   >> 1151   if(val) aGPILSelection = CandidateForSelection;
                                                   >> 1152   else    aGPILSelection = NotCandidateForSelection;
1007 }                                                1153 }
1008                                                  1154 
1009 //....oooOO0OOooo........oooOO0OOooo........o    1155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1010                                                  1156 
1011 inline G4VEmModel* G4VEnergyLossProcess::EmMo << 1157 inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const
1012 {                                                1158 {
1013   return (index < emModels->size()) ? (*emMod << 1159   return isIonisation;
1014 }                                                1160 }
1015                                                  1161 
1016 //....oooOO0OOooo........oooOO0OOooo........o    1162 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1017                                                  1163 
1018 inline G4VEmModel*                            << 1164 void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)
1019 G4VEnergyLossProcess::GetModelByIndex(std::si << 
1020 {                                                1165 {
1021   return modelManager->GetModel((G4int)idx, v << 1166   dRoverRange = v1;
                                                   >> 1167   finalRange = v2;
                                                   >> 1168   if (dRoverRange > 0.999) dRoverRange = 1.0;
                                                   >> 1169   currentCouple = 0;
                                                   >> 1170   mfpKinEnergy  = DBL_MAX;
1022 }                                                1171 }
1023                                                  1172 
1024 //....oooOO0OOooo........oooOO0OOooo........o    1173 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1025                                                  1174 
1026 #endif                                           1175 #endif
1027                                                  1176