13 #pragma implementation
25 double factor =
mag();
27 std::cerr <<
"Hep3Vector::setMag() - "
28 <<
"zero vector can't be stretched" << std::endl;
40 double u1 = NewUzVector.
x();
41 double u2 = NewUzVector.
y();
42 double u3 = NewUzVector.
z();
43 double up = u1*u1 + u2*u2;
47 double px =
dx, py =
dy, pz =
dz;
48 dx = (u1*u3*px - u2*py)/up + u1*pz;
49 dy = (u2*u3*px + u1*py)/up + u2*pz;
52 else if (u3 < 0.) {
dx = -
dx;
dz = -
dz; }
59 if ( m1== 0 )
return 0.0;
60 if ( m1==
z() )
return 1.0E72;
61 if ( m1== -
z() )
return -1.0E72;
62 return 0.5*std::log( (m1+
z())/(m1-
z()) );
66 return os <<
"(" << v.
x() <<
"," << v.
y() <<
"," << v.
z() <<
")";
70 double &
x,
double &
y,
double &
z );
79 const Hep3Vector
HepXHat(1.0, 0.0, 0.0);
80 const Hep3Vector
HepYHat(0.0, 1.0, 0.0);
81 const Hep3Vector
HepZHat(0.0, 0.0, 1.0);
90 double sinphi = std::sin(phi1);
91 double cosphi = std::cos(phi1);
93 ty =
dy * cosphi -
dz * sinphi;
94 dz =
dz * cosphi +
dy * sinphi;
100 double sinphi = std::sin(phi1);
101 double cosphi = std::cos(phi1);
103 tz =
dz * cosphi -
dx * sinphi;
104 dx =
dx * cosphi +
dz * sinphi;
110 double sinphi = std::sin(phi1);
111 double cosphi = std::cos(phi1);
113 tx =
dx * cosphi -
dy * sinphi;
114 dy =
dy * cosphi +
dx * sinphi;
121 return ( (*
this - v).
mag2() <= limit );
126 double d = (*
this -
v).
mag2();
128 if ( (vdv > 0) && (d < vdv) ) {
129 return std::sqrt (d/vdv);
130 }
else if ( (vdv == 0) && (d == 0) ) {
150 return std::sqrt ( a*a + b*b );
159 arg =
dot(q)/std::sqrt(ptot2);
160 if(arg > 1.0) arg = 1.0;
161 if(arg < -1.0) arg = -1.0;
168 double ptot2 =
mag2();
169 double qtot2 = q.
mag2();
170 if ( ptot2 == 0 || qtot2 == 0 ) {
174 arg = (pdq/ptot2) * (pdq/qtot2);
177 if(arg > 1.0) arg = 1.0;
185 if ( (
dx == 0) && (
dy == 0) ) {
187 std::cerr <<
"Hep3Vector::setEta() - "
188 <<
"Attempt to set eta of zero vector -- vector is unchanged"
192 std::cerr <<
"Hep3Vector::setEta() - "
193 <<
"Attempt to set eta of vector along Z axis -- will use phi = 0"
200 double tanHalfTheta = std::exp ( -eta1 );
202 (1 - tanHalfTheta*tanHalfTheta) / (1 + tanHalfTheta*tanHalfTheta);
204 double rho1 = r1*std::sqrt(1 - cosTheta1*cosTheta1);
205 dy = rho1 * std::sin (phi1);
206 dx = rho1 * std::cos (phi1);
214 if ( (
dx == 0) && (
dy == 0) ) {
216 std::cerr <<
"Hep3Vector::setCylTheta() - "
217 <<
"Attempt to set cylTheta of zero vector -- vector is unchanged"
229 std::cerr <<
"Hep3Vector::setCylTheta() - "
230 <<
"Attempt set cylindrical theta of vector along Z axis "
231 <<
"to a non-trivial value, while keeping rho fixed -- "
232 <<
"will return zero vector" << std::endl;
236 if ( (theta1 < 0) || (theta1 >
CLHEP::pi) ) {
237 std::cerr <<
"Hep3Vector::setCylTheta() - "
238 <<
"Setting Cyl theta of a vector based on a value not in [0, PI]"
244 if ( (theta1 == 0) || (theta1 ==
CLHEP::pi) ) {
245 std::cerr <<
"Hep3Vector::setCylTheta() - "
246 <<
"Attempt to set cylindrical theta to 0 or PI "
247 <<
"while keeping rho fixed -- infinite Z will be computed"
249 dz = (theta1==0) ? 1.0E72 : -1.0E72;
252 dz = rho1 / std::tan (theta1);
253 dy = rho1 * std::sin (phi1);
254 dx = rho1 * std::cos (phi1);
262 double theta1 = 2 * std::atan ( std::exp (-eta1) );
269 if ( (
dx == 0) && (
dy == 0) ) {
271 std::cerr <<
"Hep3Vector::setCylEta() - "
272 <<
"Attempt to set cylEta of zero vector -- vector is unchanged"
284 std::cerr <<
"Hep3Vector::setCylEta() - "
285 <<
"Attempt set cylindrical eta of vector along Z axis "
286 <<
"to a non-trivial value, while keeping rho fixed -- "
287 <<
"will return zero vector" << std::endl;
293 dz = rho1 / std::tan (theta1);
294 dy = rho1 * std::sin (phi1);
295 dx = rho1 * std::cos (phi1);
306 double oneOverC = 1.0/
c;
319 double oneOverC = 1.0/
c;