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};
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
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 fitProb(const unsigned& cmb=0) const { return (cmb<fitProb_.size() ? fitProb_[cmb] : -1.); }
00090 int correspondingHypo(const std::string& key1, const unsigned& hyp1, const std::string& key2) const { return correspondingHypo(hypoClassKeyFromString(key1), hyp1, hypoClassKeyFromString(key2) ); };
00092 int correspondingHypo(const HypoClassKey& key1, const unsigned& hyp1, const HypoClassKey& key2) const;
00093
00095 void printParticle(edm::LogInfo &log, const char* name, const reco::Candidate* cand) const;
00096
00098 void setLepDecays(const WDecay::LeptonType& lepDecTop1, const WDecay::LeptonType& lepDecTop2) { lepDecays_=std::make_pair(lepDecTop1, lepDecTop2); };
00100 void setGenEvent(const edm::Handle<TtGenEvent>& evt) { genEvt_=edm::RefProd<TtGenEvent>(evt); };
00102 void addEventHypo(const HypoClassKey& key, HypoCombPair hyp) { evtHyp_[key].push_back(hyp); };
00104 void setGenMatchSumPt(const std::vector<double>& val) {genMatchSumPt_=val;};
00106 void setGenMatchSumDR(const std::vector<double>& val) {genMatchSumDR_=val;};
00108 void setMvaMethod(const std::string& name) { mvaMethod_=name; };
00110 void setMvaDiscriminators(const std::vector<double>& val) { mvaDisc_=val; };
00112 void setFitChi2(const std::vector<double>& val) { fitChi2_=val; };
00114 void setFitProb(const std::vector<double>& val) { fitProb_=val; };
00115
00116 protected:
00117
00119 std::pair<WDecay::LeptonType, WDecay::LeptonType> lepDecays_;
00121 edm::RefProd<TtGenEvent> genEvt_;
00124 std::map<HypoClassKey, std::vector<HypoCombPair> > evtHyp_;
00125
00127 std::vector<double> fitChi2_;
00129 std::vector<double> fitProb_;
00131 std::vector<double> genMatchSumPt_;
00133 std::vector<double> genMatchSumDR_;
00135 std::string mvaMethod_;
00137 std::vector<double> mvaDisc_;
00138 };
00139
00140 #endif