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.6.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 //                                                 26 //
 27 // -------------------------------------------     27 // -------------------------------------------------------------------
 28 //                                                 28 //
 29 // GEANT4 Class file                               29 // GEANT4 Class file
 30 //                                                 30 //
 31 //                                                 31 //
 32 // File name:     G4VMultipleScattering            32 // File name:     G4VMultipleScattering
 33 //                                                 33 //
 34 // Author:        Vladimir Ivanchenko on base      34 // Author:        Vladimir Ivanchenko on base of Laszlo Urban code
 35 //                                                 35 //
 36 // Creation date: 25.03.2003                       36 // Creation date: 25.03.2003
 37 //                                                 37 //
 38 // Modifications:                                  38 // Modifications:
 39 //                                                 39 //
                                                   >>  40 // 13.04.03 Change printout (V.Ivanchenko)
                                                   >>  41 // 04-06-03 Fix compilation warnings (V.Ivanchenko)
 40 // 16-07-03 Use G4VMscModel interface (V.Ivanc     42 // 16-07-03 Use G4VMscModel interface (V.Ivanchenko)
 41 // 03-11-03 Fix initialisation problem in Retr     43 // 03-11-03 Fix initialisation problem in RetrievePhysicsTable (V.Ivanchenko)
 42 // 04-11-03 Update PrintInfoDefinition (V.Ivan     44 // 04-11-03 Update PrintInfoDefinition (V.Ivanchenko)
 43 // 01-03-04 SampleCosineTheta signature change     45 // 01-03-04 SampleCosineTheta signature changed
 44 // 22-04-04 SampleCosineTheta signature change     46 // 22-04-04 SampleCosineTheta signature changed back to original
 45 // 27-08-04 Add InitialiseForRun method (V.Iva     47 // 27-08-04 Add InitialiseForRun method (V.Ivanchneko)
 46 // 08-11-04 Migration to new interface of Stor     48 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
 47 // 11-03-05 Shift verbose level by 1 (V.Ivantc     49 // 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
 48 // 15-04-05 optimize internal interface (V.Iva     50 // 15-04-05 optimize internal interface (V.Ivanchenko)
 49 // 15-04-05 remove boundary flag (V.Ivanchenko     51 // 15-04-05 remove boundary flag (V.Ivanchenko)
 50 // 27-10-05 introduce virtual function MscStep     52 // 27-10-05 introduce virtual function MscStepLimitation() (V.Ivanchenko)
 51 // 12-04-07 Add verbosity at destruction (V.Iv     53 // 12-04-07 Add verbosity at destruction (V.Ivanchenko)
 52 // 27-10-07 Virtual functions moved to source      54 // 27-10-07 Virtual functions moved to source (V.Ivanchenko)
 53 // 11-03-08 Set skin value does not effect ste     55 // 11-03-08 Set skin value does not effect step limit type (V.Ivanchenko)
 54 // 24-06-09 Removed hidden bin in G4PhysicsVec     56 // 24-06-09 Removed hidden bin in G4PhysicsVector (V.Ivanchenko)
 55 // 04-06-13 Adoptation to MT mode (V.Ivanchenk     57 // 04-06-13 Adoptation to MT mode (V.Ivanchenko)
 56 //                                                 58 //
                                                   >>  59 // Class Description:
                                                   >>  60 //
                                                   >>  61 // It is the generic process of multiple scattering it includes common
                                                   >>  62 // part of calculations for all charged particles
 57                                                    63 
 58 // -------------------------------------------     64 // -------------------------------------------------------------------
 59 //                                                 65 //
 60 //....oooOO0OOooo........oooOO0OOooo........oo     66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 61 //....oooOO0OOooo........oooOO0OOooo........oo     67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 62                                                    68 
 63 #include "G4VMultipleScattering.hh"                69 #include "G4VMultipleScattering.hh"
 64 #include "G4PhysicalConstants.hh"                  70 #include "G4PhysicalConstants.hh"
 65 #include "G4SystemOfUnits.hh"                      71 #include "G4SystemOfUnits.hh"
 66 #include "G4LossTableManager.hh"                   72 #include "G4LossTableManager.hh"
 67 #include "G4MaterialCutsCouple.hh"                 73 #include "G4MaterialCutsCouple.hh"
 68 #include "G4Step.hh"                               74 #include "G4Step.hh"
 69 #include "G4ParticleDefinition.hh"                 75 #include "G4ParticleDefinition.hh"
 70 #include "G4VEmFluctuationModel.hh"                76 #include "G4VEmFluctuationModel.hh"
 71 #include "G4UnitsTable.hh"                         77 #include "G4UnitsTable.hh"
 72 #include "G4ProductionCutsTable.hh"                78 #include "G4ProductionCutsTable.hh"
 73 #include "G4Electron.hh"                           79 #include "G4Electron.hh"
 74 #include "G4GenericIon.hh"                         80 #include "G4GenericIon.hh"
 75 #include "G4TransportationManager.hh"              81 #include "G4TransportationManager.hh"
 76 #include "G4SafetyHelper.hh"                       82 #include "G4SafetyHelper.hh"
 77 #include "G4ParticleTable.hh"                      83 #include "G4ParticleTable.hh"
 78 #include "G4ProcessVector.hh"                      84 #include "G4ProcessVector.hh"
 79 #include "G4ProcessManager.hh"                     85 #include "G4ProcessManager.hh"
 80 #include "G4LossTableBuilder.hh"               << 
 81 #include "G4EmTableUtil.hh"                    << 
 82 #include <iostream>                                86 #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, G4ProcessType)
 87   : G4VContinuousDiscreteProcess("msc", fElect     91   : G4VContinuousDiscreteProcess("msc", fElectromagnetic),
                                                   >>  92   numberOfModels(0),
                                                   >>  93   firstParticle(nullptr),
                                                   >>  94   currParticle(nullptr),
                                                   >>  95   stepLimit(fUseSafety),
                                                   >>  96   facrange(0.04),
                                                   >>  97   latDisplacement(true),
                                                   >>  98   isIon(false),
                                                   >>  99   fDispBeyondSafety(false),
 88   fNewPosition(0.,0.,0.),                         100   fNewPosition(0.,0.,0.),
 89   fNewDirection(0.,0.,1.)                         101   fNewDirection(0.,0.,1.)
 90 {                                                 102 {
 91   theParameters = G4EmParameters::Instance();     103   theParameters = G4EmParameters::Instance();
 92   SetVerboseLevel(1);                             104   SetVerboseLevel(1);
 93   SetProcessSubType(fMultipleScattering);         105   SetProcessSubType(fMultipleScattering);
                                                   >> 106   if("ionmsc" == name) { firstParticle = G4GenericIon::GenericIon(); }
 94                                                   107 
 95   lowestKinEnergy = 10*CLHEP::eV;                 108   lowestKinEnergy = 10*CLHEP::eV;
 96                                                   109 
 97   geomMin = 0.05*CLHEP::nm;                    << 110   physStepLimit = gPathLength = tPathLength = 0.0;
                                                   >> 111   fIonisation = nullptr;
                                                   >> 112 
                                                   >> 113   geomMin   = 0.05*CLHEP::nm;
 98   minDisplacement2 = geomMin*geomMin;             114   minDisplacement2 = geomMin*geomMin;
 99                                                   115 
100   pParticleChange = &fParticleChange;             116   pParticleChange = &fParticleChange;
                                                   >> 117   safetyHelper = nullptr;
                                                   >> 118   fPositionChanged = false;
                                                   >> 119   isActive = false;
101                                                   120 
                                                   >> 121   currentModel = nullptr;
102   modelManager = new G4EmModelManager();          122   modelManager = new G4EmModelManager();
103   emManager = G4LossTableManager::Instance();     123   emManager = G4LossTableManager::Instance();
104   mscModels.reserve(2);                           124   mscModels.reserve(2);
105   emManager->Register(this);                      125   emManager->Register(this);
106 }                                                 126 }
107                                                   127 
108 //....oooOO0OOooo........oooOO0OOooo........oo    128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
109                                                   129 
110 G4VMultipleScattering::~G4VMultipleScattering(    130 G4VMultipleScattering::~G4VMultipleScattering()
111 {                                                 131 {
                                                   >> 132   /*
                                                   >> 133   if(1 < verboseLevel) {
                                                   >> 134     G4cout << "G4VMultipleScattering destruct " << GetProcessName() 
                                                   >> 135           << G4endl;
                                                   >> 136   }
                                                   >> 137   */
112   delete modelManager;                            138   delete modelManager;
113   emManager->DeRegister(this);                    139   emManager->DeRegister(this);
114 }                                                 140 }
115                                                   141 
116 //....oooOO0OOooo........oooOO0OOooo........oo    142 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
117                                                   143 
118 void G4VMultipleScattering::AddEmModel(G4int o << 144 void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
119                                        const G    145                                        const G4Region* region)
120 {                                                 146 {
121   if(nullptr == ptr) { return; }               << 147   if(!p) { return; }
122   G4VEmFluctuationModel* fm = nullptr;            148   G4VEmFluctuationModel* fm = nullptr;
123   modelManager->AddEmModel(order, ptr, fm, reg << 149   modelManager->AddEmModel(order, p, fm, region);
124   ptr->SetParticleChange(pParticleChange);     << 150   p->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, size_t)
130 {                                                 156 {
131   if(nullptr == ptr) { return; }               << 157   for(auto & msc : mscModels) { if(msc == p) { return; } }
132   if(!mscModels.empty()) {                     << 158   mscModels.push_back(p);  
133     for(auto & msc : mscModels) { if(msc == pt << 159 }
134   }                                            << 160 
135   mscModels.push_back(ptr);                    << 161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 162 
                                                   >> 163 G4VMscModel* G4VMultipleScattering::EmModel(size_t index) const
                                                   >> 164 {
                                                   >> 165   return (index < mscModels.size()) ? mscModels[index] : nullptr; 
136 }                                                 166 }
137                                                   167 
138 //....oooOO0OOooo........oooOO0OOooo........oo    168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
139                                                   169 
140 void                                              170 void 
141 G4VMultipleScattering::PreparePhysicsTable(con    171 G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
142 {                                                 172 {
                                                   >> 173   if(1 < verboseLevel) {
                                                   >> 174     G4cout << "### G4VMultipleScattering::PrepearPhysicsTable() for "
                                                   >> 175            << GetProcessName()
                                                   >> 176            << " and particle " << part.GetParticleName()
                                                   >> 177            << G4endl;
                                                   >> 178   }
143   G4bool master = emManager->IsMaster();          179   G4bool master = emManager->IsMaster();
144   if (nullptr == firstParticle) { firstParticl << 
145                                                   180 
146   emManager->PreparePhysicsTable(&part, this); << 181   if(!firstParticle) { firstParticle = &part; }
                                                   >> 182   if(part.GetParticleType() == "nucleus") {
                                                   >> 183     stepLimit = fMinimal;
                                                   >> 184     latDisplacement = false;
                                                   >> 185     facrange = 0.2;
                                                   >> 186     G4String pname = part.GetParticleName();
                                                   >> 187     if(pname != "deuteron" && pname != "triton" &&
                                                   >> 188        pname != "alpha+"   && pname != "helium" &&
                                                   >> 189        pname != "alpha"    && pname != "He3" &&
                                                   >> 190        pname != "hydrogen") {
                                                   >> 191 
                                                   >> 192       const G4ParticleDefinition* theGenericIon = 
                                                   >> 193         G4ParticleTable::GetParticleTable()->FindParticle("GenericIon");
                                                   >> 194       if(&part == theGenericIon) { isIon = true; }
                                                   >> 195      
                                                   >> 196       if(theGenericIon && firstParticle != theGenericIon) {
                                                   >> 197         G4ProcessManager* pm =  theGenericIon->GetProcessManager();
                                                   >> 198         G4ProcessVector* v = pm->GetAlongStepProcessVector();
                                                   >> 199         size_t n = v->size();
                                                   >> 200         for(size_t j=0; j<n; ++j) {
                                                   >> 201           if((*v)[j] == this) {
                                                   >> 202             firstParticle = theGenericIon;
                                                   >> 203             isIon = true; 
                                                   >> 204             break; 
                                                   >> 205           }
                                                   >> 206         }
                                                   >> 207       }
                                                   >> 208     }
                                                   >> 209   }
                                                   >> 210 
                                                   >> 211   emManager->PreparePhysicsTable(&part, this, master);
147   currParticle = nullptr;                         212   currParticle = nullptr;
148                                                   213 
                                                   >> 214   if(1 < verboseLevel) {
                                                   >> 215     G4cout << "### G4VMultipleScattering::PrepearPhysicsTable() for "
                                                   >> 216            << GetProcessName()
                                                   >> 217            << " and particle " << part.GetParticleName()
                                                   >> 218            << " local particle " << firstParticle->GetParticleName()
                                                   >> 219            << " isIon: " << isIon << " isMaster: " << master
                                                   >> 220            << G4endl;
                                                   >> 221   }
                                                   >> 222 
149   if(firstParticle == &part) {                    223   if(firstParticle == &part) {
150     baseMat = emManager->GetTableBuilder()->Ge << 
151     G4EmTableUtil::PrepareMscProcess(this, par << 
152              stepLimit, facrange,              << 
153              latDisplacement, master,          << 
154              isIon, baseMat);                  << 
155                                                   224 
                                                   >> 225     // initialise process
                                                   >> 226     InitialiseProcess(firstParticle);
                                                   >> 227 
                                                   >> 228     // heavy particles and not ions
                                                   >> 229     if(!isIon) {
                                                   >> 230       if(part.GetPDGMass() > MeV) {
                                                   >> 231         stepLimit = theParameters->MscMuHadStepLimitType(); 
                                                   >> 232         facrange = theParameters->MscMuHadRangeFactor(); 
                                                   >> 233         latDisplacement = theParameters->MuHadLateralDisplacement();
                                                   >> 234       } else {
                                                   >> 235         stepLimit = theParameters->MscStepLimitType(); 
                                                   >> 236         facrange = theParameters->MscRangeFactor(); 
                                                   >> 237         latDisplacement = theParameters->LateralDisplacement();
                                                   >> 238       }
                                                   >> 239       if(latDisplacement) { 
                                                   >> 240         fDispBeyondSafety = theParameters->LatDisplacementBeyondSafety();
                                                   >> 241       }
                                                   >> 242     }
                                                   >> 243     if(master) { SetVerboseLevel(theParameters->Verbose()); }
                                                   >> 244     else {  SetVerboseLevel(theParameters->WorkerVerbose()); }
                                                   >> 245 
                                                   >> 246     // initialisation of models
156     numberOfModels = modelManager->NumberOfMod    247     numberOfModels = modelManager->NumberOfModels();
157     currentModel = GetModelByIndex(0);         << 248     /*
                                                   >> 249         G4cout << "### G4VMultipleScattering::PreparePhysicsTable() for "
                                                   >> 250         << GetProcessName()
                                                   >> 251         << " and particle " << part.GetParticleName()
                                                   >> 252         << " Nmod= " << numberOfModels << "  " << this
                                                   >> 253         << G4endl;
                                                   >> 254     */
                                                   >> 255     for(G4int i=0; i<numberOfModels; ++i) {
                                                   >> 256       G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i));
                                                   >> 257       if(!msc) { continue; }
                                                   >> 258       msc->SetIonisation(nullptr, firstParticle);
                                                   >> 259       msc->SetMasterThread(master);
                                                   >> 260       currentModel = msc; 
                                                   >> 261       msc->SetPolarAngleLimit(theParameters->MscThetaLimit());
                                                   >> 262       G4double emax = 
                                                   >> 263         std::min(msc->HighEnergyLimit(),theParameters->MaxKinEnergy());
                                                   >> 264       msc->SetHighEnergyLimit(emax);
                                                   >> 265     }
158                                                   266 
159     if (nullptr == safetyHelper) {             << 267     modelManager->Initialise(firstParticle, G4Electron::Electron(), 
                                                   >> 268                              10.0, verboseLevel);
                                                   >> 269 
                                                   >> 270     if(!safetyHelper) {
160       safetyHelper = G4TransportationManager::    271       safetyHelper = G4TransportationManager::GetTransportationManager()
161   ->GetSafetyHelper();                         << 272         ->GetSafetyHelper();
162       safetyHelper->InitialiseHelper();           273       safetyHelper->InitialiseHelper();
163     }                                             274     }
164   }                                               275   }
165 }                                                 276 }
166                                                   277 
167 //....oooOO0OOooo........oooOO0OOooo........oo    278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
168                                                   279 
169 void G4VMultipleScattering::BuildPhysicsTable(    280 void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
170 {                                                 281 {
                                                   >> 282   G4String num = part.GetParticleName();
171   G4bool master = emManager->IsMaster();          283   G4bool master = emManager->IsMaster();
172                                                << 284   if(1 < verboseLevel) {
173   if(firstParticle == &part) {                 << 285     G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
174     emManager->BuildPhysicsTable(&part);       << 286            << GetProcessName()
                                                   >> 287            << " and particle " << num << " isIon: " << isIon
                                                   >> 288            << " IsMaster: " << master << G4endl;
175   }                                               289   }
176   const G4VMultipleScattering* ptr = this;     << 290   const G4VMultipleScattering* masterProcess = 
177   if(!master) {                                << 291     static_cast<const G4VMultipleScattering*>(GetMasterProcess());
178     ptr = static_cast<const G4VMultipleScatter << 292 
                                                   >> 293   if(firstParticle == &part) { 
                                                   >> 294     /*    
                                                   >> 295     G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
                                                   >> 296            << GetProcessName()
                                                   >> 297            << " and particle " << num
                                                   >> 298            << " IsMaster= " << G4LossTableManager::Instance()->IsMaster()
                                                   >> 299            << "  " << this
                                                   >> 300            << G4endl;
                                                   >> 301     */
                                                   >> 302     emManager->BuildPhysicsTable(firstParticle);
                                                   >> 303 
                                                   >> 304     if(!master) {
                                                   >> 305       // initialisation of models
                                                   >> 306       /*
                                                   >> 307         G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
                                                   >> 308         << GetProcessName()
                                                   >> 309         << " and particle " << num
                                                   >> 310         << " Nmod= " << numberOfModels << "  " << this
                                                   >> 311         << G4endl;
                                                   >> 312       */
                                                   >> 313       for(G4int i=0; i<numberOfModels; ++i) {
                                                   >> 314         G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i));
                                                   >> 315         if(!msc) { continue; }
                                                   >> 316         G4VMscModel* msc0= 
                                                   >> 317           static_cast<G4VMscModel*>(masterProcess->GetModelByIndex(i));
                                                   >> 318         msc->SetCrossSectionTable(msc0->GetCrossSectionTable(), false);
                                                   >> 319         msc->InitialiseLocal(firstParticle, msc0);
                                                   >> 320       }
                                                   >> 321     }
179   }                                               322   }
180                                                   323 
181   G4EmTableUtil::BuildMscProcess(this, ptr, pa << 324   // explicitly defined printout by particle name
182          numberOfModels, master);              << 325   if(1 < verboseLevel || 
                                                   >> 326      (0 < verboseLevel && (num == "e-" || 
                                                   >> 327                            num == "e+"    || num == "mu+" || 
                                                   >> 328                            num == "mu-"   || num == "proton"|| 
                                                   >> 329                            num == "pi+"   || num == "pi-" || 
                                                   >> 330                            num == "kaon+" || num == "kaon-" || 
                                                   >> 331                            num == "alpha" || num == "anti_proton" || 
                                                   >> 332                            num == "GenericIon" || num == "alpha+" || 
                                                   >> 333                            num == "alpha++" )))
                                                   >> 334     { 
                                                   >> 335       StreamInfo(G4cout, part);
                                                   >> 336     }
                                                   >> 337 
                                                   >> 338   if(1 < verboseLevel) {
                                                   >> 339     G4cout << "### G4VMultipleScattering::BuildPhysicsTable() done for "
                                                   >> 340            << GetProcessName()
                                                   >> 341            << " and particle " << num
                                                   >> 342            << G4endl;
                                                   >> 343   }
183 }                                                 344 }
184                                                   345 
185 //....oooOO0OOooo........oooOO0OOooo........oo    346 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
186                                                   347 
187 void G4VMultipleScattering::StreamInfo(std::os    348 void G4VMultipleScattering::StreamInfo(std::ostream& outFile, 
188                   const G4ParticleDefinition&     349                   const G4ParticleDefinition& part, G4bool rst) const
189 {                                                 350 {
190   G4String indent = (rst ? "  " : "");            351   G4String indent = (rst ? "  " : "");
191   outFile << G4endl << indent << GetProcessNam    352   outFile << G4endl << indent << GetProcessName() << ": ";
192   if (!rst) outFile << " for " << part.GetPart    353   if (!rst) outFile << " for " << part.GetParticleName();
193   outFile  << "  SubType= " << GetProcessSubTy    354   outFile  << "  SubType= " << GetProcessSubType() << G4endl;
                                                   >> 355   StreamProcessInfo(outFile);
194   modelManager->DumpModelList(outFile, verbose    356   modelManager->DumpModelList(outFile, verboseLevel);
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 = nullptr;
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   }
                                                   >> 369   /*
                                                   >> 370   G4cout << "G4VMultipleScattering::StartTracking Nmod= " << numberOfModels
                                                   >> 371          << "  " << currParticle->GetParticleName() 
                                                   >> 372          << " E(MeV)= " << track->GetKineticEnergy()
                                                   >> 373          << "  Ion= " << eloss << "  " << fIonisation << " IsMaster= " 
                                                   >> 374          << G4LossTableManager::Instance()->IsMaster() 
                                                   >> 375          << G4endl;
                                                   >> 376   */
207   for(G4int i=0; i<numberOfModels; ++i) {         377   for(G4int i=0; i<numberOfModels; ++i) {
208     G4VMscModel* msc = GetModelByIndex(i);     << 378     /*
                                                   >> 379     G4cout << "Next model " << i << "  " << msc 
                                                   >> 380            << " Emin= " << msc->LowEnergyLimit() 
                                                   >> 381            << " Emax= " << msc->HighEnergyLimit() 
                                                   >> 382            << " Eact= " << msc->LowEnergyActivationLimit() << G4endl;
                                                   >> 383     */
                                                   >> 384     G4VEmModel* msc = GetModelByIndex(i);
209     msc->StartTracking(track);                    385     msc->StartTracking(track);
210     if(nullptr != eloss) {                     << 386     if(eloss) { 
211       msc->SetIonisation(eloss, currParticle); << 387       G4VMscModel* mscmod = static_cast<G4VMscModel*>(msc);
                                                   >> 388       if(mscmod) { mscmod->SetIonisation(fIonisation, currParticle); } 
212     }                                             389     }
213   }                                               390   }
214 }                                              << 391 } 
215                                                   392 
216 //....oooOO0OOooo........oooOO0OOooo........oo    393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
217                                                   394 
218 G4double G4VMultipleScattering::AlongStepGetPh    395 G4double G4VMultipleScattering::AlongStepGetPhysicalInteractionLength(
219                              const G4Track& tr    396                              const G4Track& track,
220                              G4double,            397                              G4double,
221                              G4double currentM    398                              G4double currentMinimalStep,
222                              G4double&,           399                              G4double&,
223                              G4GPILSelection*     400                              G4GPILSelection* selection)
224 {                                                 401 {
225   // get Step limit proposed by the process       402   // get Step limit proposed by the process
226   *selection = NotCandidateForSelection;          403   *selection = NotCandidateForSelection;
227   physStepLimit = gPathLength = tPathLength =     404   physStepLimit = gPathLength = tPathLength = currentMinimalStep;
228                                                   405 
229   G4double ekin = track.GetKineticEnergy();       406   G4double ekin = track.GetKineticEnergy();
230   /*                                              407   /*
231   G4cout << "MSC::AlongStepGPIL: Ekin= " << ek    408   G4cout << "MSC::AlongStepGPIL: Ekin= " << ekin
232          << "  " << currParticle->GetParticleN    409          << "  " << currParticle->GetParticleName() 
233          << " currMod " << currentModel           410          << " currMod " << currentModel 
234          << G4endl;                               411          << G4endl;
235   */                                              412   */
236   // isIon flag is used only to select a model    413   // isIon flag is used only to select a model
237   if(isIon) {                                     414   if(isIon) { 
238     ekin *= proton_mass_c2/track.GetParticleDe    415     ekin *= proton_mass_c2/track.GetParticleDefinition()->GetPDGMass(); 
239   }                                               416   }
240   const G4MaterialCutsCouple* couple = track.G << 
241                                                   417   
242   // select new model, static cast is possible << 418   // select new model
243   if(1 < numberOfModels) {                        419   if(1 < numberOfModels) {
244     currentModel =                             << 420     currentModel = static_cast<G4VMscModel*>(
245       static_cast<G4VMscModel*>(SelectModel(ek << 421       SelectModel(ekin,track.GetMaterialCutsCouple()->GetIndex()));
246   }                                               422   }
247   currentModel->SetCurrentCouple(couple);      << 
248   // msc is active is model is active, energy     423   // msc is active is model is active, energy above the limit,
249   // and step size is above the limit;            424   // and step size is above the limit;
250   // if it is active msc may limit the step       425   // if it is active msc may limit the step
251   if(currentModel->IsActive(ekin) && tPathLeng    426   if(currentModel->IsActive(ekin) && tPathLength > geomMin
252      && ekin >= lowestKinEnergy) {                427      && ekin >= lowestKinEnergy) {
253     isActive = true;                              428     isActive = true;
254     tPathLength =                                 429     tPathLength = 
255       currentModel->ComputeTruePathLengthLimit    430       currentModel->ComputeTruePathLengthLimit(track, gPathLength);
256     if (tPathLength < physStepLimit) {            431     if (tPathLength < physStepLimit) { 
257       *selection = CandidateForSelection;         432       *selection = CandidateForSelection; 
258     }                                             433     }
259   } else {                                     << 434   } else { isActive = false; }
260     isActive = false;                          << 
261     gPathLength = DBL_MAX;                     << 
262   }                                            << 
263                                                   435   
264   //if(currParticle->GetPDGMass() > GeV)          436   //if(currParticle->GetPDGMass() > GeV)    
265   /*                                              437   /*
266   G4cout << "MSC::AlongStepGPIL: Ekin= " << ek    438   G4cout << "MSC::AlongStepGPIL: Ekin= " << ekin
267          << "  " << currParticle->GetParticleN    439          << "  " << currParticle->GetParticleName()
268          << " gPathLength= " << gPathLength       440          << " gPathLength= " << gPathLength
269          << " tPathLength= " << tPathLength       441          << " tPathLength= " << tPathLength
270          << " currentMinimalStep= " << current    442          << " currentMinimalStep= " << currentMinimalStep
271          << " isActive " << isActive << G4endl    443          << " isActive " << isActive << G4endl;
272   */                                              444   */
273   return gPathLength;                             445   return gPathLength;
274 }                                                 446 }
275                                                   447 
276 //....oooOO0OOooo........oooOO0OOooo........oo    448 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
277                                                   449 
278 G4double                                          450 G4double 
279 G4VMultipleScattering::PostStepGetPhysicalInte    451 G4VMultipleScattering::PostStepGetPhysicalInteractionLength(
280               const G4Track&, G4double, G4Forc    452               const G4Track&, G4double, G4ForceCondition* condition)
281 {                                                 453 {
282   *condition = NotForced;                         454   *condition = NotForced;
283   return DBL_MAX;                                 455   return DBL_MAX;
284 }                                                 456 }
285                                                   457 
286 //....oooOO0OOooo........oooOO0OOooo........oo    458 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
287                                                   459 
288 G4VParticleChange*                                460 G4VParticleChange* 
289 G4VMultipleScattering::AlongStepDoIt(const G4T    461 G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
290 {                                                 462 {
291   fParticleChange.InitialiseMSC(track, step);  << 463   fParticleChange.ProposeMomentumDirection(
292   fNewPosition = fParticleChange.GetProposedPo << 464     step.GetPostStepPoint()->GetMomentumDirection());
                                                   >> 465   fNewPosition = step.GetPostStepPoint()->GetPosition();
                                                   >> 466   fParticleChange.ProposePosition(fNewPosition);
293   fPositionChanged = false;                       467   fPositionChanged = false;
294                                                   468 
295   G4double geomLength = step.GetStepLength();     469   G4double geomLength = step.GetStepLength();
296                                                   470 
297   // very small step - no msc                     471   // very small step - no msc
298   if(!isActive) {                                 472   if(!isActive) {
299     tPathLength = geomLength;                     473     tPathLength = geomLength;
300                                                   474 
301     // sample msc                                 475     // sample msc
302   } else {                                        476   } else {
303     G4double range =                              477     G4double range = 
304       currentModel->GetRange(currParticle,trac    478       currentModel->GetRange(currParticle,track.GetKineticEnergy(),
305                              track.GetMaterial    479                              track.GetMaterialCutsCouple());
306                                                   480 
307     tPathLength = currentModel->ComputeTrueSte    481     tPathLength = currentModel->ComputeTrueStepLength(geomLength);
308                                                   482   
309     /*                                            483     /*    
310     if(currParticle->GetPDGMass() > 0.9*GeV)      484     if(currParticle->GetPDGMass() > 0.9*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 - tPathLength
316            << " ekin= " << track.GetKineticEne    490            << " ekin= " << track.GetKineticEnergy() << G4endl;
317     */                                            491     */
318     // protection against wrong t->g->t conver    492     // protection against wrong t->g->t conversion
319     tPathLength = std::min(tPathLength, physSt    493     tPathLength = std::min(tPathLength, physStepLimit);
320                                                   494 
321     // do not sample scattering at the last or    495     // do not sample scattering at the last or at a small step
322     if(tPathLength < range && tPathLength > ge    496     if(tPathLength < range && tPathLength > geomMin) {
323                                                   497 
324       static const G4double minSafety = 1.20*C    498       static const G4double minSafety = 1.20*CLHEP::nm;
325       static const G4double sFact = 0.99;         499       static const G4double sFact = 0.99;
326                                                   500 
327       G4ThreeVector displacement = currentMode    501       G4ThreeVector displacement = currentModel->SampleScattering(
328         step.GetPostStepPoint()->GetMomentumDi    502         step.GetPostStepPoint()->GetMomentumDirection(),minSafety);
329                                                   503 
330       G4double r2 = displacement.mag2();          504       G4double r2 = displacement.mag2();
331       //G4cout << "    R= " << sqrt(r2) << " R    505       //G4cout << "    R= " << sqrt(r2) << " Rmin= " << sqrt(minDisplacement2)
332       //     << " flag= " << fDispBeyondSafety    506       //     << " flag= " << fDispBeyondSafety << G4endl;
333       if(r2 > minDisplacement2) {                 507       if(r2 > minDisplacement2) {
334                                                   508 
335         fPositionChanged = true;                  509         fPositionChanged = true;
336         G4double dispR = std::sqrt(r2);           510         G4double dispR = std::sqrt(r2);
337         G4double postSafety =                     511         G4double postSafety = 
338           sFact*safetyHelper->ComputeSafety(fN    512           sFact*safetyHelper->ComputeSafety(fNewPosition, dispR); 
339         //G4cout<<"    R= "<< dispR<<" postSaf    513         //G4cout<<"    R= "<< dispR<<" postSafety= "<<postSafety<<G4endl;
340                                                   514 
341         // far away from geometry boundary        515         // far away from geometry boundary
342         if(postSafety > 0.0 && dispR <= postSa    516         if(postSafety > 0.0 && dispR <= postSafety) {
343           fNewPosition += displacement;           517           fNewPosition += displacement;
344                                                   518 
345           //near the boundary                     519           //near the boundary
346         } else {                                  520         } else {
347           // displaced point is definitely wit    521           // displaced point is definitely within the volume
348           //G4cout<<"    R= "<<dispR<<" postSa    522           //G4cout<<"    R= "<<dispR<<" postSafety= "<<postSafety<<G4endl;
349           if(dispR < postSafety) {                523           if(dispR < postSafety) {
350             fNewPosition += displacement;         524             fNewPosition += displacement;
351                                                   525 
                                                   >> 526             // optional extra mechanism is applied only if a particle
                                                   >> 527             // is stopped by the boundary
                                                   >> 528           } else if(fDispBeyondSafety && 0.0 == postSafety) {
                                                   >> 529             fNewPosition += displacement;
                                                   >> 530             G4double maxshift = 
                                                   >> 531               std::min(2.0*dispR, geomLength*(physStepLimit/tPathLength - 1.0));
                                                   >> 532             G4double dist = 0.0;
                                                   >> 533             G4double safety = postSafety + dispR;
                                                   >> 534             fNewDirection = *(fParticleChange.GetMomentumDirection());
                                                   >> 535             /*
                                                   >> 536               G4cout << "##MSC before Recheck maxshift= " << maxshift
                                                   >> 537                      << " postsafety= " << postSafety
                                                   >> 538                      << " Ekin= " << track.GetKineticEnergy()
                                                   >> 539                      << "  " << track.GetDefinition()->GetParticleName()
                                                   >> 540                      << G4endl; 
                                                   >> 541             */
                                                   >> 542             // check if it is possible to shift to the boundary
                                                   >> 543             // and the shift is not large
                                                   >> 544             if(safetyHelper->RecheckDistanceToCurrentBoundary(fNewPosition,
                                                   >> 545                fNewDirection, maxshift, &dist, &safety) 
                                                   >> 546                && std::abs(dist) < maxshift) {
                                                   >> 547                  /* 
                                                   >> 548                     G4cout << "##MSC after Recheck dist= " << dist
                                                   >> 549                     << " postsafety= " << postSafety
                                                   >> 550                     << " t= " << tPathLength
                                                   >> 551                     << " g=  " << geomLength
                                                   >> 552                     << " p=  " << physStepLimit
                                                   >> 553                     << G4endl; 
                                                   >> 554                  */
                                                   >> 555               // shift is positive
                                                   >> 556               if(dist >= 0.0) {
                                                   >> 557                 tPathLength *= (1.0 + dist/geomLength);
                                                   >> 558                 fNewPosition += dist*fNewDirection; 
                                                   >> 559 
                                                   >> 560                 // shift is negative cannot be larger than geomLength
                                                   >> 561               } else {
                                                   >> 562                 maxshift = std::min(maxshift, geomLength);
                                                   >> 563                 if(0.0 < maxshift + dist) {
                                                   >> 564                   const G4ThreeVector& postpoint = 
                                                   >> 565                     step.GetPostStepPoint()->GetPosition();
                                                   >> 566                   G4ThreeVector point = fNewPosition + dist*fNewDirection;
                                                   >> 567                   G4double R2 = (postpoint - point).mag2();
                                                   >> 568                   G4double newdist = dist;
                                                   >> 569                   // check not more than 10 extra boundaries
                                                   >> 570                   for(G4int i=0; i<10; ++i) {
                                                   >> 571                     dist = 0.0;
                                                   >> 572                     if(safetyHelper->RecheckDistanceToCurrentBoundary(
                                                   >> 573                        point, fNewDirection, maxshift, &dist, &safety) 
                                                   >> 574                        && std::abs(newdist + dist) < maxshift) {
                                                   >> 575                       point += dist*fNewDirection;
                                                   >> 576                       G4double R2new = (postpoint - point).mag2();
                                                   >> 577                       //G4cout << "Backward  i= " << i << " dist= " << dist 
                                                   >> 578                       //     << " R2= " << R2new << G4endl; 
                                                   >> 579                       if(dist >= 0.0 || R2new > R2) { break; }
                                                   >> 580                       R2 = R2new;
                                                   >> 581                       fNewPosition = point;
                                                   >> 582                       newdist += dist;
                                                   >> 583                     } else { 
                                                   >> 584                       break; 
                                                   >> 585                     }
                                                   >> 586                   }
                                                   >> 587                   tPathLength *= (1.0 + newdist/geomLength);
                                                   >> 588                 // shift on boundary is not possible for negative disp
                                                   >> 589                 } else {
                                                   >> 590                   fNewPosition += displacement*(postSafety/dispR - 1.0); 
                                                   >> 591                 }
                                                   >> 592               }
                                                   >> 593               // shift on boundary is not possible for any disp
                                                   >> 594             } else {
                                                   >> 595               fNewPosition += displacement*(postSafety/dispR - 1.0); 
                                                   >> 596             }
352             // reduced displacement               597             // reduced displacement
353           } else if(postSafety > geomMin) {       598           } else if(postSafety > geomMin) {
354             fNewPosition += displacement*(post    599             fNewPosition += displacement*(postSafety/dispR); 
355                                                   600 
356             // very small postSafety              601             // very small postSafety
357           } else {                                602           } else {
358             fPositionChanged = false;             603             fPositionChanged = false;
359           }                                       604           }
360         }                                         605         }
361         if(fPositionChanged) {                    606         if(fPositionChanged) { 
362           safetyHelper->ReLocateWithinVolume(f    607           safetyHelper->ReLocateWithinVolume(fNewPosition);
363           fParticleChange.ProposePosition(fNew    608           fParticleChange.ProposePosition(fNewPosition); 
364         }                                         609         }
365       }                                           610       }
366     }                                             611     }
367   }                                               612   }
368   fParticleChange.ProposeTrueStepLength(tPathL    613   fParticleChange.ProposeTrueStepLength(tPathLength);
369   return &fParticleChange;                        614   return &fParticleChange;
370 }                                                 615 }
371                                                   616 
372 //....oooOO0OOooo........oooOO0OOooo........oo    617 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
373                                                   618 
                                                   >> 619 G4VParticleChange* 
                                                   >> 620 G4VMultipleScattering::PostStepDoIt(const G4Track& track, const G4Step&)
                                                   >> 621 {
                                                   >> 622   fParticleChange.Initialize(track);
                                                   >> 623   return &fParticleChange;
                                                   >> 624 }
                                                   >> 625 
                                                   >> 626 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 627 
374 G4double G4VMultipleScattering::GetContinuousS    628 G4double G4VMultipleScattering::GetContinuousStepLimit(
375                                        const G    629                                        const G4Track& track,
376                                        G4doubl    630                                        G4double previousStepSize,
377                                        G4doubl    631                                        G4double currentMinimalStep,
378                                        G4doubl    632                                        G4double& currentSafety)
379 {                                                 633 {
380   G4GPILSelection selection = NotCandidateForS    634   G4GPILSelection selection = NotCandidateForSelection;
381   G4double x = AlongStepGetPhysicalInteraction    635   G4double x = AlongStepGetPhysicalInteractionLength(track,previousStepSize,
382                                                   636                                                      currentMinimalStep,
383                                                   637                                                      currentSafety, 
384                                                   638                                                      &selection);
385   return x;                                       639   return x;
386 }                                                 640 }
387                                                   641 
388 //....oooOO0OOooo........oooOO0OOooo........oo    642 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
389                                                   643 
390 G4double G4VMultipleScattering::ContinuousStep    644 G4double G4VMultipleScattering::ContinuousStepLimit(
391                                        const G    645                                        const G4Track& track,
392                                        G4doubl    646                                        G4double previousStepSize,
393                                        G4doubl    647                                        G4double currentMinimalStep,
394                                        G4doubl    648                                        G4double& currentSafety)
395 {                                                 649 {
396   return GetContinuousStepLimit(track,previous    650   return GetContinuousStepLimit(track,previousStepSize,currentMinimalStep,
397                                 currentSafety)    651                                 currentSafety);
398 }                                                 652 }
399                                                   653 
400 //....oooOO0OOooo........oooOO0OOooo........oo    654 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
401                                                   655 
402 G4double G4VMultipleScattering::GetMeanFreePat    656 G4double G4VMultipleScattering::GetMeanFreePath(
403               const G4Track&, G4double, G4Forc    657               const G4Track&, G4double, G4ForceCondition* condition)
404 {                                                 658 {
405   *condition = Forced;                            659   *condition = Forced;
406   return DBL_MAX;                                 660   return DBL_MAX;
407 }                                                 661 }
408                                                   662 
409 //....oooOO0OOooo........oooOO0OOooo........oo    663 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
410                                                   664 
411 G4bool                                            665 G4bool 
412 G4VMultipleScattering::StorePhysicsTable(const    666 G4VMultipleScattering::StorePhysicsTable(const G4ParticleDefinition* part,
413                                          const    667                                          const G4String& directory,
414                                          G4boo    668                                          G4bool ascii)
415 {                                                 669 {
416   G4bool yes = true;                              670   G4bool yes = true;
417   if(part != firstParticle || !emManager->IsMa << 671   if(part != firstParticle) { return yes; }
418                                                << 672   const G4VMultipleScattering* masterProcess = 
419   return G4EmTableUtil::StoreMscTable(this, pa << 673     static_cast<const G4VMultipleScattering*>(GetMasterProcess()); 
420               numberOfModels, verboseLevel,    << 674   if(masterProcess && masterProcess != this) { return yes; }
421                                       ascii);  << 675 
                                                   >> 676   G4int nmod = modelManager->NumberOfModels();
                                                   >> 677   static const G4String ss[4] = {"1","2","3","4"};
                                                   >> 678   for(G4int i=0; i<nmod; ++i) {
                                                   >> 679     G4VEmModel* msc = modelManager->GetModel(i);
                                                   >> 680     yes = true;
                                                   >> 681     G4PhysicsTable* table = msc->GetCrossSectionTable();
                                                   >> 682     if (table) {
                                                   >> 683       G4int j = std::min(i,3); 
                                                   >> 684       G4String name = 
                                                   >> 685         GetPhysicsTableFileName(part,directory,"LambdaMod"+ss[j],ascii);
                                                   >> 686       yes = table->StorePhysicsTable(name,ascii);
                                                   >> 687 
                                                   >> 688       if ( yes ) {
                                                   >> 689         if ( verboseLevel>0 ) {
                                                   >> 690           G4cout << "Physics table are stored for " 
                                                   >> 691                  << part->GetParticleName()
                                                   >> 692                  << " and process " << GetProcessName()
                                                   >> 693                  << " with a name <" << name << "> " << G4endl;
                                                   >> 694         }
                                                   >> 695       } else {
                                                   >> 696         G4cout << "Fail to store Physics Table for " 
                                                   >> 697                << part->GetParticleName()
                                                   >> 698                << " and process " << GetProcessName()
                                                   >> 699                << " in the directory <" << directory
                                                   >> 700                << "> " << G4endl;
                                                   >> 701       }
                                                   >> 702     }
                                                   >> 703   }
                                                   >> 704   return yes;
422 }                                                 705 }
423                                                   706 
424 //....oooOO0OOooo........oooOO0OOooo........oo    707 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
425                                                   708 
426 G4bool                                            709 G4bool 
427 G4VMultipleScattering::RetrievePhysicsTable(co    710 G4VMultipleScattering::RetrievePhysicsTable(const G4ParticleDefinition*,
428                                             co    711                                             const G4String&,
429                                             G4    712                                             G4bool)
430 {                                                 713 {
431   return true;                                    714   return true;
432 }                                                 715 }
433                                                   716 
434 //....oooOO0OOooo........oooOO0OOooo........oo    717 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
435                                                   718 
                                                   >> 719 void G4VMultipleScattering::SetIonisation(G4VEnergyLossProcess* p)
                                                   >> 720 {
                                                   >> 721   for(G4int i=0; i<numberOfModels; ++i) {
                                                   >> 722     G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i, true));
                                                   >> 723     if(msc) { msc->SetIonisation(p, firstParticle); }
                                                   >> 724   }
                                                   >> 725 }
                                                   >> 726 
                                                   >> 727 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 728 
436 void G4VMultipleScattering::ProcessDescription    729 void G4VMultipleScattering::ProcessDescription(std::ostream& outFile) const
437 {                                                 730 {
438   if(nullptr != firstParticle) {               << 731   if(firstParticle) {
439     StreamInfo(outFile, *firstParticle, true);    732     StreamInfo(outFile, *firstParticle, true);
440   }                                               733   }
441 }                                                 734 }
442                                                   735 
443 //....oooOO0OOooo........oooOO0OOooo........oo    736 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
444                                                   737 
445                                                   738