Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/parameterisation/src/G4FastSimulationManagerProcess.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/parameterisation/src/G4FastSimulationManagerProcess.cc (Version 11.3.0) and /processes/parameterisation/src/G4FastSimulationManagerProcess.cc (Version 11.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 //                                                 27 //
 28 //                                                 28 //
 29 //--------------------------------------------     29 //---------------------------------------------------------------
 30 //                                                 30 //
 31 //  G4FastSimulationProcess.cc                     31 //  G4FastSimulationProcess.cc
 32 //                                                 32 //
 33 //  Description:                                   33 //  Description:
 34 //    The process that triggers the parameteri     34 //    The process that triggers the parameterised simulations,
 35 //    if any.                                      35 //    if any.
 36 //                                                 36 //
 37 //  History:                                       37 //  History:
 38 //    August 97: First implementation. Verderi     38 //    August 97: First implementation. Verderi && MoraDeFreitas.
 39 //    October 06: move to parallel geometry sc     39 //    October 06: move to parallel geometry scheme, M. Verderi
 40 //--------------------------------------------     40 //---------------------------------------------------------------
 41                                                    41 
 42 #include "G4FastSimulationManagerProcess.hh"       42 #include "G4FastSimulationManagerProcess.hh"
 43                                                    43 
 44 #include "G4FieldTrackUpdator.hh"                  44 #include "G4FieldTrackUpdator.hh"
 45 #include "G4GlobalFastSimulationManager.hh"        45 #include "G4GlobalFastSimulationManager.hh"
 46 #include "G4ParticleChange.hh"                     46 #include "G4ParticleChange.hh"
 47 #include "G4PathFinder.hh"                         47 #include "G4PathFinder.hh"
 48 #include "G4TransportationManager.hh"              48 #include "G4TransportationManager.hh"
 49 #include "G4ios.hh"                                49 #include "G4ios.hh"
 50                                                    50 
 51 G4FastSimulationManagerProcess::G4FastSimulati     51 G4FastSimulationManagerProcess::G4FastSimulationManagerProcess(const G4String& processName,
 52                                                    52                                                                G4ProcessType theType)
 53   : G4VProcess(processName, theType),              53   : G4VProcess(processName, theType),
 54     fWorldVolume(nullptr),                         54     fWorldVolume(nullptr),
 55     fIsTrackingTime(false),                        55     fIsTrackingTime(false),
 56     fIsFirstStep(false),                           56     fIsFirstStep(false),
 57     fGhostNavigator(nullptr),                      57     fGhostNavigator(nullptr),
 58     fGhostNavigatorIndex(-1),                      58     fGhostNavigatorIndex(-1),
 59     fIsGhostGeometry(false),                       59     fIsGhostGeometry(false),
 60     fGhostSafety(-1.0),                            60     fGhostSafety(-1.0),
 61     fFieldTrack('0'),                              61     fFieldTrack('0'),
 62     fFastSimulationManager(nullptr),               62     fFastSimulationManager(nullptr),
 63     fFastSimulationTrigger(false)                  63     fFastSimulationTrigger(false)
 64 {                                                  64 {
 65   // -- set Process Sub Type                       65   // -- set Process Sub Type
 66   SetProcessSubType(static_cast<int>(FASTSIM_M     66   SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
 67                                                    67 
 68   fPathFinder = G4PathFinder::GetInstance();       68   fPathFinder = G4PathFinder::GetInstance();
 69   fTransportationManager = G4TransportationMan     69   fTransportationManager = G4TransportationManager::GetTransportationManager();
 70                                                    70 
 71   SetWorldVolume(fTransportationManager->GetNa     71   SetWorldVolume(fTransportationManager->GetNavigatorForTracking()->GetWorldVolume()->GetName());
 72   if (verboseLevel > 0)                            72   if (verboseLevel > 0)
 73     G4cout << "G4FastSimulationManagerProcess      73     G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
 74            << "' is created, and will message      74            << "' is created, and will message geometry with world volume `"
 75            << fWorldVolume->GetName() << "'."      75            << fWorldVolume->GetName() << "'." << G4endl;
 76   G4GlobalFastSimulationManager::GetGlobalFast     76   G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
 77 }                                                  77 }
 78                                                    78 
 79 G4FastSimulationManagerProcess::G4FastSimulati     79 G4FastSimulationManagerProcess::G4FastSimulationManagerProcess(const G4String& processName,
 80                                                    80                                                                const G4String& worldVolumeName,
 81                                                    81                                                                G4ProcessType theType)
 82   : G4VProcess(processName, theType),              82   : G4VProcess(processName, theType),
 83     fWorldVolume(nullptr),                         83     fWorldVolume(nullptr),
 84     fIsTrackingTime(false),                        84     fIsTrackingTime(false),
 85     fIsFirstStep(false),                           85     fIsFirstStep(false),
 86     fGhostNavigator(nullptr),                      86     fGhostNavigator(nullptr),
 87     fGhostNavigatorIndex(-1),                      87     fGhostNavigatorIndex(-1),
 88     fIsGhostGeometry(false),                       88     fIsGhostGeometry(false),
 89     fGhostSafety(-1.0),                            89     fGhostSafety(-1.0),
 90     fFieldTrack('0'),                              90     fFieldTrack('0'),
 91     fFastSimulationManager(nullptr),               91     fFastSimulationManager(nullptr),
 92     fFastSimulationTrigger(false)                  92     fFastSimulationTrigger(false)
 93 {                                                  93 {
 94   // -- set Process Sub Type                       94   // -- set Process Sub Type
 95   SetProcessSubType(static_cast<int>(FASTSIM_M     95   SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
 96                                                    96 
 97   fPathFinder = G4PathFinder::GetInstance();       97   fPathFinder = G4PathFinder::GetInstance();
 98   fTransportationManager = G4TransportationMan     98   fTransportationManager = G4TransportationManager::GetTransportationManager();
 99                                                    99 
100   SetWorldVolume(worldVolumeName);                100   SetWorldVolume(worldVolumeName);
101   if (verboseLevel > 0)                           101   if (verboseLevel > 0)
102     G4cout << "G4FastSimulationManagerProcess     102     G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
103            << "' is created, and will message     103            << "' is created, and will message geometry with world volume `"
104            << fWorldVolume->GetName() << "'."     104            << fWorldVolume->GetName() << "'." << G4endl;
105   G4GlobalFastSimulationManager::GetGlobalFast    105   G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
106 }                                                 106 }
107                                                   107 
108 G4FastSimulationManagerProcess::G4FastSimulati    108 G4FastSimulationManagerProcess::G4FastSimulationManagerProcess(const G4String& processName,
109                                                   109                                                                G4VPhysicalVolume* worldVolume,
110                                                   110                                                                G4ProcessType theType)
111   : G4VProcess(processName, theType),             111   : G4VProcess(processName, theType),
112     fWorldVolume(nullptr),                        112     fWorldVolume(nullptr),
113     fIsTrackingTime(false),                       113     fIsTrackingTime(false),
114     fIsFirstStep(false),                          114     fIsFirstStep(false),
115     fGhostNavigator(nullptr),                     115     fGhostNavigator(nullptr),
116     fGhostNavigatorIndex(-1),                     116     fGhostNavigatorIndex(-1),
117     fIsGhostGeometry(false),                      117     fIsGhostGeometry(false),
118     fGhostSafety(-1.0),                           118     fGhostSafety(-1.0),
119     fFieldTrack('0'),                             119     fFieldTrack('0'),
120     fFastSimulationManager(nullptr),              120     fFastSimulationManager(nullptr),
121     fFastSimulationTrigger(false)                 121     fFastSimulationTrigger(false)
122 {                                                 122 {
123   // -- set Process Sub Type                      123   // -- set Process Sub Type
124   SetProcessSubType(static_cast<int>(FASTSIM_M    124   SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
125                                                   125 
126   fPathFinder = G4PathFinder::GetInstance();      126   fPathFinder = G4PathFinder::GetInstance();
127   fTransportationManager = G4TransportationMan    127   fTransportationManager = G4TransportationManager::GetTransportationManager();
128                                                   128 
129   SetWorldVolume(worldVolume);                    129   SetWorldVolume(worldVolume);
130   if (verboseLevel > 0)                           130   if (verboseLevel > 0)
131     G4cout << "G4FastSimulationManagerProcess     131     G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
132            << "' is created, and will message     132            << "' is created, and will message geometry with world volume `"
133            << fWorldVolume->GetName() << "'."     133            << fWorldVolume->GetName() << "'." << G4endl;
134   G4GlobalFastSimulationManager::GetGlobalFast    134   G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
135 }                                                 135 }
136                                                   136 
137 G4FastSimulationManagerProcess::~G4FastSimulat    137 G4FastSimulationManagerProcess::~G4FastSimulationManagerProcess()
138 {                                                 138 {
139   G4GlobalFastSimulationManager::GetGlobalFast    139   G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->RemoveFSMP(this);
140 }                                                 140 }
141                                                   141 
142 // -----------------------                        142 // -----------------------
143 //   User access methods:                         143 //   User access methods:
144 // -----------------------                        144 // -----------------------
145 void G4FastSimulationManagerProcess::SetWorldV    145 void G4FastSimulationManagerProcess::SetWorldVolume(G4String newWorldName)
146 {                                                 146 {
147   if (fIsTrackingTime) {                          147   if (fIsTrackingTime) {
148     G4ExceptionDescription ed;                    148     G4ExceptionDescription ed;
149     ed << "G4FastSimulationManagerProcess `" <    149     ed << "G4FastSimulationManagerProcess `" << GetProcessName()
150        << "': changing of world volume at trac    150        << "': changing of world volume at tracking time is not allowed." << G4endl;
151     G4Exception("G4FastSimulationManagerProces    151     G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4String)", "FastSim002",
152                 JustWarning, ed, "Call ignored    152                 JustWarning, ed, "Call ignored.");
153   }                                               153   }
154   else {                                          154   else {
155     G4VPhysicalVolume* newWorld = fTransportat    155     G4VPhysicalVolume* newWorld = fTransportationManager->IsWorldExisting(newWorldName);
156     if (newWorld == nullptr) {                    156     if (newWorld == nullptr) {
157       G4ExceptionDescription tellWhatIsWrong;     157       G4ExceptionDescription tellWhatIsWrong;
158       tellWhatIsWrong << "Volume newWorldName     158       tellWhatIsWrong << "Volume newWorldName = `" << newWorldName
159                       << "' is not a parallel     159                       << "' is not a parallel world nor the mass world volume." << G4endl;
160       G4Exception("G4FastSimulationManagerProc    160       G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4String)", "FastSim003",
161                   FatalException, tellWhatIsWr    161                   FatalException, tellWhatIsWrong);
162     }                                             162     }
163     if (verboseLevel > 0) {                       163     if (verboseLevel > 0) {
164       if (fWorldVolume != nullptr)                164       if (fWorldVolume != nullptr)
165         G4cout << "G4FastSimulationManagerProc    165         G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
166                << "': changing world volume fr    166                << "': changing world volume from '" << fWorldVolume->GetName() << "' to `"
167                << newWorld << "'." << G4endl;     167                << newWorld << "'." << G4endl;
168       else                                        168       else
169         G4cout << "G4FastSimulationManagerProc    169         G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
170                << "': setting world volume fro    170                << "': setting world volume from to `" << newWorld->GetName() << "'." << G4endl;
171     }                                             171     }
172     fWorldVolume = newWorld;                      172     fWorldVolume = newWorld;
173   }                                               173   }
174 }                                                 174 }
175                                                   175 
176 void G4FastSimulationManagerProcess::SetWorldV    176 void G4FastSimulationManagerProcess::SetWorldVolume(G4VPhysicalVolume* newWorld)
177 {                                                 177 {
178   if (newWorld != nullptr)                        178   if (newWorld != nullptr)
179     SetWorldVolume(newWorld->GetName());          179     SetWorldVolume(newWorld->GetName());
180   else {                                          180   else {
181     G4ExceptionDescription tellWhatIsWrong;       181     G4ExceptionDescription tellWhatIsWrong;
182     tellWhatIsWrong << "Null pointer passed fo    182     tellWhatIsWrong << "Null pointer passed for world volume." << G4endl;
183     G4Exception("G4FastSimulationManagerProces    183     G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4VPhysicalVolume* newWorld)",
184                 "FastSim004", FatalException,     184                 "FastSim004", FatalException, tellWhatIsWrong);
185   }                                               185   }
186 }                                                 186 }
187                                                   187 
188 // --------------------                           188 // --------------------
189 //  Start/End tracking:                           189 //  Start/End tracking:
190 // --------------------                           190 // --------------------
191 void G4FastSimulationManagerProcess::StartTrac    191 void G4FastSimulationManagerProcess::StartTracking(G4Track* track)
192 {                                                 192 {
193   fIsTrackingTime = true;                         193   fIsTrackingTime = true;
194   fIsFirstStep = true;                            194   fIsFirstStep = true;
195                                                   195 
196   // -- fetch the navigator (and its index) an    196   // -- fetch the navigator (and its index) and activate it:
197   G4TransportationManager* transportationManag    197   G4TransportationManager* transportationManager =
198     G4TransportationManager::GetTransportation    198     G4TransportationManager::GetTransportationManager();
199   fGhostNavigator = transportationManager->Get    199   fGhostNavigator = transportationManager->GetNavigator(fWorldVolume);
200   fIsGhostGeometry = (fGhostNavigator != trans    200   fIsGhostGeometry = (fGhostNavigator != transportationManager->GetNavigatorForTracking());
201   if (fIsGhostGeometry)                           201   if (fIsGhostGeometry)
202     fGhostNavigatorIndex = transportationManag    202     fGhostNavigatorIndex = transportationManager->ActivateNavigator(fGhostNavigator);
203   else                                            203   else
204     fGhostNavigatorIndex = -1;                    204     fGhostNavigatorIndex = -1;
205                                                   205 
206   fPathFinder->PrepareNewTrack(track->GetPosit    206   fPathFinder->PrepareNewTrack(track->GetPosition(), track->GetMomentumDirection());
207 }                                                 207 }
208                                                   208 
209 void G4FastSimulationManagerProcess::EndTracki    209 void G4FastSimulationManagerProcess::EndTracking()
210 {                                                 210 {
211   fIsTrackingTime = false;                        211   fIsTrackingTime = false;
212   if (fIsGhostGeometry) fTransportationManager    212   if (fIsGhostGeometry) fTransportationManager->DeActivateNavigator(fGhostNavigator);
213 }                                                 213 }
214                                                   214 
215 // ------------------------------------------     215 // ------------------------------------------
216 //   PostStepGetPhysicalInteractionLength():      216 //   PostStepGetPhysicalInteractionLength():
217 // ------------------------------------------     217 // ------------------------------------------
218 G4double                                          218 G4double
219 G4FastSimulationManagerProcess::PostStepGetPhy    219 G4FastSimulationManagerProcess::PostStepGetPhysicalInteractionLength(const G4Track& track, G4double,
220                                                   220                                                                      G4ForceCondition* condition)
221 {                                                 221 {
222   // -- Get current volume, and check for pres    222   // -- Get current volume, and check for presence of fast simulation manager.
223   // -- For the case of the navigator for trac    223   // -- For the case of the navigator for tracking (fGhostNavigatorIndex == 0)
224   // -- we use the track volume. This allows t    224   // -- we use the track volume. This allows the code to be valid for both
225   // -- cases where the PathFinder is used (G4    225   // -- cases where the PathFinder is used (G4CoupledTranportation) or not
226   // -- (G4Transportation).                       226   // -- (G4Transportation).
227   const G4VPhysicalVolume* currentVolume(nullp    227   const G4VPhysicalVolume* currentVolume(nullptr);
228   if (fIsGhostGeometry)                           228   if (fIsGhostGeometry)
229     currentVolume = fPathFinder->GetLocatedVol    229     currentVolume = fPathFinder->GetLocatedVolume(fGhostNavigatorIndex);
230   else                                            230   else
231     currentVolume = track.GetVolume();            231     currentVolume = track.GetVolume();
232                                                   232 
233   if (currentVolume != nullptr) {                 233   if (currentVolume != nullptr) {
234     fFastSimulationManager = currentVolume->Ge    234     fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
235     if (fFastSimulationManager != nullptr) {      235     if (fFastSimulationManager != nullptr) {
236       // Ask for trigger:                         236       // Ask for trigger:
237       fFastSimulationTrigger =                    237       fFastSimulationTrigger =
238         fFastSimulationManager->PostStepGetFas    238         fFastSimulationManager->PostStepGetFastSimulationManagerTrigger(track, fGhostNavigator);
239       if (fFastSimulationTrigger) {               239       if (fFastSimulationTrigger) {
240         // Take control over stepping:            240         // Take control over stepping:
241         *condition = ExclusivelyForced;           241         *condition = ExclusivelyForced;
242         return 0.0;                               242         return 0.0;
243       }                                           243       }
244     }                                             244     }
245   }                                               245   }
246                                                   246 
247   // -- no fast simulation occuring there:        247   // -- no fast simulation occuring there:
248   *condition = NotForced;                         248   *condition = NotForced;
249   return DBL_MAX;                                 249   return DBL_MAX;
250 }                                                 250 }
251                                                   251 
252 //------------------------------------            252 //------------------------------------
253 //             PostStepDoIt()                     253 //             PostStepDoIt()
254 //------------------------------------            254 //------------------------------------
255 G4VParticleChange* G4FastSimulationManagerProc    255 G4VParticleChange* G4FastSimulationManagerProcess::PostStepDoIt(const G4Track&, const G4Step&)
256 {                                                 256 {
257   G4VParticleChange* finalState = fFastSimulat    257   G4VParticleChange* finalState = fFastSimulationManager->InvokePostStepDoIt();
258                                                   258 
259   // If the particle is still alive, suspend i    259   // If the particle is still alive, suspend it to force physics re-initialisation:
260   if (finalState->GetTrackStatus() != fStopAnd    260   if (finalState->GetTrackStatus() != fStopAndKill) finalState->ProposeTrackStatus(fSuspend);
261                                                   261 
262   return finalState;                              262   return finalState;
263 }                                                 263 }
264                                                   264 
265 G4double G4FastSimulationManagerProcess::Along    265 G4double G4FastSimulationManagerProcess::AlongStepGetPhysicalInteractionLength(
266   const G4Track& track, G4double previousStepS    266   const G4Track& track, G4double previousStepSize, G4double currentMinimumStep,
267   G4double& proposedSafety, G4GPILSelection* s    267   G4double& proposedSafety, G4GPILSelection* selection)
268 {                                                 268 {
269   *selection = NotCandidateForSelection;          269   *selection = NotCandidateForSelection;
270   G4double returnedStep = DBL_MAX;                270   G4double returnedStep = DBL_MAX;
271                                                   271 
272   // -----------------------------------------    272   // ---------------------------------------------------
273   // -- Below code valid for ghost geometry, o    273   // -- Below code valid for ghost geometry, otherwise
274   // -- useless for fast simulation attached t    274   // -- useless for fast simulation attached to mass
275   // -- geometry. Warn user in case along used    275   // -- geometry. Warn user in case along used for
276   // -- mass geometry ?                           276   // -- mass geometry ?
277   // -----------------------------------------    277   // --------------------------------------------------
278   if (fIsGhostGeometry) {                         278   if (fIsGhostGeometry) {
279     static G4ThreadLocal G4FieldTrack* endTrac    279     static G4ThreadLocal G4FieldTrack* endTrack_G4MT_TLS_ = nullptr;
280     if (endTrack_G4MT_TLS_ == nullptr) endTrac    280     if (endTrack_G4MT_TLS_ == nullptr) endTrack_G4MT_TLS_ = new G4FieldTrack('0');
281     G4FieldTrack& endTrack = *endTrack_G4MT_TL    281     G4FieldTrack& endTrack = *endTrack_G4MT_TLS_;
282                                                   282 
283     static G4ThreadLocal ELimited* eLimited_G4    283     static G4ThreadLocal ELimited* eLimited_G4MT_TLS_ = nullptr;
284     if (eLimited_G4MT_TLS_ == nullptr) eLimite    284     if (eLimited_G4MT_TLS_ == nullptr) eLimited_G4MT_TLS_ = new ELimited;
285     ELimited& eLimited = *eLimited_G4MT_TLS_;     285     ELimited& eLimited = *eLimited_G4MT_TLS_;
286                                                   286 
287     if (previousStepSize > 0.) fGhostSafety -=    287     if (previousStepSize > 0.) fGhostSafety -= previousStepSize;
288     if (fGhostSafety < 0.) fGhostSafety = 0.0;    288     if (fGhostSafety < 0.) fGhostSafety = 0.0;
289                                                   289 
290     // ---------------------------------------    290     // ------------------------------------------
291     // Determination of the proposed step leng    291     // Determination of the proposed step length:
292     // ---------------------------------------    292     // ------------------------------------------
293     if (currentMinimumStep <= fGhostSafety &&     293     if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.) {
294       // -- No chance to limit the step, as pr    294       // -- No chance to limit the step, as proposed move inside safety
295       returnedStep = currentMinimumStep;          295       returnedStep = currentMinimumStep;
296       proposedSafety = fGhostSafety - currentM    296       proposedSafety = fGhostSafety - currentMinimumStep;
297     }                                             297     }
298     else {                                        298     else {
299       // -- Proposed move exceeds safety, need    299       // -- Proposed move exceeds safety, need to state
300       G4FieldTrackUpdator::Update(&fFieldTrack    300       G4FieldTrackUpdator::Update(&fFieldTrack, &track);
301       returnedStep = fPathFinder->ComputeStep(    301       returnedStep = fPathFinder->ComputeStep(fFieldTrack, currentMinimumStep, fGhostNavigatorIndex,
302                                                   302                                               track.GetCurrentStepNumber(), fGhostSafety, eLimited,
303                                                   303                                               endTrack, track.GetVolume());
304                                                   304 
305       if (eLimited == kDoNot)                     305       if (eLimited == kDoNot)
306         fGhostSafety =                            306         fGhostSafety =
307           fGhostNavigator->ComputeSafety(endTr    307           fGhostNavigator->ComputeSafety(endTrack.GetPosition());  // -- step no limited by ghost
308       proposedSafety = fGhostSafety;              308       proposedSafety = fGhostSafety;
309       if (eLimited == kUnique || eLimited == k    309       if (eLimited == kUnique || eLimited == kSharedOther)
310         *selection = CandidateForSelection;       310         *selection = CandidateForSelection;
311       else if (eLimited == kSharedTransport)      311       else if (eLimited == kSharedTransport)
312         returnedStep *=                           312         returnedStep *=
313           (1.0 + 1.0e-9);  // -- Expand to dis    313           (1.0 + 1.0e-9);  // -- Expand to disable its selection in Step Manager comparison
314     }                                             314     }
315   }                                               315   }
316                                                   316 
317   // -----------------------------------------    317   // ----------------------------------------------
318   // Returns the fGhostSafety as the proposedS    318   // Returns the fGhostSafety as the proposedSafety
319   // The SteppingManager will take care of kee    319   // The SteppingManager will take care of keeping
320   // the smallest one.                            320   // the smallest one.
321   // -----------------------------------------    321   // ----------------------------------------------
322   return returnedStep;                            322   return returnedStep;
323 }                                                 323 }
324                                                   324 
325 G4VParticleChange* G4FastSimulationManagerProc    325 G4VParticleChange* G4FastSimulationManagerProcess::AlongStepDoIt(const G4Track& track,
326                                                   326                                                                  const G4Step&)
327 {                                                 327 {
328   fDummyParticleChange.Initialize(track);         328   fDummyParticleChange.Initialize(track);
329   return &fDummyParticleChange;                   329   return &fDummyParticleChange;
330 }                                                 330 }
331                                                   331 
332 //--------------------------------------------    332 //--------------------------------------------
333 //         At Rest parameterisation:              333 //         At Rest parameterisation:
334 //--------------------------------------------    334 //--------------------------------------------
335 //   AtRestGetPhysiscalInteractionLength:         335 //   AtRestGetPhysiscalInteractionLength:
336 //--------------------------------------------    336 //--------------------------------------------
337 G4double                                          337 G4double
338 G4FastSimulationManagerProcess::AtRestGetPhysi    338 G4FastSimulationManagerProcess::AtRestGetPhysicalInteractionLength(const G4Track& track,
339                                                   339                                                                    G4ForceCondition* condition)
340 {                                                 340 {
341   const G4VPhysicalVolume* currentVolume(nullp    341   const G4VPhysicalVolume* currentVolume(nullptr);
342   if (fIsGhostGeometry)                           342   if (fIsGhostGeometry)
343     currentVolume = fPathFinder->GetLocatedVol    343     currentVolume = fPathFinder->GetLocatedVolume(fGhostNavigatorIndex);
344   else                                            344   else
345     currentVolume = track.GetVolume();            345     currentVolume = track.GetVolume();
346   fFastSimulationManager = currentVolume->GetL    346   fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
347   if (fFastSimulationManager != nullptr) {        347   if (fFastSimulationManager != nullptr) {
348     // Ask for trigger:                           348     // Ask for trigger:
349     fFastSimulationTrigger =                      349     fFastSimulationTrigger =
350       fFastSimulationManager->AtRestGetFastSim    350       fFastSimulationManager->AtRestGetFastSimulationManagerTrigger(track, fGhostNavigator);
351     if (fFastSimulationTrigger) {                 351     if (fFastSimulationTrigger) {
352       // Dirty trick to take control over step    352       // Dirty trick to take control over stepping. Does anyone will ever use that ?
353       *condition = NotForced;                     353       *condition = NotForced;
354       return -1.0;                                354       return -1.0;
355     }                                             355     }
356   }                                               356   }
357                                                   357 
358   // -- no fast simulation occuring there:        358   // -- no fast simulation occuring there:
359   *condition = NotForced;                         359   *condition = NotForced;
360   return DBL_MAX;                                 360   return DBL_MAX;
361 }                                                 361 }
362                                                   362 
363 //--------------------------------------------    363 //-----------------------------------------------
364 //                  AtRestDoIt:                   364 //                  AtRestDoIt:
365 //--------------------------------------------    365 //-----------------------------------------------
366 G4VParticleChange* G4FastSimulationManagerProc    366 G4VParticleChange* G4FastSimulationManagerProcess::AtRestDoIt(const G4Track&, const G4Step&)
367 {                                                 367 {
368   return fFastSimulationManager->InvokeAtRestD    368   return fFastSimulationManager->InvokeAtRestDoIt();
369 }                                                 369 }
370                                                   370