CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DataFormats/PatCandidates/interface/CandKinResolution.h

Go to the documentation of this file.
00001 #ifndef DataFormats_PatCandidates_CandKinResolution_h
00002 #define DataFormats_PatCandidates_CandKinResolution_h
00003 #include <vector>
00004 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
00005 #include "DataFormats/Math/interface/LorentzVector.h"
00006 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00007 #include "DataFormats/Common/interface/ValueMap.h"
00008 
00009 namespace pat {
00010   class CandKinResolution  {
00031      public:
00032         typedef math::XYZTLorentzVector LorentzVector;
00033         typedef float Scalar;
00034 
00035         enum Parametrization { Invalid=0, 
00036                 // 4D = 0xN4
00037                 Cart          = 0x04, 
00038                 ECart         = 0x14, 
00039                 Spher         = 0x24, 
00040                 ESpher        = 0x34, 
00041                 MomDev        = 0x44, 
00042                 EMomDev       = 0x54, 
00043                 // 3D =0xN3
00044                 MCCart        = 0x03, 
00045                 MCSpher       = 0x13, 
00046                 MCPInvSpher   = 0x23, 
00047                 EtEtaPhi      = 0x33, 
00048                 EtThetaPhi    = 0x43,
00049                 MCMomDev      = 0x53, 
00050                 EScaledMomDev = 0x63
00051                 };
00052         CandKinResolution() ; 
00053 
00062         CandKinResolution(Parametrization parametrization, const std::vector<Scalar> &covariances, 
00063                             const std::vector<Scalar> &constraints = std::vector<Scalar>()) ;
00064 
00066         CandKinResolution(Parametrization parametrization, const AlgebraicSymMatrix44 &covariance,
00067                             const std::vector<Scalar> &constraints = std::vector<Scalar>()) ;
00068         ~CandKinResolution() ;
00069 
00071         Parametrization parametrization() const { return parametrization_; }
00072 
00074         uint32_t dimension() const { 
00075             return (static_cast<uint32_t>(parametrization_) & 0x0F);
00076         }
00077 
00079         const AlgebraicSymMatrix44 & covariance()  const { 
00080             if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00081             return covmatrix_; 
00082         }
00083 
00085         const std::vector<Scalar> & constraints() const { return constraints_; }
00086 
00088         double resolEta(const LorentzVector &p4) const ;
00089 
00091         double resolTheta(const LorentzVector &p4) const ;
00092 
00094         double resolPhi(const LorentzVector &p4) const ;
00095 
00097         double resolE(const LorentzVector &p4) const ;
00098 
00100         double resolEt(const LorentzVector &p4) const ;
00101 
00104         double resolM(const LorentzVector &p4) const ;
00105 
00107         double resolP(const LorentzVector &p4) const ;
00108 
00110         double resolPt(const LorentzVector &p4) const ;
00111 
00113         double resolPInv(const LorentzVector &p4) const ;
00114 
00116         double resolPx(const LorentzVector &p4) const ;
00117 
00119         double resolPy(const LorentzVector &p4) const ;
00120 
00122         double resolPz(const LorentzVector &p4) const ;
00123 
00124      private:
00125         // persistent 
00127         Parametrization parametrization_;
00129         std::vector<Scalar> covariances_;
00131         std::vector<Scalar> constraints_;
00132 
00133         // transient
00134 
00136         mutable bool       hasMatrix_;
00137     
00139         mutable AlgebraicSymMatrix44 covmatrix_;
00140 
00141         //methods
00142 
00144         void fillMatrix() const ; // const: the matrix is mutable
00145 
00147         void fillVector() ;
00148   };
00149 
00150   typedef std::vector<CandKinResolution>   CandKinResolutionCollection;
00151   typedef edm::ValueMap<CandKinResolution> CandKinResolutionValueMap;
00152 }
00153 
00154 #endif