Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/utils/src/G4VMultipleScattering.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/G4VMultipleScattering.cc (Version 11.3.0) and /processes/electromagnetic/utils/src/G4VMultipleScattering.cc (Version 10.0.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 // $Id: G4VMultipleScattering.cc 81864 2014-06-06 11:30:54Z gcosmo $
 26 //                                                 27 //
 27 // -------------------------------------------     28 // -------------------------------------------------------------------
 28 //                                                 29 //
 29 // GEANT4 Class file                               30 // GEANT4 Class file
 30 //                                                 31 //
 31 //                                                 32 //
 32 // File name:     G4VMultipleScattering            33 // File name:     G4VMultipleScattering
 33 //                                                 34 //
 34 // Author:        Vladimir Ivanchenko on base      35 // Author:        Vladimir Ivanchenko on base of Laszlo Urban code
 35 //                                                 36 //
 36 // Creation date: 25.03.2003                       37 // Creation date: 25.03.2003
 37 //                                                 38 //
 38 // Modifications:                                  39 // Modifications:
 39 //                                                 40 //
                                                   >>  41 // 13.04.03 Change printout (V.Ivanchenko)
                                                   >>  42 // 04-06-03 Fix compilation warnings (V.Ivanchenko)
 40 // 16-07-03 Use G4VMscModel interface (V.Ivanc     43 // 16-07-03 Use G4VMscModel interface (V.Ivanchenko)
 41 // 03-11-03 Fix initialisation problem in Retr     44 // 03-11-03 Fix initialisation problem in RetrievePhysicsTable (V.Ivanchenko)
 42 // 04-11-03 Update PrintInfoDefinition (V.Ivan     45 // 04-11-03 Update PrintInfoDefinition (V.Ivanchenko)
 43 // 01-03-04 SampleCosineTheta signature change     46 // 01-03-04 SampleCosineTheta signature changed
 44 // 22-04-04 SampleCosineTheta signature change     47 // 22-04-04 SampleCosineTheta signature changed back to original
 45 // 27-08-04 Add InitialiseForRun method (V.Iva     48 // 27-08-04 Add InitialiseForRun method (V.Ivanchneko)
 46 // 08-11-04 Migration to new interface of Stor     49 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
 47 // 11-03-05 Shift verbose level by 1 (V.Ivantc     50 // 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
 48 // 15-04-05 optimize internal interface (V.Iva     51 // 15-04-05 optimize internal interface (V.Ivanchenko)
 49 // 15-04-05 remove boundary flag (V.Ivanchenko     52 // 15-04-05 remove boundary flag (V.Ivanchenko)
 50 // 27-10-05 introduce virtual function MscStep     53 // 27-10-05 introduce virtual function MscStepLimitation() (V.Ivanchenko)
 51 // 12-04-07 Add verbosity at destruction (V.Iv     54 // 12-04-07 Add verbosity at destruction (V.Ivanchenko)
 52 // 27-10-07 Virtual functions moved to source      55 // 27-10-07 Virtual functions moved to source (V.Ivanchenko)
 53 // 11-03-08 Set skin value does not effect ste     56 // 11-03-08 Set skin value does not effect step limit type (V.Ivanchenko)
 54 // 24-06-09 Removed hidden bin in G4PhysicsVec     57 // 24-06-09 Removed hidden bin in G4PhysicsVector (V.Ivanchenko)
 55 // 04-06-13 Adoptation to MT mode (V.Ivanchenk     58 // 04-06-13 Adoptation to MT mode (V.Ivanchenko)
 56 //                                                 59 //
                                                   >>  60 // Class Description:
                                                   >>  61 //
                                                   >>  62 // It is the generic process of multiple scattering it includes common
                                                   >>  63 // part of calculations for all charged particles
 57                                                    64 
 58 // -------------------------------------------     65 // -------------------------------------------------------------------
 59 //                                                 66 //
 60 //....oooOO0OOooo........oooOO0OOooo........oo     67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 61 //....oooOO0OOooo........oooOO0OOooo........oo     68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 62                                                    69 
 63 #include "G4VMultipleScattering.hh"                70 #include "G4VMultipleScattering.hh"
 64 #include "G4PhysicalConstants.hh"                  71 #include "G4PhysicalConstants.hh"
 65 #include "G4SystemOfUnits.hh"                      72 #include "G4SystemOfUnits.hh"
 66 #include "G4LossTableManager.hh"                   73 #include "G4LossTableManager.hh"
 67 #include "G4MaterialCutsCouple.hh"                 74 #include "G4MaterialCutsCouple.hh"
 68 #include "G4Step.hh"                               75 #include "G4Step.hh"
 69 #include "G4ParticleDefinition.hh"                 76 #include "G4ParticleDefinition.hh"
 70 #include "G4VEmFluctuationModel.hh"                77 #include "G4VEmFluctuationModel.hh"
 71 #include "G4UnitsTable.hh"                         78 #include "G4UnitsTable.hh"
 72 #include "G4ProductionCutsTable.hh"                79 #include "G4ProductionCutsTable.hh"
 73 #include "G4Electron.hh"                           80 #include "G4Electron.hh"
 74 #include "G4GenericIon.hh"                         81 #include "G4GenericIon.hh"
 75 #include "G4TransportationManager.hh"              82 #include "G4TransportationManager.hh"
 76 #include "G4SafetyHelper.hh"                       83 #include "G4SafetyHelper.hh"
 77 #include "G4ParticleTable.hh"                      84 #include "G4ParticleTable.hh"
 78 #include "G4ProcessVector.hh"                      85 #include "G4ProcessVector.hh"
 79 #include "G4ProcessManager.hh"                     86 #include "G4ProcessManager.hh"
 80 #include "G4LossTableBuilder.hh"               << 
 81 #include "G4EmTableUtil.hh"                    << 
 82 #include <iostream>                            << 
 83                                                    87 
 84 //....oooOO0OOooo........oooOO0OOooo........oo     88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 85                                                    89 
 86 G4VMultipleScattering::G4VMultipleScattering(c <<  90 G4VMultipleScattering::G4VMultipleScattering(const G4String& name, 
 87   : G4VContinuousDiscreteProcess("msc", fElect <<  91                G4ProcessType):
 88   fNewPosition(0.,0.,0.),                      <<  92   G4VContinuousDiscreteProcess("msc", fElectromagnetic),
 89   fNewDirection(0.,0.,1.)                      <<  93   numberOfModels(0),
                                                   >>  94   firstParticle(0),
                                                   >>  95   currParticle(0),
                                                   >>  96   stepLimit(fUseSafety),
                                                   >>  97   skin(1.0),
                                                   >>  98   facrange(0.04),
                                                   >>  99   facgeom(2.5),
                                                   >> 100   latDisplasment(true),
                                                   >> 101   isIon(false)
 90 {                                                 102 {
 91   theParameters = G4EmParameters::Instance();  << 
 92   SetVerboseLevel(1);                             103   SetVerboseLevel(1);
 93   SetProcessSubType(fMultipleScattering);         104   SetProcessSubType(fMultipleScattering);
 94                                                << 105   if("ionmsc" == name) { firstParticle = G4GenericIon::GenericIon(); }
 95   lowestKinEnergy = 10*CLHEP::eV;              << 
 96                                                   106 
 97   geomMin = 0.05*CLHEP::nm;                       107   geomMin = 0.05*CLHEP::nm;
 98   minDisplacement2 = geomMin*geomMin;          << 108   lowestKinEnergy = 10*eV;
                                                   >> 109 
                                                   >> 110   // default limit on polar angle
                                                   >> 111   polarAngleLimit = 0.0;
                                                   >> 112 
                                                   >> 113   physStepLimit = gPathLength = tPathLength = 0.0;
                                                   >> 114   fIonisation = 0;
 99                                                   115 
100   pParticleChange = &fParticleChange;             116   pParticleChange = &fParticleChange;
                                                   >> 117   safetyHelper = 0;
                                                   >> 118   fPositionChanged = false;
                                                   >> 119   isActive = false;
101                                                   120 
                                                   >> 121   currentModel = 0;
102   modelManager = new G4EmModelManager();          122   modelManager = new G4EmModelManager();
103   emManager = G4LossTableManager::Instance();     123   emManager = G4LossTableManager::Instance();
104   mscModels.reserve(2);                        << 
105   emManager->Register(this);                      124   emManager->Register(this);
                                                   >> 125 
                                                   >> 126   warn = 0;
106 }                                                 127 }
107                                                   128 
108 //....oooOO0OOooo........oooOO0OOooo........oo    129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
109                                                   130 
110 G4VMultipleScattering::~G4VMultipleScattering(    131 G4VMultipleScattering::~G4VMultipleScattering()
111 {                                                 132 {
                                                   >> 133   /*
                                                   >> 134   if(1 < verboseLevel) {
                                                   >> 135     G4cout << "G4VMultipleScattering destruct " << GetProcessName() 
                                                   >> 136      << G4endl;
                                                   >> 137   }
                                                   >> 138   */
112   delete modelManager;                            139   delete modelManager;
113   emManager->DeRegister(this);                    140   emManager->DeRegister(this);
114 }                                                 141 }
115                                                   142 
116 //....oooOO0OOooo........oooOO0OOooo........oo    143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
117                                                   144 
118 void G4VMultipleScattering::AddEmModel(G4int o << 145 void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
119                                        const G << 146                const G4Region* region)
120 {                                                 147 {
121   if(nullptr == ptr) { return; }               << 148   G4VEmFluctuationModel* fm = 0;
122   G4VEmFluctuationModel* fm = nullptr;         << 149   modelManager->AddEmModel(order, p, fm, region);
123   modelManager->AddEmModel(order, ptr, fm, reg << 150   if(p) { p->SetParticleChange(pParticleChange); }
124   ptr->SetParticleChange(pParticleChange);     << 
125 }                                                 151 }
126                                                   152 
127 //....oooOO0OOooo........oooOO0OOooo........oo    153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
128                                                   154 
129 void G4VMultipleScattering::SetEmModel(G4VMscM << 155 void G4VMultipleScattering::SetEmModel(G4VMscModel* p, G4int index)
130 {                                                 156 {
131   if(nullptr == ptr) { return; }               << 157   G4int n = mscModels.size();
132   if(!mscModels.empty()) {                     << 158   if(index >= n) { for(G4int i=n; i<=index; ++i) { mscModels.push_back(0); } }
133     for(auto & msc : mscModels) { if(msc == pt << 159   mscModels[index] = p;
134   }                                            << 160 }
135   mscModels.push_back(ptr);                    << 161 
                                                   >> 162 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 163 
                                                   >> 164 G4VMscModel* G4VMultipleScattering::EmModel(G4int index) const
                                                   >> 165 {
                                                   >> 166   G4VMscModel* p = 0;
                                                   >> 167   if(index >= 0 && index <  G4int(mscModels.size())) { p = mscModels[index]; }
                                                   >> 168   return p;
                                                   >> 169 }
                                                   >> 170 
                                                   >> 171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 172 
                                                   >> 173 G4VEmModel* 
                                                   >> 174 G4VMultipleScattering::GetModelByIndex(G4int idx, G4bool ver) const
                                                   >> 175 {
                                                   >> 176   return modelManager->GetModel(idx, ver);
136 }                                                 177 }
137                                                   178 
138 //....oooOO0OOooo........oooOO0OOooo........oo    179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
139                                                   180 
140 void                                              181 void 
141 G4VMultipleScattering::PreparePhysicsTable(con    182 G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
142 {                                                 183 {
143   G4bool master = emManager->IsMaster();       << 184  G4bool master = true;
144   if (nullptr == firstParticle) { firstParticl << 185   const G4VMultipleScattering* masterProc = 
                                                   >> 186     static_cast<const G4VMultipleScattering*>(GetMasterProcess());
                                                   >> 187   if(masterProc && masterProc != this) { master = false; }
                                                   >> 188 
                                                   >> 189   if(!firstParticle) { firstParticle = &part; }
                                                   >> 190   if(part.GetParticleType() == "nucleus") {
                                                   >> 191     SetStepLimitType(fMinimal);
                                                   >> 192     SetLateralDisplasmentFlag(false);
                                                   >> 193     SetRangeFactor(0.2);
                                                   >> 194     G4String pname = part.GetParticleName();
                                                   >> 195     if(pname != "deuteron" && pname != "triton" &&
                                                   >> 196        pname != "alpha+"   && pname != "helium" &&
                                                   >> 197        pname != "alpha"    && pname != "He3" &&
                                                   >> 198        pname != "hydrogen") {
                                                   >> 199 
                                                   >> 200       const G4ParticleDefinition* theGenericIon = 
                                                   >> 201   G4ParticleTable::GetParticleTable()->FindParticle("GenericIon");
                                                   >> 202      
                                                   >> 203       if(theGenericIon && firstParticle != theGenericIon) {
                                                   >> 204   G4ProcessManager* pm =  theGenericIon->GetProcessManager();
                                                   >> 205   G4ProcessVector* v = pm->GetAlongStepProcessVector();
                                                   >> 206   size_t n = v->size();
                                                   >> 207   for(size_t j=0; j<n; ++j) {
                                                   >> 208     if((*v)[j] == this) {
                                                   >> 209       firstParticle = theGenericIon;
                                                   >> 210       isIon = true; 
                                                   >> 211       break; 
                                                   >> 212     }
                                                   >> 213   }
                                                   >> 214       }
                                                   >> 215     }
                                                   >> 216   }
145                                                   217 
146   emManager->PreparePhysicsTable(&part, this); << 218   emManager->PreparePhysicsTable(&part, this, master);
147   currParticle = nullptr;                      << 219   currParticle = 0;
                                                   >> 220 
                                                   >> 221   if(1 < verboseLevel) {
                                                   >> 222     G4cout << "### G4VMultipleScattering::PrepearPhysicsTable() for "
                                                   >> 223            << GetProcessName()
                                                   >> 224            << " and particle " << part.GetParticleName()
                                                   >> 225            << " local particle " << firstParticle->GetParticleName()
                                                   >> 226      << " isIon= " << isIon 
                                                   >> 227            << G4endl;
                                                   >> 228   }
148                                                   229 
149   if(firstParticle == &part) {                    230   if(firstParticle == &part) {
150     baseMat = emManager->GetTableBuilder()->Ge << 
151     G4EmTableUtil::PrepareMscProcess(this, par << 
152              stepLimit, facrange,              << 
153              latDisplacement, master,          << 
154              isIon, baseMat);                  << 
155                                                   231 
                                                   >> 232     InitialiseProcess(firstParticle);
                                                   >> 233 
                                                   >> 234     // initialisation of models
156     numberOfModels = modelManager->NumberOfMod    235     numberOfModels = modelManager->NumberOfModels();
157     currentModel = GetModelByIndex(0);         << 236     for(G4int i=0; i<numberOfModels; ++i) {
                                                   >> 237       G4VMscModel* msc = static_cast<G4VMscModel*>(modelManager->GetModel(i));
                                                   >> 238       msc->SetIonisation(0, firstParticle);
                                                   >> 239       msc->SetMasterThread(master);
                                                   >> 240       if(0 == i) { currentModel = msc; }
                                                   >> 241       if(isIon) {
                                                   >> 242   msc->SetStepLimitType(fMinimal);
                                                   >> 243   msc->SetLateralDisplasmentFlag(false);
                                                   >> 244   msc->SetRangeFactor(0.2);
                                                   >> 245       } else {
                                                   >> 246   msc->SetStepLimitType(StepLimitType());
                                                   >> 247   msc->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
                                                   >> 248   msc->SetSkin(Skin());
                                                   >> 249   msc->SetRangeFactor(RangeFactor());
                                                   >> 250   msc->SetGeomFactor(GeomFactor());
                                                   >> 251       }
                                                   >> 252       msc->SetPolarAngleLimit(polarAngleLimit);
                                                   >> 253       G4double emax = 
                                                   >> 254   std::min(msc->HighEnergyLimit(),emManager->MaxKinEnergy());
                                                   >> 255       msc->SetHighEnergyLimit(emax);
                                                   >> 256     }
158                                                   257 
159     if (nullptr == safetyHelper) {             << 258     modelManager->Initialise(firstParticle, G4Electron::Electron(), 
                                                   >> 259            10.0, verboseLevel);
                                                   >> 260 
                                                   >> 261     if(!safetyHelper) {
160       safetyHelper = G4TransportationManager::    262       safetyHelper = G4TransportationManager::GetTransportationManager()
161   ->GetSafetyHelper();                            263   ->GetSafetyHelper();
162       safetyHelper->InitialiseHelper();           264       safetyHelper->InitialiseHelper();
163     }                                             265     }
164   }                                               266   }
165 }                                                 267 }
166                                                   268 
167 //....oooOO0OOooo........oooOO0OOooo........oo    269 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
168                                                   270 
169 void G4VMultipleScattering::BuildPhysicsTable(    271 void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
170 {                                                 272 {
171   G4bool master = emManager->IsMaster();       << 273   G4String num = part.GetParticleName();
172                                                << 274   if(1 < verboseLevel) {
173   if(firstParticle == &part) {                 << 275     G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
174     emManager->BuildPhysicsTable(&part);       << 276            << GetProcessName()
                                                   >> 277            << " and particle " << num
                                                   >> 278      << " IsMaster= " << G4LossTableManager::Instance()->IsMaster()
                                                   >> 279            << G4endl;
175   }                                               280   }
176   const G4VMultipleScattering* ptr = this;     << 281   G4bool master = true;
177   if(!master) {                                << 282   const G4VMultipleScattering* masterProcess = 
178     ptr = static_cast<const G4VMultipleScatter << 283     static_cast<const G4VMultipleScattering*>(GetMasterProcess()); 
                                                   >> 284   if(masterProcess && masterProcess != this) { master = false; }
                                                   >> 285 
                                                   >> 286   if(firstParticle == &part) { 
                                                   >> 287     /*    
                                                   >> 288     G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
                                                   >> 289            << GetProcessName()
                                                   >> 290            << " and particle " << num
                                                   >> 291      << " IsMaster= " << G4LossTableManager::Instance()->IsMaster()
                                                   >> 292      << "  " << this
                                                   >> 293            << G4endl;
                                                   >> 294     */
                                                   >> 295     emManager->BuildPhysicsTable(firstParticle);
                                                   >> 296 
                                                   >> 297     if(!master) {
                                                   >> 298       // initialisation of models
                                                   >> 299       G4bool printing = true;
                                                   >> 300       numberOfModels = modelManager->NumberOfModels();
                                                   >> 301       /*
                                                   >> 302   G4cout << "### G4VMultipleScattering::SlaveBuildPhysicsTable() for "
                                                   >> 303   << GetProcessName()
                                                   >> 304   << " and particle " << num
                                                   >> 305   << " Nmod= " << numberOfModels << "  " << this
                                                   >> 306   << G4endl;
                                                   >> 307       */
                                                   >> 308       for(G4int i=0; i<numberOfModels; ++i) {
                                                   >> 309   G4VMscModel* msc = 
                                                   >> 310     static_cast<G4VMscModel*>(GetModelByIndex(i, printing));
                                                   >> 311   G4VMscModel* msc0= 
                                                   >> 312     static_cast<G4VMscModel*>(masterProcess->GetModelByIndex(i,printing));
                                                   >> 313   msc->SetCrossSectionTable(msc0->GetCrossSectionTable(), false);
                                                   >> 314       }
                                                   >> 315     }
                                                   >> 316 
179   }                                               317   }
180                                                   318 
181   G4EmTableUtil::BuildMscProcess(this, ptr, pa << 319   // explicitly defined printout by particle name
182          numberOfModels, master);              << 320   if(1 < verboseLevel || 
                                                   >> 321      (0 < verboseLevel && (num == "e-" || 
                                                   >> 322          num == "e+"    || num == "mu+" || 
                                                   >> 323          num == "mu-"   || num == "proton"|| 
                                                   >> 324          num == "pi+"   || num == "pi-" || 
                                                   >> 325          num == "kaon+" || num == "kaon-" || 
                                                   >> 326          num == "alpha" || num == "anti_proton" || 
                                                   >> 327          num == "GenericIon")))
                                                   >> 328     { 
                                                   >> 329       G4cout << G4endl << GetProcessName() 
                                                   >> 330        << ":   for " << num
                                                   >> 331        << "    SubType= " << GetProcessSubType() 
                                                   >> 332        << G4endl;
                                                   >> 333       PrintInfo();
                                                   >> 334       modelManager->DumpModelList(verboseLevel);
                                                   >> 335     }
                                                   >> 336 
                                                   >> 337   if(1 < verboseLevel) {
                                                   >> 338     G4cout << "### G4VMultipleScattering::BuildPhysicsTable() done for "
                                                   >> 339            << GetProcessName()
                                                   >> 340            << " and particle " << num
                                                   >> 341            << G4endl;
                                                   >> 342   }
183 }                                                 343 }
184                                                   344 
185 //....oooOO0OOooo........oooOO0OOooo........oo    345 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
186                                                   346 
187 void G4VMultipleScattering::StreamInfo(std::os << 347 void G4VMultipleScattering::PrintInfoDefinition()
188                   const G4ParticleDefinition&  << 
189 {                                                 348 {
190   G4String indent = (rst ? "  " : "");         << 349   if (0 < verboseLevel) {
191   outFile << G4endl << indent << GetProcessNam << 350     G4cout << G4endl << GetProcessName() 
192   if (!rst) outFile << " for " << part.GetPart << 351      << ":   for " << firstParticle->GetParticleName()
193   outFile  << "  SubType= " << GetProcessSubTy << 352      << "    SubType= " << GetProcessSubType() 
194   modelManager->DumpModelList(outFile, verbose << 353      << G4endl;
                                                   >> 354     PrintInfo();
                                                   >> 355     modelManager->DumpModelList(verboseLevel);
                                                   >> 356   }
195 }                                                 357 }
196                                                   358 
197 //....oooOO0OOooo........oooOO0OOooo........oo    359 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
198                                                   360 
199 void G4VMultipleScattering::StartTracking(G4Tr    361 void G4VMultipleScattering::StartTracking(G4Track* track)
200 {                                                 362 {
201   G4VEnergyLossProcess* eloss = nullptr;       << 363   G4VEnergyLossProcess* eloss = 0;
202   if(track->GetParticleDefinition() != currPar    364   if(track->GetParticleDefinition() != currParticle) {
203     currParticle = track->GetParticleDefinitio    365     currParticle = track->GetParticleDefinition();
204     fIonisation = emManager->GetEnergyLossProc    366     fIonisation = emManager->GetEnergyLossProcess(currParticle);
205     eloss = fIonisation;                          367     eloss = fIonisation;
206   }                                               368   }
207   for(G4int i=0; i<numberOfModels; ++i) {      << 369   /*  
208     G4VMscModel* msc = GetModelByIndex(i);     << 370   G4cout << "G4VMultipleScattering::StartTracking Nmod= " << numberOfModels
209     msc->StartTracking(track);                 << 371    << "  " << currParticle->GetParticleName() 
210     if(nullptr != eloss) {                     << 372    << " E(MeV)= " << track->GetKineticEnergy()
211       msc->SetIonisation(eloss, currParticle); << 373    << "  Ion= " << eloss << "  " << fIonisation << " IsMaster= " 
                                                   >> 374    << G4LossTableManager::Instance()->IsMaster() 
                                                   >> 375    << G4endl;
                                                   >> 376   */
                                                   >> 377   // one model
                                                   >> 378   if(1 == numberOfModels) {
                                                   >> 379     currentModel->StartTracking(track);
                                                   >> 380     if(eloss) { currentModel->SetIonisation(fIonisation, currParticle); }
                                                   >> 381 
                                                   >> 382     // many models
                                                   >> 383   } else { 
                                                   >> 384     for(G4int i=0; i<numberOfModels; ++i) {
                                                   >> 385       G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i,true));
                                                   >> 386       msc->StartTracking(track);
                                                   >> 387       if(eloss) { msc->SetIonisation(fIonisation, currParticle); }
212     }                                             388     }
213   }                                               389   }
214 }                                              << 390 } 
215                                                   391 
216 //....oooOO0OOooo........oooOO0OOooo........oo    392 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
217                                                   393 
218 G4double G4VMultipleScattering::AlongStepGetPh    394 G4double G4VMultipleScattering::AlongStepGetPhysicalInteractionLength(
219                              const G4Track& tr    395                              const G4Track& track,
220                              G4double,            396                              G4double,
221                              G4double currentM    397                              G4double currentMinimalStep,
222                              G4double&,           398                              G4double&,
223                              G4GPILSelection*     399                              G4GPILSelection* selection)
224 {                                                 400 {
225   // get Step limit proposed by the process       401   // get Step limit proposed by the process
226   *selection = NotCandidateForSelection;          402   *selection = NotCandidateForSelection;
227   physStepLimit = gPathLength = tPathLength =     403   physStepLimit = gPathLength = tPathLength = currentMinimalStep;
228                                                   404 
229   G4double ekin = track.GetKineticEnergy();       405   G4double ekin = track.GetKineticEnergy();
230   /*                                              406   /*
231   G4cout << "MSC::AlongStepGPIL: Ekin= " << ek    407   G4cout << "MSC::AlongStepGPIL: Ekin= " << ekin
232          << "  " << currParticle->GetParticleN    408          << "  " << currParticle->GetParticleName() 
233          << " currMod " << currentModel        << 409    << " currMod " << currentModel 
234          << G4endl;                            << 410    << G4endl;
235   */                                              411   */
236   // isIon flag is used only to select a model    412   // isIon flag is used only to select a model
237   if(isIon) {                                     413   if(isIon) { 
238     ekin *= proton_mass_c2/track.GetParticleDe    414     ekin *= proton_mass_c2/track.GetParticleDefinition()->GetPDGMass(); 
239   }                                               415   }
240   const G4MaterialCutsCouple* couple = track.G << 
241                                                   416   
242   // select new model, static cast is possible << 417   // select new model
243   if(1 < numberOfModels) {                        418   if(1 < numberOfModels) {
244     currentModel =                             << 419     currentModel = static_cast<G4VMscModel*>(
245       static_cast<G4VMscModel*>(SelectModel(ek << 420       SelectModel(ekin,track.GetMaterialCutsCouple()->GetIndex()));
246   }                                               421   }
247   currentModel->SetCurrentCouple(couple);      << 422   // step limit
248   // msc is active is model is active, energy  << 423   if(currentModel->IsActive(ekin) && gPathLength >= geomMin 
249   // and step size is above the limit;         << 
250   // if it is active msc may limit the step    << 
251   if(currentModel->IsActive(ekin) && tPathLeng << 
252      && ekin >= lowestKinEnergy) {                424      && ekin >= lowestKinEnergy) {
253     isActive = true;                              425     isActive = true;
254     tPathLength =                                 426     tPathLength = 
255       currentModel->ComputeTruePathLengthLimit    427       currentModel->ComputeTruePathLengthLimit(track, gPathLength);
256     if (tPathLength < physStepLimit) {            428     if (tPathLength < physStepLimit) { 
257       *selection = CandidateForSelection;         429       *selection = CandidateForSelection; 
258     }                                             430     }
259   } else {                                     << 431   } else { isActive = false; }
260     isActive = false;                          << 432   
261     gPathLength = DBL_MAX;                     << 
262   }                                            << 
263                                                   433   
264   //if(currParticle->GetPDGMass() > GeV)          434   //if(currParticle->GetPDGMass() > GeV)    
265   /*                                              435   /*
266   G4cout << "MSC::AlongStepGPIL: Ekin= " << ek    436   G4cout << "MSC::AlongStepGPIL: Ekin= " << ekin
267          << "  " << currParticle->GetParticleN    437          << "  " << currParticle->GetParticleName()
268          << " gPathLength= " << gPathLength    << 438    << " gPathLength= " << gPathLength
269          << " tPathLength= " << tPathLength    << 439    << " tPathLength= " << tPathLength
270          << " currentMinimalStep= " << current << 440    << " currentMinimalStep= " << currentMinimalStep
271          << " isActive " << isActive << G4endl << 441    << " isActive " << isActive << G4endl;
272   */                                              442   */
273   return gPathLength;                             443   return gPathLength;
274 }                                                 444 }
275                                                   445 
276 //....oooOO0OOooo........oooOO0OOooo........oo    446 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
277                                                   447 
278 G4double                                          448 G4double 
279 G4VMultipleScattering::PostStepGetPhysicalInte    449 G4VMultipleScattering::PostStepGetPhysicalInteractionLength(
280               const G4Track&, G4double, G4Forc    450               const G4Track&, G4double, G4ForceCondition* condition)
281 {                                                 451 {
282   *condition = NotForced;                      << 452   *condition = Forced;
                                                   >> 453   //*condition = NotForced;
283   return DBL_MAX;                                 454   return DBL_MAX;
284 }                                                 455 }
285                                                   456 
286 //....oooOO0OOooo........oooOO0OOooo........oo    457 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
287                                                   458 
288 G4VParticleChange*                                459 G4VParticleChange* 
289 G4VMultipleScattering::AlongStepDoIt(const G4T    460 G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
290 {                                                 461 {
291   fParticleChange.InitialiseMSC(track, step);  << 462   fParticleChange.ProposeMomentumDirection(
292   fNewPosition = fParticleChange.GetProposedPo << 463     step.GetPostStepPoint()->GetMomentumDirection());
                                                   >> 464   fNewPosition = step.GetPostStepPoint()->GetPosition();
                                                   >> 465   fParticleChange.ProposePosition(fNewPosition);
293   fPositionChanged = false;                       466   fPositionChanged = false;
294                                                   467 
295   G4double geomLength = step.GetStepLength();     468   G4double geomLength = step.GetStepLength();
296                                                   469 
297   // very small step - no msc                     470   // very small step - no msc
298   if(!isActive) {                                 471   if(!isActive) {
299     tPathLength = geomLength;                     472     tPathLength = geomLength;
300                                                   473 
301     // sample msc                                 474     // sample msc
302   } else {                                        475   } else {
303     G4double range =                              476     G4double range = 
304       currentModel->GetRange(currParticle,trac    477       currentModel->GetRange(currParticle,track.GetKineticEnergy(),
305                              track.GetMaterial << 478            track.GetMaterialCutsCouple());
306                                                   479 
307     tPathLength = currentModel->ComputeTrueSte    480     tPathLength = currentModel->ComputeTrueStepLength(geomLength);
308                                                   481   
309     /*                                         << 482     // protection against wrong t->g->t conversion
310     if(currParticle->GetPDGMass() > 0.9*GeV)   << 483     /*
                                                   >> 484     if(currParticle->GetPDGMass() > GeV)    
311     G4cout << "G4VMsc::AlongStepDoIt: GeomLeng    485     G4cout << "G4VMsc::AlongStepDoIt: GeomLength= " 
312            << geomLength                       << 486      << geomLength 
313            << " tPathLength= " << tPathLength  << 487      << " tPathLength= " << tPathLength
314            << " physStepLimit= " << physStepLi << 488      << " physStepLimit= " << physStepLimit
315            << " dr= " << range - tPathLength   << 489      << " dr= " << range - trueLength 
316            << " ekin= " << track.GetKineticEne << 490      << " ekin= " << track.GetKineticEnergy() << G4endl;
317     */                                            491     */
318     // protection against wrong t->g->t conver << 492     if (tPathLength > physStepLimit) {
319     tPathLength = std::min(tPathLength, physSt << 493       tPathLength = physStepLimit; 
                                                   >> 494     }
320                                                   495 
321     // do not sample scattering at the last or    496     // do not sample scattering at the last or at a small step
322     if(tPathLength < range && tPathLength > ge << 497     if(tPathLength + geomMin < range && tPathLength > geomMin) {
323                                                << 
324       static const G4double minSafety = 1.20*C << 
325       static const G4double sFact = 0.99;      << 
326                                                   498 
                                                   >> 499       G4double preSafety = step.GetPreStepPoint()->GetSafety();
                                                   >> 500       G4double maxDisp   = (tPathLength + geomLength)*0.5; 
                                                   >> 501       G4double postSafety= preSafety - maxDisp; 
                                                   >> 502       G4bool safetyRecomputed = false;
                                                   >> 503       if(postSafety < maxDisp) {
                                                   >> 504   safetyRecomputed = true;
                                                   >> 505   postSafety = safetyHelper->ComputeSafety(fNewPosition,maxDisp); 
                                                   >> 506       } 
327       G4ThreeVector displacement = currentMode    507       G4ThreeVector displacement = currentModel->SampleScattering(
328         step.GetPostStepPoint()->GetMomentumDi << 508         step.GetPostStepPoint()->GetMomentumDirection(), postSafety);
329                                                   509 
330       G4double r2 = displacement.mag2();          510       G4double r2 = displacement.mag2();
331       //G4cout << "    R= " << sqrt(r2) << " R << 511 
332       //     << " flag= " << fDispBeyondSafety << 512       //G4cout << "R= " << sqrt(r2) << " postSafety= " << postSafety 
333       if(r2 > minDisplacement2) {              << 513       // << G4endl;
334                                                << 514 
335         fPositionChanged = true;               << 515       // make correction for displacement
336         G4double dispR = std::sqrt(r2);        << 516       if(r2 > 0.0) {
337         G4double postSafety =                  << 517 
338           sFact*safetyHelper->ComputeSafety(fN << 518   fPositionChanged = true;
339         //G4cout<<"    R= "<< dispR<<" postSaf << 519         G4double fac = 1.0;
340                                                << 520 
341         // far away from geometry boundary     << 521   // displaced point is definitely within the volume
342         if(postSafety > 0.0 && dispR <= postSa << 522   if(r2 > postSafety*postSafety) {
343           fNewPosition += displacement;        << 523           G4double dispR = std::sqrt(r2);
344                                                << 524           if(!safetyRecomputed) {
345           //near the boundary                  << 525       postSafety = safetyHelper->ComputeSafety(fNewPosition, dispR);
346         } else {                               << 526     } 
347           // displaced point is definitely wit << 527 
348           //G4cout<<"    R= "<<dispR<<" postSa << 528     if(dispR > postSafety) { 
349           if(dispR < postSafety) {             << 529       fac = 0.99*postSafety/dispR; 
350             fNewPosition += displacement;      << 530     }
351                                                << 531   }
352             // reduced displacement            << 532   // compute new endpoint of the Step
353           } else if(postSafety > geomMin) {    << 533   fNewPosition += fac*displacement;
354             fNewPosition += displacement*(post << 534   //safetyHelper->ReLocateWithinVolume(fNewPosition);
355                                                << 
356             // very small postSafety           << 
357           } else {                             << 
358             fPositionChanged = false;          << 
359           }                                    << 
360         }                                      << 
361         if(fPositionChanged) {                 << 
362           safetyHelper->ReLocateWithinVolume(f << 
363           fParticleChange.ProposePosition(fNew << 
364         }                                      << 
365       }                                           535       }
366     }                                             536     }
367   }                                               537   }
368   fParticleChange.ProposeTrueStepLength(tPathL    538   fParticleChange.ProposeTrueStepLength(tPathLength);
                                                   >> 539   //fParticleChange.ProposePosition(fNewPosition);
                                                   >> 540   return &fParticleChange;
                                                   >> 541 }
                                                   >> 542 
                                                   >> 543 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 544 
                                                   >> 545 G4VParticleChange* 
                                                   >> 546 G4VMultipleScattering::PostStepDoIt(const G4Track& track, const G4Step&)
                                                   >> 547 {
                                                   >> 548   fParticleChange.Initialize(track);  
                                                   >> 549  
                                                   >> 550   if(fPositionChanged) { 
                                                   >> 551     safetyHelper->ReLocateWithinVolume(fNewPosition);
                                                   >> 552     fParticleChange.ProposePosition(fNewPosition); 
                                                   >> 553   }
                                                   >> 554  
369   return &fParticleChange;                        555   return &fParticleChange;
370 }                                                 556 }
371                                                   557 
372 //....oooOO0OOooo........oooOO0OOooo........oo    558 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
373                                                   559 
374 G4double G4VMultipleScattering::GetContinuousS    560 G4double G4VMultipleScattering::GetContinuousStepLimit(
375                                        const G    561                                        const G4Track& track,
376                                        G4doubl    562                                        G4double previousStepSize,
377                                        G4doubl    563                                        G4double currentMinimalStep,
378                                        G4doubl    564                                        G4double& currentSafety)
379 {                                                 565 {
380   G4GPILSelection selection = NotCandidateForS    566   G4GPILSelection selection = NotCandidateForSelection;
381   G4double x = AlongStepGetPhysicalInteraction    567   G4double x = AlongStepGetPhysicalInteractionLength(track,previousStepSize,
382                                                << 568                  currentMinimalStep,
383                                                << 569                  currentSafety, 
384                                                << 570                  &selection);
385   return x;                                       571   return x;
386 }                                                 572 }
387                                                   573 
388 //....oooOO0OOooo........oooOO0OOooo........oo    574 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
389                                                   575 
390 G4double G4VMultipleScattering::ContinuousStep    576 G4double G4VMultipleScattering::ContinuousStepLimit(
391                                        const G    577                                        const G4Track& track,
392                                        G4doubl    578                                        G4double previousStepSize,
393                                        G4doubl    579                                        G4double currentMinimalStep,
394                                        G4doubl    580                                        G4double& currentSafety)
395 {                                                 581 {
396   return GetContinuousStepLimit(track,previous    582   return GetContinuousStepLimit(track,previousStepSize,currentMinimalStep,
397                                 currentSafety) << 583         currentSafety);
398 }                                                 584 }
399                                                   585 
400 //....oooOO0OOooo........oooOO0OOooo........oo    586 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
401                                                   587 
402 G4double G4VMultipleScattering::GetMeanFreePat    588 G4double G4VMultipleScattering::GetMeanFreePath(
403               const G4Track&, G4double, G4Forc    589               const G4Track&, G4double, G4ForceCondition* condition)
404 {                                                 590 {
405   *condition = Forced;                            591   *condition = Forced;
406   return DBL_MAX;                                 592   return DBL_MAX;
407 }                                                 593 }
408                                                   594 
409 //....oooOO0OOooo........oooOO0OOooo........oo    595 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
410                                                   596 
411 G4bool                                            597 G4bool 
412 G4VMultipleScattering::StorePhysicsTable(const    598 G4VMultipleScattering::StorePhysicsTable(const G4ParticleDefinition* part,
413                                          const << 599            const G4String& directory,
414                                          G4boo << 600            G4bool ascii)
415 {                                                 601 {
416   G4bool yes = true;                              602   G4bool yes = true;
417   if(part != firstParticle || !emManager->IsMa << 603   if(part != firstParticle) { return yes; }
418                                                << 604   G4int nmod = modelManager->NumberOfModels();
419   return G4EmTableUtil::StoreMscTable(this, pa << 605   static const G4String ss[4] = {"1","2","3","4"};
420               numberOfModels, verboseLevel,    << 606   for(G4int i=0; i<nmod; ++i) {
421                                       ascii);  << 607     G4VEmModel* msc = modelManager->GetModel(i);
                                                   >> 608     yes = true;
                                                   >> 609     G4PhysicsTable* table = msc->GetCrossSectionTable();
                                                   >> 610     if (table) {
                                                   >> 611       G4int j = std::min(i,3); 
                                                   >> 612       G4String name = 
                                                   >> 613   GetPhysicsTableFileName(part,directory,"LambdaMod"+ss[j],ascii);
                                                   >> 614       yes = table->StorePhysicsTable(name,ascii);
                                                   >> 615 
                                                   >> 616       if ( yes ) {
                                                   >> 617   if ( verboseLevel>0 ) {
                                                   >> 618     G4cout << "Physics table are stored for " 
                                                   >> 619      << part->GetParticleName()
                                                   >> 620      << " and process " << GetProcessName()
                                                   >> 621      << " with a name <" << name << "> " << G4endl;
                                                   >> 622   }
                                                   >> 623       } else {
                                                   >> 624   G4cout << "Fail to store Physics Table for " 
                                                   >> 625          << part->GetParticleName()
                                                   >> 626          << " and process " << GetProcessName()
                                                   >> 627          << " in the directory <" << directory
                                                   >> 628          << "> " << G4endl;
                                                   >> 629       }
                                                   >> 630     }
                                                   >> 631   }
                                                   >> 632   return yes;
422 }                                                 633 }
423                                                   634 
424 //....oooOO0OOooo........oooOO0OOooo........oo    635 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
425                                                   636 
426 G4bool                                            637 G4bool 
427 G4VMultipleScattering::RetrievePhysicsTable(co    638 G4VMultipleScattering::RetrievePhysicsTable(const G4ParticleDefinition*,
428                                             co << 639               const G4String&,
429                                             G4 << 640               G4bool)
430 {                                                 641 {
431   return true;                                    642   return true;
432 }                                                 643 }
433                                                   644 
434 //....oooOO0OOooo........oooOO0OOooo........oo    645 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
435                                                   646 
436 void G4VMultipleScattering::ProcessDescription << 647 void G4VMultipleScattering::SetIonisation(G4VEnergyLossProcess* p)
437 {                                                 648 {
438   if(nullptr != firstParticle) {               << 649   for(G4int i=0; i<numberOfModels; ++i) {
439     StreamInfo(outFile, *firstParticle, true); << 650     G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i, true));
                                                   >> 651     msc->SetIonisation(p, firstParticle);
440   }                                               652   }
441 }                                                 653 }
442                                                   654 
443 //....oooOO0OOooo........oooOO0OOooo........oo    655 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
444                                                   656 
445                                                   657