CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/TopQuarkAnalysis/TopTools/interface/JetPartonMatching.h

Go to the documentation of this file.
00001 #ifndef JetPartonMatching_h
00002 #define JetPartonMatching_h
00003 
00004 #include "DataFormats/JetReco/interface/GenJet.h"
00005 #include "DataFormats/JetReco/interface/CaloJet.h"
00006 #include "DataFormats/PatCandidates/interface/Jet.h"
00007 #include "DataFormats/Candidate/interface/Candidate.h"
00008 
00009 #include <vector>
00010 
00011 class JetPartonMatching {
00012   // common class for jet parton matching in ttbar
00013   // decays. Several matching algorithms are provided
00014  public:
00015 
00016   typedef std::vector< std::pair<unsigned int, int> > MatchingCollection;
00017   enum algorithms { totalMinDist, minSumDist, ptOrderedMinDist, unambiguousOnly };
00018 
00019   JetPartonMatching(){};
00020   JetPartonMatching(const std::vector<const reco::Candidate*>&, const std::vector<reco::GenJet>&,
00021                     const int, const bool, const bool, const double);
00022   JetPartonMatching(const std::vector<const reco::Candidate*>&, const std::vector<reco::CaloJet>&,
00023                     const int, const bool, const bool, const double);
00024   JetPartonMatching(const std::vector<const reco::Candidate*>&, const std::vector<pat::Jet>&,
00025                     const int, const bool, const bool, const double);
00026   JetPartonMatching(const std::vector<const reco::Candidate*>&, const std::vector<const reco::Candidate*>&,
00027                     const int, const bool, const bool, const double);
00028   ~JetPartonMatching(){};       
00029   
00030   //matching meta information
00031   unsigned int getNumberOfAvailableCombinations() { return matching.size(); }
00032   int getNumberOfUnmatchedPartons(const unsigned int comb=0){ return (comb<numberOfUnmatchedPartons.size() ? (int)numberOfUnmatchedPartons[comb] : -1 ); }
00033   int getMatchForParton(const unsigned int part, const unsigned int comb=0);
00034   std::vector<int> getMatchesForPartons(const unsigned int comb=0);
00035   double getDistanceForParton(const unsigned int part, const unsigned int comb=0);
00036   double getSumDistances(const unsigned int comb=0);
00037 
00038   //matching quantities
00039   double getSumDeltaE (const unsigned int comb=0) { return (comb<sumDeltaE .size() ? sumDeltaE [comb] : -999.); }
00040   double getSumDeltaPt(const unsigned int comb=0) { return (comb<sumDeltaPt.size() ? sumDeltaPt[comb] : -999.); }
00041   double getSumDeltaR (const unsigned int comb=0) { return (comb<sumDeltaR .size() ? sumDeltaR [comb] : -999.); }
00042 
00043   void print();
00044   
00045  private:
00046   
00047   void calculate();
00048   double distance(const math::XYZTLorentzVector&, const math::XYZTLorentzVector&);
00049   void matchingTotalMinDist();
00050   void minSumDist_recursion(const unsigned int, std::vector<unsigned int>&, std::vector<bool>&, std::vector<std::pair<double, MatchingCollection> >&);
00051   void matchingMinSumDist();
00052   void matchingPtOrderedMinDist();
00053   void matchingUnambiguousOnly();
00054   
00055  private:
00056  
00057   std::vector<const reco::Candidate*> partons;
00058   std::vector<const reco::Candidate*> jets;
00059   std::vector<MatchingCollection> matching;
00060   
00061   std::vector<unsigned int> numberOfUnmatchedPartons;
00062   std::vector<double> sumDeltaE;
00063   std::vector<double> sumDeltaPt;
00064   std::vector<double> sumDeltaR;
00065   
00066   int algorithm_;
00067   bool useMaxDist_;
00068   bool useDeltaR_;
00069   double maxDist_;
00070 };
00071 
00072 #endif