Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:16

0001 #ifndef KinematicParameters_H
0002 #define KinematicParameters_H
0003 
0004 #include "RecoVertex/KinematicFitPrimitives/interface/Matrices.h"
0005 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0006 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0007 
0008 /**
0009  * Class to store the 7-vector of
0010  * particle parameters: (x,y,z,p_x,p_y,p_z,m)
0011  *
0012  * Kirill Prokofiev Febrauary 2003
0013  */
0014 
0015 class KinematicParameters {
0016 public:
0017   typedef ROOT::Math::SVector<double, 7> AlgebraicVector7;
0018 
0019   KinematicParameters() : vl(false) {}
0020 
0021   template <typename... Args>
0022   KinematicParameters(Args... args) : par(args...), vl(true) {}
0023 
0024   KinematicParameters(const AlgebraicVector7& pr) : par(pr), vl(true) {}
0025 
0026   /**
0027    * \brief The full vector (7 elements)
0028    * 
0029    * The order of the parameters is (x,y,z,p_x,p_y,p_z,m)
0030    */
0031   AlgebraicVector7 const& vector() const { return par; }
0032 
0033   /**
0034    * \brief Allows to access directly one component of the vector (index between 0 and 6)
0035    * 
0036    * The order of the parameters is (x,y,z,p_x,p_y,p_z,m)
0037    */
0038   double operator()(const int i) const { return par(i); }
0039 
0040   /**
0041    * The momentum vector
0042    */
0043   GlobalVector momentum() const { return GlobalVector(par[3], par[4], par[5]); }
0044 
0045   /**
0046    * The position of the state
0047    */
0048   GlobalPoint position() const { return GlobalPoint(par[0], par[1], par[2]); }
0049 
0050   /**
0051    * The mass of the particle
0052    */
0053   double mass() const { return par(6); }
0054 
0055   /**
0056    * The energy of the particle
0057    */
0058   double energy() const { return sqrt(par(3) * par(3) + par(4) * par(4) + par(5) * par(5) + par(6) * par(6)); }
0059 
0060   bool isValid() const { return vl; }
0061 
0062 private:
0063   AlgebraicVector7 par;
0064   bool vl;
0065 };
0066 
0067 #endif