257{
259 G4double geometryStepLength(-1.0), newSafety(-1.0);
260
261 State(fParticleIsLooping) = false;
262 State(fEndGlobalTimeComputed) = false;
263 State(fGeometryLimitedStep) = false;
264
265
266
267
268
269
270
271
272
273
275
276
277
279
280 G4ThreeVector startMomentumDir = pParticle->GetMomentumDirection();
282
283
284
285
286
287
288
290 G4double MagSqShift = OriginShift.mag2();
292 {
293 currentSafety = 0.0;
294 }
295 else
296 {
298 }
299
300
301
302 G4double particleCharge = pParticle->GetCharge();
303
304
305
306
307
308
309
311 G4bool fieldExertsForce =
false;
312 if ((particleCharge != 0.0))
313 {
315 if (fieldMgr != 0)
316 {
317
319
320
321
322
323
325 }
326 }
327
328
329
330
331
332
333 if (!fieldExertsForce)
334 {
337 {
338
339
340 geometryStepLength = currentMinimumStep;
341 State(fGeometryLimitedStep) =
false;
342 }
343 else
344 {
345
346
347
349 startMomentumDir,
350 currentMinimumStep,
351 newSafety);
352
353
354
355
356
357
358
361
365
367 State(fTransportEndPosition));
369
370
371
372 currentSafety = newSafety;
373
374 State(fGeometryLimitedStep) = (linearStepLength <= currentMinimumStep);
375 if (
State(fGeometryLimitedStep))
376 {
377
378 geometryStepLength = linearStepLength;
379 }
380 else
381 {
382
383 geometryStepLength = currentMinimumStep;
384 }
385 }
386 State(fEndPointDistance) = geometryStepLength;
387
388
389
390 State(fTransportEndPosition) = startPosition
391 + geometryStepLength * startMomentumDir;
392
393
394
395 State(fTransportEndMomentumDir) = startMomentumDir;
398 State(fParticleIsLooping) =
false;
399 State(fMomentumChanged) =
false;
400 State(fEndGlobalTimeComputed) =
true;
401 State(theInteractionTimeLeft) =
State(fEndPointDistance)
403 State(fCandidateEndGlobalTime) =
State(theInteractionTimeLeft)
405
406
407
408
409
410
411
412
413
414
415 }
416 else
417 {
418
420 exceptionDescription
421 << "ITTransportation does not support external fields.";
422 exceptionDescription
423 << " If you are dealing with a tradiational MC simulation, ";
424 exceptionDescription << "please use G4Transportation.";
425
426 G4Exception(
"G4ITTransportation::AlongStepGetPhysicalInteractionLength",
428
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 if (currentMinimumStep == 0.0)
583 {
584 if (currentSafety == 0.0)
585 {
586 State(fGeometryLimitedStep) =
true;
587
588
589
590 }
591 }
592
593
594
595
596 if (currentSafety <
State(fEndPointDistance))
597 {
598
599
600
601 if (particleCharge != 0.0)
602 {
603
605 State(fTransportEndPosition));
606 currentSafety = endSafety;
609
610
611
612
613
617
619 State(fTransportEndPosition));
621
622
623
624
625 currentSafety +=
State(fEndPointDistance);
626
627#ifdef G4DEBUG_TRANSPORT
629 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl;
630 G4cout <<
" Called Navigator->ComputeSafety at "
631 <<
State(fTransportEndPosition)
632 <<
" and it returned safety= " << endSafety <<
G4endl;
633 G4cout <<
" Adding endpoint distance " <<
State(fEndPointDistance)
634 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl;
635#endif
636 }
637 }
638
639
640
641
642
643
644 return geometryStepLength;
645}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define fPreviousSftOrigin
G4IT * GetIT(const G4Track *track)
virtual void ConfigureForTrack(const G4Track *)
const G4Field * GetDetectorField() const
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
G4TrackingInformation * GetTrackingInfo()
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
virtual void LoadTrackState(G4TrackStateManager &manager)
virtual void ResetTrackState()
G4double GetVelocity() const
G4VPhysicalVolume * GetVolume() const
G4double GetGlobalTime() const
G4double GetKineticEnergy() const
const G4ThreeVector & GetPolarization() const