1144{
1145 const G4double toleratedRelativeError= 1.0e-10;
1146 G4double minStep= kInfinity, newSafety=0.0;
1150
1151#ifdef G4DEBUG_PATHFINDER
1153 if( fVerboseLevel > 2 )
1154 {
1155 G4cout <<
" G4ITPathFinder::DoNextCurvedStep ****** " <<
G4endl;
1156 G4cout <<
" Initial value of field track is " << fieldTrack
1157 <<
" and proposed step= " << proposedStepLength <<
G4endl;
1158 }
1159#endif
1160
1162
1163 if( fNoActiveNavigators > 1 )
1164 {
1165
1166
1167 G4double minSafety= kInfinity, safety;
1168 for( numNav=0; numNav < fNoActiveNavigators; ++numNav )
1169 {
1170 safety= fpNavigator[numNav]->ComputeSafety( startPoint, false );
1173 minSafety = std::min( safety, minSafety );
1174 }
1175
1176
1177
1182 }
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1196 fTrueMinStep = std::min( minStep, proposedStepLength );
1197
1198 if( fNoActiveNavigators== 1 )
1199 {
1200
1201
1202
1206
1207
1208
1212 }
1213
1214#ifdef G4DEBUG_PATHFINDER
1215 if( fVerboseLevel > 2 )
1216 {
1217 G4cout <<
"G4ITPathFinder::DoNextCurvedStep : " <<
G4endl
1218 <<
" initialState = " << initialState <<
G4endl
1220 G4cout <<
"G4ITPathFinder::DoNextCurvedStep : "
1221 << " minStep = " << minStep
1222 << " proposedStepLength " << proposedStepLength
1223 <<
" safety = " << newSafety <<
G4endl;
1224 }
1225#endif
1227 if( minStep < proposedStepLength )
1228 {
1229
1230
1231
1233 for( numNav=0; numNav < fNoActiveNavigators; ++numNav )
1234 {
1235 G4double finalStep, lastPreSafety=0.0, minStepLast;
1238
1240 minStepLast, didLimit );
1241
1242
1243
1244
1247 if( (minStepLast != kInfinity) )
1248 {
1249 diffStep = (finalStep-minStepLast);
1250 if ( std::abs(diffStep) <= toleratedRelativeError * finalStep )
1251 {
1252 diffStep = 0.0;
1253 }
1254 currentStepSize += diffStep;
1255 }
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1271 if( limited ) { noLimited++; }
1272
1273#ifdef G4DEBUG_PATHFINDER
1274 G4bool StepError= (currentStepSize < 0)
1275 || ( (minStepLast != kInfinity) && (diffStep < 0) ) ;
1276 if( StepError || (fVerboseLevel > 2) )
1277 {
1279
1280 G4cout <<
" G4ITPathFinder::ComputeStep. Geometry " << numNav
1282 << " from final-step= " << finalStep
1284 << " minStepLast= " << minStepLast
1285 <<
" limited = " << (
fLimitTruth[numNav] ?
"YES" :
" NO")
1286 << " ";
1287 G4cout <<
" status = " << limitedString <<
" #= " << didLimit
1289
1290 if( StepError )
1291 {
1292 std::ostringstream message;
1293 message << "Incorrect calculation of step size for one navigator"
1295 << " currentStepSize = " << currentStepSize
1296 <<
", diffStep= " << diffStep <<
G4endl
1297 << "ERROR in computing step size for this navigator.";
1300 }
1301 }
1302#endif
1303 }
1304
1306 }
1307 else if ( (minStep == proposedStepLength)
1308 || (minStep == kInfinity)
1309 || ( std::abs(minStep-proposedStepLength)
1310 < toleratedRelativeError * proposedStepLength ) )
1311 {
1312
1313
1314
1315
1316
1317
1318
1319 currentStepSize= minStep;
1320 for( numNav=0; numNav < fNoActiveNavigators; ++numNav )
1321 {
1323
1326 }
1328 }
1329 else
1330 {
1331 std::ostringstream message;
1332 message <<
"Incorrect calculation of step size for one navigator." <<
G4endl
1333 << " currentStepSize = " << minStep << " is larger than "
1334 << " proposed StepSize = " << proposedStepLength << ".";
1337 }
1338
1339#ifdef G4DEBUG_PATHFINDER
1340 if( fVerboseLevel > 2 )
1341 {
1342 G4cout <<
" Exiting G4ITPathFinder::DoNextCurvedStep " <<
G4endl;
1344 }
1346#endif
1347
1348 return minStep;
1349}
#define fMinSafety_PreStepPt
#define fPreSafetyMinValue
#define fPreSafetyLocation
#define fPreStepCenterRenewed
G4double ObtainFinalStep(G4int navigatorId, G4double &pNewSafety, G4double &minStepLast, ELimited &limitedStep)
G4String & LimitedString(ELimited lim)