CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/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   int numberOfConsideredJets(const std::string& key) const { return numberOfConsideredJets(hypoClassKeyFromString(key) ); };
00076   int numberOfConsideredJets(const HypoClassKey& key) const { return (isHypoAvailable(key) ? nJetsConsidered_.find(key)->second : -1); };
00078   std::vector<int> jetLeptonCombination(const std::string& key, const unsigned& cmb=0) const { return jetLeptonCombination(hypoClassKeyFromString(key), cmb); };
00080   std::vector<int> jetLeptonCombination(const HypoClassKey& key, const unsigned& cmb=0) const { return (evtHyp_.find(key)->second)[cmb].second; };
00082   double genMatchSumPt(const unsigned& cmb=0) const { return (cmb<genMatchSumPt_.size() ? genMatchSumPt_[cmb] : -1.); };
00084   double genMatchSumDR(const unsigned& cmb=0) const { return (cmb<genMatchSumDR_.size() ? genMatchSumDR_[cmb] : -1.); };
00086   std::string mvaMethod() const { return mvaMethod_; }
00088   double mvaDisc(const unsigned& cmb=0) const { return (cmb<mvaDisc_.size() ? mvaDisc_[cmb] : -1.); }
00090   double fitChi2(const unsigned& cmb=0) const { return (cmb<fitChi2_.size() ? fitChi2_[cmb] : -1.); }
00092   double hitFitChi2(const unsigned& cmb=0) const { return (cmb<hitFitChi2_.size() ? hitFitChi2_[cmb] : -1.); }
00094   double fitProb(const unsigned& cmb=0) const { return (cmb<fitProb_.size() ? fitProb_[cmb] : -1.); }
00096   double hitFitProb(const unsigned& cmb=0) const { return (cmb<hitFitProb_.size() ? hitFitProb_[cmb] : -1.); }
00098   double hitFitMT(const unsigned& cmb=0) const { return (cmb<hitFitMT_.size() ? hitFitMT_[cmb] : -1.); }
00100   double hitFitSigMT(const unsigned& cmb=0) const { return (cmb<hitFitSigMT_.size() ? hitFitSigMT_[cmb] : -1.); }
00102   int correspondingHypo(const std::string& key1, const unsigned& hyp1, const std::string& key2) const { return correspondingHypo(hypoClassKeyFromString(key1), hyp1, hypoClassKeyFromString(key2) ); };
00104   int correspondingHypo(const HypoClassKey& key1, const unsigned& hyp1, const HypoClassKey& key2) const;
00105 
00107   const reco::Candidate* topPair(const std::string& key, const unsigned& cmb=0) const { return topPair(hypoClassKeyFromString(key), cmb); };
00109   const reco::Candidate* topPair(const HypoClassKey& key, const unsigned& cmb=0) const { return !isHypoValid(key,cmb) ? 0 : (reco::Candidate*)&eventHypo(key,cmb); };
00111   const math::XYZTLorentzVector* topPair() const { return (!genEvt_ ? 0 : this->genEvent()->topPair()); };
00112 
00114   void printParticle(edm::LogInfo &log, const char* name, const reco::Candidate* cand) const;
00115 
00117   void setLepDecays(const WDecay::LeptonType& lepDecTop1, const WDecay::LeptonType& lepDecTop2) { lepDecays_=std::make_pair(lepDecTop1, lepDecTop2); };
00119   void setGenEvent(const edm::Handle<TtGenEvent>& evt) { genEvt_=edm::RefProd<TtGenEvent>(evt); };
00121   void addEventHypo(const HypoClassKey& key, const HypoCombPair hyp) { evtHyp_[key].push_back(hyp); };
00123   void setNumberOfConsideredJets(const HypoClassKey& key, const unsigned int nJets) { nJetsConsidered_[key]=nJets; };
00125   void setGenMatchSumPt(const std::vector<double>& val) {genMatchSumPt_=val;};
00127   void setGenMatchSumDR(const std::vector<double>& val) {genMatchSumDR_=val;};
00129   void setMvaMethod(const std::string& name) { mvaMethod_=name; };
00131   void setMvaDiscriminators(const std::vector<double>& val) { mvaDisc_=val; };
00133   void setFitChi2(const std::vector<double>& val) { fitChi2_=val; };
00135   void setHitFitChi2(const std::vector<double>& val) { hitFitChi2_=val; };
00137   void setFitProb(const std::vector<double>& val) { fitProb_=val; };
00139   void setHitFitProb(const std::vector<double>& val) { hitFitProb_=val; };
00141   void setHitFitMT(const std::vector<double>& val) { hitFitMT_=val; };
00143   void setHitFitSigMT(const std::vector<double>& val) { hitFitSigMT_=val; };
00144 
00145  protected:
00146 
00148   std::pair<WDecay::LeptonType, WDecay::LeptonType> lepDecays_;
00150   edm::RefProd<TtGenEvent> genEvt_;
00153   std::map<HypoClassKey, std::vector<HypoCombPair> > evtHyp_;
00155   std::map<HypoClassKey, int> nJetsConsidered_;
00156   
00158   std::vector<double> fitChi2_;        
00159   std::vector<double> hitFitChi2_;
00161   std::vector<double> fitProb_; 
00162   std::vector<double> hitFitProb_;
00164   std::vector<double> hitFitMT_; 
00165   std::vector<double> hitFitSigMT_; 
00167   std::vector<double> genMatchSumPt_;  
00169   std::vector<double> genMatchSumDR_;   
00171   std::string mvaMethod_;               
00173   std::vector<double> mvaDisc_;         
00174 };
00175 
00176 #endif