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 9.1)


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