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