258{
259
260
261
262
263
266
267
269 if (!endTrack_G4MT_TLS_) endTrack_G4MT_TLS_ =
new G4FieldTrack (
'0') ;
271
273 if (!eLimited_G4MT_TLS_) eLimited_G4MT_TLS_ =
new ELimited ;
274 ELimited &eLimited = *eLimited_G4MT_TLS_;
275
276
277
278
279
280 if ( previousStepSize > 0.0 )
281 {
282 for ( auto& parallelWorldSafety : fParallelWorldSafeties )
283 {
284 parallelWorldSafety -= previousStepSize;
285 if ( parallelWorldSafety < 0. ) parallelWorldSafety = 0.0;
286 fParallelWorldSafety = parallelWorldSafety < fParallelWorldSafety ? parallelWorldSafety : fParallelWorldSafety ;
287 }
288 }
289
290
291
292
293
294 if ( ( currentMinimumStep <= fParallelWorldSafety ) && ( currentMinimumStep > 0. ) )
295 {
296
297
298 returnedStep = currentMinimumStep;
299 proposedSafety = fParallelWorldSafety - currentMinimumStep;
300 }
301 else
302 {
303
304 G4double smallestReturnedStep = -1.0;
306 for ( size_t i = 0 ; i < fParallelWorldNavigatorIndeces.size() ; i++ )
307 {
308
309 if ( currentMinimumStep >= fParallelWorldSafeties[i] )
310 {
313 currentMinimumStep,
314 fParallelWorldNavigatorIndeces[i],
316 fParallelWorldSafeties[i],
317 eLimited,
318 endTrack,
320
321 if ( ( smallestReturnedStep < 0.0 ) || ( tmpReturnedStep <= smallestReturnedStep ) )
322 {
323 smallestReturnedStep = tmpReturnedStep;
324 eLimitedForSmallestStep = eLimited;
325 }
326
328 {
329
330 fParallelWorldSafeties[i] = fParallelWorldNavigators[i]->ComputeSafety(endTrack.
GetPosition());
331 fParallelWorldIsLimiting[i] = false;
332 }
333 else
334 {
335 fParallelWorldIsLimiting[i] = true;
336 }
337 }
338
339
340 fParallelWorldSafety = fParallelWorldSafeties[i] < fParallelWorldSafety ? fParallelWorldSafeties[i] : fParallelWorldSafety ;
341 }
342
343
344
345 if ( eLimitedForSmallestStep ==
kDoNot )
346 {
347 returnedStep = currentMinimumStep;
348 }
349
350 if ( eLimitedForSmallestStep ==
kUnique ||
352 {
354 returnedStep = smallestReturnedStep;
355 }
357 {
358 returnedStep = smallestReturnedStep* (1.0 + 1.0e-9);
359 }
360
361
362 proposedSafety = fParallelWorldSafety ;
363 }
364
365
366 return returnedStep;
367}
@ NotCandidateForSelection
static void Update(G4FieldTrack *, const G4Track *)
G4ThreeVector GetPosition() const
G4double ComputeStep(const G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4int navigatorId, G4int stepNo, G4double &pNewSafety, ELimited &limitedStep, G4FieldTrack &EndState, G4VPhysicalVolume *currentVolume)
G4VPhysicalVolume * GetVolume() const
G4int GetCurrentStepNumber() const