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.5.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: G4FastSimulationManagerProcess.cc,v 1.18 2008-03-13 16:03:23 gcosmo Exp $
                                                   >>  28 // GEANT4 tag $Name: not supported by cvs2svn $
 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 
 53   : G4VProcess(processName, theType),          <<  54 G4FastSimulationManagerProcess::
 54     fWorldVolume(nullptr),                     <<  55 G4FastSimulationManagerProcess(const G4String& processName,
 55     fIsTrackingTime(false),                    <<  56              G4ProcessType       theType) : 
 56     fIsFirstStep(false),                       <<  57   G4VProcess(processName,theType),
 57     fGhostNavigator(nullptr),                  <<  58   fWorldVolume(0),
 58     fGhostNavigatorIndex(-1),                  <<  59   fIsTrackingTime(false),
 59     fIsGhostGeometry(false),                   <<  60   fGhostNavigator(0),
 60     fGhostSafety(-1.0),                        <<  61   fGhostNavigatorIndex(-1),
 61     fFieldTrack('0'),                          <<  62   fIsGhostGeometry(false),
 62     fFastSimulationManager(nullptr),           <<  63   fGhostSafety(-1.0),
 63     fFastSimulationTrigger(false)              <<  64   fFieldTrack('0'),
                                                   >>  65   fFastSimulationManager(0),
                                                   >>  66   fFastSimulationTrigger(false)
 64 {                                                  67 {
 65   // -- set Process Sub Type                       68   // -- set Process Sub Type
 66   SetProcessSubType(static_cast<int>(FASTSIM_M     69   SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
 67                                                    70 
 68   fPathFinder = G4PathFinder::GetInstance();   << 
 69   fTransportationManager = G4TransportationMan << 
 70                                                    71 
                                                   >>  72   fPathFinder            = G4PathFinder::GetInstance();
                                                   >>  73   fTransportationManager = G4TransportationManager::GetTransportationManager();
                                                   >>  74   
 71   SetWorldVolume(fTransportationManager->GetNa     75   SetWorldVolume(fTransportationManager->GetNavigatorForTracking()->GetWorldVolume()->GetName());
 72   if (verboseLevel > 0)                        <<  76   if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess `" << GetProcessName() 
 73     G4cout << "G4FastSimulationManagerProcess  <<  77            << "' is created, and will message geometry with world volume `" 
 74            << "' is created, and will message  <<  78            << fWorldVolume->GetName() << "'." << G4endl;
 75            << fWorldVolume->GetName() << "'."  << 
 76   G4GlobalFastSimulationManager::GetGlobalFast     79   G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
 77 }                                                  80 }
 78                                                    81 
 79 G4FastSimulationManagerProcess::G4FastSimulati <<  82 
 80                                                <<  83 G4FastSimulationManagerProcess::
 81                                                <<  84 G4FastSimulationManagerProcess(const G4String&     processName,
 82   : G4VProcess(processName, theType),          <<  85              const G4String& worldVolumeName,
 83     fWorldVolume(nullptr),                     <<  86              G4ProcessType           theType) :
 84     fIsTrackingTime(false),                    <<  87   G4VProcess(processName,theType),
 85     fIsFirstStep(false),                       <<  88   fWorldVolume(0),
 86     fGhostNavigator(nullptr),                  <<  89   fIsTrackingTime(false),
 87     fGhostNavigatorIndex(-1),                  <<  90   fGhostNavigator(0),
 88     fIsGhostGeometry(false),                   <<  91   fGhostNavigatorIndex(-1),
 89     fGhostSafety(-1.0),                        <<  92   fIsGhostGeometry(false),
 90     fFieldTrack('0'),                          <<  93   fGhostSafety(-1.0),
 91     fFastSimulationManager(nullptr),           <<  94   fFieldTrack('0'),
 92     fFastSimulationTrigger(false)              <<  95   fFastSimulationManager(0),
                                                   >>  96   fFastSimulationTrigger(false)
 93 {                                                  97 {
 94   // -- set Process Sub Type                       98   // -- set Process Sub Type
 95   SetProcessSubType(static_cast<int>(FASTSIM_M     99   SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
 96                                                   100 
 97   fPathFinder = G4PathFinder::GetInstance();   << 101 
                                                   >> 102   fPathFinder            = G4PathFinder::GetInstance();
 98   fTransportationManager = G4TransportationMan    103   fTransportationManager = G4TransportationManager::GetTransportationManager();
 99                                                   104 
100   SetWorldVolume(worldVolumeName);                105   SetWorldVolume(worldVolumeName);
101   if (verboseLevel > 0)                        << 106   if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess `" << GetProcessName() 
102     G4cout << "G4FastSimulationManagerProcess  << 107            << "' is created, and will message geometry with world volume `" 
103            << "' is created, and will message  << 108            << fWorldVolume->GetName() << "'." << G4endl;
104            << fWorldVolume->GetName() << "'."  << 
105   G4GlobalFastSimulationManager::GetGlobalFast    109   G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
106 }                                                 110 }
107                                                   111 
108 G4FastSimulationManagerProcess::G4FastSimulati << 112 
109                                                << 113 G4FastSimulationManagerProcess::
110                                                << 114 G4FastSimulationManagerProcess(const G4String&    processName,
111   : G4VProcess(processName, theType),          << 115              G4VPhysicalVolume* worldVolume,
112     fWorldVolume(nullptr),                     << 116              G4ProcessType      theType) :
113     fIsTrackingTime(false),                    << 117   G4VProcess(processName,theType),
114     fIsFirstStep(false),                       << 118   fWorldVolume(0),
115     fGhostNavigator(nullptr),                  << 119   fIsTrackingTime(false),
116     fGhostNavigatorIndex(-1),                  << 120   fGhostNavigator(0),
117     fIsGhostGeometry(false),                   << 121   fGhostNavigatorIndex(-1),
118     fGhostSafety(-1.0),                        << 122   fIsGhostGeometry(false),
119     fFieldTrack('0'),                          << 123   fGhostSafety(-1.0),
120     fFastSimulationManager(nullptr),           << 124   fFieldTrack('0'),
121     fFastSimulationTrigger(false)              << 125   fFastSimulationManager(0),
                                                   >> 126   fFastSimulationTrigger(false)
122 {                                                 127 {
123   // -- set Process Sub Type                      128   // -- set Process Sub Type
124   SetProcessSubType(static_cast<int>(FASTSIM_M    129   SetProcessSubType(static_cast<int>(FASTSIM_ManagerProcess));
                                                   >> 130   
125                                                   131 
126   fPathFinder = G4PathFinder::GetInstance();   << 132   fPathFinder            = G4PathFinder::GetInstance();
127   fTransportationManager = G4TransportationMan    133   fTransportationManager = G4TransportationManager::GetTransportationManager();
128                                                   134 
129   SetWorldVolume(worldVolume);                    135   SetWorldVolume(worldVolume);
130   if (verboseLevel > 0)                        << 136   if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess `" << GetProcessName() 
131     G4cout << "G4FastSimulationManagerProcess  << 137            << "' is created, and will message geometry with world volume `" 
132            << "' is created, and will message  << 138            << fWorldVolume->GetName() << "'." << G4endl;
133            << fWorldVolume->GetName() << "'."  << 
134   G4GlobalFastSimulationManager::GetGlobalFast    139   G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
135 }                                                 140 }
136                                                   141 
                                                   >> 142 
137 G4FastSimulationManagerProcess::~G4FastSimulat    143 G4FastSimulationManagerProcess::~G4FastSimulationManagerProcess()
138 {                                                 144 {
139   G4GlobalFastSimulationManager::GetGlobalFast    145   G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->RemoveFSMP(this);
140 }                                                 146 }
141                                                   147 
                                                   >> 148 
142 // -----------------------                        149 // -----------------------
143 //   User access methods:                         150 //   User access methods:
144 // -----------------------                        151 // -----------------------
145 void G4FastSimulationManagerProcess::SetWorldV    152 void G4FastSimulationManagerProcess::SetWorldVolume(G4String newWorldName)
146 {                                                 153 {
147   if (fIsTrackingTime) {                       << 154   if (fIsTrackingTime)
148     G4ExceptionDescription ed;                 << 155     {
149     ed << "G4FastSimulationManagerProcess `" < << 156       G4ExceptionDescription ed;
150        << "': changing of world volume at trac << 157       ed << "G4FastSimulationManagerProcess `" << GetProcessName()
151     G4Exception("G4FastSimulationManagerProces << 158    << "': changing of world volume at tracking time is not allowed." << G4endl;
152                 JustWarning, ed, "Call ignored << 159       G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4String)",
153   }                                            << 160       "FastSim002",
154   else {                                       << 161       JustWarning, ed,
155     G4VPhysicalVolume* newWorld = fTransportat << 162       "Call ignored.");
156     if (newWorld == nullptr) {                 << 
157       G4ExceptionDescription tellWhatIsWrong;  << 
158       tellWhatIsWrong << "Volume newWorldName  << 
159                       << "' is not a parallel  << 
160       G4Exception("G4FastSimulationManagerProc << 
161                   FatalException, tellWhatIsWr << 
162     }                                             163     }
163     if (verboseLevel > 0) {                    << 164   else
164       if (fWorldVolume != nullptr)             << 165     {
165         G4cout << "G4FastSimulationManagerProc << 166       G4VPhysicalVolume* newWorld = fTransportationManager->IsWorldExisting(newWorldName);
166                << "': changing world volume fr << 167       if (newWorld == 0)
167                << newWorld << "'." << G4endl;  << 168   {
168       else                                     << 169     G4ExceptionDescription  tellWhatIsWrong;
169         G4cout << "G4FastSimulationManagerProc << 170     tellWhatIsWrong << "Volume newWorldName = `" <<  newWorldName
170                << "': setting world volume fro << 171         << "' is not a parallel world nor the mass world volume."
                                                   >> 172         << G4endl;
                                                   >> 173     G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4String)",
                                                   >> 174           "FastSim003",
                                                   >> 175           FatalException,
                                                   >> 176           tellWhatIsWrong);
                                                   >> 177   }
                                                   >> 178       if (verboseLevel>0)
                                                   >> 179       {
                                                   >> 180   if (fWorldVolume) G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
                                                   >> 181          << "': changing world volume from '"  << fWorldVolume->GetName() 
                                                   >> 182          << "' to `" << newWorld << "'." << G4endl;
                                                   >> 183   else              G4cout << "G4FastSimulationManagerProcess `" << GetProcessName()
                                                   >> 184          << "': setting world volume from to `"<< newWorld->GetName() << "'." << G4endl;
                                                   >> 185       }
                                                   >> 186       fWorldVolume = newWorld;
171     }                                             187     }
172     fWorldVolume = newWorld;                   << 
173   }                                            << 
174 }                                                 188 }
175                                                   189 
                                                   >> 190 
176 void G4FastSimulationManagerProcess::SetWorldV    191 void G4FastSimulationManagerProcess::SetWorldVolume(G4VPhysicalVolume* newWorld)
177 {                                                 192 {
178   if (newWorld != nullptr)                     << 193   if (newWorld) SetWorldVolume(newWorld->GetName());
179     SetWorldVolume(newWorld->GetName());       << 194   else
180   else {                                       << 195     {
181     G4ExceptionDescription tellWhatIsWrong;    << 196       G4ExceptionDescription  tellWhatIsWrong;
182     tellWhatIsWrong << "Null pointer passed fo << 197       tellWhatIsWrong << "Null pointer passed for world volume." << G4endl;
183     G4Exception("G4FastSimulationManagerProces << 198       G4Exception("G4FastSimulationManagerProcess::SetWorldVolume(const G4VPhysicalVolume* newWorld)",
184                 "FastSim004", FatalException,  << 199       "FastSim004",
185   }                                            << 200       FatalException,
                                                   >> 201       tellWhatIsWrong); 
                                                   >> 202     }
186 }                                                 203 }
187                                                   204 
                                                   >> 205 
188 // --------------------                           206 // --------------------
189 //  Start/End tracking:                           207 //  Start/End tracking:
190 // --------------------                           208 // --------------------
191 void G4FastSimulationManagerProcess::StartTrac << 209 void
                                                   >> 210 G4FastSimulationManagerProcess::
                                                   >> 211 StartTracking(G4Track* track)
192 {                                                 212 {
193   fIsTrackingTime = true;                         213   fIsTrackingTime = true;
194   fIsFirstStep = true;                         << 214   fIsFirstStep    = true;
195                                                << 215   
196   // -- fetch the navigator (and its index) an    216   // -- fetch the navigator (and its index) and activate it:
197   G4TransportationManager* transportationManag << 217   G4TransportationManager* transportationManager = G4TransportationManager::GetTransportationManager();
198     G4TransportationManager::GetTransportation << 218   fGhostNavigator                            = transportationManager->GetNavigator(fWorldVolume);
199   fGhostNavigator = transportationManager->Get << 219   fIsGhostGeometry                           = (fGhostNavigator != transportationManager->GetNavigatorForTracking());
200   fIsGhostGeometry = (fGhostNavigator != trans << 220   if (fIsGhostGeometry) fGhostNavigatorIndex = transportationManager->ActivateNavigator(fGhostNavigator);
201   if (fIsGhostGeometry)                        << 221   else                  fGhostNavigatorIndex = -1;
202     fGhostNavigatorIndex = transportationManag << 
203   else                                         << 
204     fGhostNavigatorIndex = -1;                 << 
205                                                   222 
206   fPathFinder->PrepareNewTrack(track->GetPosit    223   fPathFinder->PrepareNewTrack(track->GetPosition(), track->GetMomentumDirection());
207 }                                                 224 }
208                                                   225 
209 void G4FastSimulationManagerProcess::EndTracki << 226 
                                                   >> 227 void
                                                   >> 228 G4FastSimulationManagerProcess::
                                                   >> 229 EndTracking()
210 {                                                 230 {
211   fIsTrackingTime = false;                        231   fIsTrackingTime = false;
212   if (fIsGhostGeometry) fTransportationManager << 232   if ( fIsGhostGeometry ) fTransportationManager->DeActivateNavigator(fGhostNavigator); 
213 }                                                 233 }
214                                                   234 
                                                   >> 235 
215 // ------------------------------------------     236 // ------------------------------------------
216 //   PostStepGetPhysicalInteractionLength():      237 //   PostStepGetPhysicalInteractionLength():
217 // ------------------------------------------     238 // ------------------------------------------
218 G4double                                       << 239 G4double 
219 G4FastSimulationManagerProcess::PostStepGetPhy << 240 G4FastSimulationManagerProcess::
220                                                << 241 PostStepGetPhysicalInteractionLength(const G4Track&               track, 
                                                   >> 242              G4double,
                                                   >> 243              G4ForceCondition*        condition)
221 {                                                 244 {
222   // -- Get current volume, and check for pres    245   // -- Get current volume, and check for presence of fast simulation manager.
223   // -- For the case of the navigator for trac    246   // -- For the case of the navigator for tracking (fGhostNavigatorIndex == 0)
224   // -- we use the track volume. This allows t    247   // -- we use the track volume. This allows the code to be valid for both
225   // -- cases where the PathFinder is used (G4    248   // -- cases where the PathFinder is used (G4CoupledTranportation) or not
226   // -- (G4Transportation).                       249   // -- (G4Transportation).
227   const G4VPhysicalVolume* currentVolume(nullp << 250   const G4VPhysicalVolume* currentVolume(0);
228   if (fIsGhostGeometry)                        << 251   if ( fIsGhostGeometry )  currentVolume = fPathFinder->GetLocatedVolume(fGhostNavigatorIndex);
229     currentVolume = fPathFinder->GetLocatedVol << 252   else                     currentVolume = track.GetVolume();
230   else                                         << 253 
231     currentVolume = track.GetVolume();         << 254   if ( currentVolume )
232                                                << 255     {
233   if (currentVolume != nullptr) {              << 256       fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
234     fFastSimulationManager = currentVolume->Ge << 257       if( fFastSimulationManager )
235     if (fFastSimulationManager != nullptr) {   << 258   {
236       // Ask for trigger:                      << 259     // Ask for trigger:
237       fFastSimulationTrigger =                 << 260     fFastSimulationTrigger = fFastSimulationManager->PostStepGetFastSimulationManagerTrigger(track, fGhostNavigator);
238         fFastSimulationManager->PostStepGetFas << 261     if( fFastSimulationTrigger )
239       if (fFastSimulationTrigger) {            << 262       {
240         // Take control over stepping:         << 263         // Take control over stepping:
241         *condition = ExclusivelyForced;        << 264         *condition = ExclusivelyForced;
242         return 0.0;                            << 265         return 0.0;
243       }                                        << 266       }
                                                   >> 267   }     
244     }                                             268     }
245   }                                            << 269   
246                                                << 
247   // -- no fast simulation occuring there:        270   // -- no fast simulation occuring there:
248   *condition = NotForced;                         271   *condition = NotForced;
249   return DBL_MAX;                                 272   return DBL_MAX;
250 }                                                 273 }
251                                                   274 
252 //------------------------------------            275 //------------------------------------
253 //             PostStepDoIt()                     276 //             PostStepDoIt()
254 //------------------------------------            277 //------------------------------------
255 G4VParticleChange* G4FastSimulationManagerProc << 278 G4VParticleChange*
                                                   >> 279 G4FastSimulationManagerProcess::
                                                   >> 280 PostStepDoIt(const G4Track&,
                                                   >> 281        const G4Step&)
256 {                                                 282 {
257   G4VParticleChange* finalState = fFastSimulat    283   G4VParticleChange* finalState = fFastSimulationManager->InvokePostStepDoIt();
258                                                << 284   
259   // If the particle is still alive, suspend i    285   // If the particle is still alive, suspend it to force physics re-initialisation:
260   if (finalState->GetTrackStatus() != fStopAnd    286   if (finalState->GetTrackStatus() != fStopAndKill) finalState->ProposeTrackStatus(fSuspend);
261                                                << 287   
262   return finalState;                              288   return finalState;
263 }                                                 289 }
264                                                   290 
265 G4double G4FastSimulationManagerProcess::Along << 291 
266   const G4Track& track, G4double previousStepS << 292 G4double 
267   G4double& proposedSafety, G4GPILSelection* s << 293 G4FastSimulationManagerProcess::
                                                   >> 294 AlongStepGetPhysicalInteractionLength(const G4Track&                track,
                                                   >> 295               G4double           previousStepSize,
                                                   >> 296               G4double         currentMinimumStep, 
                                                   >> 297               G4double&            proposedSafety, 
                                                   >> 298               G4GPILSelection*          selection)
268 {                                                 299 {
269   *selection = NotCandidateForSelection;       << 300   
                                                   >> 301   *selection            = NotCandidateForSelection;
270   G4double returnedStep = DBL_MAX;                302   G4double returnedStep = DBL_MAX;
271                                                   303 
272   // -----------------------------------------    304   // ---------------------------------------------------
273   // -- Below code valid for ghost geometry, o    305   // -- Below code valid for ghost geometry, otherwise
274   // -- useless for fast simulation attached t    306   // -- useless for fast simulation attached to mass
275   // -- geometry. Warn user in case along used << 307   // -- geometry. Warn user in case along used for 
276   // -- mass geometry ?                           308   // -- mass geometry ?
277   // -----------------------------------------    309   // --------------------------------------------------
278   if (fIsGhostGeometry) {                      << 310   if ( fIsGhostGeometry )
279     static G4ThreadLocal G4FieldTrack* endTrac << 311     {
280     if (endTrack_G4MT_TLS_ == nullptr) endTrac << 312       static G4FieldTrack endTrack('0');
281     G4FieldTrack& endTrack = *endTrack_G4MT_TL << 313       static ELimited eLimited;
282                                                << 314       
283     static G4ThreadLocal ELimited* eLimited_G4 << 315       if (previousStepSize > 0.) fGhostSafety -= previousStepSize;
284     if (eLimited_G4MT_TLS_ == nullptr) eLimite << 316       if (fGhostSafety < 0.)     fGhostSafety = 0.0;
285     ELimited& eLimited = *eLimited_G4MT_TLS_;  << 317       
286                                                << 318       // ------------------------------------------
287     if (previousStepSize > 0.) fGhostSafety -= << 319       // Determination of the proposed step length:
288     if (fGhostSafety < 0.) fGhostSafety = 0.0; << 320       // ------------------------------------------
289                                                << 321       if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
290     // --------------------------------------- << 322   {
291     // Determination of the proposed step leng << 323     // -- No chance to limit the step, as proposed move inside safety
292     // --------------------------------------- << 324     returnedStep   = currentMinimumStep;
293     if (currentMinimumStep <= fGhostSafety &&  << 325     proposedSafety = fGhostSafety - currentMinimumStep;
294       // -- No chance to limit the step, as pr << 326   }
295       returnedStep = currentMinimumStep;       << 327       else
296       proposedSafety = fGhostSafety - currentM << 328   {
297     }                                          << 329     // -- Proposed move exceeds safety, need to state
298     else {                                     << 330     G4FieldTrackUpdator::Update(&fFieldTrack, &track);
299       // -- Proposed move exceeds safety, need << 331     returnedStep = fPathFinder->ComputeStep(fFieldTrack,
300       G4FieldTrackUpdator::Update(&fFieldTrack << 332               currentMinimumStep,
301       returnedStep = fPathFinder->ComputeStep( << 333               fGhostNavigatorIndex,
302                                                << 334               track.GetCurrentStepNumber(),
303                                                << 335               fGhostSafety,
304                                                << 336               eLimited,
305       if (eLimited == kDoNot)                  << 337               endTrack,
306         fGhostSafety =                         << 338               track.GetVolume());
307           fGhostNavigator->ComputeSafety(endTr << 339     
308       proposedSafety = fGhostSafety;           << 340     if(eLimited == kDoNot) fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition()); // -- step no limited by ghost
309       if (eLimited == kUnique || eLimited == k << 341     proposedSafety = fGhostSafety;
310         *selection = CandidateForSelection;    << 342     if      (eLimited == kUnique || eLimited == kSharedOther) *selection     = CandidateForSelection;
311       else if (eLimited == kSharedTransport)   << 343     else if (eLimited == kSharedTransport)                     returnedStep *= (1.0 + 1.0e-9);   // -- Expand to disable its selection in Step Manager comparison
312         returnedStep *=                        << 344   }
313           (1.0 + 1.0e-9);  // -- Expand to dis << 
314     }                                             345     }
315   }                                            << 346   
316                                                   347 
317   // -----------------------------------------    348   // ----------------------------------------------
318   // Returns the fGhostSafety as the proposedS    349   // Returns the fGhostSafety as the proposedSafety
319   // The SteppingManager will take care of kee    350   // The SteppingManager will take care of keeping
320   // the smallest one.                            351   // the smallest one.
321   // -----------------------------------------    352   // ----------------------------------------------
322   return returnedStep;                            353   return returnedStep;
323 }                                                 354 }
324                                                   355 
325 G4VParticleChange* G4FastSimulationManagerProc << 356 G4VParticleChange*
326                                                << 357 G4FastSimulationManagerProcess::
                                                   >> 358 AlongStepDoIt(const G4Track& track,
                                                   >> 359         const G4Step&)
327 {                                                 360 {
328   fDummyParticleChange.Initialize(track);         361   fDummyParticleChange.Initialize(track);
329   return &fDummyParticleChange;                   362   return &fDummyParticleChange;
330 }                                                 363 }
331                                                   364 
                                                   >> 365 
332 //--------------------------------------------    366 //--------------------------------------------
333 //         At Rest parameterisation:              367 //         At Rest parameterisation:
334 //--------------------------------------------    368 //--------------------------------------------
335 //   AtRestGetPhysiscalInteractionLength:         369 //   AtRestGetPhysiscalInteractionLength:
336 //--------------------------------------------    370 //--------------------------------------------
337 G4double                                       << 371 G4double 
338 G4FastSimulationManagerProcess::AtRestGetPhysi << 372 G4FastSimulationManagerProcess::
339                                                << 373 AtRestGetPhysicalInteractionLength(const G4Track&        track, 
340 {                                              << 374            G4ForceCondition* condition)
341   const G4VPhysicalVolume* currentVolume(nullp << 375 {
342   if (fIsGhostGeometry)                        << 376   const G4VPhysicalVolume* currentVolume(0);
343     currentVolume = fPathFinder->GetLocatedVol << 377   if ( fIsGhostGeometry )  currentVolume = fPathFinder->GetLocatedVolume(fGhostNavigatorIndex);
344   else                                         << 378   else                     currentVolume = track.GetVolume();
345     currentVolume = track.GetVolume();         << 
346   fFastSimulationManager = currentVolume->GetL    379   fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
347   if (fFastSimulationManager != nullptr) {     << 380   if( fFastSimulationManager )
348     // Ask for trigger:                        << 381     {
349     fFastSimulationTrigger =                   << 382       // Ask for trigger:
350       fFastSimulationManager->AtRestGetFastSim << 383       fFastSimulationTrigger = fFastSimulationManager->AtRestGetFastSimulationManagerTrigger(track, fGhostNavigator);
351     if (fFastSimulationTrigger) {              << 384       if( fFastSimulationTrigger )
352       // Dirty trick to take control over step << 385   {
353       *condition = NotForced;                  << 386     // Dirty trick to take control over stepping. Does anyone will ever use that ?
354       return -1.0;                             << 387     *condition = NotForced;
                                                   >> 388     return -1.0;
                                                   >> 389   }
355     }                                             390     }
356   }                                            << 391   
357                                                << 
358   // -- no fast simulation occuring there:        392   // -- no fast simulation occuring there:
359   *condition = NotForced;                         393   *condition = NotForced;
360   return DBL_MAX;                                 394   return DBL_MAX;
361 }                                                 395 }
362                                                   396 
363 //--------------------------------------------    397 //-----------------------------------------------
364 //                  AtRestDoIt:                   398 //                  AtRestDoIt:
365 //--------------------------------------------    399 //-----------------------------------------------
366 G4VParticleChange* G4FastSimulationManagerProc    400 G4VParticleChange* G4FastSimulationManagerProcess::AtRestDoIt(const G4Track&, const G4Step&)
367 {                                                 401 {
368   return fFastSimulationManager->InvokeAtRestD    402   return fFastSimulationManager->InvokeAtRestDoIt();
369 }                                                 403 }
                                                   >> 404 
                                                   >> 405 
                                                   >> 406 void G4FastSimulationManagerProcess::Verbose() const
                                                   >> 407 {
                                                   >> 408   /*  G4cout << "     >>>>> Trigger Status : ";
                                                   >> 409   switch(fFastSimulationManager->GetTriggerStatus())
                                                   >> 410     {
                                                   >> 411     case NoModel:
                                                   >> 412       G4cout << "NoModel" << G4endl;
                                                   >> 413       break;
                                                   >> 414     case OnBoundaryButLeaving:
                                                   >> 415       G4cout << "OnBoundaryButLeaving" << G4endl;
                                                   >> 416       break;
                                                   >> 417     case OneModelTrigger:
                                                   >> 418       G4cout << "OneModelTrigger" << G4endl;
                                                   >> 419       break;
                                                   >> 420     case NoModelTrigger:
                                                   >> 421       G4cout << "NoModelTrigger" << G4endl;
                                                   >> 422       break;
                                                   >> 423     case Undefined:
                                                   >> 424       G4cout << "Undefined" << G4endl;
                                                   >> 425       break;
                                                   >> 426     default:
                                                   >> 427       G4cout << " Bizarre..." << G4endl;
                                                   >> 428       break;
                                                   >> 429     }*/
                                                   >> 430 }
                                                   >> 431 
                                                   >> 432 
370                                                   433