Geant4 Cross Reference

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

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/utils/src/G4VMultipleScattering.cc (Version 11.3.0) and /processes/electromagnetic/utils/src/G4VMultipleScattering.cc (Version 10.0)


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