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