14 #pragma implementation
26 double factor =
mag();
28 std::cerr <<
"Hep3Vector::setMag() - "
29 <<
"zero vector can't be stretched" << std::endl;
41 double u1 = NewUzVector.
x();
42 double u2 = NewUzVector.
y();
43 double u3 = NewUzVector.
z();
44 double up = u1*u1 + u2*u2;
48 double px =
dx, py =
dy, pz =
dz;
49 dx = (u1*u3*px - u2*py)/up + u1*pz;
50 dy = (u2*u3*px + u1*py)/up + u2*pz;
53 else if (u3 < 0.) {
dx = -
dx;
dz = -
dz; }
60 if ( m1== 0 )
return 0.0;
61 if ( m1==
z() )
return 1.0E72;
62 if ( m1== -
z() )
return -1.0E72;
63 return 0.5*std::log( (m1+
z())/(m1-
z()) );
67 return os <<
"(" << v.
x() <<
"," << v.
y() <<
"," << v.
z() <<
")";
71 double & x,
double & y,
double & z );
80 const Hep3Vector
HepXHat(1.0, 0.0, 0.0);
81 const Hep3Vector
HepYHat(0.0, 1.0, 0.0);
82 const Hep3Vector
HepZHat(0.0, 0.0, 1.0);
91 double sinphi = std::sin(phi1);
92 double cosphi = std::cos(phi1);
94 ty =
dy * cosphi -
dz * sinphi;
95 dz =
dz * cosphi +
dy * sinphi;
101 double sinphi = std::sin(phi1);
102 double cosphi = std::cos(phi1);
104 tz =
dz * cosphi -
dx * sinphi;
105 dx =
dx * cosphi +
dz * sinphi;
111 double sinphi = std::sin(phi1);
112 double cosphi = std::cos(phi1);
114 tx =
dx * cosphi -
dy * sinphi;
115 dy =
dy * cosphi +
dx * sinphi;
122 return ( (*
this - v).
mag2() <= limit );
127 double d = (*
this - v).
mag2();
129 if ( (vdv > 0) && (d < vdv) ) {
130 return std::sqrt (d/vdv);
131 }
else if ( (vdv == 0) && (d == 0) ) {
149 double a =
eta() - v.
eta();
151 return std::sqrt ( a*a + b*b );
160 arg =
dot(q)/std::sqrt(ptot2);
161 if(arg > 1.0) arg = 1.0;
162 if(arg < -1.0) arg = -1.0;
169 double ptot2 =
mag2();
170 double qtot2 = q.
mag2();
171 if ( ptot2 == 0 || qtot2 == 0 ) {
175 arg = (pdq/ptot2) * (pdq/qtot2);
178 if(arg > 1.0) arg = 1.0;
186 if ( (
dx == 0) && (
dy == 0) ) {
188 std::cerr <<
"Hep3Vector::setEta() - "
189 <<
"Attempt to set eta of zero vector -- vector is unchanged"
193 std::cerr <<
"Hep3Vector::setEta() - "
194 <<
"Attempt to set eta of vector along Z axis -- will use phi = 0"
201 double tanHalfTheta = std::exp ( -eta1 );
203 (1 - tanHalfTheta*tanHalfTheta) / (1 + tanHalfTheta*tanHalfTheta);
205 double rho1 = r1*std::sqrt(1 - cosTheta1*cosTheta1);
206 dy = rho1 * std::sin (phi1);
207 dx = rho1 * std::cos (phi1);
215 if ( (
dx == 0) && (
dy == 0) ) {
217 std::cerr <<
"Hep3Vector::setCylTheta() - "
218 <<
"Attempt to set cylTheta of zero vector -- vector is unchanged"
230 std::cerr <<
"Hep3Vector::setCylTheta() - "
231 <<
"Attempt set cylindrical theta of vector along Z axis "
232 <<
"to a non-trivial value, while keeping rho fixed -- "
233 <<
"will return zero vector" << std::endl;
237 if ( (theta1 < 0) || (theta1 >
CLHEP::pi) ) {
238 std::cerr <<
"Hep3Vector::setCylTheta() - "
239 <<
"Setting Cyl theta of a vector based on a value not in [0, PI]"
245 if ( (theta1 == 0) || (theta1 ==
CLHEP::pi) ) {
246 std::cerr <<
"Hep3Vector::setCylTheta() - "
247 <<
"Attempt to set cylindrical theta to 0 or PI "
248 <<
"while keeping rho fixed -- infinite Z will be computed"
250 dz = (theta1==0) ? 1.0E72 : -1.0E72;
253 dz = rho1 / std::tan (theta1);
254 dy = rho1 * std::sin (phi1);
255 dx = rho1 * std::cos (phi1);
263 double theta1 = 2 * std::atan ( std::exp (-eta1) );
270 if ( (
dx == 0) && (
dy == 0) ) {
272 std::cerr <<
"Hep3Vector::setCylEta() - "
273 <<
"Attempt to set cylEta of zero vector -- vector is unchanged"
285 std::cerr <<
"Hep3Vector::setCylEta() - "
286 <<
"Attempt set cylindrical eta of vector along Z axis "
287 <<
"to a non-trivial value, while keeping rho fixed -- "
288 <<
"will return zero vector" << std::endl;
294 dz = rho1 / std::tan (theta1);
295 dy = rho1 * std::sin (phi1);
296 dx = rho1 * std::cos (phi1);
307 double oneOverC = 1.0/c;
320 double oneOverC = 1.0/c;
void set(double x, double y, double z)
DLL_API const Hep3Vector HepZHat
Hep3Vector & operator/=(double)
double howNear(const Hep3Vector &v) const
double deltaPhi(const Hep3Vector &v2) const
bool isNear(const Hep3Vector &, double epsilon=tolerance) const
double dot(const Hep3Vector &) const
std::ostream & operator<<(std::ostream &os, const HepRandom &dist)
double deltaR(const Hep3Vector &v) const
Hep3Vector & rotateUz(const Hep3Vector &)
Hep3Vector & rotateZ(double)
static DLL_API double tolerance
double pseudoRapidity() const
DLL_API const Hep3Vector HepYHat
HepLorentzVector operator/(const HepLorentzVector &, double a)
DLL_API const Hep3Vector HepXHat
Hep3Vector & rotateY(double)
std::istream & operator>>(std::istream &is, HepRandom &dist)
Hep3Vector & rotateX(double)
void ZMinput3doubles(std::istream &is, const char *type, double &x, double &y, double &z)
static constexpr double twopi
double epsilon(double density, double temperature)
static constexpr double pi