Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:09

0001 // @(#)root/mathcore:$Id$
0002 // Authors: W. Brown, M. Fischler, L. Moneta    2005
0003 
0004  /**********************************************************************
0005   *                                                                    *
0006   * Copyright (c) 2005 ROOT FNAL MathLib Team                          *
0007   *                                                                    *
0008   *                                                                    *
0009   **********************************************************************/
0010 
0011 // Header file for BoostZ
0012 //
0013 // Created by: Mark Fischler  Mon Nov 1  2005
0014 //
0015 // Last update: $Id$
0016 //
0017 #ifndef ROOT_Math_GenVector_BoostZ
0018 #define ROOT_Math_GenVector_BoostZ 1
0019 
0020 #include "Math/GenVector/LorentzVector.h"
0021 #include "Math/GenVector/PxPyPzE4D.h"
0022 #include "Math/GenVector/DisplacementVector3D.h"
0023 #include "Math/GenVector/Cartesian3D.h"
0024 
0025 namespace ROOT {
0026 
0027   namespace Math {
0028 
0029 //__________________________________________________________________________________________
0030    /**
0031       Class representing a Lorentz Boost along the Z axis, by beta.
0032       For efficiency, gamma is held as well.
0033 
0034       @ingroup GenVector
0035 
0036       @sa Overview of the @ref GenVector "physics vector library"
0037    */
0038 
0039 class BoostZ {
0040 
0041 public:
0042 
0043    typedef double Scalar;
0044 
0045    enum ELorentzRotationMatrixIndex {
0046       kLXX =  0, kLXY =  1, kLXZ =  2, kLXT =  3
0047     , kLYX =  4, kLYY =  5, kLYZ =  6, kLYT =  7
0048     , kLZX =  8, kLZY =  9, kLZZ = 10, kLZT = 11
0049     , kLTX = 12, kLTY = 13, kLTZ = 14, kLTT = 15
0050    };
0051 
0052    enum EBoostMatrixIndex {
0053       kXX =  0, kXY =  1, kXZ =  2, kXT =  3
0054       , kYY =  4, kYZ =  5, kYT =  6
0055       , kZZ =  7, kZT =  8
0056       , kTT =  9
0057    };
0058 
0059    // ========== Constructors and Assignment =====================
0060 
0061    /**
0062       Default constructor (identity transformation)
0063    */
0064    BoostZ();
0065 
0066    /**
0067       Construct given a Scalar beta_z
0068    */
0069    explicit BoostZ(Scalar beta_z) { SetComponents(beta_z); }
0070 
0071 
0072    // The compiler-generated copy ctor, copy assignment, and dtor are OK.
0073 
0074    /**
0075       Re-adjust components to eliminate small deviations from a perfect
0076       orthosyplectic matrix.
0077    */
0078    void Rectify();
0079 
0080    // ======== Components ==============
0081 
0082    /**
0083       Set components from a Scalar beta_z
0084    */
0085    void
0086    SetComponents (Scalar beta_z);
0087 
0088    /**
0089       Get components into a Scalar beta_z
0090    */
0091    void
0092    GetComponents (Scalar& beta_z) const;
0093 
0094 
0095    /**
0096        Retrieve the beta of the Boost
0097    */
0098    Scalar Beta() const { return fBeta; }
0099 
0100    /**
0101        Retrieve the gamma of the Boost
0102    */
0103    Scalar Gamma() const { return fGamma; }
0104 
0105    /**
0106        Set the given beta of the Boost
0107    */
0108    void  SetBeta(Scalar beta) { SetComponents(beta); }
0109 
0110    /**
0111       The beta vector for this boost
0112    */
0113    typedef  DisplacementVector3D<Cartesian3D<double>, DefaultCoordinateSystemTag > XYZVector;
0114    XYZVector BetaVector() const;
0115 
0116    /**
0117       Get elements of internal 4x4 symmetric representation, into a data
0118       array suitable for direct use as the components of a LorentzRotation
0119       Note -- 16 Scalars will be written into the array; if the array is not
0120       that large, then this will lead to undefined behavior.
0121    */
0122    void
0123    GetLorentzRotation (Scalar r[]) const;
0124 
0125    // =========== operations ==============
0126 
0127    /**
0128       Lorentz transformation operation on a Minkowski ('Cartesian')
0129       LorentzVector
0130    */
0131    LorentzVector< ROOT::Math::PxPyPzE4D<double> >
0132    operator() (const LorentzVector< ROOT::Math::PxPyPzE4D<double> > & v) const;
0133 
0134    /**
0135       Lorentz transformation operation on a LorentzVector in any
0136       coordinate system
0137    */
0138    template <class CoordSystem>
0139    LorentzVector<CoordSystem>
0140    operator() (const LorentzVector<CoordSystem> & v) const {
0141       LorentzVector< PxPyPzE4D<double> > xyzt(v);
0142       LorentzVector< PxPyPzE4D<double> > r_xyzt = operator()(xyzt);
0143       return LorentzVector<CoordSystem> ( r_xyzt );
0144    }
0145 
0146    /**
0147       Lorentz transformation operation on an arbitrary 4-vector v.
0148       Preconditions:  v must implement methods x(), y(), z(), and t()
0149       and the arbitrary vector type must have a constructor taking (x,y,z,t)
0150    */
0151    template <class Foreign4Vector>
0152    Foreign4Vector
0153    operator() (const Foreign4Vector & v) const {
0154       LorentzVector< PxPyPzE4D<double> > xyzt(v);
0155       LorentzVector< PxPyPzE4D<double> > r_xyzt = operator()(xyzt);
0156       return Foreign4Vector ( r_xyzt.X(), r_xyzt.Y(), r_xyzt.Z(), r_xyzt.T() );
0157    }
0158 
0159    /**
0160       Overload operator * for boost on a vector
0161    */
0162    template <class A4Vector>
0163    inline
0164    A4Vector operator* (const A4Vector & v) const
0165    {
0166       return operator()(v);
0167    }
0168 
0169    /**
0170       Invert a BoostZ in place
0171    */
0172    void Invert();
0173 
0174    /**
0175       Return inverse of  a BoostZ
0176    */
0177    BoostZ Inverse() const;
0178 
0179    /**
0180       Equality/inequality operators
0181    */
0182    bool operator == (const BoostZ & rhs) const {
0183       if( fBeta  != rhs.fBeta  ) return false;
0184       if( fGamma != rhs.fGamma ) return false;
0185       return true;
0186    }
0187    bool operator != (const BoostZ & rhs) const {
0188       return ! operator==(rhs);
0189    }
0190 
0191 private:
0192 
0193    Scalar fBeta;    // boost beta z
0194    Scalar fGamma;   // boost gamma
0195 
0196 };  // BoostZ
0197 
0198 // ============ Class BoostZ ends here ============
0199 
0200 /**
0201    Stream Output and Input
0202  */
0203   // TODO - I/O should be put in the manipulator form
0204 
0205 std::ostream & operator<< (std::ostream & os, const BoostZ & b);
0206 
0207 
0208 } //namespace Math
0209 } //namespace ROOT
0210 
0211 
0212 
0213 
0214 
0215 
0216 
0217 #endif /* ROOT_Math_GenVector_BoostZ  */