1146 ESide side = kNull, sidephi = kNull ;
1151 G4double sinSPhi, cosSPhi, ePhi, sinEPhi, cosEPhi;
1153 G4double pDistS, compS, pDistE, compE, sphi2, xi, yi, zi, vphi ;
1171 G4double tolRMax = fRmax - fRmaxTolerance ;
1173 G4double vDotNmax = pDotV - fRtor*(v.
x()*p.
x() + v.
y()*p.
y())/rho ;
1174 G4double pDotxyNmax = (1 - fRtor/rho) ;
1176 if( (pt*pt > tolRMax*tolRMax) && (vDotNmax >= 0) )
1182 if ( calcNorm && (pDotxyNmax >= -2.*fRmaxTolerance) )
1185 p.
y()*(1 - fRtor/rho)/pt,
1193 snxt = SolveNumericJT(p,v,fRmax,
false);
1200 G4double tolRMin = fRmin + fRminTolerance ;
1202 if ( (pt*pt < tolRMin*tolRMin) && (vDotNmax < 0) )
1204 if (calcNorm) { *validNorm = false ; }
1208 sd[0] = SolveNumericJT(p,v,fRmin,
false);
1221 snxt = SolveNumericJT(p,v,fRmax,
false);
1226 sd[0] = SolveNumericJT(p,v,fRmin,
false);
1234 if ( calcNorm && (snxt == 0.0) )
1236 *validNorm = false ;
1244 sinSPhi = std::sin(fSPhi) ;
1245 cosSPhi = std::cos(fSPhi) ;
1246 ePhi = fSPhi + fDPhi ;
1247 sinEPhi = std::sin(ePhi) ;
1248 cosEPhi = std::cos(ePhi) ;
1249 cPhi = fSPhi + fDPhi*0.5 ;
1250 sinCPhi = std::sin(cPhi) ;
1251 cosCPhi = std::cos(cPhi) ;
1256 vphi = std::atan2(v.
y(),v.
x()) ;
1258 if ( vphi < fSPhi - halfAngTolerance ) { vphi +=
twopi; }
1259 else if ( vphi > ePhi + halfAngTolerance ) { vphi -=
twopi; }
1261 if ( p.
x() || p.
y() )
1263 pDistS = p.
x()*sinSPhi - p.
y()*cosSPhi ;
1264 pDistE = -p.
x()*sinEPhi + p.
y()*cosEPhi ;
1268 compS = -sinSPhi*v.
x() + cosSPhi*v.
y() ;
1269 compE = sinEPhi*v.
x() - cosEPhi*v.
y() ;
1272 if( ( (fDPhi <=
pi) && ( (pDistS <= halfCarTolerance)
1273 && (pDistE <= halfCarTolerance) ) )
1274 || ( (fDPhi >
pi) && !((pDistS > halfCarTolerance)
1275 && (pDistE > halfCarTolerance) ) ) )
1281 sphi = pDistS/compS ;
1283 if (sphi >= -halfCarTolerance)
1285 xi = p.
x() + sphi*v.
x() ;
1286 yi = p.
y() + sphi*v.
y() ;
1295 if ( ((fSPhi-halfAngTolerance)<=vphi)
1296 && ((ePhi+halfAngTolerance)>=vphi) )
1301 else if ( yi*cosCPhi-xi*sinCPhi >=0 )
1322 sphi2 = pDistE/compE ;
1328 xi = p.
x() + sphi2*v.
x() ;
1329 yi = p.
y() + sphi2*v.
y() ;
1336 if( !( (fSPhi-halfAngTolerance <= vphi)
1337 && (ePhi+halfAngTolerance >= vphi) ) )
1345 if ( (yi*cosCPhi-xi*sinCPhi) >= 0)
1367 vphi = std::atan2(v.
y(),v.
x());
1369 if ( ( fSPhi-halfAngTolerance <= vphi ) &&
1370 ( vphi <= ( ePhi+halfAngTolerance ) ) )
1399 xi = p.
x() + snxt*v.
x() ;
1400 yi = p.
y() + snxt*v.
y() ;
1401 zi = p.
z() + snxt*v.
z() ;
1402 rhoi = std::hypot(xi,yi);
1403 it = hypot(zi,rhoi-fRtor);
1405 iDotxyNmax = (1-fRtor/rhoi) ;
1406 if(iDotxyNmax >= -2.*fRmaxTolerance)
1409 yi*(1-fRtor/rhoi)/it,
1415 *validNorm = false ;
1420 *validNorm = false ;
1431 *validNorm = false ;
1438 *n=
G4ThreeVector(-std::sin(fSPhi+fDPhi),std::cos(fSPhi+fDPhi),0);
1443 *validNorm = false ;
1453 std::ostringstream message;
1454 G4int oldprc = message.precision(16);
1455 message <<
"Undefined side for valid surface normal to solid."
1457 <<
"Position:" << G4endl << G4endl
1458 <<
"p.x() = " << p.
x()/
mm <<
" mm" << G4endl
1459 <<
"p.y() = " << p.
y()/
mm <<
" mm" << G4endl
1460 <<
"p.z() = " << p.
z()/
mm <<
" mm" << G4endl << G4endl
1461 <<
"Direction:" << G4endl << G4endl
1462 <<
"v.x() = " << v.
x() << G4endl
1463 <<
"v.y() = " << v.
y() << G4endl
1464 <<
"v.z() = " << v.
z() << G4endl << G4endl
1465 <<
"Proposed distance :" << G4endl << G4endl
1466 <<
"snxt = " << snxt/
mm <<
" mm" <<
G4endl;
1467 message.precision(oldprc);
1473 if ( snxt<halfCarTolerance ) { snxt=0 ; }
static constexpr double mm
static const G4double kInfinity
CLHEP::Hep3Vector G4ThreeVector
static constexpr double twopi
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static constexpr double pi