Go to the documentation of this file.
14 #pragma implementation
17 #include "CLHEP/Vector/defs.h"
18 #include "CLHEP/Vector/ThreeVector.h"
19 #include "CLHEP/Vector/ZMxpv.h"
20 #include "CLHEP/Units/PhysicalConstants.h"
28 double factor =
mag();
31 "Hep3Vector::setMag : zero vector can't be stretched"));
49 std::cerr <<
"Hep3Vector subscripting: bad index (" <<
i <<
")"
66 <<
"Hep3Vector subscripting: bad index (" <<
i <<
")"
75 double u1 = NewUzVector.
x();
76 double u2 = NewUzVector.
y();
77 double u3 = NewUzVector.
z();
78 double up = u1*u1 + u2*u2;
82 double px =
dx, py =
dy, pz =
dz;
83 dx = (u1*u3*px - u2*py)/up + u1*pz;
84 dy = (u2*u3*px + u1*py)/up + u2*pz;
87 else if (u3 < 0.) {
dx = -
dx;
dz = -
dz; }
94 if ( m1== 0 )
return 0.0;
95 if ( m1==
z() )
return 1.0E72;
96 if ( m1== -
z() )
return -1.0E72;
97 return 0.5*std::log( (m1+
z())/(m1-
z()) );
101 return os <<
"(" <<
v.x() <<
"," <<
v.y() <<
"," <<
v.z() <<
")";
105 double &
x,
double & y,
double & z );
125 double sinphi = std::sin(phi1);
126 double cosphi = std::cos(phi1);
128 ty =
dy * cosphi -
dz * sinphi;
129 dz =
dz * cosphi +
dy * sinphi;
135 double sinphi = std::sin(phi1);
136 double cosphi = std::cos(phi1);
138 tz =
dz * cosphi -
dx * sinphi;
139 dx =
dx * cosphi +
dz * sinphi;
145 double sinphi = std::sin(phi1);
146 double cosphi = std::cos(phi1);
148 tx =
dx * cosphi -
dy * sinphi;
149 dy =
dy * cosphi +
dx * sinphi;
155 double limit =
dot(
v)*epsilon*epsilon;
156 return ( (*
this -
v).
mag2() <= limit );
161 double d = (*
this -
v).
mag2();
163 if ( (vdv > 0) && (d < vdv) ) {
164 return std::sqrt (d/vdv);
165 }
else if ( (vdv == 0) && (d == 0) ) {
174 if ( dphi > CLHEP::pi ) {
175 dphi -= CLHEP::twopi;
176 }
else if ( dphi <= -CLHEP::pi ) {
177 dphi += CLHEP::twopi;
183 double a =
eta() -
v.eta();
185 return std::sqrt (
a*
a +
b*
b );
194 arg =
dot(q)/std::sqrt(ptot2);
195 if(arg > 1.0) arg = 1.0;
196 if(arg < -1.0) arg = -1.0;
203 double ptot2 =
mag2();
204 double qtot2 = q.
mag2();
205 if ( ptot2 == 0 || qtot2 == 0 ) {
209 arg = (pdq/ptot2) * (pdq/qtot2);
212 if(arg > 1.0) arg = 1.0;
220 if ( (
dx == 0) && (
dy == 0) ) {
223 "Attempt to set eta of zero vector -- vector is unchanged"));
227 "Attempt to set eta of vector along Z axis -- will use phi = 0"));
233 double tanHalfTheta = std::exp ( -eta1 );
235 (1 - tanHalfTheta*tanHalfTheta) / (1 + tanHalfTheta*tanHalfTheta);
237 double rho1 = r1*std::sqrt(1 - cosTheta1*cosTheta1);
238 dy = rho1 * std::sin (phi1);
239 dx = rho1 * std::cos (phi1);
247 if ( (
dx == 0) && (
dy == 0) ) {
250 "Attempt to set cylTheta of zero vector -- vector is unchanged"));
257 if (theta1 == CLHEP::pi) {
262 "Attempt set cylindrical theta of vector along Z axis "
263 "to a non-trivial value, while keeping rho fixed -- "
264 "will return zero vector"));
268 if ( (theta1 < 0) || (theta1 > CLHEP::pi) ) {
270 "Setting Cyl theta of a vector based on a value not in [0, PI]"));
275 if ( (theta1 == 0) || (theta1 == CLHEP::pi) ) {
277 "Attempt to set cylindrical theta to 0 or PI "
278 "while keeping rho fixed -- infinite Z will be computed"));
279 dz = (theta1==0) ? 1.0E72 : -1.0E72;
282 dz = rho1 / std::tan (theta1);
283 dy = rho1 * std::sin (phi1);
284 dx = rho1 * std::cos (phi1);
292 double theta1 = 2 * std::atan ( std::exp (-eta1) );
299 if ( (
dx == 0) && (
dy == 0) ) {
302 "Attempt to set cylEta of zero vector -- vector is unchanged"));
309 if (theta1 == CLHEP::pi) {
314 "Attempt set cylindrical eta of vector along Z axis "
315 "to a non-trivial value, while keeping rho fixed -- "
316 "will return zero vector"));
322 dz = rho1 / std::tan (theta1);
323 dy = rho1 * std::sin (phi1);
324 dx = rho1 * std::cos (phi1);
332 "Attempt to divide vector by 0 -- "
333 "will produce infinities and/or NANs"));
335 double oneOverC = 1.0/c;
344 "Attempt to do vector /= 0 -- "
345 "division by zero would produce infinite or NAN components"));
347 double oneOverC = 1.0/c;
double deltaR(const Hep3Vector &v) const
Hep3Vector & operator/=(double)
double dot(const Hep3Vector &) const
bool isNear(const Hep3Vector &, double epsilon=tolerance) const
Hep3Vector & rotateY(double)
double operator()(int) const
HepRotation and so forth isNear() norm2() rectify() static Rotation row1 row4(To avoid bloat in the code pulled in for programs which don 't use all these features, we split the implementation .cc files. Only isNear() goes into the original Rotation.cc) --------------------------------------- HepAxisAngle and HepEulerAngles classes --------------------------------------- These classes are very useful and simple structures for holding the result of a nice intuituve decomposition of a rotation there is no longer much content in the distinct ZOOM PhysicsVectors library The only content left in the library is the object files representing the various Exception objects When we build the CLHEP classes for the ZOOM we will set up so as to use ZOOM SpaceVector is(but we can disable namespace usage and most of our users do so at this point). What I do is leave Hep3Vector in the global namespace
Hep3Vector & rotateX(double)
HepLorentzVector operator/(const HepLorentzVector &, double a)
Signatures of Hep3Vector::rotate For equivalent ZOOM axis There is no harm in leaving this axis CLHEP has implemented a first forming an identity then rotating that by axis and I leave the CLHEP code alone people are of course free to use the ZOOM originated method with signature which I believe will be faster Return types for rotateZ CLHEP and PhysicsVectors each have these three and they are identical except that the ZOOM version returns a reference to while in CLHEP they return void Having methods that alter an object return a reference to that object is convenient for certain chained and costs nothing I don t wish to potentially break ZOOM user code for no good so I have made these CLHEP method conform to this convention There are a couple of other CLHEP rotate and which use the void return type
double deltaPhi(const Hep3Vector &v2) const
they are gone ZOOM Features Discontinued The following features of the ZOOM package were felt to be extreme overkill These have been after checking that no existing user code was utilizing as in SpaceVector v
Hep3Vector & rotateUz(const Hep3Vector &)
double pseudoRapidity() const
Issues Concerning the PhysicsVectors CLHEP Vector Merge The merge of ZOOM PhysicsVdectors and the CLHEP Vector package is completed The purpose of this document is to list the major issues that affected the merge of these and where relevant describe the resolutions More detailed documents describe more minor issues General Approach As agreed at the June CLHEP the approach is to combine the features of each ZOOM class with the corresponding CLHEP class expanding the interface to create a single lingua franca of what a Hep3Vector(for example) means. We are not forming SpaceVector as an class derived from Hep3Vector and enhancing it in that way. Another rule imposed by the agreement is to avoid using the Exceptions package(even though that will later go into CLHEP for other uses). A desirable goal is to avoid cluttering the interface and enlarging the code linked in when ordinary CLHEP Vector functionallity is used. To this end
double howNear(const Hep3Vector &v) const
std::istream & operator>>(std::istream &is, HepAxisAngle &aa)
Hep3Vector & rotateZ(double)
void ZMinput3doubles(std::istream &is, const char *type, double &x, double &y, double &z)
std::ostream & operator<<(std::ostream &os, const HepAxisAngle &aa)
any side effects of that construction would occur twice The semantics of throw x
it has advantages For I leave the ZMthrows but substitute I replaced ZMthrow with ZMthrowA in this package ZMthrowA