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.1)


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