18 #pragma implementation 21 #include "CLHEP/Vector/defs.h" 22 #include "CLHEP/Vector/ThreeVector.h" 23 #include "CLHEP/Vector/ZMxpv.h" 24 #include "CLHEP/Units/PhysicalConstants.h" 43 "Spherical coordinates set with negative R"));
46 if ( (theta1 < 0) || (theta1 > CLHEP::pi) ) {
48 "Spherical coordinates set with theta not in [0, PI]"));
51 dz = r1 * std::cos(theta1);
52 double rho1 ( r1*std::sin(theta1));
53 dy = rho1 * std::sin (phi1);
54 dx = rho1 * std::cos (phi1);
64 "Cylindrical coordinates supplied with negative Rho"));
68 dy = rho1 * std::sin (phi1);
69 dx = rho1 * std::cos (phi1);
79 "Attempt set vector components rho, phi, theta with zero rho -- " 80 "zero vector is returned, ignoring theta and phi"));
84 if ( (theta1 == 0) || (theta1 == CLHEP::pi) ) {
86 "Attempt set cylindrical vector vector with finite rho and " 87 "theta along the Z axis: infinite Z would be computed"));
89 if ( (theta1 < 0) || (theta1 > CLHEP::pi) ) {
91 "Rho, phi, theta set with theta not in [0, PI]"));
94 dz = rho1 / std::tan (theta1);
95 dy = rho1 * std::sin (phi1);
96 dx = rho1 * std::cos (phi1);
106 "Attempt set vector components rho, phi, eta with zero rho -- " 107 "zero vector is returned, ignoring eta and phi"));
111 double theta1 (2 * std::atan ( std::exp (-eta1) ));
112 dz = rho1 / std::tan (theta1);
113 dy = rho1 * std::sin (phi1);
114 dx = rho1 * std::cos (phi1);
128 }
else if (
dz < v.
dz ) {
130 }
else if (
dy > v.
dy ) {
132 }
else if (
dy < v.
dy ) {
134 }
else if (
dx > v.
dx ) {
136 }
else if (
dx < v.
dx ) {
174 double v1v2 = std::fabs(
dot(v));
177 return ( (
mag2() == 0) && (v.
mag2() == 0) ) ? 0 : 1;
180 double abscross = v1Xv2.
mag();
181 if ( abscross >= v1v2 ) {
184 return abscross/v1v2;
189 double epsilon)
const {
193 static const double TOOBIG = std::pow(2.0,507);
194 static const double SCALE = std::pow(2.0,-507);
195 double v1v2 = std::fabs(
dot(v));
197 return ( (
mag2() == 0) && (v.
mag2() == 0) );
199 if ( v1v2 >= TOOBIG ) {
203 double x2 = sv1Xsv2.
mag2();
204 double limit = v1v2*SCALE*SCALE;
205 limit = epsilon*epsilon*limit*limit;
206 return ( x2 <= limit );
212 if ( (std::fabs (v1Xv2.
dx) > TOOBIG) ||
213 (std::fabs (v1Xv2.
dy) > TOOBIG) ||
214 (std::fabs (v1Xv2.
dz) > TOOBIG) ) {
218 return ( (v1Xv2.
mag2()) <= ((epsilon * v1v2) * (epsilon * v1v2)) );
226 double v1v2 = std::fabs(
dot(v));
232 double abscross = v1Xv2.
mag();
233 if ( v1v2 >= abscross ) {
236 return v1v2/abscross;
242 double epsilon)
const {
246 static const double TOOBIG = std::pow(2.0,507);
247 static const double SCALE = std::pow(2.0,-507);
248 double v1v2 = std::fabs(
dot(v));
250 if ( v1v2 >= TOOBIG ) {
254 double x2 = sv1Xsv2.
mag2();
255 double limit = epsilon*epsilon*x2;
256 double y2 = v1v2*SCALE*SCALE;
257 return ( y2*y2 <= limit );
263 if ( (std::fabs (eps_v1Xv2.
dx) > TOOBIG) ||
264 (std::fabs (eps_v1Xv2.
dy) > TOOBIG) ||
265 (std::fabs (eps_v1Xv2.
dz) > TOOBIG) ) {
271 return ( v1v2*v1v2 <= eps_v1Xv2.
mag2() );
302 for (k=0; k<8; k++) {
303 value.u.i[k] = negOne.u.i[k] | posTwo.u.i[k];
int compare(const Hep3Vector &v) const
bool operator>=(const Hep3Vector &v) const
bool isOrthogonal(const Hep3Vector &v, double epsilon=tolerance) const
void setCylindrical(double r, double phi, double z)
bool isParallel(const Hep3Vector &v, double epsilon=tolerance) const
Hep3Vector cross(const Hep3Vector &) const
double negativeInfinity() const
bool operator<=(const Hep3Vector &v) const
void setRhoPhiEta(double rho, double phi, double eta)
double howOrthogonal(const Hep3Vector &v) const
void setRhoPhiTheta(double rho, double phi, double theta)
void setSpherical(double r, double theta, double phi)
double howParallel(const Hep3Vector &v) const
static double setTolerance(double tol)
bool operator<(const Hep3Vector &v) const
double dot(const Hep3Vector &) const
bool operator>(const Hep3Vector &v) const