CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/AnalysisDataFormats/TopObjects/interface/TtEvent.h

Go to the documentation of this file.
00001 #ifndef TopObjects_TtEvent_h
00002 #define TopObjects_TtEvent_h
00003 
00004 #include <vector>
00005 #include <string>
00006 
00007 #include "DataFormats/Common/interface/Handle.h"
00008 #include "DataFormats/Common/interface/RefProd.h"
00009 #include "DataFormats/Candidate/interface/CompositeCandidate.h"
00010 #include "AnalysisDataFormats/TopObjects/interface/TtGenEvent.h"
00011 
00023 namespace edm{
00024   class LogInfo;
00025 }
00026 
00027 class TtEvent {
00028 
00029  public:
00031   enum HypoClassKey {kGeom, kWMassMaxSumPt, kMaxSumPtWMass, kGenMatch, kMVADisc, kKinFit, kKinSolution, kWMassDeltaTopMass, kHitFit};
00033   typedef std::pair<reco::CompositeCandidate, std::vector<int> > HypoCombPair;
00034 
00035  protected:
00037    struct HypoClassKeyStringToEnum { const char* label; HypoClassKey value; };
00039    HypoClassKey hypoClassKeyFromString(const std::string& label) const;
00040   
00041  public:
00043   TtEvent(){};
00045   virtual ~TtEvent(){};
00046 
00048   std::pair<WDecay::LeptonType, WDecay::LeptonType> lepDecays() const { return lepDecays_; }
00051   const reco::CompositeCandidate& eventHypo(const HypoClassKey& key, const unsigned& cmb=0) const { return (evtHyp_.find(key)->second)[cmb].first; };
00053   const edm::RefProd<TtGenEvent>& genEvent() const { return genEvt_; };
00054 
00056   bool isHypoClassAvailable(const std::string& key) const { return isHypoClassAvailable( hypoClassKeyFromString(key) ); };
00058   bool isHypoClassAvailable(const HypoClassKey& key) const { return (evtHyp_.find(key)!=evtHyp_.end()); };
00059   // check if hypothesis 'cmb' is available within the hypothesis class
00060   bool isHypoAvailable(const std::string& key, const unsigned& cmb=0) const { return isHypoAvailable( hypoClassKeyFromString(key), cmb ); };
00062   bool isHypoAvailable(const HypoClassKey& key, const unsigned& cmb=0) const { return isHypoClassAvailable(key) ? (cmb<evtHyp_.find(key)->second.size()) : false; };
00064   bool isHypoValid(const std::string& key, const unsigned& cmb=0) const { return isHypoValid( hypoClassKeyFromString(key), cmb ); };
00066   bool isHypoValid(const HypoClassKey& key, const unsigned& cmb=0) const { return isHypoAvailable(key, cmb) ? !eventHypo(key, cmb).roles().empty() : false; };
00068   unsigned int numberOfAvailableHypoClasses() const { return evtHyp_.size(); };
00070   unsigned int numberOfAvailableHypos(const std::string& key) const { return numberOfAvailableHypos( hypoClassKeyFromString(key) ); };
00072   unsigned int numberOfAvailableHypos(const HypoClassKey& key) const { return isHypoAvailable(key) ? evtHyp_.find(key)->second.size() : 0; };
00074   std::vector<int> jetLeptonCombination(const std::string& key, const unsigned& cmb=0) const { return jetLeptonCombination(hypoClassKeyFromString(key), cmb); };
00076   std::vector<int> jetLeptonCombination(const HypoClassKey& key, const unsigned& cmb=0) const { return (evtHyp_.find(key)->second)[cmb].second; };
00078   double genMatchSumPt(const unsigned& cmb=0) const { return (cmb<genMatchSumPt_.size() ? genMatchSumPt_[cmb] : -1.); };
00080   double genMatchSumDR(const unsigned& cmb=0) const { return (cmb<genMatchSumDR_.size() ? genMatchSumDR_[cmb] : -1.); };
00082   std::string mvaMethod() const { return mvaMethod_; }
00084   double mvaDisc(const unsigned& cmb=0) const { return (cmb<mvaDisc_.size() ? mvaDisc_[cmb] : -1.); }
00086   double fitChi2(const unsigned& cmb=0) const { return (cmb<fitChi2_.size() ? fitChi2_[cmb] : -1.); }
00088   double hitFitChi2(const unsigned& cmb=0) const { return (cmb<hitFitChi2_.size() ? hitFitChi2_[cmb] : -1.); }
00090   double fitProb(const unsigned& cmb=0) const { return (cmb<fitProb_.size() ? fitProb_[cmb] : -1.); }
00092   double hitFitProb(const unsigned& cmb=0) const { return (cmb<hitFitProb_.size() ? hitFitProb_[cmb] : -1.); }
00094   double hitFitMT(const unsigned& cmb=0) const { return (cmb<hitFitMT_.size() ? hitFitMT_[cmb] : -1.); }
00096   double hitFitSigMT(const unsigned& cmb=0) const { return (cmb<hitFitSigMT_.size() ? hitFitSigMT_[cmb] : -1.); }
00098   int correspondingHypo(const std::string& key1, const unsigned& hyp1, const std::string& key2) const { return correspondingHypo(hypoClassKeyFromString(key1), hyp1, hypoClassKeyFromString(key2) ); };
00100   int correspondingHypo(const HypoClassKey& key1, const unsigned& hyp1, const HypoClassKey& key2) const;
00101 
00103   void printParticle(edm::LogInfo &log, const char* name, const reco::Candidate* cand) const;
00104 
00106   void setLepDecays(const WDecay::LeptonType& lepDecTop1, const WDecay::LeptonType& lepDecTop2) { lepDecays_=std::make_pair(lepDecTop1, lepDecTop2); };
00108   void setGenEvent(const edm::Handle<TtGenEvent>& evt) { genEvt_=edm::RefProd<TtGenEvent>(evt); };
00110   void addEventHypo(const HypoClassKey& key, HypoCombPair hyp) { evtHyp_[key].push_back(hyp); };
00112   void setGenMatchSumPt(const std::vector<double>& val) {genMatchSumPt_=val;};
00114   void setGenMatchSumDR(const std::vector<double>& val) {genMatchSumDR_=val;};
00116   void setMvaMethod(const std::string& name) { mvaMethod_=name; };
00118   void setMvaDiscriminators(const std::vector<double>& val) { mvaDisc_=val; };
00120   void setFitChi2(const std::vector<double>& val) { fitChi2_=val; };
00122   void setHitFitChi2(const std::vector<double>& val) { hitFitChi2_=val; };
00124   void setFitProb(const std::vector<double>& val) { fitProb_=val; };
00126   void setHitFitProb(const std::vector<double>& val) { hitFitProb_=val; };
00128   void setHitFitMT(const std::vector<double>& val) { hitFitMT_=val; };
00130   void setHitFitSigMT(const std::vector<double>& val) { hitFitSigMT_=val; };
00131   
00132  protected:
00133 
00135    std::pair<WDecay::LeptonType, WDecay::LeptonType> lepDecays_;
00137   edm::RefProd<TtGenEvent> genEvt_;
00140   std::map<HypoClassKey, std::vector<HypoCombPair> > evtHyp_;
00141   
00143   std::vector<double> fitChi2_;        
00144   std::vector<double> hitFitChi2_;
00146   std::vector<double> fitProb_; 
00147   std::vector<double> hitFitProb_;
00149   std::vector<double> hitFitMT_; 
00150   std::vector<double> hitFitSigMT_; 
00152   std::vector<double> genMatchSumPt_;  
00154   std::vector<double> genMatchSumDR_;   
00156   std::string mvaMethod_;               
00158   std::vector<double> mvaDisc_;         
00159 };
00160 
00161 #endif