64 fTransportEndPosition(0.0, 0.0, 0.0),
65 fTransportEndMomentumDir(0.0, 0.0, 0.0),
66 fTransportEndKineticEnergy(0.0),
67 fTransportEndSpin(0.0, 0.0, 0.0),
68 fMomentumChanged(
false),
69 fEndGlobalTimeComputed(
false),
70 fCandidateEndGlobalTime(0.0),
71 fParticleIsLooping(
false ),
74 fPreviousMassSafety( 0.0 ),
75 fPreviousFullSafety( 0.0 ),
76 fMassGeometryLimitedStep(
false ),
77 fAnyGeometryLimitedStep(
false ),
78 fEndpointDistance( -1.0 ),
79 fSumEnergyKilled( 0.0 ), fMaxEnergyKilled( 0.0 ),
80 fFirstStepInMassVolume(
true ),
81 fFirstStepInAnyVolume(
true )
96 G4cout <<
" G4CoupledTransportation constructor: ----- " <<
G4endl;
98 G4cout <<
" Navigator Id obtained in G4CoupledTransportation constructor "
100 G4cout <<
" Reports First/Last in "
102 <<
" geometry " << G4endl;
141 outStr <<
" G4CoupledTransportation: Statistics for looping particles "
143 outStr <<
" Sum of energy of loopers killed: "
145 outStr <<
" Max energy of loopers killed: "
150 outStr <<
" Sum of energy of loopers 'saved': "
152 outStr <<
" Sum of energy of unstable loopers 'saved': "
195 #ifdef G4DEBUG_TRANSPORT
196 G4cout <<
" CoupledTransport::AlongStep GPIL: "
215 #ifdef G4DEBUG_TRANSPORT
218 G4cout <<
"G4CoupledTransportation::AlongStepGPIL> called in volume "
230 startMassSafety = 0.0;
231 startFullSafety= 0.0;
237 G4double mag_shift= std::sqrt(MagSqShift);
266 const G4Field* ptrField=
nullptr;
269 G4bool eligibleEM = (particleCharge != 0.0)
273 if( (fieldMgr!=
nullptr) && (eligibleEM||eligibleGrav) )
285 if( ptrField !=
nullptr)
287 fieldExertsForce = eligibleEM
293 if( fieldExertsForce )
300 if( equationOfMotion )
302 equationOfMotion->SetChargeMomentumMass( chargeState,
306 #ifdef G4DEBUG_TRANSPORT
309 G4cerr <<
" ERROR in G4CoupledTransportation> "
310 <<
"Cannot find valid Equation of motion: " <<
G4endl;
311 <<
" Unable to pass Charge, Momentum and Mass " <<
G4endl;
334 if( currentMinimumStep > 0 )
359 #ifdef G4DEBUG_TRANSPORT
363 message <<
" ERROR in determining geometries limiting the step" <<
G4endl;
366 message <<
"Incompatible conditions - by which geometries was it limited ?";
367 G4Exception(
"G4CoupledTransportation::AlongStepGetPhysicalInteractionLength()",
372 geometryStepLength =
std::min( lengthAlongCurve, currentMinimumStep);
380 fPreviousSftOrigin = startPosition ;
385 #ifdef G4DEBUG_TRANSPORT
388 G4cout <<
"G4Transport:CompStep> "
389 <<
" called the pathfinder for a new step at " << startPosition
390 <<
" and obtained step = " << lengthAlongCurve <<
G4endl;
391 G4cout <<
" New safety (preStep) = " << newMassSafety
392 <<
" versus precalculated = " << startMassSafety <<
G4endl;
397 startMassSafety = newMassSafety ;
398 startFullSafety = newFullSafety ;
406 geometryStepLength = lengthAlongCurve= 0.0 ;
415 endTrackState= aFieldTrack;
419 if( startMassSafety == 0.0 )
428 if( !fieldExertsForce )
438 #ifdef G4DEBUG_TRANSPORT
441 G4cout <<
" G4CT::CS End Position = "
443 G4cout <<
" G4CT::CS End Direction = "
472 G4double absEdiff = std::fabs(startEnergy- endEnergy);
496 safetyProposal= startFullSafety;
502 && ( particleCharge != 0.0 ) )
530 #ifdef G4DEBUG_TRANSPORT
532 G4cout <<
"***CoupledTransportation::AlongStepGPIL ** " <<
G4endl ;
534 <<
" give safety values: Mass= " << endMassSafety
535 <<
" All= " << endFullSafety <<
G4endl ;
536 G4cout <<
" Adding endpoint distance " << fEndpointDistance
537 <<
" to obtain pseudo-safety= " << safetyProposal <<
G4endl ;
543 G4cout <<
"***CoupledTransportation::AlongStepGPIL ** " <<
G4endl ;
544 G4cout <<
" Quick Safety estimate at endpoint "
546 <<
" gives safety endpoint value = "
548 <<
" using start-point value " << startFullSafety
554 proposedSafetyForStart= safetyProposal;
557 return geometryStepLength ;
567 const char *methodName=
"AlongStepDoIt";
598 if( finalVelocity > 0.0 ) { finalInverseVel= 1.0 / finalVelocity; }
600 if( initialVelocity > 0.0 ) { initialInverseVel= 1.0 / initialVelocity; }
603 if (finalVelocity > 0.0)
607 * (initialInverseVel + finalInverseVel);
608 deltaTime = stepLength * meanInverseVelocity ;
612 deltaTime = stepLength * initialInverseVel ;
646 if( candidateForEnd && stable )
648 const G4int electronPDG= 11;
681 noCallsCT_ASDI, methodName );
699 G4cout <<
" ** G4CoupledTransportation::AlongStepDoIt():"
700 <<
" Particle is looping but is saved ..." <<
G4endl
705 <<
" Total no of calls to this method (all tracks) = "
706 << noCallsCT_ASDI <<
G4endl;
751 <<
"**************************************************************"
753 G4cerr <<
"Endpoint has moved between value expected from TransportEndPosition "
754 <<
" and value from Track in PostStepDoIt. " << G4endl
755 <<
"Change of " << Quantity <<
" is " << moveVec.
mag() /
mm
757 <<
" and its vector is " << (1.0/
mm) * moveVec <<
" mm " << G4endl
758 <<
"Endpoint of ComputeStep was " << OldVector
759 <<
" and current position to locate is " << NewVector << G4endl;
787 #ifdef G4DEBUG_TRANSPORT
792 "End of Step Position" );
793 G4cerr <<
" Problem in G4CoupledTransportation::PostStepDoIt " <<
G4endl;
801 G4cout <<
" Calling PathFinder::Locate() from "
802 <<
" G4CoupledTransportation::PostStepDoIt " <<
G4endl;
822 #ifdef G4DEBUG_TRANSPORT
825 G4cout <<
"G4CoupledTransportation::PostStepDoIt --- fNavigatorId = "
831 G4cout <<
"CHECK !!!!!!!!!!! fCurrentTouchableHandle->GetVolume() = "
833 if( vol ) {
G4cout <<
"Name=" << vol->GetName(); }
850 #ifdef G4DEBUG_TRANSPORT
853 G4cout <<
"G4CoupledTransportation::PostStepDoIt -- "
855 <<
" must be false " <<
G4endl;
874 #ifdef G4DEBUG_NAVIGATION
875 G4cout <<
" CoupledTransport::AlongStep GPIL: "
909 if( pNewMaterialCutsCouple!=0
910 && pNewMaterialCutsCouple->
GetMaterial()!=pNewMaterial )
990 #ifdef G4DEBUG_TRANSPORT
1020 moduloFactor= 10, no_large_ediff= 0;
1022 if( std::fabs(startEnergy- endEnergy) >
perThousand * endEnergy )
1025 if( (no_large_ediff% warnModulo) == 0 )
1029 message <<
"Energy change in Step is above 1^-3 relative value. "
1031 <<
" Relative change in 'tracking' step = "
1032 << std::setw(15) << (endEnergy-startEnergy)/startEnergy
1034 <<
" Starting E= " << std::setw(12) << startEnergy /
MeV
1036 <<
" Ending E= " << std::setw(12) << endEnergy /
MeV
1038 <<
"Energy has been corrected -- however, review"
1039 <<
" field propagation parameters for accuracy." <<
G4endl;
1041 || (no_large_ediff == warnModulo * moduloFactor) )
1043 message <<
"These include EpsilonStepMax(/Min) in G4FieldManager,"
1045 <<
"which determine fractional error per step for integrated quantities."
1047 <<
"Note also the influence of the permitted number of integration steps."
1050 message <<
"Bad 'endpoint'. Energy change detected and corrected."
1052 <<
"Has occurred already " << no_large_ediff <<
" times.";
1053 G4Exception(
"G4CoupledTransportation::AlongStepGetPIL()",
1055 if( no_large_ediff == warnModulo * moduloFactor )
1057 warnModulo *= moduloFactor;
1110 G4int maxTrials = 10;
1123 G4int maxTrials = 30;
1134 const char*
message=
"Logger object missing from G4CoupledTransportation";