242{
243
244
245
246
247
248
251
252
254 if (!endTrack_MT) endTrack_MT = new G4FieldTrack ('0');
255 G4FieldTrack& endTrack = *endTrack_MT;
256
258 if (!eLimited_MT) eLimited_MT =
new ELimited;
260
261
262
263
264 if ( previousStepSize > 0.0 )
265 {
266 for ( auto& parallelWorldSafety : fParallelWorldSafeties )
267 {
268 parallelWorldSafety -= previousStepSize;
269 if ( parallelWorldSafety < 0. ) { parallelWorldSafety = 0.0; }
270 fParallelWorldSafety = parallelWorldSafety < fParallelWorldSafety
271 ? parallelWorldSafety : fParallelWorldSafety;
272 }
273 }
274
275
276
277
278 if ( ( currentMinimumStep <= fParallelWorldSafety )
279 && ( currentMinimumStep > 0. ) )
280 {
281
282
283 returnedStep = currentMinimumStep;
284 proposedSafety = fParallelWorldSafety - currentMinimumStep;
285 }
286 else
287 {
288
289 G4double smallestReturnedStep = -1.0;
291 for ( std::size_t i = 0 ; i < fParallelWorldNavigatorIndeces.size() ; ++i )
292 {
293
294 if ( currentMinimumStep >= fParallelWorldSafeties[i] )
295 {
297 G4double tmpReturnedStep = fPathFinder->ComputeStep(fFieldTrack,
298 currentMinimumStep,
299 fParallelWorldNavigatorIndeces[i],
301 fParallelWorldSafeties[i],
303
304 if ( ( smallestReturnedStep < 0.0 ) || ( tmpReturnedStep <= smallestReturnedStep ) )
305 {
306 smallestReturnedStep = tmpReturnedStep;
307 eLimitedForSmallestStep = eLimited;
308 }
309
311 {
312
313 fParallelWorldSafeties[i] = fParallelWorldNavigators[i]->ComputeSafety(endTrack.
GetPosition());
314 fParallelWorldIsLimiting[i] = false;
315 }
316 else
317 {
318 fParallelWorldIsLimiting[i] = true;
319 }
320 }
321
322
323 fParallelWorldSafety = fParallelWorldSafeties[i] < fParallelWorldSafety
324 ? fParallelWorldSafeties[i] : fParallelWorldSafety;
325 }
326
327
328
329 if ( eLimitedForSmallestStep ==
kDoNot )
330 {
331 returnedStep = currentMinimumStep;
332 }
333
334 if ( eLimitedForSmallestStep ==
kUnique ||
336 {
338 returnedStep = smallestReturnedStep;
339 }
341 {
342
343 returnedStep = smallestReturnedStep* (1.0 + 1.0e-9);
344 }
345
346
347 proposedSafety = fParallelWorldSafety ;
348 }
349
350
351 return returnedStep;
352}
@ NotCandidateForSelection
static void Update(G4FieldTrack *, const G4Track *)
G4ThreeVector GetPosition() const
G4VPhysicalVolume * GetVolume() const
G4int GetCurrentStepNumber() const