1154 const G4double toleratedRelativeError= 1.0e-10;
1163 ->GetEquationOfMotion();
1166 initialState.GetMomentum().mag2(),
1167 initialState.GetRestMass() );
1169 #ifdef G4DEBUG_PATHFINDER
1171 if( fVerboseLevel > 2 )
1173 G4cout <<
" G4PathFinder::DoNextCurvedStep ****** " <<
G4endl;
1174 G4cout <<
" Initial value of field track is " << fieldTrack
1175 <<
" and proposed step= " << proposedStepLength <<
G4endl;
1179 fPreStepCenterRenewed=
true;
1181 if( fNoActiveNavigators > 1 )
1186 for( numNav=0; numNav < fNoActiveNavigators; ++numNav )
1189 fPreSafetyValues[numNav]= safety;
1190 fCurrentPreStepSafety[numNav]= safety;
1191 minSafety =
std::min( safety, minSafety );
1196 fPreSafetyLocation= startPoint;
1197 fPreSafetyMinValue= minSafety;
1198 fPreStepLocation= startPoint;
1199 fMinSafety_PreStepPt= minSafety;
1204 minStep= fpFieldPropagator->
ComputeStep( fieldTrack,
1207 pCurrentPhysicalVolume );
1211 fEndState= fieldTrack;
1213 fTrueMinStep =
std::min( minStep, proposedStepLength );
1215 if( fNoActiveNavigators== 1 )
1220 fPreSafetyValues[0]= newSafety;
1221 fPreSafetyLocation= startPoint;
1222 fPreSafetyMinValue= newSafety;
1226 fCurrentPreStepSafety[0]= newSafety;
1227 fPreStepLocation= startPoint;
1228 fMinSafety_PreStepPt= newSafety;
1231 #ifdef G4DEBUG_PATHFINDER
1232 if( fVerboseLevel > 2 )
1234 G4cout <<
"G4PathFinder::DoNextCurvedStep : " <<
G4endl
1235 <<
" initialState = " << initialState <<
G4endl
1236 <<
" and endState = " << fEndState <<
G4endl;
1237 G4cout <<
"G4PathFinder::DoNextCurvedStep : "
1238 <<
" minStep = " << minStep
1239 <<
" proposedStepLength " << proposedStepLength
1240 <<
" safety = " << newSafety <<
G4endl;
1244 if( minStep < proposedStepLength )
1250 for( numNav=0; numNav < fNoActiveNavigators; ++numNav )
1252 G4double finalStep, lastPreSafety=0.0, minStepLast;
1257 minStepLast, didLimit );
1262 currentStepSize = fTrueMinStep;
1266 diffStep = (finalStep-minStepLast);
1267 if ( std::abs(diffStep) <= toleratedRelativeError * finalStep )
1271 currentStepSize += diffStep;
1273 fCurrentStepSize[numNav] = currentStepSize;
1286 fLimitedStep[numNav] = didLimit;
1287 fLimitTruth[numNav] = limited = (didLimit !=
kDoNot );
1288 if( limited ) { noLimited++; }
1290 #ifdef G4DEBUG_PATHFINDER
1291 G4bool StepError= (currentStepSize < 0)
1292 || ( (minStepLast !=
kInfinity) && (diffStep < 0) ) ;
1293 if( StepError || (fVerboseLevel > 2) )
1297 G4cout <<
" G4PathFinder::ComputeStep. Geometry " << numNav
1298 <<
" step= " << fCurrentStepSize[numNav]
1299 <<
" from final-step= " << finalStep
1300 <<
" fTrueMinStep= " << fTrueMinStep
1301 <<
" minStepLast= " << minStepLast
1302 <<
" limited = " << (fLimitTruth[numNav] ?
"YES" :
" NO")
1304 G4cout <<
" status = " << limitedString <<
" #= " << didLimit
1309 std::ostringstream message;
1310 message <<
"Incorrect calculation of step size for one navigator"
1312 <<
" currentStepSize = " << currentStepSize
1313 <<
", diffStep= " << diffStep << G4endl
1314 <<
"ERROR in computing step size for this navigator.";
1322 fNoGeometriesLimiting= noLimited;
1324 else if ( (minStep == proposedStepLength)
1326 || ( std::abs(minStep-proposedStepLength)
1327 < toleratedRelativeError * proposedStepLength ) )
1336 currentStepSize= minStep;
1337 for( numNav=0; numNav < fNoActiveNavigators; ++numNav )
1339 fCurrentStepSize[numNav] = minStep;
1341 fLimitedStep[numNav] =
kDoNot;
1342 fLimitTruth[numNav] =
false;
1344 fNoGeometriesLimiting= 0;
1348 std::ostringstream message;
1349 message <<
"Incorrect calculation of step size for one navigator." <<
G4endl
1350 <<
" currentStepSize = " << minStep <<
" is larger than "
1351 <<
" proposed StepSize = " << proposedStepLength <<
".";
1356 #ifdef G4DEBUG_PATHFINDER
1357 if( fVerboseLevel > 2 )
1359 G4cout <<
" Exiting G4PathFinder::DoNextCurvedStep " <<
G4endl;
G4String & LimitedString(ELimited lim)
static const G4double kInfinity
virtual void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double MassXc2)=0
const G4MagIntegratorStepper * GetStepper() const
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double ComputeStep(G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4double &pNewSafety, G4VPhysicalVolume *pPhysVol=0)
G4ChordFinder * GetChordFinder()
G4double ObtainFinalStep(G4int navigatorId, G4double &pNewSafety, G4double &minStepLast, ELimited &limitedStep)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
G4MagInt_Driver * GetIntegrationDriver()