17#include "CLHEP/Vector/defs.h"
18#include "CLHEP/Vector/ThreeVector.h"
19#include "CLHEP/Vector/ZMxpv.h"
20#include "CLHEP/Units/PhysicalConstants.h"
39 "Spherical coordinates set with negative R"));
42 if ( (theta1 < 0) || (theta1 > CLHEP::pi) ) {
44 "Spherical coordinates set with theta not in [0, PI]"));
47 double rho1 ( r1*std::sin(theta1));
48 setZ(r1 * std::cos(theta1));
49 setY(rho1 * std::sin (phi1));
50 setX(rho1 * std::cos (phi1));
60 "Cylindrical coordinates supplied with negative Rho"));
64 setY(rho1 * std::sin (phi1));
65 setX(rho1 * std::cos (phi1));
75 "Attempt set vector components rho, phi, theta with zero rho -- "
76 "zero vector is returned, ignoring theta and phi"));
80 if ( (theta1 == 0) || (theta1 == CLHEP::pi) ) {
82 "Attempt set cylindrical vector vector with finite rho and "
83 "theta along the Z axis: infinite Z would be computed"));
85 if ( (theta1 < 0) || (theta1 > CLHEP::pi) ) {
87 "Rho, phi, theta set with theta not in [0, PI]"));
90 setZ(rho1 / std::tan (theta1));
91 setY(rho1 * std::sin (phi1));
92 setX(rho1 * std::cos (phi1));
102 "Attempt set vector components rho, phi, eta with zero rho -- "
103 "zero vector is returned, ignoring eta and phi"));
107 double theta1 (2 * std::atan ( std::exp (-eta1) ));
108 setZ(rho1 / std::tan (theta1));
109 setY(rho1 * std::sin (phi1));
110 setX(rho1 * std::cos (phi1));
124 }
else if (
z() < v.
z() ) {
126 }
else if (
y() > v.
y() ) {
128 }
else if (
y() < v.
y() ) {
130 }
else if (
x() > v.
x() ) {
132 }
else if (
x() < v.
x() ) {
170 double v1v2 = std::fabs(
dot(v));
173 return ( (
mag2() == 0) && (v.
mag2() == 0) ) ? 0 : 1;
176 double abscross = v1Xv2.
mag();
177 if ( abscross >= v1v2 ) {
180 return abscross/v1v2;
185 double epsilon)
const {
189 static const double TOOBIG = std::pow(2.0,507);
190 static const double SCALE = std::pow(2.0,-507);
191 double v1v2 = std::fabs(
dot(v));
193 return ( (
mag2() == 0) && (v.
mag2() == 0) );
195 if ( v1v2 >= TOOBIG ) {
199 double x2 = sv1Xsv2.
mag2();
200 double limit = v1v2*SCALE*SCALE;
201 limit = epsilon*epsilon*limit*limit;
202 return ( x2 <= limit );
208 if ( (std::fabs (v1Xv2.
x()) > TOOBIG) ||
209 (std::fabs (v1Xv2.
y()) > TOOBIG) ||
210 (std::fabs (v1Xv2.
z()) > TOOBIG) ) {
214 return ( (v1Xv2.
mag2()) <= ((epsilon * v1v2) * (epsilon * v1v2)) );
222 double v1v2 = std::fabs(
dot(v));
228 double abscross = v1Xv2.
mag();
229 if ( v1v2 >= abscross ) {
232 return v1v2/abscross;
238 double epsilon)
const {
242 static const double TOOBIG = std::pow(2.0,507);
243 static const double SCALE = std::pow(2.0,-507);
244 double v1v2 = std::fabs(
dot(v));
246 if ( v1v2 >= TOOBIG ) {
250 double x2 = sv1Xsv2.
mag2();
251 double limit = epsilon*epsilon*x2;
252 double y2 = v1v2*SCALE*SCALE;
253 return ( y2*y2 <= limit );
259 if ( (std::fabs (eps_v1Xv2.
x()) > TOOBIG) ||
260 (std::fabs (eps_v1Xv2.
y()) > TOOBIG) ||
261 (std::fabs (eps_v1Xv2.
z()) > TOOBIG) ) {
267 return ( v1v2*v1v2 <= eps_v1Xv2.
mag2() );
298 for (k=0; k<8; k++) {
299 value.u.i[k] = negOne.u.i[k] | posTwo.u.i[k];
void setRhoPhiEta(double rho, double phi, double eta)
bool operator>=(const Hep3Vector &v) const
void setSpherical(double r, double theta, double phi)
Hep3Vector cross(const Hep3Vector &) const
double dot(const Hep3Vector &) const
bool operator>(const Hep3Vector &v) const
bool isOrthogonal(const Hep3Vector &v, double epsilon=tolerance) const
double negativeInfinity() const
static double setTolerance(double tol)
bool operator<=(const Hep3Vector &v) const
void setCylindrical(double r, double phi, double z)
void set(double x, double y, double z)
int compare(const Hep3Vector &v) const
double howParallel(const Hep3Vector &v) const
double howOrthogonal(const Hep3Vector &v) const
void setRhoPhiTheta(double rho, double phi, double theta)
bool operator<(const Hep3Vector &v) const
bool isParallel(const Hep3Vector &v, double epsilon=tolerance) const