258{
260 G4double geometryStepLength(-1.0), newSafety(-1.0);
261
262 State(fParticleIsLooping) =
false;
263 State(fEndGlobalTimeComputed) =
false;
264 State(fGeometryLimitedStep) =
false;
265
266
267
268
269
270
271
272
273
274
276
277
278
280
283
284
285
286
287
288
289
293 {
294 currentSafety = 0.0;
295 }
296 else
297 {
299 }
300
301
302
304
305
306
307
308
309
310
312 G4bool fieldExertsForce =
false;
313 if ((particleCharge != 0.0))
314 {
316 if (fieldMgr != nullptr)
317 {
318
320
321
322
323
324
326 }
327 }
328
329
330
331
332
333
334 if (!fieldExertsForce)
335 {
338 {
339
340
341 geometryStepLength = currentMinimumStep;
342 State(fGeometryLimitedStep) =
false;
343 }
344 else
345 {
346
347
348
350 startMomentumDir,
351 currentMinimumStep,
352 newSafety);
353
354
355
356
357
358
359
362
366
368 State(fTransportEndPosition));
370
371
372
373 currentSafety = newSafety;
374
375 State(fGeometryLimitedStep) = (linearStepLength <= currentMinimumStep);
376 if (
State(fGeometryLimitedStep))
377 {
378
379 geometryStepLength = linearStepLength;
380 }
381 else
382 {
383
384 geometryStepLength = currentMinimumStep;
385 }
386 }
387 State(fEndPointDistance) = geometryStepLength;
388
389
390
391 State(fTransportEndPosition) = startPosition
392 + geometryStepLength * startMomentumDir;
393
394
395
396 State(fTransportEndMomentumDir) = startMomentumDir;
399 State(fParticleIsLooping) =
false;
400 State(fMomentumChanged) =
false;
401 State(fEndGlobalTimeComputed) =
true;
402 State(theInteractionTimeLeft) =
State(fEndPointDistance)
404 State(fCandidateEndGlobalTime) =
State(theInteractionTimeLeft)
406
407
408
409
410
411
412
413
414
415
416 }
417 else
418 {
419
421 exceptionDescription
422 << "ITTransportation does not support external fields.";
423 exceptionDescription
424 << " If you are dealing with a tradiational MC simulation, ";
425 exceptionDescription << "please use G4Transportation.";
426
427 G4Exception(
"G4ITTransportation::AlongStepGetPhysicalInteractionLength",
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578 }
579
580
581
582
583 if (currentMinimumStep == 0.0)
584 {
585 if (currentSafety == 0.0)
586 {
587 State(fGeometryLimitedStep) =
true;
588
589
590
591 }
592 }
593
594
595
596
597 if (currentSafety <
State(fEndPointDistance))
598 {
599
600
601
602 if (particleCharge != 0.0)
603 {
604
606 State(fTransportEndPosition));
607 currentSafety = endSafety;
610
611
612
613
614
618
620 State(fTransportEndPosition));
622
623
624
625
626 currentSafety +=
State(fEndPointDistance);
627
628#ifdef G4DEBUG_TRANSPORT
630 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl;
631 G4cout <<
" Called Navigator->ComputeSafety at "
632 <<
State(fTransportEndPosition)
633 <<
" and it returned safety= " << endSafety <<
G4endl;
634 G4cout <<
" Adding endpoint distance " <<
State(fEndPointDistance)
635 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl;
636#endif
637 }
638 }
639
640
641
642
643
644
645 return geometryStepLength;
646}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define fPreviousSftOrigin
G4IT * GetIT(const G4Track *track)
const G4ThreeVector & GetMomentumDirection() const
G4double GetCharge() const
virtual void ConfigureForTrack(const G4Track *)
const G4Field * GetDetectorField() const
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
G4TrackingInformation * GetTrackingInfo()
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
void LoadTrackState(G4TrackStateManager &manager) override
void ResetTrackState() override
G4double GetVelocity() const
G4VPhysicalVolume * GetVolume() const
const G4ThreeVector & GetPosition() const
const G4DynamicParticle * GetDynamicParticle() const
const G4ThreeVector & GetPolarization() const