CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/PatCandidates/interface/MET.h

Go to the documentation of this file.
00001 //
00002 // $Id: MET.h,v 1.20 2010/08/09 14:39:00 mbluj Exp $
00003 //
00004 
00005 #ifndef DataFormats_PatCandidates_MET_h
00006 #define DataFormats_PatCandidates_MET_h
00007 
00023 #include "DataFormats/METReco/interface/CaloMET.h"
00024 #include "DataFormats/METReco/interface/PFMET.h"
00025 #include "DataFormats/METReco/interface/GenMET.h"
00026 #include "DataFormats/PatCandidates/interface/PATObject.h"
00027 
00028 
00029 // Define typedefs for convenience
00030 namespace pat {
00031   class MET;
00032   typedef std::vector<MET>              METCollection; 
00033   typedef edm::Ref<METCollection>       METRef; 
00034   typedef edm::RefVector<METCollection> METRefVector; 
00035 }
00036 
00037 
00038 // Class definition
00039 namespace pat {
00040 
00041 
00042   class MET : public PATObject<reco::MET> {
00043 
00044     public:
00045 
00047       MET();
00049       MET(const reco::MET & aMET);
00051       MET(const edm::RefToBase<reco::MET> & aMETRef);
00053       MET(const edm::Ptr<reco::MET> & aMETRef);
00055       virtual ~MET();
00056 
00058       virtual MET * clone() const { return new MET(*this); }
00059 
00060       // ---- methods for generated MET link ----
00062       const reco::GenMET * genMET() const;
00064       void setGenMET(const reco::GenMET & gm);
00065 
00066       // ---- methods for MET corrections ----
00074       unsigned int nCorrections() const;
00075       enum UncorrectionType {
00076         uncorrNONE = -1, 
00077         uncorrALL = 0, 
00078         uncorrJES,     
00079         uncorrMUON,    
00080         uncorrTAU,    
00081         uncorrMAXN
00082       };
00083       float corEx(UncorrectionType ix = uncorrALL) const;
00084       float corEy(UncorrectionType ix = uncorrALL) const;
00085       float corSumEt(UncorrectionType ix = uncorrALL) const;
00086       float uncorrectedPt(UncorrectionType ix = uncorrALL) const;
00087       float uncorrectedPhi(UncorrectionType ix = uncorrALL) const;
00088 
00089       // ---- methods to know what the pat::MET was constructed from ----
00091       bool isCaloMET() const { return !caloMET_.empty(); }
00093       bool isPFMET() const { return !pfMET_.empty(); }
00095       bool isRecoMET() const { return  ( caloMET_.empty() && pfMET_.empty() ); }
00096 
00097       // ---- methods for CaloMET specific stuff ----
00099       double maxEtInEmTowers() const {return caloSpecific().MaxEtInEmTowers;}
00101       double maxEtInHadTowers() const {return caloSpecific().MaxEtInHadTowers;}
00103       double etFractionHadronic () const {return caloSpecific().EtFractionHadronic;}
00105       double emEtFraction() const {return caloSpecific().EtFractionEm;}
00107       double hadEtInHB() const {return caloSpecific().HadEtInHB;}
00109       double hadEtInHO() const {return caloSpecific().HadEtInHO;}
00111       double hadEtInHE() const {return caloSpecific().HadEtInHE;}
00113       double hadEtInHF() const {return caloSpecific().HadEtInHF;}
00115       double emEtInEB() const {return caloSpecific().EmEtInEB;}
00117       double emEtInEE() const {return caloSpecific().EmEtInEE;}
00119       double emEtInHF() const {return caloSpecific().EmEtInHF;}
00121       double metSignificance() const {return caloSpecific().METSignificance;}
00123       double CaloSETInpHF() const {return caloSpecific().CaloSETInpHF;}
00125       double CaloSETInmHF() const {return caloSpecific().CaloSETInmHF;}
00127       double CaloMETInpHF() const {return caloSpecific().CaloMETInpHF;}
00129       double CaloMETInmHF() const {return caloSpecific().CaloMETInmHF;}
00131       double CaloMETPhiInpHF() const {return caloSpecific().CaloMETPhiInpHF;}
00133       double CaloMETPhiInmHF() const {return caloSpecific().CaloMETPhiInmHF;}
00135       const SpecificCaloMETData & caloSpecific() const {
00136           if (!isCaloMET()) throw cms::Exception("pat::MET") << "This pat::MET has not been made from a reco::CaloMET\n";
00137           return caloMET_[0];
00138       }
00139 
00140       // ---- methods for PFMET specific stuff ----
00141       double NeutralEMFraction() const { return pfSpecific().NeutralEMFraction; }
00142       double NeutralHadEtFraction() const { return pfSpecific().NeutralHadFraction; }
00143       double ChargedEMEtFraction() const { return pfSpecific().ChargedEMFraction; }
00144       double ChargedHadEtFraction() const { return pfSpecific().ChargedHadFraction; }
00145       double MuonEtFraction() const { return pfSpecific().MuonFraction; }
00146       double Type6EtFraction() const { return pfSpecific().Type6Fraction; }
00147       double Type7EtFraction() const { return pfSpecific().Type7Fraction; }
00149       const SpecificPFMETData & pfSpecific() const {
00150           if (!isPFMET()) throw cms::Exception("pat::MET") << "This pat::MET has not been made from a reco::PFMET\n";
00151           return pfMET_[0];
00152       }
00153 
00154     protected:
00155 
00156       // ---- GenMET holder ----
00157       std::vector<reco::GenMET> genMET_;
00158       // ---- holder for CaloMET specific info ---
00159       std::vector<SpecificCaloMETData> caloMET_;
00160       // ---- holder for pfMET specific info ---
00161       std::vector<SpecificPFMETData> pfMET_;
00162 
00163       // ---- members for MET corrections ----
00164       struct UncorInfo {
00165         UncorInfo(): corEx(0), corEy(0), corSumEt(0), pt(0), phi(0) {}
00166         float corEx;
00167         float corEy;
00168         float corSumEt;
00169         float pt;
00170         float phi;
00171       };
00172       // uncorrection transients
00173       mutable std::vector<UncorInfo> uncorInfo_;
00174       mutable unsigned int nCorrections_;
00175       mutable float oldPt_;
00176       
00177     protected:
00178 
00179       // ---- non-public correction utilities ----
00180       void checkUncor_() const;
00181       void setPtPhi_(UncorInfo& uci) const;
00182 
00183   };
00184 
00185 
00186 }
00187 
00188 #endif