CMS 3D CMS Logo

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 #include "DataFormats/Common/interface/BoolCache.h"
00009 
00010 namespace pat {
00011   class CandKinResolution  {
00032      public:
00033         typedef math::XYZTLorentzVector LorentzVector;
00034         typedef float Scalar;
00035 
00036         enum Parametrization { Invalid=0, 
00037                 // 4D = 0xN4
00038                 Cart          = 0x04, 
00039                 ECart         = 0x14, 
00040                 Spher         = 0x24, 
00041                 ESpher        = 0x34, 
00042                 MomDev        = 0x44, 
00043                 EMomDev       = 0x54, 
00044                 // 3D =0xN3
00045                 MCCart        = 0x03, 
00046                 MCSpher       = 0x13, 
00047                 MCPInvSpher   = 0x23, 
00048                 EtEtaPhi      = 0x33, 
00049                 EtThetaPhi    = 0x43,
00050                 MCMomDev      = 0x53, 
00051                 EScaledMomDev = 0x63
00052                 };
00053         CandKinResolution() ; 
00054 
00063         CandKinResolution(Parametrization parametrization, const std::vector<Scalar> &covariances, 
00064                             const std::vector<Scalar> &constraints = std::vector<Scalar>()) ;
00065 
00067         CandKinResolution(Parametrization parametrization, const AlgebraicSymMatrix44 &covariance,
00068                             const std::vector<Scalar> &constraints = std::vector<Scalar>()) ;
00069         ~CandKinResolution() ;
00070 
00072         Parametrization parametrization() const { return parametrization_; }
00073 
00075         uint32_t dimension() const { 
00076             return (static_cast<uint32_t>(parametrization_) & 0x0F);
00077         }
00078 
00080         const AlgebraicSymMatrix44 & covariance()  const { 
00081             if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00082             return covmatrix_; 
00083         }
00084 
00086         const std::vector<Scalar> & constraints() const { return constraints_; }
00087 
00089         double resolEta(const LorentzVector &p4) const ;
00090 
00092         double resolTheta(const LorentzVector &p4) const ;
00093 
00095         double resolPhi(const LorentzVector &p4) const ;
00096 
00098         double resolE(const LorentzVector &p4) const ;
00099 
00101         double resolEt(const LorentzVector &p4) const ;
00102 
00105         double resolM(const LorentzVector &p4) const ;
00106 
00108         double resolP(const LorentzVector &p4) const ;
00109 
00111         double resolPt(const LorentzVector &p4) const ;
00112 
00114         double resolPInv(const LorentzVector &p4) const ;
00115 
00117         double resolPx(const LorentzVector &p4) const ;
00118 
00120         double resolPy(const LorentzVector &p4) const ;
00121 
00123         double resolPz(const LorentzVector &p4) const ;
00124 
00125      private:
00126         // persistent 
00128         Parametrization parametrization_;
00130         std::vector<Scalar> covariances_;
00132         std::vector<Scalar> constraints_;
00133 
00134         // transient
00135 
00137         mutable edm::BoolCache       hasMatrix_;
00138     
00140         mutable AlgebraicSymMatrix44 covmatrix_;
00141 
00142         //methods
00143 
00145         void fillMatrix() const ; // const: the matrix is mutable
00146 
00148         void fillVector() ;
00149   };
00150 
00151   typedef std::vector<CandKinResolution>   CandKinResolutionCollection;
00152   typedef edm::ValueMap<CandKinResolution> CandKinResolutionValueMap;
00153 }
00154 
00155 #endif

Generated on Tue Jun 9 17:31:23 2009 for CMSSW by  doxygen 1.5.4