#ifndef PHYSVEC_H #define PHYSVEC_H // ---------------------------------------------------------------------- // // PhysVec.h Implementing some "convenience" notations for classes in // the PhysicsVectors package. // // History: // 04-Jun-1998 MF Initial version. // 15-Jun-1998 WEB Added namespace support // 08-Jan-2001 MF Removal of methods supported by CLHEP Vector // 09-Jan-2001 MF Use of rotation interfaces in methods // 04-Mar-2002 MF Back to using concrete rotations in methods // due to major limplification and inlining eliminating // much of the RotationInterface functionallity. // // ---------------------------------------------------------------------- // *** WARNING: // // Most of the features implemented in this header were intentionally // left out of the basic PhysicsVectors classes because their meanings // were either slightly ambiguous, or mathematically shaky, or because // they implicitly supported a trap of misuse that would not be caught // automatically. // // These convenient notations should be used with due care. #include "ZMutility/ZMenvironment.h" #ifndef HEP_ROTATION_INTERFACES_H #include "CLHEP/Vector/RotationInterfaces.h" #endif #ifndef HEP_THREEVECTOR_H #include "CLHEP/Vector/ThreeVector.h" #endif #ifndef UNITVECTOR_H #include "PhysicsVectors/UnitVector.h" #endif #ifndef HEP_LORENTZVECTOR_H #include "CLHEP/Vector/LorentzVector.h" #endif #ifndef HEP_ROTATION_H #include "CLHEP/Vector/Rotation.h" #endif #ifndef HEP_LORENTZROTATION_H #include "CLHEP/Vector/LorentzRotation.h" #endif ZM_BEGIN_NAMESPACE( zmpv ) /* namespace zmpv { */ //-------------------------------------- // // transposeOf (R) // transposeOf (T) // contraTransposeOf (T) // // This concept ties in closely with treating the matrix representation of the // transformation as the transformation itself. As might be expected, this is // convenient when implementing v*R. In the case of Rotation, the transpose is // the same as the inverse. // a a c da // The contraTranspose of a LorentzTransformation matrix L b is Lb = g L d g // bc // and is used to form a contravariant 4-vector from another by // right-multiplication. It is the transpose, with the space-time mixed // terms negated. //-------------------------------------- inline HepRotation transposeOf (const HepRotation & R) { return inverseOf (R); } HepLorentzRotation transposeOf (const HepLorentzRotation & T); HepLorentzRotation contraTransposeOf (const HepLorentzRotation & T); //------------------------------------- // // v = v*R // u = u*R // w = w*R w = w*T // // Right-multiplication of a vector by a Rotation mathematically results in // something similar to -- but not the same as -- a vector. In particular, // the only safe thing you can do combining such a "covariant vector" with // an ordinary "contravariant" vector is to take the dot product. With that // caveat, feel free to do x = v1*R*v2. x = v1*(R*v2) will be quicker. // // For 4-vectors, since the only class we have is by implication contravariant, // w*T gives a contravariant 4-vector defined by the relation // (w1*T) * w2 == w1 * (T*w2). This uses the "contraTranspose" of T. //-------------------------------------- inline Hep3Vector operator* ( const Hep3Vector & v, const HepRotation & R ) { return (transposeOf(R)) (v); } inline UnitVector operator* ( const UnitVector & u, const HepRotation & R ) { return (transposeOf(R)) (u); } inline HepLorentzVector operator* ( const HepLorentzVector & w, const HepRotation & R ) { return (transposeOf(R)) (w); } inline HepLorentzVector operator* ( const HepLorentzVector & w, const HepLorentzRotation & T ) { return (contraTransposeOf(T)) (w); } //------------------------------------- // // LorentzVec (x, y, z, t) // // This signature was not provided as a LorentzVector cosntructor because if // the user accidentally puts (t, x, y, z) that will compile and run but give // unintended answers. That is the reason we force the use of Tcomponent(t). // The way we "add a new signature" to the LorentzVector class is to define a // derived class LorentzVec. You can do anything with a LorentzVec that you // could with LorentzVector, except that it is constructed only from four pure // Float8 scalars. // // This entire matter is moot once CLHEP Vector is in. This constrcutor is // present for HepLorentzVector. // //------------------------------------- typedef HepLorentzVector LorentzVec; //------------------------------------- // // Removed: // x = v*v // x = w*w // // The v.dot(v) notation was selected for the basic package because some // people felt v*v ought to mean v.cross(v); thus the meaning of v*v would // unclear. Use this notation knowing that it is v.dot(v). For PlaneVector // and LorentzVector, the notation is unambiguous because cross products // make less sense. // // These were removed from here at CLHEP merge time because in CLHEP the // notations x = v*v and x = w*w are in fact first-class methods. // //------------------------------------ //------------------------------------- // // v = R*v // u = R*u // w = R*w w = T*w // // These are not present in the basic package because mathematically, there is // no compelling reason to tie application of a transformaion to matrix // multiplication by its representation. However, they are practical and safe. // // These were removed from here at CLHEP merge time because in CLHEP the // notations x = v*v and x = w*w are in fact first-class methods. // //-------------------------------------- ZM_END_NAMESPACE( zmpv ) /* } // namespace zmpv */ #endif // PHYSVEC_H