Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/utils/src/G4LossTableManager.cc

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/src/G4LossTableManager.cc (Version 11.3.0) and /processes/electromagnetic/utils/src/G4LossTableManager.cc (Version 9.6.p2)


  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$
                                                   >>  27 //
 26 // -------------------------------------------     28 // -------------------------------------------------------------------
 27 //                                                 29 //
 28 // GEANT4 Class file                               30 // GEANT4 Class file
 29 //                                                 31 //
 30 //                                                 32 //
 31 // File name:     G4LossTableManager               33 // File name:     G4LossTableManager
 32 //                                                 34 //
 33 // Author:        Vladimir Ivanchenko              35 // Author:        Vladimir Ivanchenko
 34 //                                                 36 //
 35 // Creation date: 03.01.2002                       37 // Creation date: 03.01.2002
 36 //                                                 38 //
 37 // Modifications: by V.Ivanchenko              <<  39 // Modifications:
 38 //                                                 40 //
                                                   >>  41 // 20-01-03 Migrade to cut per region (V.Ivanchenko)
                                                   >>  42 // 15-02-03 Lambda table can be scaled (V.Ivanchenko)
                                                   >>  43 // 17-02-03 Fix problem of store/restore tables (V.Ivanchenko)
                                                   >>  44 // 10-03-03 Add Ion registration (V.Ivanchenko)
                                                   >>  45 // 25-03-03 Add deregistration (V.Ivanchenko)
                                                   >>  46 // 02-04-03 Change messenger (V.Ivanchenko)
                                                   >>  47 // 26-04-03 Fix retrieve tables (V.Ivanchenko)
                                                   >>  48 // 13-05-03 Add calculation of precise range (V.Ivanchenko)
                                                   >>  49 // 23-07-03 Add exchange with G4EnergyLossTables (V.Ivanchenko)
                                                   >>  50 // 05-10-03 Add G4VEmProcesses registration and Verbose command (V.Ivanchenko)
                                                   >>  51 // 17-10-03 Add SetParameters method (V.Ivanchenko)
                                                   >>  52 // 23-10-03 Add control on inactive processes (V.Ivanchenko)
                                                   >>  53 // 04-11-03 Add checks in RetrievePhysicsTable (V.Ivanchenko)
                                                   >>  54 // 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
                                                   >>  55 // 14-01-04 Activate precise range calculation (V.Ivanchenko)
                                                   >>  56 // 10-03-04 Fix a problem of Precise Range table (V.Ivanchenko)
                                                   >>  57 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
                                                   >>  58 // 13-01-04 Fix problem which takes place for inactivate eIoni (V.Ivanchenko)
                                                   >>  59 // 25-01-04 Fix initialisation problem for ions (V.Ivanchenko)
                                                   >>  60 // 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
                                                   >>  61 // 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
                                                   >>  62 // 20-01-06 Introduce G4EmTableType to remove repeating code (VI)
                                                   >>  63 // 23-03-06 Set flag isIonisation (VI)
                                                   >>  64 // 10-05-06 Add methods  SetMscStepLimitation, FacRange and MscFlag (VI)
                                                   >>  65 // 22-05-06 Add methods  Set/Get bremsTh (VI)
                                                   >>  66 // 05-06-06 Do not clear loss_table map between runs (VI)
                                                   >>  67 // 16-01-07 Create new energy loss table for e+,e-,mu+,mu- and 
                                                   >>  68 //          left ionisation table for further usage (VI)
                                                   >>  69 // 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
                                                   >>  70 // 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko)
                                                   >>  71 // 21-02-08 Added G4EmSaturation (V.Ivanchenko)
                                                   >>  72 // 12-04-10 Added PreparePhsyicsTables and BuildPhysicsTables entries (V.Ivanchenko)
 39 //                                                 73 //
 40 // Class Description:                              74 // Class Description:
 41 //                                                 75 //
 42 // -------------------------------------------     76 // -------------------------------------------------------------------
 43 //                                                 77 //
 44 //....oooOO0OOooo........oooOO0OOooo........oo     78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 45 //....oooOO0OOooo........oooOO0OOooo........oo     79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 46                                                    80 
 47 #include "G4LossTableManager.hh"                   81 #include "G4LossTableManager.hh"
 48 #include "G4SystemOfUnits.hh"                      82 #include "G4SystemOfUnits.hh"
 49                                                <<  83 #include "G4EnergyLossMessenger.hh"
 50 #include "G4VMultipleScattering.hh"            << 
 51 #include "G4VEmProcess.hh"                     << 
 52                                                << 
 53 #include "G4EmParameters.hh"                   << 
 54 #include "G4EmSaturation.hh"                   << 
 55 #include "G4EmConfigurator.hh"                 << 
 56 #include "G4ElectronIonPair.hh"                << 
 57 #include "G4NIELCalculator.hh"                 << 
 58 #include "G4EmCorrections.hh"                  << 
 59 #include "G4LossTableBuilder.hh"               << 
 60 #include "G4VAtomDeexcitation.hh"              << 
 61 #include "G4VSubCutProducer.hh"                << 
 62                                                << 
 63 #include "G4PhysicsTable.hh"                       84 #include "G4PhysicsTable.hh"
 64 #include "G4ParticleDefinition.hh"                 85 #include "G4ParticleDefinition.hh"
 65 #include "G4MaterialCutsCouple.hh"                 86 #include "G4MaterialCutsCouple.hh"
 66 #include "G4ProcessManager.hh"                     87 #include "G4ProcessManager.hh"
 67 #include "G4Electron.hh"                           88 #include "G4Electron.hh"
 68 #include "G4Proton.hh"                             89 #include "G4Proton.hh"
                                                   >>  90 #include "G4VMultipleScattering.hh"
                                                   >>  91 #include "G4VEmProcess.hh"
 69 #include "G4ProductionCutsTable.hh"                92 #include "G4ProductionCutsTable.hh"
 70 #include "G4PhysicsTableHelper.hh"                 93 #include "G4PhysicsTableHelper.hh"
                                                   >>  94 #include "G4EmCorrections.hh"
                                                   >>  95 #include "G4EmSaturation.hh"
                                                   >>  96 #include "G4EmConfigurator.hh"
                                                   >>  97 #include "G4ElectronIonPair.hh"
 71 #include "G4EmTableType.hh"                        98 #include "G4EmTableType.hh"
                                                   >>  99 #include "G4LossTableBuilder.hh"
                                                   >> 100 #include "G4VAtomDeexcitation.hh"
 72 #include "G4Region.hh"                            101 #include "G4Region.hh"
 73 #include "G4PhysicalConstants.hh"              << 
 74                                                   102 
 75 #include "G4Gamma.hh"                          << 103 G4LossTableManager* G4LossTableManager::theInstance = 0;
 76 #include "G4Positron.hh"                       << 
 77 #include "G4OpticalPhoton.hh"                  << 
 78 #include "G4Neutron.hh"                        << 
 79 #include "G4MuonPlus.hh"                       << 
 80 #include "G4MuonMinus.hh"                      << 
 81 #include "G4GenericIon.hh"                     << 
 82                                                   104 
 83 //....oooOO0OOooo........oooOO0OOooo........oo    105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
 84                                                   106 
 85 static std::once_flag applyOnce;               << 
 86 G4ThreadLocal G4LossTableManager* G4LossTableM << 
 87                                                << 
 88 G4LossTableManager* G4LossTableManager::Instan    107 G4LossTableManager* G4LossTableManager::Instance()
 89 {                                                 108 {
 90   if(nullptr == instance) {                    << 109   if(0 == theInstance) {
 91     static G4ThreadLocalSingleton<G4LossTableM << 110     static G4LossTableManager manager;
 92     instance = inst.Instance();                << 111     theInstance = &manager;
 93   }                                               112   }
 94   return instance;                             << 113   return theInstance;
 95 }                                                 114 }
 96                                                   115 
 97 //....oooOO0OOooo........oooOO0OOooo........oo    116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
 98                                                   117 
 99 G4LossTableManager::~G4LossTableManager()         118 G4LossTableManager::~G4LossTableManager()
