21 double factor =
mag();
23 std::cerr <<
"Hep3Vector::setMag() - "
24 <<
"zero vector can't be stretched" << std::endl;
36 double u1 = NewUzVector.
x();
37 double u2 = NewUzVector.
y();
38 double u3 = NewUzVector.
z();
39 double up = u1*u1 + u2*u2;
43 double px = (u1 * u3 *
x() - u2 *
y()) / up + u1 *
z();
44 double py = (u2 * u3 *
x() + u1 *
y()) / up + u2 *
z();
45 double pz = -up *
x() + u3 *
z();
57 if ( m1== 0 )
return 0.0;
58 if ( m1==
z() )
return 1.0E72;
59 if ( m1== -
z() )
return -1.0E72;
60 return 0.5*std::log( (m1+
z())/(m1-
z()) );
64 return os <<
"(" << v.
x() <<
"," << v.
y() <<
"," << v.
z() <<
")";
68 double & x,
double & y,
double & z );
88 double sinphi = std::sin(phi1);
89 double cosphi = std::cos(phi1);
90 double ty =
y() * cosphi -
z() * sinphi;
91 double tz =
z() * cosphi +
y() * sinphi;
98 double sinphi = std::sin(phi1);
99 double cosphi = std::cos(phi1);
100 double tx =
x() * cosphi +
z() * sinphi;
101 double tz =
z() * cosphi -
x() * sinphi;
108 double sinphi = std::sin(phi1);
109 double cosphi = std::cos(phi1);
110 double tx =
x() * cosphi -
y() * sinphi;
111 double ty =
y() * cosphi +
x() * sinphi;
119 return ( (*
this - v).
mag2() <= limit );
124 double d = (*
this - v).
mag2();
126 if ( (vdv > 0) && (d < vdv) ) {
127 return std::sqrt (d/vdv);
128 }
else if ( (vdv == 0) && (d == 0) ) {
137 if ( dphi > CLHEP::pi ) {
138 dphi -= CLHEP::twopi;
139 }
else if ( dphi <= -CLHEP::pi ) {
140 dphi += CLHEP::twopi;
146 double a =
eta() - v.
eta();
148 return std::sqrt ( a*a + b*b );
157 arg =
dot(q)/std::sqrt(ptot2);
158 if(arg > 1.0) arg = 1.0;
159 if(arg < -1.0) arg = -1.0;
166 double ptot2 =
mag2();
167 double qtot2 = q.
mag2();
168 if ( ptot2 == 0 || qtot2 == 0 ) {
172 arg = (pdq/ptot2) * (pdq/qtot2);
175 if(arg > 1.0) arg = 1.0;
183 if ( (
x() == 0) && (
y() == 0) ) {
185 std::cerr <<
"Hep3Vector::setEta() - "
186 <<
"Attempt to set eta of zero vector -- vector is unchanged"
190 std::cerr <<
"Hep3Vector::setEta() - "
191 <<
"Attempt to set eta of vector along Z axis -- will use phi = 0"
198 double tanHalfTheta = std::exp ( -eta1 );
200 (1 - tanHalfTheta*tanHalfTheta) / (1 + tanHalfTheta*tanHalfTheta);
201 double rho1 = r1*std::sqrt(1 - cosTheta1*cosTheta1);
202 setZ(r1 * cosTheta1);
203 setY(rho1 * std::sin (phi1));
204 setX(rho1 * std::cos (phi1));
212 if ( (
x() == 0) && (
y() == 0) ) {
214 std::cerr <<
"Hep3Vector::setCylTheta() - "
215 <<
"Attempt to set cylTheta of zero vector -- vector is unchanged"
220 setZ(std::fabs(
z()));
223 if (theta1 == CLHEP::pi) {
224 setZ(-std::fabs(
z()));
227 std::cerr <<
"Hep3Vector::setCylTheta() - "
228 <<
"Attempt set cylindrical theta of vector along Z axis "
229 <<
"to a non-trivial value, while keeping rho fixed -- "
230 <<
"will return zero vector" << std::endl;
234 if ( (theta1 < 0) || (theta1 > CLHEP::pi) ) {
235 std::cerr <<
"Hep3Vector::setCylTheta() - "
236 <<
"Setting Cyl theta of a vector based on a value not in [0, PI]"
242 if ( (theta1 == 0) || (theta1 == CLHEP::pi) ) {
243 std::cerr <<
"Hep3Vector::setCylTheta() - "
244 <<
"Attempt to set cylindrical theta to 0 or PI "
245 <<
"while keeping rho fixed -- infinite Z will be computed"
247 setZ((theta1==0) ? 1.0E72 : -1.0E72);
250 setZ(rho1 / std::tan (theta1));
251 setY(rho1 * std::sin (phi1));
252 setX(rho1 * std::cos (phi1));
260 double theta1 = 2 * std::atan ( std::exp (-eta1) );
267 if ( (
x() == 0) && (
y() == 0) ) {
269 std::cerr <<
"Hep3Vector::setCylEta() - "
270 <<
"Attempt to set cylEta of zero vector -- vector is unchanged"
275 setZ(std::fabs(
z()));
278 if (theta1 == CLHEP::pi) {
279 setZ(-std::fabs(
z()));
282 std::cerr <<
"Hep3Vector::setCylEta() - "
283 <<
"Attempt set cylindrical eta of vector along Z axis "
284 <<
"to a non-trivial value, while keeping rho fixed -- "
285 <<
"will return zero vector" << std::endl;
291 setZ(rho1 / std::tan (theta1));
292 setY(rho1 * std::sin (phi1));
293 setX(rho1 * std::cos (phi1));
G4double epsilon(G4double density, G4double temperature)
Hep3Vector & rotateY(double)
Hep3Vector & rotateX(double)
static DLL_API double tolerance
Hep3Vector & rotateZ(double)
static const int ToleranceTicks
Hep3Vector & operator/=(double)
double howNear(const Hep3Vector &v) const
double dot(const Hep3Vector &) const
bool isNear(const Hep3Vector &, double epsilon=tolerance) const
double pseudoRapidity() const
double deltaPhi(const Hep3Vector &v2) const
void set(double x, double y, double z)
double deltaR(const Hep3Vector &v) const
Hep3Vector & rotateUz(const Hep3Vector &)
DLL_API const Hep3Vector HepZHat
std::istream & operator>>(std::istream &is, HepRandom &dist)
void ZMinput3doubles(std::istream &is, const char *type, double &x, double &y, double &z)
DLL_API const Hep3Vector HepXHat
DLL_API const Hep3Vector HepYHat
std::ostream & operator<<(std::ostream &os, const HepRandom &dist)
HepLorentzVector operator/(const HepLorentzVector &, double a)