Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/scoring/src/G4ParallelWorldProcess.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/scoring/src/G4ParallelWorldProcess.cc (Version 11.3.0) and /processes/scoring/src/G4ParallelWorldProcess.cc (Version 9.6.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
                                                   >>  27 // $Id: G4ParallelWorldProcess.cc 69966 2013-05-21 09:52:06Z gcosmo $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-04-ref-00 $
 27 //                                                 29 //
 28 //                                                 30 //
 29                                                    31 
                                                   >>  32 #include "G4ios.hh"
 30 #include "G4ParallelWorldProcess.hh"               33 #include "G4ParallelWorldProcess.hh"
 31                                                <<  34 #include "G4Step.hh"
 32 #include "G4FieldTrackUpdator.hh"              <<  35 #include "G4StepPoint.hh"
 33 #include "G4Material.hh"                       << 
 34 #include "G4Navigator.hh"                          36 #include "G4Navigator.hh"
 35 #include "G4ParallelWorldProcessStore.hh"      <<  37 #include "G4VTouchable.hh"
                                                   >>  38 #include "G4VPhysicalVolume.hh"
 36 #include "G4ParticleChange.hh"                     39 #include "G4ParticleChange.hh"
 37 #include "G4PathFinder.hh"                         40 #include "G4PathFinder.hh"
                                                   >>  41 #include "G4TransportationManager.hh"
                                                   >>  42 #include "G4ParticleChange.hh"
                                                   >>  43 #include "G4StepPoint.hh"
                                                   >>  44 #include "G4FieldTrackUpdator.hh"
                                                   >>  45 #include "G4Material.hh"
 38 #include "G4ProductionCuts.hh"                     46 #include "G4ProductionCuts.hh"
 39 #include "G4ProductionCutsTable.hh"                47 #include "G4ProductionCutsTable.hh"
                                                   >>  48 
 40 #include "G4SDManager.hh"                          49 #include "G4SDManager.hh"
 41 #include "G4Step.hh"                           << 
 42 #include "G4StepPoint.hh"                      << 
 43 #include "G4TransportationManager.hh"          << 
 44 #include "G4TransportationProcessType.hh"      << 
 45 #include "G4VPhysicalVolume.hh"                << 
 46 #include "G4VSensitiveDetector.hh"                 50 #include "G4VSensitiveDetector.hh"
 47 #include "G4VTouchable.hh"                     << 
 48 #include "G4ios.hh"                            << 
 49                                                << 
 50 G4ThreadLocal G4Step* G4ParallelWorldProcess:: << 
 51 G4ThreadLocal G4int G4ParallelWorldProcess::nP << 
 52 G4ThreadLocal G4int G4ParallelWorldProcess::fN << 
 53                                                    51 
                                                   >>  52 G4Step* G4ParallelWorldProcess::fpHyperStep = 0;
                                                   >>  53 G4int   G4ParallelWorldProcess::nParallelWorlds = 0;
                                                   >>  54 G4int   G4ParallelWorldProcess::fNavIDHyp = 0;
 54 const G4Step* G4ParallelWorldProcess::GetHyper     55 const G4Step* G4ParallelWorldProcess::GetHyperStep()
 55 {                                              <<  56 { return fpHyperStep; }
 56   return fpHyperStep;                          << 
 57 }                                              << 
 58                                                << 
 59 G4int G4ParallelWorldProcess::GetHypNavigatorI     57 G4int G4ParallelWorldProcess::GetHypNavigatorID()
 60 {                                              <<  58 { return fNavIDHyp; }
 61   return fNavIDHyp;                            << 
 62 }                                              << 
 63                                                    59 
 64 G4ParallelWorldProcess::G4ParallelWorldProcess <<  60 G4ParallelWorldProcess::
 65   : G4VProcess(processName, theType), fFieldTr <<  61 G4ParallelWorldProcess(const G4String& processName,G4ProcessType theType)
                                                   >>  62 :G4VProcess(processName,theType), fGhostNavigator(0), fNavigatorID(-1),
                                                   >>  63  fFieldTrack('0'),layeredMaterialFlag(false)
 66 {                                                  64 {
 67   SetProcessSubType(PARALLEL_WORLD_PROCESS);   <<  65   if(!fpHyperStep) fpHyperStep = new G4Step();
 68   if (fpHyperStep == nullptr) fpHyperStep = ne << 
 69   iParallelWorld = ++nParallelWorlds;              66   iParallelWorld = ++nParallelWorlds;
 70                                                    67 
 71   pParticleChange = &aDummyParticleChange;         68   pParticleChange = &aDummyParticleChange;
 72                                                    69 
 73   fGhostStep = new G4Step();                       70   fGhostStep = new G4Step();
 74   fGhostPreStepPoint = fGhostStep->GetPreStepP     71   fGhostPreStepPoint = fGhostStep->GetPreStepPoint();
 75   fGhostPostStepPoint = fGhostStep->GetPostSte     72   fGhostPostStepPoint = fGhostStep->GetPostStepPoint();
 76                                                    73 
 77   fTransportationManager = G4TransportationMan     74   fTransportationManager = G4TransportationManager::GetTransportationManager();
 78   fTransportationManager->GetNavigatorForTrack     75   fTransportationManager->GetNavigatorForTracking()->SetPushVerbosity(false);
 79   fPathFinder = G4PathFinder::GetInstance();       76   fPathFinder = G4PathFinder::GetInstance();
 80                                                    77 
 81   fGhostWorldName = "** NotDefined **";        <<  78   if (verboseLevel>0)
 82   G4ParallelWorldProcessStore::GetInstance()-> <<  79   {
 83                                                << 
 84   if (verboseLevel > 0) {                      << 
 85     G4cout << GetProcessName() << " is created     80     G4cout << GetProcessName() << " is created " << G4endl;
 86   }                                                81   }
 87 }                                                  82 }
 88                                                    83 
 89 G4ParallelWorldProcess::~G4ParallelWorldProces     84 G4ParallelWorldProcess::~G4ParallelWorldProcess()
 90 {                                                  85 {
 91   delete fGhostStep;                               86   delete fGhostStep;
 92   nParallelWorlds--;                               87   nParallelWorlds--;
 93   if (nParallelWorlds == 0) {                  <<  88   if(nParallelWorlds==0)
                                                   >>  89   {
 94     delete fpHyperStep;                            90     delete fpHyperStep;
 95     fpHyperStep = nullptr;                     <<  91     fpHyperStep = 0;
 96   }                                                92   }
 97 }                                                  93 }
 98                                                    94 
 99 void G4ParallelWorldProcess::SetParallelWorld( <<  95 void G4ParallelWorldProcess::
                                                   >>  96 SetParallelWorld(G4String parallelWorldName)
100 {                                                  97 {
101   fGhostWorldName = parallelWorldName;             98   fGhostWorldName = parallelWorldName;
102   fGhostWorld = fTransportationManager->GetPar     99   fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
103   fGhostNavigator = fTransportationManager->Ge    100   fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
104   fGhostNavigator->SetPushVerbosity(false);       101   fGhostNavigator->SetPushVerbosity(false);
105 }                                                 102 }
106                                                   103 
107 void G4ParallelWorldProcess::SetParallelWorld( << 104 void G4ParallelWorldProcess::
                                                   >> 105 SetParallelWorld(G4VPhysicalVolume* parallelWorld)
108 {                                                 106 {
109   fGhostWorldName = parallelWorld->GetName();     107   fGhostWorldName = parallelWorld->GetName();
110   fGhostWorld = parallelWorld;                    108   fGhostWorld = parallelWorld;
111   fGhostNavigator = fTransportationManager->Ge    109   fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
112   fGhostNavigator->SetPushVerbosity(false);       110   fGhostNavigator->SetPushVerbosity(false);
113 }                                                 111 }
114                                                   112 
115 void G4ParallelWorldProcess::StartTracking(G4T    113 void G4ParallelWorldProcess::StartTracking(G4Track* trk)
116 {                                                 114 {
117   if (fGhostNavigator != nullptr) {            << 115   if(fGhostNavigator)
118     fNavigatorID = fTransportationManager->Act << 116   { fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
119   }                                            << 117   else
120   else {                                       << 118   {
121     G4Exception(                               << 119     G4Exception("G4ParallelWorldProcess::StartTracking",
122       "G4ParallelWorldProcess::StartTracking", << 120        "ProcParaWorld000",FatalException,
123       "G4ParallelWorldProcess is used for trac << 121        "G4ParallelWorldProcess is used for tracking without having a parallel world assigned");
124   }                                               122   }
125   fPathFinder->PrepareNewTrack(trk->GetPositio << 123   fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
126                                                   124 
127   fOldGhostTouchable = fPathFinder->CreateTouc    125   fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
128   fGhostPreStepPoint->SetTouchableHandle(fOldG    126   fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
129   fNewGhostTouchable = fOldGhostTouchable;        127   fNewGhostTouchable = fOldGhostTouchable;
130   fGhostPostStepPoint->SetTouchableHandle(fNew    128   fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
131                                                   129 
132   fGhostSafety = -1.;                             130   fGhostSafety = -1.;
133   fOnBoundary = false;                            131   fOnBoundary = false;
134   fGhostPreStepPoint->SetStepStatus(fUndefined    132   fGhostPreStepPoint->SetStepStatus(fUndefined);
135   fGhostPostStepPoint->SetStepStatus(fUndefine    133   fGhostPostStepPoint->SetStepStatus(fUndefined);
136                                                   134 
                                                   >> 135 //  G4VPhysicalVolume* thePhys = fNewGhostTouchable->GetVolume();
                                                   >> 136 //  if(thePhys)
                                                   >> 137 //  {
                                                   >> 138 //    G4Material* ghostMaterial = thePhys->GetLogicalVolume()->GetMaterial();
                                                   >> 139 //    if(ghostMaterial)
                                                   >> 140 //    { G4cout << " --- Material : " << ghostMaterial->GetName() << G4endl; }
                                                   >> 141 //  }
                                                   >> 142 
137   *(fpHyperStep->GetPostStepPoint()) = *(trk->    143   *(fpHyperStep->GetPostStepPoint()) = *(trk->GetStep()->GetPostStepPoint());
138   if (layeredMaterialFlag) {                   << 144   if(layeredMaterialFlag)
                                                   >> 145   {
139     G4StepPoint* realWorldPostStepPoint = trk-    146     G4StepPoint* realWorldPostStepPoint = trk->GetStep()->GetPostStepPoint();
140     SwitchMaterial(realWorldPostStepPoint);       147     SwitchMaterial(realWorldPostStepPoint);
141     G4StepPoint* realWorldPreStepPoint = trk-> << 
142     SwitchMaterial(realWorldPreStepPoint);     << 
143     G4double velocity = trk->CalculateVelocity << 
144     realWorldPostStepPoint->SetVelocity(veloci << 
145     realWorldPreStepPoint->SetVelocity(velocit << 
146     trk->SetVelocity(velocity);                << 
147   }                                               148   }
148   *(fpHyperStep->GetPreStepPoint()) = *(fpHype    149   *(fpHyperStep->GetPreStepPoint()) = *(fpHyperStep->GetPostStepPoint());
149 }                                                 150 }
150                                                   151 
151 G4double G4ParallelWorldProcess::AtRestGetPhys << 152 G4double 
152                                                << 153 G4ParallelWorldProcess::AtRestGetPhysicalInteractionLength(
153 {                                              << 154          const G4Track& /*track*/, 
154   //++++++++++++++++++++++++++++++++++++++++++ << 155          G4ForceCondition* condition)
155   // At Rest must be registered ONLY for the p << 156 {
156   // process(es).                              << 157 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
157   //++++++++++++++++++++++++++++++++++++++++++ << 158 // At Rest must be registered ONLY for the particle which has other At Rest
                                                   >> 159 // process(es).
                                                   >> 160 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
158   *condition = Forced;                            161   *condition = Forced;
159   return DBL_MAX;                                 162   return DBL_MAX;
160 }                                                 163 }
161                                                   164 
162 G4VParticleChange* G4ParallelWorldProcess::AtR << 165 G4VParticleChange* G4ParallelWorldProcess::AtRestDoIt(
163 {                                              << 166      const G4Track& track,
164   //++++++++++++++++++++++++++++++++++++++++++ << 167      const G4Step& step)
165   // At Rest must be registered ONLY for the p << 168 { 
166   // process(es).                              << 169 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
167   //++++++++++++++++++++++++++++++++++++++++++ << 170 // At Rest must be registered ONLY for the particle which has other At Rest
                                                   >> 171 // process(es).
                                                   >> 172 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
168   fOldGhostTouchable = fGhostPostStepPoint->Ge    173   fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
169   G4VSensitiveDetector* aSD = nullptr;         << 174   G4VSensitiveDetector* aSD = 0;
170   if (fOldGhostTouchable->GetVolume() != nullp << 175   if(fOldGhostTouchable->GetVolume())
171     aSD = fOldGhostTouchable->GetVolume()->Get << 176   { aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector(); }
172   }                                            << 
173   fOnBoundary = false;                            177   fOnBoundary = false;
174   if (aSD != nullptr) {                        << 178   if(aSD)
                                                   >> 179   {
175     CopyStep(step);                               180     CopyStep(step);
176     fGhostPreStepPoint->SetSensitiveDetector(a    181     fGhostPreStepPoint->SetSensitiveDetector(aSD);
177                                                   182 
178     fNewGhostTouchable = fOldGhostTouchable;      183     fNewGhostTouchable = fOldGhostTouchable;
179                                                << 184   
180     fGhostPreStepPoint->SetTouchableHandle(fOl    185     fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
181     fGhostPostStepPoint->SetTouchableHandle(fN    186     fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
182     if (fNewGhostTouchable->GetVolume() != nul << 187     if(fNewGhostTouchable->GetVolume())
                                                   >> 188     {
183       fGhostPostStepPoint->SetSensitiveDetecto    189       fGhostPostStepPoint->SetSensitiveDetector(
184         fNewGhostTouchable->GetVolume()->GetLo    190         fNewGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
185     }                                             191     }
186     else {                                     << 192     else
187       fGhostPostStepPoint->SetSensitiveDetecto << 193     { fGhostPostStepPoint->SetSensitiveDetector(0); }
188     }                                          << 
189                                                   194 
190     aSD->Hit(fGhostStep);                         195     aSD->Hit(fGhostStep);
191   }                                               196   }
192                                                   197 
193   pParticleChange->Initialize(track);             198   pParticleChange->Initialize(track);
194   return pParticleChange;                         199   return pParticleChange;
195 }                                                 200 }
196                                                   201 
197 G4double G4ParallelWorldProcess::PostStepGetPh << 202 G4double 
198                                                << 203 G4ParallelWorldProcess::PostStepGetPhysicalInteractionLength(
199                                                << 204          const G4Track& /*track*/, 
                                                   >> 205          G4double   /*previousStepSize*/, 
                                                   >> 206          G4ForceCondition* condition)
200 {                                                 207 {
201   *condition = StronglyForced;                    208   *condition = StronglyForced;
202   return DBL_MAX;                                 209   return DBL_MAX;
203 }                                                 210 }
204                                                   211 
205 G4VParticleChange* G4ParallelWorldProcess::Pos << 212 G4VParticleChange* G4ParallelWorldProcess::PostStepDoIt(
206 {                                              << 213      const G4Track& track,
                                                   >> 214      const G4Step& step)
                                                   >> 215 { 
207   fOldGhostTouchable = fGhostPostStepPoint->Ge    216   fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
208   G4VSensitiveDetector* aSD = nullptr;         << 217   G4VSensitiveDetector* aSD = 0;
209   if (fOldGhostTouchable->GetVolume() != nullp << 218   if(fOldGhostTouchable->GetVolume())
210     aSD = fOldGhostTouchable->GetVolume()->Get << 219   { aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector(); }
211   }                                            << 
212   CopyStep(step);                                 220   CopyStep(step);
213   fGhostPreStepPoint->SetSensitiveDetector(aSD    221   fGhostPreStepPoint->SetSensitiveDetector(aSD);
214                                                   222 
215   if (fOnBoundary) {                           << 223   if(fOnBoundary)
                                                   >> 224   {
216     fNewGhostTouchable = fPathFinder->CreateTo    225     fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
217   }                                               226   }
218   else {                                       << 227   else
                                                   >> 228   {
219     fNewGhostTouchable = fOldGhostTouchable;      229     fNewGhostTouchable = fOldGhostTouchable;
220   }                                               230   }
221                                                << 231     
222   fGhostPreStepPoint->SetTouchableHandle(fOldG    232   fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
223   fGhostPostStepPoint->SetTouchableHandle(fNew    233   fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
224                                                   234 
225   if (fNewGhostTouchable->GetVolume() != nullp << 235   if(fNewGhostTouchable->GetVolume())
                                                   >> 236   {
226     fGhostPostStepPoint->SetSensitiveDetector(    237     fGhostPostStepPoint->SetSensitiveDetector(
227       fNewGhostTouchable->GetVolume()->GetLogi    238       fNewGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
228   }                                               239   }
229   else {                                       << 240   else
230     fGhostPostStepPoint->SetSensitiveDetector( << 241   { fGhostPostStepPoint->SetSensitiveDetector(0); }
231   }                                            << 
232                                                   242 
233   G4VSensitiveDetector* sd = fGhostPreStepPoin    243   G4VSensitiveDetector* sd = fGhostPreStepPoint->GetSensitiveDetector();
234   if (sd != nullptr) {                         << 244   if(sd)
                                                   >> 245   {
235     sd->Hit(fGhostStep);                          246     sd->Hit(fGhostStep);
236   }                                               247   }
237                                                   248 
238   pParticleChange->Initialize(track);          << 249   pParticleChange->Initialize(track); 
239   if (layeredMaterialFlag) {                   << 250   if(layeredMaterialFlag)
240     G4StepPoint* realWorldPostStepPoint = ((G4 << 251   {
                                                   >> 252     G4StepPoint* realWorldPostStepPoint =
                                                   >> 253      ((G4Step*)(track.GetStep()))->GetPostStepPoint();
241     SwitchMaterial(realWorldPostStepPoint);       254     SwitchMaterial(realWorldPostStepPoint);
242   }                                               255   }
243   return pParticleChange;                         256   return pParticleChange;
244 }                                                 257 }
245                                                   258 
246 G4double G4ParallelWorldProcess::AlongStepGetP << 259 G4double G4ParallelWorldProcess::AlongStepGetPhysicalInteractionLength(
247                                                << 260             const G4Track& track, G4double  previousStepSize, G4double  currentMinimumStep,
248                                                << 261             G4double& proposedSafety, G4GPILSelection* selection)
249                                                << 262 {
250                                                << 263   static G4FieldTrack endTrack('0');
251 {                                              << 264   //static ELimited eLimited;
252   static G4ThreadLocal G4FieldTrack* endTrack_ << 
253   if (endTrack_G4MT_TLS_ == nullptr) endTrack_ << 
254   G4FieldTrack& endTrack = *endTrack_G4MT_TLS_ << 
255   // static ELimited eLimited;                 << 
256   ELimited eLimited;                              265   ELimited eLimited;
257   ELimited eLim = kUndefLimited;                  266   ELimited eLim = kUndefLimited;
258                                                << 267   
259   *selection = NotCandidateForSelection;          268   *selection = NotCandidateForSelection;
260   G4double returnedStep = DBL_MAX;                269   G4double returnedStep = DBL_MAX;
261                                                   270 
262   if (previousStepSize > 0.) {                 << 271   if (previousStepSize > 0.)
263     fGhostSafety -= previousStepSize;          << 272   { fGhostSafety -= previousStepSize; }
264   }                                            << 
265   if (fGhostSafety < 0.) fGhostSafety = 0.0;      273   if (fGhostSafety < 0.) fGhostSafety = 0.0;
266                                                << 274       
267   if (currentMinimumStep <= fGhostSafety && cu << 275   if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
                                                   >> 276   {
268     // I have no chance to limit                  277     // I have no chance to limit
269     returnedStep = currentMinimumStep;            278     returnedStep = currentMinimumStep;
270     fOnBoundary = false;                          279     fOnBoundary = false;
271     proposedSafety = fGhostSafety - currentMin    280     proposedSafety = fGhostSafety - currentMinimumStep;
272     eLim = kDoNot;                                281     eLim = kDoNot;
273   }                                               282   }
274   else {                                       << 283   else 
275     G4FieldTrackUpdator::Update(&fFieldTrack,  << 284   {
276                                                << 285     G4FieldTrackUpdator::Update(&fFieldTrack,&track);
277 #ifdef G4DEBUG_PARALLEL_WORLD_PROCESS          << 286     returnedStep
278     if (verboseLevel > 0) {                    << 287       = fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
279       int localVerb = verboseLevel - 1;        << 288                      track.GetCurrentStepNumber(),fGhostSafety,eLimited,
280                                                << 289                      endTrack,track.GetVolume());
281       if (localVerb == 1) {                    << 290     if(eLimited == kDoNot)
282         G4cout << " Pll Wrl  proc::AlongStepGP << 291     {
283       }                                        << 
284       else if (localVerb > 1) {                << 
285         G4cout << "--------------------------- << 
286         G4cout << " ParallelWorldProcess: fiel << 
287         G4cout << "--------------------------- << 
288         G4cout << fFieldTrack << G4endl;       << 
289         G4cout << "--------------------------- << 
290       }                                        << 
291     }                                          << 
292 #endif                                         << 
293                                                << 
294     returnedStep = fPathFinder->ComputeStep(fF << 
295                                             tr << 
296                                             en << 
297     if (eLimited == kDoNot) {                  << 
298       fOnBoundary = false;                        292       fOnBoundary = false;
299       fGhostSafety = fGhostNavigator->ComputeS    293       fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition());
300     }                                             294     }
301     else {                                     << 295     else
                                                   >> 296     {
302       fOnBoundary = true;                         297       fOnBoundary = true;
303       // fGhostSafetyEnd = 0.0;    // At end-p << 
304     }                                             298     }
305     proposedSafety = fGhostSafety;                299     proposedSafety = fGhostSafety;
306     if (eLimited == kUnique || eLimited == kSh << 300     if(eLimited == kUnique || eLimited == kSharedOther) {
307       *selection = CandidateForSelection;      << 301        *selection = CandidateForSelection;
308     }                                             302     }
309     else if (eLimited == kSharedTransport) {   << 303     else if (eLimited == kSharedTransport) { 
310       returnedStep *= (1.0 + 1.0e-9);          << 304        returnedStep *= (1.0 + 1.0e-9);  
311     }                                             305     }
312     eLim = eLimited;                              306     eLim = eLimited;
313   }                                               307   }
314                                                   308 
315   if (iParallelWorld == nParallelWorlds) fNavI << 309   if(iParallelWorld==nParallelWorlds) fNavIDHyp = 0;
316   if (eLim == kUnique || eLim == kSharedOther) << 310   if(eLim == kUnique || eLim == kSharedOther) fNavIDHyp = fNavigatorID;
317   return returnedStep;                            311   return returnedStep;
318 }                                                 312 }
319                                                   313 
320 G4VParticleChange* G4ParallelWorldProcess::Alo << 314 G4VParticleChange* G4ParallelWorldProcess::AlongStepDoIt(
                                                   >> 315     const G4Track& track, const G4Step& )
321 {                                                 316 {
322   pParticleChange->Initialize(track);             317   pParticleChange->Initialize(track);
323   return pParticleChange;                      << 318   return pParticleChange; 
324 }                                                 319 }
325                                                   320 
326 void G4ParallelWorldProcess::CopyStep(const G4 << 321 void G4ParallelWorldProcess::CopyStep(const G4Step & step)
327 {                                                 322 {
328   G4StepStatus prevStat = fGhostPostStepPoint-    323   G4StepStatus prevStat = fGhostPostStepPoint->GetStepStatus();
329                                                   324 
330   fGhostStep->SetTrack(step.GetTrack());          325   fGhostStep->SetTrack(step.GetTrack());
331   fGhostStep->SetStepLength(step.GetStepLength    326   fGhostStep->SetStepLength(step.GetStepLength());
332   fGhostStep->SetTotalEnergyDeposit(step.GetTo    327   fGhostStep->SetTotalEnergyDeposit(step.GetTotalEnergyDeposit());
333   fGhostStep->SetNonIonizingEnergyDeposit(step    328   fGhostStep->SetNonIonizingEnergyDeposit(step.GetNonIonizingEnergyDeposit());
334   fGhostStep->SetControlFlag(step.GetControlFl    329   fGhostStep->SetControlFlag(step.GetControlFlag());
335   fGhostStep->SetSecondary((const_cast<G4Step& << 
336                                                   330 
337   *fGhostPreStepPoint = *(step.GetPreStepPoint    331   *fGhostPreStepPoint = *(step.GetPreStepPoint());
338   *fGhostPostStepPoint = *(step.GetPostStepPoi    332   *fGhostPostStepPoint = *(step.GetPostStepPoint());
339                                                   333 
340   fGhostPreStepPoint->SetStepStatus(prevStat);    334   fGhostPreStepPoint->SetStepStatus(prevStat);
341   if (fOnBoundary) {                           << 335   if(fOnBoundary)
342     fGhostPostStepPoint->SetStepStatus(fGeomBo << 336   { fGhostPostStepPoint->SetStepStatus(fGeomBoundary); }
343   }                                            << 337   else if(fGhostPostStepPoint->GetStepStatus()==fGeomBoundary)
344   else if (fGhostPostStepPoint->GetStepStatus( << 338   { fGhostPostStepPoint->SetStepStatus(fPostStepDoItProc); }
345     fGhostPostStepPoint->SetStepStatus(fPostSt << 
346   }                                            << 
347                                                   339 
348   if (iParallelWorld == 1) {                   << 340   if(iParallelWorld==1)
                                                   >> 341   {
349     G4StepStatus prevStatHyp = fpHyperStep->Ge    342     G4StepStatus prevStatHyp = fpHyperStep->GetPostStepPoint()->GetStepStatus();
350                                                   343 
351     fpHyperStep->SetTrack(step.GetTrack());       344     fpHyperStep->SetTrack(step.GetTrack());
352     fpHyperStep->SetStepLength(step.GetStepLen    345     fpHyperStep->SetStepLength(step.GetStepLength());
353     fpHyperStep->SetTotalEnergyDeposit(step.Ge    346     fpHyperStep->SetTotalEnergyDeposit(step.GetTotalEnergyDeposit());
354     fpHyperStep->SetNonIonizingEnergyDeposit(s    347     fpHyperStep->SetNonIonizingEnergyDeposit(step.GetNonIonizingEnergyDeposit());
355     fpHyperStep->SetControlFlag(step.GetContro    348     fpHyperStep->SetControlFlag(step.GetControlFlag());
356                                                   349 
357     *(fpHyperStep->GetPreStepPoint()) = *(fpHy    350     *(fpHyperStep->GetPreStepPoint()) = *(fpHyperStep->GetPostStepPoint());
358     *(fpHyperStep->GetPostStepPoint()) = *(ste    351     *(fpHyperStep->GetPostStepPoint()) = *(step.GetPostStepPoint());
359                                                << 352   
360     fpHyperStep->GetPreStepPoint()->SetStepSta    353     fpHyperStep->GetPreStepPoint()->SetStepStatus(prevStatHyp);
361   }                                               354   }
362                                                   355 
363   if (fOnBoundary) {                           << 356   if(fOnBoundary)
364     fpHyperStep->GetPostStepPoint()->SetStepSt << 357   { fpHyperStep->GetPostStepPoint()->SetStepStatus(fGeomBoundary); }
365   }                                            << 
366 }                                                 358 }
367                                                   359 
368 void G4ParallelWorldProcess::SwitchMaterial(G4    360 void G4ParallelWorldProcess::SwitchMaterial(G4StepPoint* realWorldStepPoint)
369 {                                                 361 {
370   if (realWorldStepPoint->GetStepStatus() == f << 362   if(realWorldStepPoint->GetStepStatus()==fWorldBoundary) return;
371   G4VPhysicalVolume* thePhys = fNewGhostToucha    363   G4VPhysicalVolume* thePhys = fNewGhostTouchable->GetVolume();
372   if (thePhys != nullptr) {                    << 364   if(thePhys)
                                                   >> 365   {
373     G4Material* ghostMaterial = thePhys->GetLo    366     G4Material* ghostMaterial = thePhys->GetLogicalVolume()->GetMaterial();
374     if (ghostMaterial != nullptr) {            << 367     if(ghostMaterial)
                                                   >> 368     {
375       G4Region* ghostRegion = thePhys->GetLogi    369       G4Region* ghostRegion = thePhys->GetLogicalVolume()->GetRegion();
376       G4ProductionCuts* prodCuts = realWorldSt << 370       G4ProductionCuts* prodCuts =
377       if (ghostRegion != nullptr) {            << 371           realWorldStepPoint->GetMaterialCutsCouple()->GetProductionCuts();
                                                   >> 372       if(ghostRegion)
                                                   >> 373       {
378         G4ProductionCuts* ghostProdCuts = ghos    374         G4ProductionCuts* ghostProdCuts = ghostRegion->GetProductionCuts();
379         if (ghostProdCuts != nullptr) prodCuts << 375         if(ghostProdCuts) prodCuts = ghostProdCuts;
380       }                                           376       }
381       const G4MaterialCutsCouple* ghostMCCoupl    377       const G4MaterialCutsCouple* ghostMCCouple =
382         G4ProductionCutsTable::GetProductionCu << 378           G4ProductionCutsTable::GetProductionCutsTable()
383                                                << 379           ->GetMaterialCutsCouple(ghostMaterial,prodCuts);
384       if (ghostMCCouple != nullptr) {          << 380       if(ghostMCCouple)
                                                   >> 381       {
385         realWorldStepPoint->SetMaterial(ghostM    382         realWorldStepPoint->SetMaterial(ghostMaterial);
386         realWorldStepPoint->SetMaterialCutsCou    383         realWorldStepPoint->SetMaterialCutsCouple(ghostMCCouple);
387         *(fpHyperStep->GetPostStepPoint()) = *    384         *(fpHyperStep->GetPostStepPoint()) = *(fGhostPostStepPoint);
388         fpHyperStep->GetPostStepPoint()->SetMa    385         fpHyperStep->GetPostStepPoint()->SetMaterial(ghostMaterial);
389         fpHyperStep->GetPostStepPoint()->SetMa    386         fpHyperStep->GetPostStepPoint()->SetMaterialCutsCouple(ghostMCCouple);
390       }                                           387       }
391       else {                                   << 388       else
392         G4cout << "!!! MaterialCutsCouple is n << 389       {
393                << G4endl << "    Material in r << 390         G4cout << "!!! MaterialCutsCouple is not found for "
394                << realWorldStepPoint->GetMater << 391                << ghostMaterial->GetName() << "." << G4endl
                                                   >> 392                << "    Material in real world ("
                                                   >> 393                << realWorldStepPoint->GetMaterial()->GetName()
                                                   >> 394                << ") is used." << G4endl;
395       }                                           395       }
396     }                                             396     }
397   }                                               397   }
398 }                                                 398 }
399                                                   399 
400 G4bool G4ParallelWorldProcess::IsAtRestRequire    400 G4bool G4ParallelWorldProcess::IsAtRestRequired(G4ParticleDefinition* partDef)
401 {                                                 401 {
402   G4int pdgCode = partDef->GetPDGEncoding();      402   G4int pdgCode = partDef->GetPDGEncoding();
403   if (pdgCode == 0) {                          << 403   if(pdgCode==0)
                                                   >> 404   {
404     G4String partName = partDef->GetParticleNa    405     G4String partName = partDef->GetParticleName();
405     if (partName == "geantino") return false;  << 406     if(partName=="opticalphoton") return false;
406     if (partName == "chargedgeantino") return  << 407     if(partName=="geantino") return false;
407   }                                            << 408     if(partName=="chargedgeantino") return false;
408   else {                                       << 409   }
409     if (pdgCode == 11 || pdgCode == 2212) retu << 410   else
410     pdgCode = std::abs(pdgCode);               << 411   {
411     if (pdgCode == 22) return false;  // gamma << 412     if(pdgCode==22) return false; // gamma
412     if (pdgCode == 12 || pdgCode == 14 || pdgC << 413     if(pdgCode==11) return false; // electron
                                                   >> 414     if(pdgCode==2212) return false; // proton
                                                   >> 415     if(pdgCode==-12) return false; // anti_nu_e
                                                   >> 416     if(pdgCode==12) return false; // nu_e
                                                   >> 417     if(pdgCode==-14) return false; // anti_nu_mu
                                                   >> 418     if(pdgCode==14) return false; // nu_mu
                                                   >> 419     if(pdgCode==-16) return false; // anti_nu_tau
                                                   >> 420     if(pdgCode==16) return false; // nu_tau
413   }                                               421   }
414   return true;                                    422   return true;
415 }                                                 423 }
                                                   >> 424 
416                                                   425