100 {                                                 119 {
101   for (auto const & p : loss_vector) { delete  << 120   for (G4int i=0; i<n_loss; ++i) {
102   for (auto const & p : msc_vector) { delete p << 121     if( loss_vector[i] ) { delete loss_vector[i]; }
103   for (auto const & p : emp_vector) { delete p << 122   }
104   for (auto const & p : p_vector) { delete p;  << 123   size_t msc = msc_vector.size();
105                                                << 124   for (size_t j=0; j<msc; ++j) {
106   std::size_t mod = mod_vector.size();         << 125     if( msc_vector[j] ) { delete msc_vector[j]; }
107   std::size_t fmod = fmod_vector.size();       << 126   }
108   for (std::size_t a=0; a<mod; ++a) {          << 127   size_t emp = emp_vector.size();
109     if( nullptr != mod_vector[a] ) {           << 128   for (size_t k=0; k<emp; ++k) {
110       for (std::size_t b=0; b<fmod; ++b) {     << 129     if( emp_vector[k] ) { delete emp_vector[k]; }
111         if((G4VEmModel*)(fmod_vector[b]) == mo << 130   }
112           fmod_vector[b] = nullptr;            << 131   size_t mod = mod_vector.size();
113         }                                      << 132   for (size_t a=0; a<mod; ++a) {
114       }                                        << 133     if( mod_vector[a] ) { delete mod_vector[a]; }
115       delete mod_vector[a];                    << 134   }
116       mod_vector[a] = nullptr;                 << 135   size_t fmod = fmod_vector.size();
117     }                                          << 136   for (size_t b=0; b<fmod; ++b) {
                                                   >> 137     if( fmod_vector[b] ) { delete fmod_vector[b]; }
118   }                                               138   }
119   for (auto const & p : fmod_vector) { delete  << 
120                                                << 
121   Clear();                                        139   Clear();
                                                   >> 140   delete theMessenger;
122   delete tableBuilder;                            141   delete tableBuilder;
123   delete emCorrections;                           142   delete emCorrections;
                                                   >> 143   delete emSaturation;
124   delete emConfigurator;                          144   delete emConfigurator;
125   delete emElectronIonPair;                       145   delete emElectronIonPair;
126   delete nielCalculator;                       << 
127   delete atomDeexcitation;                        146   delete atomDeexcitation;
128   delete subcutProducer;                       << 
129 }                                                 147 }
130                                                   148 
131 //....oooOO0OOooo........oooOO0OOooo........oo    149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
132                                                   150 
133 G4LossTableManager::G4LossTableManager()          151 G4LossTableManager::G4LossTableManager()
134 {                                                 152 {
135   theParameters = G4EmParameters::Instance();  << 153   n_loss = 0;
136   theElectron = G4Electron::Electron();        << 154   run = 0;
137                                                << 155   startInitialisation = false;
138   // only one thread is the master             << 156   all_tables_are_built = false;
139   std::call_once(applyOnce, [this]() { isMaste << 157   currentLoss = 0;
140   verbose = isMaster ? theParameters->Verbose( << 158   currentParticle = 0;
141                                                << 159   firstParticle = 0;
142   tableBuilder = new G4LossTableBuilder(isMast << 160   lossFluctuationFlag = true;
143   emCorrections = new G4EmCorrections(verbose) << 161   subCutoffFlag = false;
144                                                << 162   rndmStepFlag = false;
145   std::size_t n = 70;                          << 163   minSubRange = 0.0;
146   loss_vector.reserve(n);                      << 164   maxRangeVariation = 1.0;
147   part_vector.reserve(n);                      << 165   maxFinalStep = 0.0;
148   base_part_vector.reserve(n);                 << 166   minKinEnergy = 0.1*keV;
149   dedx_vector.reserve(n);                      << 167   maxKinEnergy = 10.0*TeV;
150   range_vector.reserve(n);                     << 168   nbinsLambda  = 77;
151   inv_range_vector.reserve(n);                 << 169   nbinsPerDecade = 7;
152   tables_are_built.reserve(n);                 << 170   maxKinEnergyForMuons = 10.*TeV;
153   isActive.reserve(n);                         << 171   integral = true;
154   msc_vector.reserve(10);                      << 172   integralActive = false;
155   emp_vector.reserve(16);                      << 173   buildCSDARange = false;
156   mod_vector.reserve(150);                     << 174   minEnergyActive = false;
157   fmod_vector.reserve(60);                     << 175   maxEnergyActive = false;
                                                   >> 176   maxEnergyForMuonsActive = false;
                                                   >> 177   stepFunctionActive = false;
                                                   >> 178   flagLPM = true;
                                                   >> 179   splineFlag = true;
                                                   >> 180   bremsTh = DBL_MAX;
                                                   >> 181   factorForAngleLimit = 1.0;
                                                   >> 182   verbose = 1;
                                                   >> 183   theMessenger = new G4EnergyLossMessenger();
                                                   >> 184   theElectron  = G4Electron::Electron();
                                                   >> 185   tableBuilder = new G4LossTableBuilder();
                                                   >> 186   emCorrections= new G4EmCorrections();
                                                   >> 187   emSaturation = new G4EmSaturation();
                                                   >> 188   emConfigurator = new G4EmConfigurator(verbose);
                                                   >> 189   emElectronIonPair = new G4ElectronIonPair();
                                                   >> 190   tableBuilder->SetSplineFlag(splineFlag);
                                                   >> 191   atomDeexcitation = 0;
158 }                                                 192 }
159                                                   193 
160 //....oooOO0OOooo........oooOO0OOooo........oo    194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
161                                                   195 
162 void G4LossTableManager::Clear()                  196 void G4LossTableManager::Clear()
163 {                                                 197 {
164   all_tables_are_built = false;                   198   all_tables_are_built = false;
165   currentLoss = nullptr;                       << 199   currentLoss = 0;
166   currentParticle = nullptr;                   << 200   currentParticle = 0;
167   if(n_loss) {                                 << 201   if(n_loss)
168     dedx_vector.clear();                       << 202     {
169     range_vector.clear();                      << 203       dedx_vector.clear();
170     inv_range_vector.clear();                  << 204       range_vector.clear();
171     loss_map.clear();                          << 205       inv_range_vector.clear();
172     loss_vector.clear();                       << 206       loss_map.clear();
173     part_vector.clear();                       << 207       loss_vector.clear();
174     base_part_vector.clear();                  << 208       part_vector.clear();
175     tables_are_built.clear();                  << 209       base_part_vector.clear();
176     isActive.clear();                          << 210       tables_are_built.clear();
177     n_loss = 0;                                << 211       isActive.clear();
178   }                                            << 212       n_loss = 0;
                                                   >> 213     }
179 }                                                 214 }
180                                                   215 
181 //....oooOO0OOooo........oooOO0OOooo........oo    216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
182                                                   217 
183 void G4LossTableManager::Register(G4VEnergyLos    218 void G4LossTableManager::Register(G4VEnergyLossProcess* p)
184 {                                                 219 {
185   if (nullptr == p) { return; }                << 220   if(!p) { return; }
186   for (G4int i=0; i<n_loss; ++i) {                221   for (G4int i=0; i<n_loss; ++i) {
187     if(loss_vector[i] == p) { return; }           222     if(loss_vector[i] == p) { return; }
188   }                                               223   }
189   if(verbose > 1) {                               224   if(verbose > 1) {
190     G4cout << "G4LossTableManager::Register G4    225     G4cout << "G4LossTableManager::Register G4VEnergyLossProcess : " 
191            << p->GetProcessName() << "  idx= " << 226      << p->GetProcessName() << "  idx= " << n_loss << G4endl;
192   }                                               227   }
193   ++n_loss;                                       228   ++n_loss;
194   loss_vector.push_back(p);                       229   loss_vector.push_back(p);
195   part_vector.push_back(nullptr);              << 230   part_vector.push_back(0);
196   base_part_vector.push_back(nullptr);         << 231   base_part_vector.push_back(0);
197   dedx_vector.push_back(nullptr);              << 232   dedx_vector.push_back(0);
198   range_vector.push_back(nullptr);             << 233   range_vector.push_back(0);
199   inv_range_vector.push_back(nullptr);         << 234   inv_range_vector.push_back(0);
200   tables_are_built.push_back(false);              235   tables_are_built.push_back(false);
201   isActive.push_back(true);                       236   isActive.push_back(true);
202   all_tables_are_built = false;                   237   all_tables_are_built = false;
203 }                                              << 238   if(!lossFluctuationFlag) { p->SetLossFluctuations(false); }
204                                                << 239   if(subCutoffFlag)        { p->ActivateSubCutoff(true); }
205 //....oooOO0OOooo........oooOO0OOooo........oo << 240   if(rndmStepFlag)         { p->SetRandomStep(true); }
206                                                << 241   if(stepFunctionActive)   { p->SetStepFunction(maxRangeVariation, maxFinalStep); }
207 void G4LossTableManager::ResetParameters()     << 242   if(integralActive)       { p->SetIntegral(integral); }
208 {                                              << 243   if(minEnergyActive)      { p->SetMinKinEnergy(minKinEnergy); }
209   // initialisation once per run               << 244   if(maxEnergyActive)      { p->SetMaxKinEnergy(maxKinEnergy); }
210   if (!resetParam) { return; }                 << 
211   resetParam = false;                          << 
212   startInitialisation = true;                  << 
213   verbose = theParameters->Verbose();          << 
214   if(!isMaster) {                              << 
215     verbose = theParameters->WorkerVerbose();  << 
216   } else {                                     << 
217     if(verbose > 0) { theParameters->Dump(); } << 
218   }                                            << 
219                                                << 
220   tableBuilder->InitialiseBaseMaterials();     << 
221   if (nullptr != nielCalculator) { nielCalcula << 
222                                                << 
223   emCorrections->SetVerbose(verbose);          << 
224   if(nullptr != emConfigurator) { emConfigurat << 
225   if(nullptr != emElectronIonPair) { emElectro << 
226   if(nullptr != atomDeexcitation) {            << 
227     atomDeexcitation->SetVerboseLevel(verbose) << 
228     atomDeexcitation->InitialiseAtomicDeexcita << 
229   }                                            << 
230   if (1 < verbose) {                           << 
231     G4cout << "====== G4LossTableManager::Rese << 
232            << " Nloss=" << loss_vector.size()  << 
233      << " run=" << run << " master=" << isMast << 
234      << G4endl;                                << 
235   }                                            << 
236 }                                                 245 }
237                                                   246 
238 //....oooOO0OOooo........oooOO0OOooo........oo    247 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
239                                                   248 
240 void G4LossTableManager::DeRegister(G4VEnergyL    249 void G4LossTableManager::DeRegister(G4VEnergyLossProcess* p)
241 {                                                 250 {
242   if (nullptr == p) { return; }                << 251   if(!p) { return; }
243   for (G4int i=0; i<n_loss; ++i) {                252   for (G4int i=0; i<n_loss; ++i) {
244     if(loss_vector[i] == p) {                  << 253     if(loss_vector[i] == p) { loss_vector[i] = 0; }
245       loss_vector[i] = nullptr;                << 
246       break;                                   << 
247     }                                          << 
248   }                                               254   }
249 }                                                 255 }
250                                                   256 
251 //....oooOO0OOooo........oooOO0OOooo........oo    257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
252                                                   258 
253 void G4LossTableManager::Register(G4VMultipleS    259 void G4LossTableManager::Register(G4VMultipleScattering* p)
254 {                                                 260 {
255   if (nullptr == p) { return; }                << 261   if(!p) { return; }
256   std::size_t n = msc_vector.size();           << 262   G4int n = msc_vector.size();
257   for (std::size_t i=0; i<n; ++i) {            << 263   for (G4int i=0; i<n; ++i) {
258     if(msc_vector[i] == p) { return; }            264     if(msc_vector[i] == p) { return; }
259   }                                               265   }
260   if(verbose > 1) {                               266   if(verbose > 1) {
261     G4cout << "G4LossTableManager::Register G4    267     G4cout << "G4LossTableManager::Register G4VMultipleScattering : " 
262            << p->GetProcessName() << "  idx= " << 268      << p->GetProcessName() << "  idx= " << msc_vector.size() << G4endl;
263   }                                               269   }
264   msc_vector.push_back(p);                        270   msc_vector.push_back(p);
265 }                                                 271 }
266                                                   272 
267 //....oooOO0OOooo........oooOO0OOooo........oo    273 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
268                                                   274 
269 void G4LossTableManager::DeRegister(G4VMultipl    275 void G4LossTableManager::DeRegister(G4VMultipleScattering* p)
270 {                                                 276 {
271   if (nullptr == p) { return; }                << 277   if(!p) { return; }
272   std::size_t msc = msc_vector.size();         << 278   size_t msc = msc_vector.size();
273   for (std::size_t i=0; i<msc; ++i) {          << 279   for (size_t i=0; i<msc; ++i) {
274     if(msc_vector[i] == p) {                   << 280     if(msc_vector[i] == p) { msc_vector[i] = 0; }
275       msc_vector[i] = nullptr;                 << 
276       break;                                   << 
277     }                                          << 
278   }                                               281   }
279 }                                                 282 }
280                                                   283 
281 //....oooOO0OOooo........oooOO0OOooo........oo    284 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
282                                                   285 
283 void G4LossTableManager::Register(G4VEmProcess    286 void G4LossTableManager::Register(G4VEmProcess* p)
284 {                                                 287 {
285   if (nullptr == p) { return; }                << 288   if(!p) { return; }
286   std::size_t n = emp_vector.size();           << 289   G4int n = emp_vector.size();
287   for (std::size_t i=0; i<n; ++i) {            << 290   for (G4int i=0; i<n; ++i) {
288     if(emp_vector[i] == p) { return; }            291     if(emp_vector[i] == p) { return; }
289   }                                               292   }
290   if(verbose > 1) {                               293   if(verbose > 1) {
291     G4cout << "G4LossTableManager::Register G4    294     G4cout << "G4LossTableManager::Register G4VEmProcess : " 
292            << p->GetProcessName() << "  idx= " << 295      << p->GetProcessName() << "  idx= " << emp_vector.size() << G4endl;
293   }                                               296   }
294   emp_vector.push_back(p);                        297   emp_vector.push_back(p);
295 }                                                 298 }
296                                                   299 
297 //....oooOO0OOooo........oooOO0OOooo........oo    300 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
298                                                   301 
299 void G4LossTableManager::DeRegister(G4VEmProce    302 void G4LossTableManager::DeRegister(G4VEmProcess* p)
300 {                                                 303 {
301   if (nullptr == p) { return; }                << 304   if(!p) { return; }
302   std::size_t emp = emp_vector.size();         << 305   size_t emp = emp_vector.size();
303   for (std::size_t i=0; i<emp; ++i) {          << 306   for (size_t i=0; i<emp; ++i) {
304     if(emp_vector[i] == p) {                   << 307     if(emp_vector[i] == p) { emp_vector[i] = 0; }
305       emp_vector[i] = nullptr;                 << 
306       break;                                   << 
307     }                                          << 
308   }                                            << 
309 }                                              << 
310                                                << 
311 //....oooOO0OOooo........oooOO0OOooo........oo << 
312                                                << 
313 void G4LossTableManager::Register(G4VProcess*  << 
314 {                                              << 
315   if (nullptr == p) { return; }                << 
316   std::size_t n = p_vector.size();             << 
317   for (std::size_t i=0; i<n; ++i) {            << 
318     if(p_vector[i] == p) { return; }           << 
319   }                                            << 
320   if(verbose > 1) {                            << 
321     G4cout << "G4LossTableManager::Register G4 << 
322            << p->GetProcessName() << "  idx= " << 
323   }                                            << 
324   p_vector.push_back(p);                       << 
325 }                                              << 
326                                                << 
327 //....oooOO0OOooo........oooOO0OOooo........oo << 
328                                                << 
329 void G4LossTableManager::DeRegister(G4VProcess << 
330 {                                              << 
331   if (nullptr == p) { return; }                << 
332   std::size_t emp = p_vector.size();           << 
333   for (std::size_t i=0; i<emp; ++i) {          << 
334     if(p_vector[i] == p) {                     << 
335       p_vector[i] = nullptr;                   << 
336       break;                                   << 
337     }                                          << 
338   }                                               308   }
339 }                                                 309 }
340                                                   310 
341 //....oooOO0OOooo........oooOO0OOooo........oo    311 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
342                                                   312 
343 void G4LossTableManager::Register(G4VEmModel*     313 void G4LossTableManager::Register(G4VEmModel* p)
344 {                                                 314 {
345   mod_vector.push_back(p);                        315   mod_vector.push_back(p);
346   if(verbose > 1) {                               316   if(verbose > 1) {
347     G4cout << "G4LossTableManager::Register G4    317     G4cout << "G4LossTableManager::Register G4VEmModel : " 
348            << p->GetName() << "  " << p << "   << 318      << p->GetName() << G4endl;
349   }                                               319   }
350 }                                                 320 }
351                                                   321 
352 //....oooOO0OOooo........oooOO0OOooo........oo    322 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
353                                                   323 
354 void G4LossTableManager::DeRegister(G4VEmModel    324 void G4LossTableManager::DeRegister(G4VEmModel* p)
355 {                                                 325 {
356   //G4cout << "G4LossTableManager::DeRegister  << 326   size_t n = mod_vector.size();
357   std::size_t n = mod_vector.size();           << 327   for (size_t i=0; i<n; ++i) {
358   for (std::size_t i=0; i<n; ++i) {            << 328     if(mod_vector[i] == p) { mod_vector[i] = 0; }
359     if(mod_vector[i] == p) {                   << 
360       mod_vector[i] = nullptr;                 << 
361       break;                                   << 
362     }                                          << 
363   }                                               329   }
364 }                                                 330 }
365                                                   331 
366 //....oooOO0OOooo........oooOO0OOooo........oo    332 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
367                                                   333 
368 void G4LossTableManager::Register(G4VEmFluctua    334 void G4LossTableManager::Register(G4VEmFluctuationModel* p)
369 {                                                 335 {
370   fmod_vector.push_back(p);                       336   fmod_vector.push_back(p);
371   if(verbose > 1) {                               337   if(verbose > 1) {
372     G4cout << "G4LossTableManager::Register G4    338     G4cout << "G4LossTableManager::Register G4VEmFluctuationModel : " 
373            << p->GetName() << "  " << fmod_vec << 339      << p->GetName() << G4endl;
374   }                                               340   }
375 }                                                 341 }
376                                                   342 
377 //....oooOO0OOooo........oooOO0OOooo........oo    343 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
378                                                   344 
379 void G4LossTableManager::DeRegister(G4VEmFluct    345 void G4LossTableManager::DeRegister(G4VEmFluctuationModel* p)
380 {                                                 346 {
381   std::size_t n = fmod_vector.size();          << 347   size_t n = fmod_vector.size();
382   for (std::size_t i=0; i<n; ++i) {            << 348   for (size_t i=0; i<n; ++i) {
383     if(fmod_vector[i] == p) { fmod_vector[i] = << 349     if(fmod_vector[i] == p) { fmod_vector[i] = 0; }
384   }                                               350   }
385 }                                                 351 }
386                                                   352 
387 //....oooOO0OOooo........oooOO0OOooo........oo    353 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
388                                                   354 
                                                   >> 355 void G4LossTableManager::RegisterIon(const G4ParticleDefinition* ion, 
                                                   >> 356              G4VEnergyLossProcess* p)
                                                   >> 357 {
                                                   >> 358   loss_map[ion] = p;
                                                   >> 359 }
                                                   >> 360 
                                                   >> 361 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 362 
389 void G4LossTableManager::RegisterExtraParticle    363 void G4LossTableManager::RegisterExtraParticle(
390      const G4ParticleDefinition* part,            364      const G4ParticleDefinition* part,
391      G4VEnergyLossProcess* p)                     365      G4VEnergyLossProcess* p)
392 {                                                 366 { 
393   if (nullptr == p || nullptr == part) { retur << 367   if(!p || !part) { return; }
394   for (G4int i=0; i<n_loss; ++i) {                368   for (G4int i=0; i<n_loss; ++i) {
395     if(loss_vector[i] == p) { return; }           369     if(loss_vector[i] == p) { return; }
396   }                                               370   }
397   if(verbose > 1) {                               371   if(verbose > 1) {
398     G4cout << "G4LossTableManager::RegisterExt    372     G4cout << "G4LossTableManager::RegisterExtraParticle "
399            << part->GetParticleName() << "  G4 << 373      << part->GetParticleName() << "  G4VEnergyLossProcess : " 
400            << p->GetProcessName() << "  idx= " << 374      << p->GetProcessName() << "  idx= " << n_loss << G4endl;
401   }                                               375   }
402   ++n_loss;                                       376   ++n_loss;
403   loss_vector.push_back(p);                       377   loss_vector.push_back(p);
404   part_vector.push_back(part);                    378   part_vector.push_back(part);
405   base_part_vector.push_back(p->BaseParticle()    379   base_part_vector.push_back(p->BaseParticle());
406   dedx_vector.push_back(nullptr);              << 380   dedx_vector.push_back(0);
407   range_vector.push_back(nullptr);             << 381   range_vector.push_back(0);
408   inv_range_vector.push_back(nullptr);         << 382   inv_range_vector.push_back(0);
409   tables_are_built.push_back(false);              383   tables_are_built.push_back(false);
410   all_tables_are_built = false;                   384   all_tables_are_built = false;
411 }                                                 385 }
412                                                   386 
413 //....oooOO0OOooo........oooOO0OOooo........oo << 
414                                                << 
415 G4VEnergyLossProcess*                          << 
416 G4LossTableManager::GetEnergyLossProcess(const << 
417 {                                              << 
418   if(aParticle != currentParticle) {           << 
419     currentParticle = aParticle;               << 
420     std::map<PD,G4VEnergyLossProcess*,std::les << 
421     if ((pos = loss_map.find(aParticle)) != lo << 
422       currentLoss = (*pos).second;             << 
423     } else {                                   << 
424       currentLoss = nullptr;                   << 
425       if(0.0 != aParticle->GetPDGCharge() &&   << 
426    (pos = loss_map.find(theGenericIon)) != los << 
427   currentLoss = (*pos).second;                 << 
428       }                                        << 
429     }                                          << 
430   }                                            << 
431   return currentLoss;                          << 
432 }                                              << 
433                                                << 
434 //....oooOO0OOooo........oooOO0OOooo........oo    387 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
435                                                   388 
436 void                                              389 void 
437 G4LossTableManager::PreparePhysicsTable(const     390 G4LossTableManager::PreparePhysicsTable(const G4ParticleDefinition* particle,
438                                         G4VEne << 391           G4VEnergyLossProcess* p)
439 {                                                 392 {
440   if (1 < verbose) {                              393   if (1 < verbose) {
441     G4cout << "G4LossTableManager::PreparePhys    394     G4cout << "G4LossTableManager::PreparePhysicsTable for " 
442            << particle->GetParticleName()      << 395      << particle->GetParticleName() 
443            << " and " << p->GetProcessName() < << 396      << " and " << p->GetProcessName() << " run= " << run 
444            << "   loss_vector " << loss_vector << 397      << "   loss_vector " << loss_vector.size() << G4endl;
445      << " run=" << run << " master=" << isMast << 
446      << G4endl;                                << 
447   }                                               398   }
                                                   >> 399   if(!startInitialisation) { tableBuilder->SetInitialisationFlag(false); }
448                                                   400 
449   // start initialisation for the first run       401   // start initialisation for the first run
450   if( -1 == run ) {                            << 402   startInitialisation = true;
451     if (nullptr != emConfigurator) { emConfigu << 403 
                                                   >> 404   if( 0 == run ) {
                                                   >> 405     emConfigurator->PrepareModels(particle, p);
452                                                   406 
453     // initialise particles for given process     407     // initialise particles for given process
454     for (G4int j=0; j<n_loss; ++j) {              408     for (G4int j=0; j<n_loss; ++j) {
455       if (p == loss_vector[j] && nullptr == pa << 409       if (p == loss_vector[j]) {
456         part_vector[j] = particle;             << 410   if (!part_vector[j]) { part_vector[j] = particle; }
457         if (particle->GetParticleName() == "Ge << 
458           theGenericIon = particle;            << 
459         }                                      << 
460       }                                           411       }
461     }                                             412     }
462   }                                               413   }
463   ResetParameters();                           << 
464 }                                                 414 }
465                                                   415 
466 //....oooOO0OOooo........oooOO0OOooo........oo    416 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
467                                                   417 
468 void                                              418 void 
469 G4LossTableManager::PreparePhysicsTable(const     419 G4LossTableManager::PreparePhysicsTable(const G4ParticleDefinition* particle,
470                                         G4VEmP << 420           G4VEmProcess* p)
471 {                                                 421 {
472   if (1 < verbose) {                              422   if (1 < verbose) {
473     G4cout << "G4LossTableManager::PreparePhys    423     G4cout << "G4LossTableManager::PreparePhysicsTable for " 
474            << particle->GetParticleName()      << 424      << particle->GetParticleName() 
475            << " and " << p->GetProcessName()   << 425      << " and " << p->GetProcessName() << G4endl;
476      << " run=" << run << " master=" << isMast << 
477      << G4endl;                                << 
478   }                                               426   }
                                                   >> 427   if(!startInitialisation) { tableBuilder->SetInitialisationFlag(false); }
479                                                   428 
480   // start initialisation for the first run       429   // start initialisation for the first run
481   if( -1 == run ) {                            << 430   if( 0 == run ) {
482     if (nullptr != emConfigurator) { emConfigu << 431     emConfigurator->PrepareModels(particle, p);
483   }                                               432   }
484                                                << 433   startInitialisation = true;
485   ResetParameters();                           << 
486 }                                                 434 }
487                                                   435 
488 //....oooOO0OOooo........oooOO0OOooo........oo    436 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
489                                                   437 
490 void                                              438 void 
491 G4LossTableManager::PreparePhysicsTable(const     439 G4LossTableManager::PreparePhysicsTable(const G4ParticleDefinition* particle,
492                                         G4VMul << 440           G4VMultipleScattering* p)
493 {                                                 441 {
494   if (1 < verbose) {                              442   if (1 < verbose) {
495     G4cout << "G4LossTableManager::PreparePhys    443     G4cout << "G4LossTableManager::PreparePhysicsTable for " 
496            << particle->GetParticleName()      << 444      << particle->GetParticleName() 
497            << " and " << p->GetProcessName()   << 445      << " and " << p->GetProcessName() << G4endl;
498      << " run=" << run << " master=" << isMast << 
499      << G4endl;                                << 
500   }                                               446   }
                                                   >> 447   if(!startInitialisation) { tableBuilder->SetInitialisationFlag(false); }
501                                                   448 
502   // start initialisation for the first run       449   // start initialisation for the first run
503   if ( -1 == run ) {                           << 450   if( 0 == run ) {
504     if (nullptr != emConfigurator) { emConfigu << 451     emConfigurator->PrepareModels(particle, p);
505   }                                               452   } 
506                                                << 
507   ResetParameters();                           << 
508 }                                                 453 }
509                                                   454 
510 //....oooOO0OOooo........oooOO0OOooo........oo    455 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
511                                                   456 
512 void                                              457 void 
513 G4LossTableManager::BuildPhysicsTable(const G4    458 G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition*)
514 {                                                 459 {
515   if(-1 == run && startInitialisation) {       << 460   if(0 == run && startInitialisation) {
516     if (nullptr != emConfigurator) { emConfigu << 461     emConfigurator->Clear();
517   }                                            << 
518   if (startInitialisation) { resetParam = true << 
519 }                                              << 
520                                                << 
521 //....oooOO0OOooo........oooOO0OOooo........oo << 
522                                                << 
523 void G4LossTableManager::LocalPhysicsTables(   << 
524      const G4ParticleDefinition* aParticle,    << 
525      G4VEnergyLossProcess* p)                  << 
526 {                                              << 
527   if (1 < verbose) {                           << 
528     G4cout << "### G4LossTableManager::LocalPh << 
529            << aParticle->GetParticleName()     << 
530            << " and process " << p->GetProcess << 
531            << G4endl;                          << 
532   }                                            << 
533                                                << 
534   if(-1 == run && startInitialisation) {       << 
535     if (nullptr != emConfigurator) { emConfigu << 
536     firstParticle = aParticle;                 << 
537   }                                            << 
538                                                << 
539   if (startInitialisation) {                   << 
540     ++run;                                     << 
541     if (1 < verbose) {                         << 
542       G4cout << "===== G4LossTableManager::Loc << 
543              << run << " =====" << G4endl;     << 
544     }                                          << 
545     currentParticle = nullptr;                 << 
546     startInitialisation = false;               << 
547     resetParam = true;                         << 
548     for (G4int i=0; i<n_loss; ++i) {           << 
549       if (nullptr != loss_vector[i]) {         << 
550         tables_are_built[i] = false;           << 
551       } else {                                 << 
552         tables_are_built[i] = true;            << 
553         part_vector[i] = nullptr;              << 
554       }                                        << 
555     }                                          << 
556   }                                            << 
557                                                << 
558   all_tables_are_built= true;                  << 
559   for (G4int i=0; i<n_loss; ++i) {             << 
560     if(p == loss_vector[i]) {                  << 
561       tables_are_built[i] = true;              << 
562       isActive[i] = true;                      << 
563       part_vector[i] = p->Particle();          << 
564       base_part_vector[i] = p->BaseParticle(); << 
565       dedx_vector[i] = p->DEDXTable();         << 
566       range_vector[i] = p->RangeTableForLoss() << 
567       inv_range_vector[i] = p->InverseRangeTab << 
568       if(0 == run && p->IsIonisationProcess()) << 
569         loss_map[part_vector[i]] = p;          << 
570       }                                        << 
571                                                << 
572       if(1 < verbose) {                        << 
573         G4cout << i <<".   "<< p->GetProcessNa << 
574         if(part_vector[i]) {                   << 
575           G4cout << "  for "  << part_vector[i << 
576         }                                      << 
577         G4cout << "  active= " << isActive[i]  << 
578                << "  table= " << tables_are_bu << 
579                << "  isIonisation= " << p->IsI << 
580                << G4endl;                      << 
581       }                                        << 
582       break;                                   << 
583     } else if(!tables_are_built[i]) {          << 
584       all_tables_are_built = false;            << 
585     }                                          << 
586   }                                            << 
587                                                << 
588   if(1 < verbose) {                            << 
589     G4cout << "### G4LossTableManager::LocalPh << 
590            << G4endl;                          << 
591   }                                            << 
592   if(all_tables_are_built) {                   << 
593     if(1 < verbose) {                          << 
594       G4cout << "%%%%% All dEdx and Range tabl << 
595              << run << " %%%%%" << G4endl;     << 
596     }                                          << 
597   }                                               462   }
598 }                                                 463 }
599                                                   464 
600 //....oooOO0OOooo........oooOO0OOooo........oo    465 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
601                                                   466 
602 void G4LossTableManager::BuildPhysicsTable(       467 void G4LossTableManager::BuildPhysicsTable(
603      const G4ParticleDefinition* aParticle,       468      const G4ParticleDefinition* aParticle,
604      G4VEnergyLossProcess* p)                     469      G4VEnergyLossProcess* p)
605 {                                                 470 {
606   if(1 < verbose) {                               471   if(1 < verbose) {
607     G4cout << "### G4LossTableManager::BuildPh << 472     G4cout << "### G4LossTableManager::BuildDEDXTable() is requested for "
608            << aParticle->GetParticleName()        473            << aParticle->GetParticleName()
609            << " and process " << p->GetProcess << 474      << " and process " << p->GetProcessName() << G4endl;
610   }                                               475   }
611   // clear configurator                           476   // clear configurator
612   if(-1 == run && startInitialisation) {       << 477   if(0 == run && startInitialisation) {
613     if( nullptr != emConfigurator) { emConfigu << 478     emConfigurator->Clear();
614     firstParticle = aParticle;                    479     firstParticle = aParticle; 
615   }                                               480   }
616   if(startInitialisation) {                    << 481   if(startInitialisation && atomDeexcitation) {
617     ++run;                                     << 482     atomDeexcitation->InitialiseAtomicDeexcitation();
618     resetParam = true;                         << 483   }
619     startInitialisation = false;               << 484   startInitialisation = false;
                                                   >> 485 
                                                   >> 486   // initialisation before any table is built
                                                   >> 487   if ( aParticle == firstParticle ) {
                                                   >> 488     all_tables_are_built = true;
                                                   >> 489 
620     if(1 < verbose) {                             490     if(1 < verbose) {
621       G4cout << "===== G4LossTableManager::Bui << 491       G4cout << "### G4LossTableManager start initilisation for first particle "
622              << run << " ===== " << atomDeexci << 492        << firstParticle->GetParticleName() 
                                                   >> 493        << G4endl;
623     }                                             494     }
624     currentParticle = nullptr;                 << 
625     all_tables_are_built = false;              << 
626                                                << 
627     for (G4int i=0; i<n_loss; ++i) {              495     for (G4int i=0; i<n_loss; ++i) {
628       G4VEnergyLossProcess* el = loss_vector[i    496       G4VEnergyLossProcess* el = loss_vector[i];
629                                                   497 
630       if(nullptr != el) {                      << 498       if(el) {
631         isActive[i] = true;                    << 499   const G4ProcessManager* pm = el->GetProcessManager();
632         part_vector[i] = el->Particle();       << 500         isActive[i] = false;
633         base_part_vector[i] = el->BaseParticle << 501         if(pm) { isActive[i] = pm->GetProcessActivation(el); }
634         tables_are_built[i] = false;           << 502         if(0 == run) { base_part_vector[i] = el->BaseParticle(); }
635         if(1 < verbose) {                      << 503         tables_are_built[i] = false;
636           G4cout << i <<".   "<< el->GetProces << 504   all_tables_are_built= false;
                                                   >> 505         if(!isActive[i]) { el->SetIonisation(false); }
                                                   >> 506   
                                                   >> 507   if(1 < verbose) { 
                                                   >> 508     G4cout << i <<".   "<< el->GetProcessName();
637           if(el->Particle()) {                    509           if(el->Particle()) {
638             G4cout << "  for "  << el->Particl << 510       G4cout << "  for "  << el->Particle()->GetParticleName();
639           }                                    << 511     }
640           G4cout << "  active= " << isActive[i << 512     G4cout << "  active= " << isActive[i]
641                  << "  table= " << tables_are_    513                  << "  table= " << tables_are_built[i]
642                  << "  isIonisation= " << el-> << 514      << "  isIonisation= " << el->IsIonisationProcess();
643           if(base_part_vector[i]) {            << 515     if(base_part_vector[i]) { 
644             G4cout << "  base particle "       << 516       G4cout << "  base particle " << base_part_vector[i]->GetParticleName();
645                    << base_part_vector[i]->Get << 517     }
646           }                                    << 518     G4cout << G4endl;
647           G4cout << G4endl;                    << 519   }
648         }                                      << 
649       } else {                                    520       } else {
650         tables_are_built[i] = true;               521         tables_are_built[i] = true;
651         part_vector[i] = nullptr;              << 522         part_vector[i] = 0;
652         isActive[i] = false;                   << 
653       }                                           523       }
654     }                                             524     }
                                                   >> 525     ++run;
                                                   >> 526     currentParticle = 0;
655   }                                               527   }
656                                                   528 
657   if (all_tables_are_built) {                  << 529   // Set run time parameters 
658     theParameters->SetIsPrintedFlag(true);     << 530   SetParameters(aParticle, p);
659     return;                                    << 531 
660   }                                            << 532   if (all_tables_are_built) { return; }
661                                                   533 
662   // Build tables for given particle              534   // Build tables for given particle
663   all_tables_are_built = true;                    535   all_tables_are_built = true;
664                                                   536 
665   for(G4int i=0; i<n_loss; ++i) {                 537   for(G4int i=0; i<n_loss; ++i) {
666     if(p == loss_vector[i] && !tables_are_buil << 538     if(p == loss_vector[i] && !tables_are_built[i] && !base_part_vector[i]) {
667       const G4ParticleDefinition* curr_part =     539       const G4ParticleDefinition* curr_part = part_vector[i];
668       if(1 < verbose) {                           540       if(1 < verbose) {
669         G4cout << "### Build Table for " << p- << 541         G4cout << "### BuildPhysicsTable for " << p->GetProcessName()
670                << " and " << curr_part->GetPar << 542                << " and " << curr_part->GetParticleName()
671                << "  " << tables_are_built[i]  << 543                << " start BuildTable " << G4endl;
672                << G4endl;                      << 
673       }                                           544       }
674       G4VEnergyLossProcess* curr_proc = BuildT    545       G4VEnergyLossProcess* curr_proc = BuildTables(curr_part);
675       if(curr_proc) {                          << 546       if(curr_proc) { CopyTables(curr_part, curr_proc); }
676         CopyTables(curr_part, curr_proc);      << 
677         if(p == curr_proc && 0 == run && p->Is << 
678           loss_map[aParticle] = p;             << 
679           //G4cout << "G4LossTableManager::Bui << 
680           //     << aParticle->GetParticleName << 
681           //         << " added to map " << p  << 
682         }                                      << 
683       }                                        << 
684     }                                             547     }
685     if ( !tables_are_built[i] ) { all_tables_a    548     if ( !tables_are_built[i] ) { all_tables_are_built = false; }
686   }                                               549   }
                                                   >> 550 
687   if(1 < verbose) {                               551   if(1 < verbose) {
688     G4cout << "### G4LossTableManager::BuildPh << 552     G4cout << "### G4LossTableManager::BuildDEDXTable end: "
689            << "all_tables_are_built= " << all_ << 553            << "all_tables_are_built= " << all_tables_are_built
690            << aParticle->GetParticleName() <<  << 554            << G4endl;
                                                   >> 555     
                                                   >> 556     if(all_tables_are_built) {
                                                   >> 557       G4cout << "### All dEdx and Range tables are built #####" << G4endl;
                                                   >> 558     }
691   }                                               559   }
692 }                                                 560 }
693                                                   561 
694 //....oooOO0OOooo........oooOO0OOooo........oo    562 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
695                                                   563 
696 void G4LossTableManager::CopyTables(const G4Pa    564 void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
697                                     G4VEnergyL << 565                                           G4VEnergyLossProcess* base_proc)
698 {                                                 566 {
699   for (G4int j=0; j<n_loss; ++j) {                567   for (G4int j=0; j<n_loss; ++j) {
700                                                   568 
701     G4VEnergyLossProcess* proc = loss_vector[j    569     G4VEnergyLossProcess* proc = loss_vector[j];
                                                   >> 570     //if(proc == base_proc || proc->Particle() == part) 
                                                   >> 571     //  tables_are_built[j] = true;
702                                                   572 
703     if (!tables_are_built[j] && part == base_p    573     if (!tables_are_built[j] && part == base_part_vector[j]) {
704       tables_are_built[j] = true;                 574       tables_are_built[j] = true;
705       // for base particle approach only ionis << 575       proc->SetDEDXTable(base_proc->DEDXTable(),fRestricted);
706       proc->SetDEDXTable(base_proc->Ionisation << 576       proc->SetDEDXTable(base_proc->DEDXTableForSubsec(),fSubRestricted);
707       proc->SetDEDXTable(base_proc->DEDXunRest    577       proc->SetDEDXTable(base_proc->DEDXunRestrictedTable(),fTotal);
708       proc->SetCSDARangeTable(base_proc->CSDAR    578       proc->SetCSDARangeTable(base_proc->CSDARangeTable());
709       proc->SetRangeTableForLoss(base_proc->Ra    579       proc->SetRangeTableForLoss(base_proc->RangeTableForLoss());
710       proc->SetInverseRangeTable(base_proc->In    580       proc->SetInverseRangeTable(base_proc->InverseRangeTable());
711       proc->SetLambdaTable(base_proc->LambdaTa    581       proc->SetLambdaTable(base_proc->LambdaTable());
712       if(proc->IsIonisationProcess()) {        << 582       proc->SetSubLambdaTable(base_proc->SubLambdaTable());
713         range_vector[j] = base_proc->RangeTabl << 583       proc->SetIonisation(base_proc->IsIonisationProcess());
714         inv_range_vector[j] = base_proc->Inver << 584       loss_map[part_vector[j]] = proc;
715         loss_map[part_vector[j]] = proc;       << 
716         //G4cout << "G4LossTableManager::CopyT << 
717         //       << part_vector[j]->GetParticl << 
718         //       << " added to map " << proc < << 
719       }                                        << 
720       if (1 < verbose) {                          585       if (1 < verbose) {
721          G4cout << "   CopyTables for " << pro << 586          G4cout << "For " << proc->GetProcessName()
722                 << " for " << part_vector[j]->    587                 << " for " << part_vector[j]->GetParticleName()
723                 << " base_part= " << part->Get    588                 << " base_part= " << part->GetParticleName()
724                 << " tables are assigned"      << 589                 << " tables are assigned "
725                 << G4endl;                        590                 << G4endl;
726       }                                           591       }
727     }                                             592     }
                                                   >> 593 
                                                   >> 594     if (theElectron == part && theElectron == proc->SecondaryParticle() ) {
                                                   >> 595       proc->SetSecondaryRangeTable(base_proc->RangeTableForLoss());
                                                   >> 596     }
728   }                                               597   }
729 }                                                 598 }
730                                                   599 
731 //....oooOO0OOooo........oooOO0OOooo........oo    600 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
732                                                   601 
733 G4VEnergyLossProcess* G4LossTableManager::Buil    602 G4VEnergyLossProcess* G4LossTableManager::BuildTables(
734                       const G4ParticleDefiniti    603                       const G4ParticleDefinition* aParticle)
735 {                                                 604 {
736   if(1 < verbose) {                               605   if(1 < verbose) {
737     G4cout << "   G4LossTableManager::BuildTab << 606     G4cout << "G4LossTableManager::BuildTables() for "
738            << aParticle->GetParticleName() <<     607            << aParticle->GetParticleName() << G4endl;
739   }                                               608   }
740                                                   609 
741   std::vector<G4PhysicsTable*> t_list;            610   std::vector<G4PhysicsTable*> t_list;  
742   std::vector<G4VEnergyLossProcess*> loss_list    611   std::vector<G4VEnergyLossProcess*> loss_list;
743   std::vector<G4bool> build_flags;             << 612   loss_list.clear();
744   G4VEnergyLossProcess* em = nullptr;          << 613   G4VEnergyLossProcess* em = 0;
745   G4VEnergyLossProcess* p = nullptr;           << 614   G4VEnergyLossProcess* p = 0;
746   G4int iem = 0;                                  615   G4int iem = 0;
747   G4PhysicsTable* dedx = nullptr;              << 616   G4PhysicsTable* dedx = 0;
748   G4int i;                                        617   G4int i;
749                                                   618 
750   G4ProcessVector* pvec =                      << 
751     aParticle->GetProcessManager()->GetProcess << 
752   G4int nvec = (G4int)pvec->size();            << 
753                                                << 
754   for (i=0; i<n_loss; ++i) {                      619   for (i=0; i<n_loss; ++i) {
755     p = loss_vector[i];                           620     p = loss_vector[i];
756     if (nullptr != p) {                        << 621     if (p && aParticle == part_vector[i] && !tables_are_built[i]) {
757       G4bool yes = (aParticle == part_vector[i << 622       if ((p->IsIonisationProcess() && isActive[i]) || 
758                                                << 623     !em || (em && !isActive[iem]) ) {
759       // possible case of process sharing betw << 624         em = p;
760       if(!yes) {                               << 625         iem= i;
761         auto ptr = static_cast<G4VProcess*>(p) << 
762         for(G4int j=0; j<nvec; ++j) {          << 
763           //G4cout << "j= " << j << " " << (*p << 
764           if(ptr == (*pvec)[j]) {              << 
765             yes = true;                        << 
766             break;                             << 
767           }                                    << 
768         }                                      << 
769       }                                        << 
770       // process belong to this particle       << 
771       if(yes && isActive[i]) {                 << 
772         if (p->IsIonisationProcess() || !em) { << 
773           em = p;                              << 
774           iem= i;                              << 
775         }                                      << 
776         // tables may be shared between partic << 
777         G4bool val = false;                    << 
778         if (!tables_are_built[i]) {            << 
779           val = true;                          << 
780           dedx = p->BuildDEDXTable(fRestricted << 
781           //G4cout << "===Build DEDX table for << 
782           // << " idx= " << i << " dedx:" << d << 
783           p->SetDEDXTable(dedx,fRestricted);   << 
784           tables_are_built[i] = true;          << 
785         } else {                               << 
786           dedx = p->DEDXTable();               << 
787         }                                      << 
788         t_list.push_back(dedx);                << 
789         loss_list.push_back(p);                << 
790         build_flags.push_back(val);            << 
791       }                                           626       }
                                                   >> 627       dedx = p->BuildDEDXTable(fRestricted);
                                                   >> 628       //      G4cout << "Build DEDX table for " << aParticle->GetParticleName()
                                                   >> 629       //       << "  " << dedx << " " << dedx->length() << G4endl;
                                                   >> 630       p->SetDEDXTable(dedx,fRestricted); 
                                                   >> 631       t_list.push_back(dedx);
                                                   >> 632       loss_list.push_back(p);
                                                   >> 633       tables_are_built[i] = true;
792     }                                             634     }
793   }                                               635   }
794                                                   636 
795   G4int n_dedx = (G4int)t_list.size();         << 637   G4int n_dedx = t_list.size();
796   if (0 == n_dedx || !em) {                       638   if (0 == n_dedx || !em) {
797     G4cout << "G4LossTableManager WARNING: no     639     G4cout << "G4LossTableManager WARNING: no DEDX processes for " 
798            << aParticle->GetParticleName() <<  << 640      << aParticle->GetParticleName() << G4endl;
799     return nullptr;                            << 641     return 0;
800   }                                               642   }
801   G4int nSubRegions = em->NumberOfSubCutoffReg    643   G4int nSubRegions = em->NumberOfSubCutoffRegions();
802                                                   644 
803   if (1 < verbose) {                              645   if (1 < verbose) {
804     G4cout << "     Start to build the sum of  << 646     G4cout << "G4LossTableManager::BuildTables() start to build range tables"
                                                   >> 647            << " and the sum of " << n_dedx << " processes"
805            << " iem= " << iem << " em= " << em    648            << " iem= " << iem << " em= " << em->GetProcessName()
806            << " buildCSDARange= " << theParame << 649            << " buildCSDARange= " << buildCSDARange
807            << " nSubRegions= " << nSubRegions; << 650      << " nSubRegions= " << nSubRegions
808     if(subcutProducer) {                       << 651      << G4endl;
809       G4cout << " SubCutProducer " << subcutPr << 
810     }                                          << 
811     G4cout << G4endl;                          << 
812   }                                               652   }
813   // do not build tables if producer class is  << 
814   if(subcutProducer) { nSubRegions = 0; }      << 
815                                                << 
816   dedx = em->DEDXTable();                      << 
817   em->SetDEDXTable(dedx, fIsIonisation);       << 
818                                                   653 
                                                   >> 654   dedx = em->IonisationTable();
819   if (1 < n_dedx) {                               655   if (1 < n_dedx) {
820     dedx = nullptr;                            << 656     em->SetDEDXTable(dedx, fIsIonisation);
821     dedx = G4PhysicsTableHelper::PreparePhysic << 657     dedx = 0;
                                                   >> 658     dedx  = G4PhysicsTableHelper::PreparePhysicsTable(dedx);
822     tableBuilder->BuildDEDXTable(dedx, t_list)    659     tableBuilder->BuildDEDXTable(dedx, t_list);
823     em->SetDEDXTable(dedx, fRestricted);          660     em->SetDEDXTable(dedx, fRestricted);
824   }                                               661   }
825                                                << 
826   dedx_vector[iem] = dedx;                        662   dedx_vector[iem] = dedx;
827                                                   663 
828   G4PhysicsTable* range = em->RangeTableForLos    664   G4PhysicsTable* range = em->RangeTableForLoss();
829   if(!range) range  = G4PhysicsTableHelper::Pr    665   if(!range) range  = G4PhysicsTableHelper::PreparePhysicsTable(range);
830   range_vector[iem] = range;                      666   range_vector[iem] = range;
831                                                   667 
832   G4PhysicsTable* invrange = em->InverseRangeT    668   G4PhysicsTable* invrange = em->InverseRangeTable();
833   if(!invrange) invrange = G4PhysicsTableHelpe    669   if(!invrange) invrange = G4PhysicsTableHelper::PreparePhysicsTable(invrange);
834   inv_range_vector[iem]  = invrange;              670   inv_range_vector[iem]  = invrange;
835                                                   671 
836   tableBuilder->BuildRangeTable(dedx, range);  << 672   G4bool flag = em->IsIonisationProcess();
837   tableBuilder->BuildInverseRangeTable(range,  << 673   tableBuilder->BuildRangeTable(dedx, range, flag);
                                                   >> 674   tableBuilder->BuildInverseRangeTable(range, invrange, flag);
                                                   >> 675 
                                                   >> 676   //  if(1<verbose) G4cout << *dedx << G4endl;
838                                                   677 
839   em->SetRangeTableForLoss(range);                678   em->SetRangeTableForLoss(range);
840   em->SetInverseRangeTable(invrange);             679   em->SetInverseRangeTable(invrange);
841                                                   680 
                                                   >> 681   //  if(1<verbose) G4cout << *range << G4endl;
                                                   >> 682 
                                                   >> 683   std::vector<G4PhysicsTable*> listSub;
842   std::vector<G4PhysicsTable*> listCSDA;          684   std::vector<G4PhysicsTable*> listCSDA;
843                                                   685 
844   for (i=0; i<n_dedx; ++i) {                      686   for (i=0; i<n_dedx; ++i) {
845     p = loss_list[i];                             687     p = loss_list[i];
846     if(build_flags[i]) {                       << 688     p->SetIonisation(false);
847       p->SetLambdaTable(p->BuildLambdaTable(fR << 689     p->SetLambdaTable(p->BuildLambdaTable(fRestricted));
                                                   >> 690     if (0 < nSubRegions) {
                                                   >> 691       dedx = p->BuildDEDXTable(fSubRestricted);
                                                   >> 692       p->SetDEDXTable(dedx,fSubRestricted);
                                                   >> 693       listSub.push_back(dedx);
                                                   >> 694       p->SetSubLambdaTable(p->BuildLambdaTable(fSubRestricted));
                                                   >> 695       if(p != em) em->AddCollaborativeProcess(p);
848     }                                             696     }
849     if(theParameters->BuildCSDARange()) {      << 697     if(buildCSDARange) { 
850       dedx = p->BuildDEDXTable(fTotal);           698       dedx = p->BuildDEDXTable(fTotal);
851       p->SetDEDXTable(dedx,fTotal);               699       p->SetDEDXTable(dedx,fTotal);
852       listCSDA.push_back(dedx);                   700       listCSDA.push_back(dedx); 
853     }                                             701     }     
854   }                                               702   }
855                                                   703 
856   if(theParameters->BuildCSDARange()) {        << 704   if (0 < nSubRegions) {
                                                   >> 705     G4PhysicsTable* dedxSub = em->IonisationTableForSubsec();
                                                   >> 706     if (1 < listSub.size()) {
                                                   >> 707       em->SetDEDXTable(dedxSub, fIsSubIonisation);
                                                   >> 708       dedxSub = 0;
                                                   >> 709       dedxSub = G4PhysicsTableHelper::PreparePhysicsTable(dedxSub);
                                                   >> 710       tableBuilder->BuildDEDXTable(dedxSub, listSub);
                                                   >> 711       em->SetDEDXTable(dedxSub, fSubRestricted);
                                                   >> 712     }
                                                   >> 713   }
                                                   >> 714   if(buildCSDARange) {
857     G4PhysicsTable* dedxCSDA = em->DEDXunRestr    715     G4PhysicsTable* dedxCSDA = em->DEDXunRestrictedTable();
858     if (1 < n_dedx) {                             716     if (1 < n_dedx) {
859       dedxCSDA = G4PhysicsTableHelper::Prepare << 717       dedxCSDA = 0;
                                                   >> 718       dedxCSDA  = G4PhysicsTableHelper::PreparePhysicsTable(dedxCSDA);
860       tableBuilder->BuildDEDXTable(dedxCSDA, l    719       tableBuilder->BuildDEDXTable(dedxCSDA, listCSDA);
861       em->SetDEDXTable(dedxCSDA,fTotal);          720       em->SetDEDXTable(dedxCSDA,fTotal);
862     }                                             721     }
863     G4PhysicsTable* rCSDA = em->CSDARangeTable    722     G4PhysicsTable* rCSDA = em->CSDARangeTable();
864     if(!rCSDA) { rCSDA = G4PhysicsTableHelper: << 723     if(!rCSDA) rCSDA = G4PhysicsTableHelper::PreparePhysicsTable(rCSDA);
865     tableBuilder->BuildRangeTable(dedxCSDA, rC << 724     tableBuilder->BuildRangeTable(dedxCSDA, rCSDA, flag);
866     em->SetCSDARangeTable(rCSDA);                 725     em->SetCSDARangeTable(rCSDA);
867   }                                               726   }
868                                                   727 
                                                   >> 728   em->SetIonisation(true);
                                                   >> 729   loss_map[aParticle] = em;
                                                   >> 730 
869   if (1 < verbose) {                              731   if (1 < verbose) {
870     G4cout << "G4LossTableManager::BuildTables    732     G4cout << "G4LossTableManager::BuildTables: Tables are built for "
871            << aParticle->GetParticleName()        733            << aParticle->GetParticleName()
872            << "; ionisation process: " << em-> << 734      << "; ionisation process: " << em->GetProcessName()
873            << "  " << em                       << 
874            << G4endl;                             735            << G4endl;
875   }                                               736   }
876   return em;                                      737   return em;
877 }                                                 738 }
878                                                   739 
879 //....oooOO0OOooo........oooOO0OOooo........oo    740 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
880                                                   741 
                                                   >> 742 G4EnergyLossMessenger* G4LossTableManager::GetMessenger()
                                                   >> 743 {
                                                   >> 744   return theMessenger;
                                                   >> 745 }
                                                   >> 746 
                                                   >> 747 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 748 
881 void G4LossTableManager::ParticleHaveNoLoss(      749 void G4LossTableManager::ParticleHaveNoLoss(
882      const G4ParticleDefinition* aParticle)       750      const G4ParticleDefinition* aParticle)
883 {                                                 751 {
884   G4ExceptionDescription ed;                      752   G4ExceptionDescription ed;
885   ed << "Energy loss process not found for " <    753   ed << "Energy loss process not found for " << aParticle->GetParticleName() 
886      << " !";                                  << 754      << " !" << G4endl;
887   G4Exception("G4LossTableManager::ParticleHav    755   G4Exception("G4LossTableManager::ParticleHaveNoLoss", "em0001",
888               FatalException, ed);             << 756         FatalException, ed);
                                                   >> 757 
                                                   >> 758 }
                                                   >> 759 
                                                   >> 760 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 761 
                                                   >> 762 G4bool G4LossTableManager::BuildCSDARange() const
                                                   >> 763 {
                                                   >> 764   return buildCSDARange;
                                                   >> 765 }
                                                   >> 766 
                                                   >> 767 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 768 
                                                   >> 769 void G4LossTableManager::SetLossFluctuations(G4bool val)
                                                   >> 770 {
                                                   >> 771   lossFluctuationFlag = val;
                                                   >> 772   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 773     if(loss_vector[i]) { loss_vector[i]->SetLossFluctuations(val); }
                                                   >> 774   }
                                                   >> 775 }
                                                   >> 776 
                                                   >> 777 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 778 
                                                   >> 779 void G4LossTableManager::SetSubCutoff(G4bool val, const G4Region* r)
                                                   >> 780 {
                                                   >> 781   subCutoffFlag = val;
                                                   >> 782   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 783     if(loss_vector[i]) { loss_vector[i]->ActivateSubCutoff(val, r); }
                                                   >> 784   }
                                                   >> 785 }
                                                   >> 786 
                                                   >> 787 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 788 
                                                   >> 789 void G4LossTableManager::SetIntegral(G4bool val)
                                                   >> 790 {
                                                   >> 791   integral = val;
                                                   >> 792   integralActive = true;
                                                   >> 793   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 794     if(loss_vector[i]) { loss_vector[i]->SetIntegral(val); }
                                                   >> 795   }
                                                   >> 796   size_t emp = emp_vector.size();
                                                   >> 797   for (size_t k=0; k<emp; ++k) {
                                                   >> 798     if(emp_vector[k]) { emp_vector[k]->SetIntegral(val); }
                                                   >> 799   }
                                                   >> 800 }
                                                   >> 801 
                                                   >> 802 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 803 
                                                   >> 804 void G4LossTableManager::SetMinSubRange(G4double val)
                                                   >> 805 {
                                                   >> 806   minSubRange = val;
                                                   >> 807   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 808     if(loss_vector[i]) { loss_vector[i]->SetMinSubRange(val); }
                                                   >> 809   }
                                                   >> 810 }
                                                   >> 811 
                                                   >> 812 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 813 
                                                   >> 814 void G4LossTableManager::SetRandomStep(G4bool val)
                                                   >> 815 {
                                                   >> 816   rndmStepFlag = val;
                                                   >> 817   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 818     if(loss_vector[i]) { loss_vector[i]->SetRandomStep(val); }
                                                   >> 819   }
                                                   >> 820 }
                                                   >> 821 
                                                   >> 822 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 823 
                                                   >> 824 void G4LossTableManager::SetMinEnergy(G4double val)
                                                   >> 825 {
                                                   >> 826   minEnergyActive = true;
                                                   >> 827   minKinEnergy = val;
                                                   >> 828   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 829     if(loss_vector[i]) { loss_vector[i]->SetMinKinEnergy(val); }
                                                   >> 830   }
                                                   >> 831   size_t emp = emp_vector.size();
                                                   >> 832   for (size_t k=0; k<emp; ++k) {
                                                   >> 833     if(emp_vector[k]) { emp_vector[k]->SetMinKinEnergy(val); }
                                                   >> 834   }
                                                   >> 835 }
                                                   >> 836 
                                                   >> 837 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 838 
                                                   >> 839 void G4LossTableManager::SetMaxEnergy(G4double val)
                                                   >> 840 {
                                                   >> 841   maxEnergyActive = true;
                                                   >> 842   maxKinEnergy = val;
                                                   >> 843   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 844     if(loss_vector[i]) { loss_vector[i]->SetMaxKinEnergy(val); }
                                                   >> 845   }
                                                   >> 846   size_t emp = emp_vector.size();
                                                   >> 847   for (size_t k=0; k<emp; ++k) {
                                                   >> 848     if(emp_vector[k]) { emp_vector[k]->SetMaxKinEnergy(val); }
                                                   >> 849   }
                                                   >> 850 }
                                                   >> 851 
                                                   >> 852 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 853 
                                                   >> 854 void G4LossTableManager::SetMaxEnergyForCSDARange(G4double val)
                                                   >> 855 {
                                                   >> 856   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 857     if(loss_vector[i]) { loss_vector[i]->SetMaxKinEnergyForCSDARange(val); }
                                                   >> 858   }
                                                   >> 859 }
                                                   >> 860 
                                                   >> 861 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 862 
                                                   >> 863 void G4LossTableManager::SetMaxEnergyForMuons(G4double val)
                                                   >> 864 {
                                                   >> 865   maxEnergyForMuonsActive = true;
                                                   >> 866   maxKinEnergyForMuons = val;
                                                   >> 867 }
                                                   >> 868 
                                                   >> 869 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 870 
                                                   >> 871 void G4LossTableManager::SetDEDXBinning(G4int val)
                                                   >> 872 {
                                                   >> 873   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 874     if(loss_vector[i]) { loss_vector[i]->SetDEDXBinning(val); }
                                                   >> 875   }
                                                   >> 876 }
                                                   >> 877 
                                                   >> 878 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 879 
                                                   >> 880 void G4LossTableManager::SetDEDXBinningForCSDARange(G4int val)
                                                   >> 881 {
                                                   >> 882   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 883     if(loss_vector[i]) { loss_vector[i]->SetDEDXBinningForCSDARange(val); }
                                                   >> 884   }
                                                   >> 885 }
                                                   >> 886 
                                                   >> 887 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 888 
                                                   >> 889 void G4LossTableManager::SetLambdaBinning(G4int val)
                                                   >> 890 {
                                                   >> 891   G4int n = val/G4int(std::log10(maxKinEnergy/minKinEnergy) + 0.5);
                                                   >> 892   if(n < 5) {
                                                   >> 893     G4cout << "G4LossTableManager::SetLambdaBinning WARNING "
                                                   >> 894      << "too small number of bins " << val << "  ignored" 
                                                   >> 895      << G4endl;
                                                   >> 896     return;
                                                   >> 897   } 
                                                   >> 898   nbinsLambda = val;
                                                   >> 899   nbinsPerDecade = n;
                                                   >> 900   size_t emp = emp_vector.size();
                                                   >> 901   for (size_t k=0; k<emp; ++k) {
                                                   >> 902     if(emp_vector[k]) { emp_vector[k]->SetLambdaBinning(val); }
                                                   >> 903   }
                                                   >> 904 }
                                                   >> 905 
                                                   >> 906 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 907 
                                                   >> 908 G4int G4LossTableManager::GetNumberOfBinsPerDecade() const
                                                   >> 909 {
                                                   >> 910   return nbinsPerDecade;
889 }                                                 911 }
890                                                   912 
891 //....oooOO0OOooo........oooOO0OOooo........oo    913 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
892                                                   914 
893 void G4LossTableManager::SetVerbose(G4int val)    915 void G4LossTableManager::SetVerbose(G4int val)
894 {                                                 916 {
895   verbose = val;                                  917   verbose = val;
                                                   >> 918   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 919     if(loss_vector[i]) { loss_vector[i]->SetVerboseLevel(val); }
                                                   >> 920   }
                                                   >> 921   size_t msc = msc_vector.size();
                                                   >> 922   for (size_t j=0; j<msc; ++j) {
                                                   >> 923     if(msc_vector[j]) { msc_vector[j]->SetVerboseLevel(val); }
                                                   >> 924   }
                                                   >> 925   size_t emp = emp_vector.size();
                                                   >> 926   for (size_t k=0; k<emp; ++k) {
                                                   >> 927     if(emp_vector[k]) { emp_vector[k]->SetVerboseLevel(val); }
                                                   >> 928   }
                                                   >> 929   emConfigurator->SetVerbose(val);
                                                   >> 930   //tableBuilder->SetVerbose(val);
                                                   >> 931   //emCorrections->SetVerbose(val);
                                                   >> 932   emSaturation->SetVerbose(val);
                                                   >> 933   emElectronIonPair->SetVerbose(val);
                                                   >> 934   if(atomDeexcitation) { atomDeexcitation->SetVerboseLevel(val); }
                                                   >> 935 }
                                                   >> 936 
                                                   >> 937 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 938 
                                                   >> 939 void G4LossTableManager::SetStepFunction(G4double v1, G4double v2)
                                                   >> 940 {
                                                   >> 941   stepFunctionActive = true;
                                                   >> 942   maxRangeVariation = v1;
                                                   >> 943   maxFinalStep = v2;
                                                   >> 944   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 945     if(loss_vector[i]) { loss_vector[i]->SetStepFunction(v1, v2); }
                                                   >> 946   }
                                                   >> 947 }
                                                   >> 948 
                                                   >> 949 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 950 
                                                   >> 951 void G4LossTableManager::SetLinearLossLimit(G4double val)
                                                   >> 952 {
                                                   >> 953   for(G4int i=0; i<n_loss; ++i) {
                                                   >> 954     if(loss_vector[i]) { loss_vector[i]->SetLinearLossLimit(val); }
                                                   >> 955   }
                                                   >> 956 }
                                                   >> 957 
                                                   >> 958 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 959 
                                                   >> 960 void G4LossTableManager::SetBuildCSDARange(G4bool val)
                                                   >> 961 {
                                                   >> 962   buildCSDARange = val;
                                                   >> 963 }
                                                   >> 964 
                                                   >> 965 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 966 
                                                   >> 967 void 
                                                   >> 968 G4LossTableManager::SetParameters(const G4ParticleDefinition* aParticle,
                                                   >> 969           G4VEnergyLossProcess* p)
                                                   >> 970 {
                                                   >> 971   if(stepFunctionActive) { p->SetStepFunction(maxRangeVariation, maxFinalStep); }
                                                   >> 972   if(integralActive)     { p->SetIntegral(integral); }
                                                   >> 973   if(minEnergyActive)    { p->SetMinKinEnergy(minKinEnergy); }
                                                   >> 974   if(maxEnergyActive)    { p->SetMaxKinEnergy(maxKinEnergy); }
                                                   >> 975   p->SetVerboseLevel(verbose);
                                                   >> 976   if(maxEnergyForMuonsActive) {
                                                   >> 977     G4double dm = std::abs(aParticle->GetPDGMass() - 105.7*MeV);
                                                   >> 978     if(dm < 5.*MeV) { p->SetMaxKinEnergy(maxKinEnergyForMuons); }
                                                   >> 979   }
896 }                                                 980 }
897                                                   981 
898 //....oooOO0OOooo........oooOO0OOooo........oo    982 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
899                                                   983 
900 const std::vector<G4VEnergyLossProcess*>&         984 const std::vector<G4VEnergyLossProcess*>& 
901 G4LossTableManager::GetEnergyLossProcessVector    985 G4LossTableManager::GetEnergyLossProcessVector()
902 {                                                 986 {
903   return loss_vector;                             987   return loss_vector;
904 }                                                 988 }
905                                                   989 
906 //....oooOO0OOooo........oooOO0OOooo........oo    990 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
907                                                   991 
908 const std::vector<G4VEmProcess*>& G4LossTableM    992 const std::vector<G4VEmProcess*>& G4LossTableManager::GetEmProcessVector()
909 {                                                 993 {
910   return emp_vector;                              994   return emp_vector;
911 }                                                 995 }
912                                                   996 
913 //....oooOO0OOooo........oooOO0OOooo........oo    997 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
914                                                   998 
915 const std::vector<G4VMultipleScattering*>&        999 const std::vector<G4VMultipleScattering*>& 
916 G4LossTableManager::GetMultipleScatteringVecto    1000 G4LossTableManager::GetMultipleScatteringVector()
917 {                                                 1001 {
918   return msc_vector;                              1002   return msc_vector;
919 }                                                 1003 }
920                                                   1004 
                                                   >> 1005 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 1006 
                                                   >> 1007 void G4LossTableManager::SetLPMFlag(G4bool val)
                                                   >> 1008 {
                                                   >> 1009   flagLPM = val;
                                                   >> 1010 }
                                                   >> 1011 
                                                   >> 1012 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 1013 
                                                   >> 1014 G4bool G4LossTableManager::LPMFlag() const
                                                   >> 1015 {
                                                   >> 1016   return flagLPM;
                                                   >> 1017 }
                                                   >> 1018 
                                                   >> 1019 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 1020 
                                                   >> 1021 void G4LossTableManager::SetSplineFlag(G4bool val)
                                                   >> 1022 {
                                                   >> 1023   splineFlag = val;
                                                   >> 1024   tableBuilder->SetSplineFlag(splineFlag);
                                                   >> 1025 }
                                                   >> 1026 
                                                   >> 1027 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
                                                   >> 1028 
                                                   >> 1029 G4bool G4LossTableManager::SplineFlag() const
                                                   >> 1030 {
                                                   >> 1031   return splineFlag;
                                                   >> 1032 }
                                                   >> 1033 
                                                   >> 1034 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1035 
                                                   >> 1036 void G4LossTableManager::SetBremsstrahlungTh(G4double val) 
                                                   >> 1037 {
                                                   >> 1038   bremsTh = val;
                                                   >> 1039 }
                                                   >> 1040 
                                                   >> 1041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1042 
                                                   >> 1043 G4double G4LossTableManager::BremsstrahlungTh() const
                                                   >> 1044 {
                                                   >> 1045   return bremsTh;
                                                   >> 1046 }
                                                   >> 1047 
                                                   >> 1048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1049 
                                                   >> 1050 void G4LossTableManager::SetFactorForAngleLimit(G4double val) 
                                                   >> 1051 {
                                                   >> 1052   if(val > 0.0) { factorForAngleLimit = val; }
                                                   >> 1053 }
                                                   >> 1054 
                                                   >> 1055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 1056 
                                                   >> 1057 G4double G4LossTableManager::FactorForAngleLimit() const
                                                   >> 1058 {
                                                   >> 1059   return factorForAngleLimit;
                                                   >> 1060 }
                                                   >> 1061 
                                                   >> 1062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 1063 
                                                   >> 1064 G4double G4LossTableManager::MinKinEnergy() const
                                                   >> 1065 {
                                                   >> 1066   return minKinEnergy;
                                                   >> 1067 }
                                                   >> 1068 
                                                   >> 1069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 1070 
                                                   >> 1071 G4double G4LossTableManager::MaxKinEnergy() const
                                                   >> 1072 {
                                                   >> 1073   return maxKinEnergy;
                                                   >> 1074 }
                                                   >> 1075 
                                                   >> 1076 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 1077 
                                                   >> 1078 G4EmCorrections* G4LossTableManager::EmCorrections() 
                                                   >> 1079 {
                                                   >> 1080   return emCorrections;
                                                   >> 1081 }
                                                   >> 1082 
921 //....oooOO0OOooo........oooOO0OOooo........oo    1083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
922                                                   1084 
923 G4EmSaturation* G4LossTableManager::EmSaturati    1085 G4EmSaturation* G4LossTableManager::EmSaturation()
924 {                                                 1086 {
925   return theParameters->GetEmSaturation();     << 1087   return emSaturation;
926 }                                                 1088 }
927                                                   1089 
928 //....oooOO0OOooo........oooOO0OOooo........oo    1090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
929                                                   1091 
930 G4EmConfigurator* G4LossTableManager::EmConfig    1092 G4EmConfigurator* G4LossTableManager::EmConfigurator()
931 {                                                 1093 {
932   if(!emConfigurator) {                        << 
933     emConfigurator = new G4EmConfigurator(verb << 
934   }                                            << 
935   return emConfigurator;                          1094   return emConfigurator;
936 }                                                 1095 }
937                                                   1096 
938 //....oooOO0OOooo........oooOO0OOooo........oo    1097 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
939                                                   1098 
940 G4ElectronIonPair* G4LossTableManager::Electro    1099 G4ElectronIonPair* G4LossTableManager::ElectronIonPair()
941 {                                                 1100 {
942   if(!emElectronIonPair) {                     << 
943     emElectronIonPair = new G4ElectronIonPair( << 
944   }                                            << 
945   return emElectronIonPair;                       1101   return emElectronIonPair;
946 }                                                 1102 }
947                                                   1103 
948 //....oooOO0OOooo........oooOO0OOooo........oo << 1104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
949                                                   1105 
950 void G4LossTableManager::SetNIELCalculator(G4N << 1106 G4VAtomDeexcitation* G4LossTableManager::AtomDeexcitation()
951 {                                                 1107 {
952   if(nullptr != ptr && ptr != nielCalculator)  << 1108   return atomDeexcitation;
953     delete nielCalculator;                     << 
954     nielCalculator = ptr;                      << 
955   }                                            << 
956 }                                                 1109 }
957                                                   1110 
958 //....oooOO0OOooo........oooOO0OOooo........oo << 1111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
959                                                   1112 
960 G4NIELCalculator* G4LossTableManager::NIELCalc << 1113 G4LossTableBuilder* G4LossTableManager::GetTableBuilder()
961 {                                                 1114 {
962   if(!nielCalculator) {                        << 1115   return tableBuilder;
963     nielCalculator = new G4NIELCalculator(null << 
964   }                                            << 
965   return nielCalculator;                       << 
966 }                                                 1116 }
967                                                   1117 
968 //....oooOO0OOooo........oooOO0OOooo........oo    1118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
969                                                   1119  
970 void G4LossTableManager::SetAtomDeexcitation(G    1120 void G4LossTableManager::SetAtomDeexcitation(G4VAtomDeexcitation* p)
971 {                                                 1121 {
972   if(atomDeexcitation != p) {                  << 1122   atomDeexcitation = p;
973     delete atomDeexcitation;                   << 
974     atomDeexcitation = p;                      << 
975   }                                            << 
976 }                                                 1123 }
977                                                   1124 
978 //....oooOO0OOooo........oooOO0OOooo........oo    1125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
979                                                   1126 
980 void G4LossTableManager::SetSubCutProducer(G4V << 1127 G4VEnergyLossProcess* 
                                                   >> 1128 G4LossTableManager::GetEnergyLossProcess(const G4ParticleDefinition *aParticle)
981 {                                                 1129 {
982   if(subcutProducer != p) {                    << 1130   if(aParticle != currentParticle) {
983     delete subcutProducer;                     << 1131     currentParticle = aParticle;
984     subcutProducer = p;                        << 1132     std::map<PD,G4VEnergyLossProcess*,std::less<PD> >::const_iterator pos;
                                                   >> 1133     if ((pos = loss_map.find(aParticle)) != loss_map.end()) {
                                                   >> 1134       currentLoss = (*pos).second;
                                                   >> 1135     } else {
                                                   >> 1136       currentLoss = 0;
                                                   >> 1137       //ParticleHaveNoLoss(aParticle);
                                                   >> 1138     }
985   }                                               1139   }
                                                   >> 1140   return currentLoss;
986 }                                                 1141 }
987                                                   1142 
988 //....oooOO0OOooo........oooOO0OOooo........oo << 1143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
989                                                   1144 
990 void G4LossTableManager::PrintEWarning(G4Strin << 1145 G4double G4LossTableManager::GetDEDX(const G4ParticleDefinition *aParticle,
                                                   >> 1146              G4double kineticEnergy,
                                                   >> 1147              const G4MaterialCutsCouple *couple)
991 {                                                 1148 {
992   G4String ss = "G4LossTableManager::" + tit;  << 1149   if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
993   G4ExceptionDescription ed;                   << 1150   G4double x = 0.0;
994   /*                                           << 1151   if(currentLoss) { x = currentLoss->GetDEDX(kineticEnergy, couple); }
995   ed << "Parameter is out of range: " << val   << 1152   else            { x = G4EnergyLossTables::GetDEDX(currentParticle,
996      << " it will have no effect!\n" << " ## " << 1153                 kineticEnergy,couple,false); }
997      << " nbins= " << nbinsLambda              << 1154   return x;
998      << " nbinsPerDecade= " << nbinsPerDecade  << 
999      << " Emin(keV)= " << minKinEnergy/keV     << 
1000      << " Emax(GeV)= " << maxKinEnergy/GeV;   << 
1001   */                                          << 
1002   G4Exception(ss, "em0044", JustWarning, ed); << 
1003 }                                                1155 }
1004                                                  1156 
1005 //....oooOO0OOooo........oooOO0OOooo........o << 1157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1006                                                  1158 
1007 void G4LossTableManager::DumpHtml()           << 1159 G4double G4LossTableManager::GetSubDEDX(const G4ParticleDefinition *aParticle,
                                                   >> 1160           G4double kineticEnergy,
                                                   >> 1161           const G4MaterialCutsCouple *couple)
1008 {                                                1162 {
1009   // Automatic generation of html documentati << 1163   if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
1010   // List processes and models for the most i << 1164   G4double x = 0.0;
1011   // particles in descending order of importa << 1165   if(currentLoss) { x = currentLoss->GetDEDXForSubsec(kineticEnergy, couple); }
1012   // NB. for model names with length > 18 cha << 1166   return x;
1013   //  to be edited by hand. Or modify G4EmMod << 1167 }
1014                                               << 
1015   char* dirName = std::getenv("G4PhysListDocD << 
1016   char* physList = std::getenv("G4PhysListNam << 
1017   if (dirName && physList) {                  << 
1018     G4String physListName = G4String(physList << 
1019     G4String pathName = G4String(dirName) + " << 
1020                                               << 
1021     std::ofstream outFile;                    << 
1022     outFile.open(pathName);                   << 
1023                                               << 
1024     outFile << physListName << G4endl;        << 
1025     outFile << std::string(physListName.lengt << 
1026                                               << 
1027     std::vector<G4ParticleDefinition*> partic << 
1028         G4Gamma::Gamma(),                     << 
1029         G4Electron::Electron(),               << 
1030         G4Positron::Positron(),               << 
1031         G4Proton::ProtonDefinition(),         << 
1032         G4MuonPlus::MuonPlusDefinition(),     << 
1033         G4MuonMinus::MuonMinusDefinition(),   << 
1034       };                                      << 
1035                                               << 
1036     std::vector<G4VEmProcess*> emproc_vector  << 
1037     std::vector<G4VEnergyLossProcess*> enloss << 
1038       GetEnergyLossProcessVector();           << 
1039     std::vector<G4VMultipleScattering*> mscat << 
1040       GetMultipleScatteringVector();          << 
1041                                               << 
1042     for (auto theParticle : particles) {      << 
1043       outFile << G4endl << "**" << theParticl << 
1044               << "**" << G4endl << G4endl <<  << 
1045                                               << 
1046       G4ProcessManager* pm = theParticle->Get << 
1047       G4ProcessVector*  pv = pm->GetProcessLi << 
1048       G4int plen = pm->GetProcessListLength() << 
1049                                               << 
1050       for (auto emproc : emproc_vector) {     << 
1051         for (G4int i = 0; i < plen; ++i) {    << 
1052           G4VProcess* proc = (*pv)[i];        << 
1053           if (proc == emproc) {               << 
1054             outFile << G4endl;                << 
1055             proc->ProcessDescription(outFile) << 
1056             break;                            << 
1057           }                                   << 
1058         }                                     << 
1059       }                                       << 
1060                                                  1168 
1061       for (auto mscproc : mscat_vector) {     << 1169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1062         for (G4int i = 0; i < plen; ++i) {    << 
1063           G4VProcess* proc = (*pv)[i];        << 
1064           if (proc == mscproc) {              << 
1065             outFile << G4endl;                << 
1066             proc->ProcessDescription(outFile) << 
1067             break;                            << 
1068           }                                   << 
1069         }                                     << 
1070       }                                       << 
1071                                                  1170 
1072       for (auto enlossproc : enloss_vector) { << 1171 G4double G4LossTableManager::GetCSDARange(const G4ParticleDefinition *aParticle,
1073         for (G4int i = 0; i < plen; ++i) {    << 1172             G4double kineticEnergy,
1074           G4VProcess* proc = (*pv)[i];        << 1173             const G4MaterialCutsCouple *couple)
1075           if (proc == enlossproc) {           << 1174 {
1076             outFile << G4endl;                << 1175   if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
1077             proc->ProcessDescription(outFile) << 1176   G4double x = DBL_MAX;
1078             break;                            << 1177   if(currentLoss) { x = currentLoss->GetCSDARange(kineticEnergy, couple); }
1079           }                                   << 1178   return x;
1080         }                                     << 1179 }
1081       }                                       << 1180 
1082     }                                         << 1181 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1083     outFile.close();                          << 1182 
1084   }                                           << 1183 G4double 
                                                   >> 1184 G4LossTableManager::GetRangeFromRestricteDEDX(const G4ParticleDefinition *aParticle,
                                                   >> 1185                 G4double kineticEnergy,
                                                   >> 1186                 const G4MaterialCutsCouple *couple)
                                                   >> 1187 {
                                                   >> 1188   if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
                                                   >> 1189   G4double x;
                                                   >> 1190   if(currentLoss) { x = currentLoss->GetRangeForLoss(kineticEnergy, couple); }
                                                   >> 1191   else { x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy,
                                                   >> 1192             couple,false); }
                                                   >> 1193   return x;
1085 }                                                1194 }
1086                                                  1195 
1087 //....oooOO0OOooo........oooOO0OOooo........o    1196 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1088                                                  1197 
                                                   >> 1198 G4double G4LossTableManager::GetRange(const G4ParticleDefinition *aParticle,
                                                   >> 1199               G4double kineticEnergy,
                                                   >> 1200               const G4MaterialCutsCouple *couple)
                                                   >> 1201 {
                                                   >> 1202   if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
                                                   >> 1203   G4double x;
                                                   >> 1204   if(currentLoss) { x = currentLoss->GetRange(kineticEnergy, couple); }
                                                   >> 1205   else { x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy,
                                                   >> 1206             couple,false); }
                                                   >> 1207   return x;
                                                   >> 1208 }
                                                   >> 1209 
                                                   >> 1210 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 1211 
                                                   >> 1212 G4double G4LossTableManager::GetEnergy(const G4ParticleDefinition *aParticle,
                                                   >> 1213                G4double range,
                                                   >> 1214                const G4MaterialCutsCouple *couple)
                                                   >> 1215 {
                                                   >> 1216   if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
                                                   >> 1217   G4double x;
                                                   >> 1218   if(currentLoss) { x = currentLoss->GetKineticEnergy(range, couple); }
                                                   >> 1219   else { x = G4EnergyLossTables::GetPreciseEnergyFromRange(currentParticle,range,
                                                   >> 1220                  couple,false); }
                                                   >> 1221   return x;
                                                   >> 1222 }
                                                   >> 1223 
                                                   >> 1224 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 1225 
                                                   >> 1226 G4double G4LossTableManager::GetDEDXDispersion(const G4MaterialCutsCouple *couple,
                                                   >> 1227                  const G4DynamicParticle* dp,
                                                   >> 1228                  G4double& length)
                                                   >> 1229 {
                                                   >> 1230   const G4ParticleDefinition* aParticle = dp->GetParticleDefinition();
                                                   >> 1231   if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
                                                   >> 1232   G4double x = 0.0;
                                                   >> 1233   if(currentLoss) { currentLoss->GetDEDXDispersion(couple, dp, length); }
                                                   >> 1234   return x;
                                                   >> 1235 }
                                                   >> 1236 
                                                   >> 1237 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1089                                                  1238