CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/TopQuarkAnalysis/TopJetCombination/interface/TtFullHadHypothesis.h

Go to the documentation of this file.
00001 #ifndef TtFullHadHypothesis_h
00002 #define TtFullHadHypothesis_h
00003 
00004 #include <memory>
00005 #include <vector>
00006 
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "FWCore/Framework/interface/EDProducer.h"
00009 #include "FWCore/Framework/interface/Frameworkfwd.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 
00012 #include "DataFormats/PatCandidates/interface/Jet.h"
00013 #include "DataFormats/Candidate/interface/ShallowClonePtrCandidate.h"
00014 
00015 #include "AnalysisDataFormats/TopObjects/interface/TtFullHadronicEvent.h"
00016 
00017 /*
00018    \class   TtFullHadHypothesis TtFullHadHypothesis.h "TopQuarkAnalysis/TopJetCombination/interface/TtFullHadHypothesis.h"
00019 
00020    \brief   Interface class for the creation of full-hadronic ttbar event hypotheses
00021 
00022    The class provides an interface for the creation of full-hadronic ttbar event hypotheses. Input information is read 
00023    from the event content and the proper candidate creation is taken care of. Hypotheses are characterized by the 
00024    CompositeCandidate made of a ttbar pair (including all its decay products in a parton level interpretation) and an 
00025    enumerator type key to specify the algorithm to determine the candidate (hypothesis cklass). The buildKey and the 
00026    buildHypo class have to implemented by derived classes.
00027 **/
00028 
00029 class TtFullHadHypothesis : public edm::EDProducer {
00030 
00031  public:
00033   explicit TtFullHadHypothesis(const edm::ParameterSet& cfg);
00035   ~TtFullHadHypothesis();
00036 
00037  protected:
00039   virtual void produce(edm::Event&, const edm::EventSetup&);
00041   void resetCandidates();
00044   std::string jetCorrectionLevel(const std::string& quarkType);
00046   template <typename C>
00047   void setCandidate(const edm::Handle<C>& handle, const int& idx, reco::ShallowClonePtrCandidate*& clone);
00049   void setCandidate(const edm::Handle<std::vector<pat::Jet> >& handle, const int& idx, reco::ShallowClonePtrCandidate*& clone, const std::string& correctionLevel);
00051   int key() const { return key_; };
00053   reco::CompositeCandidate hypo();
00055   bool isValid(const int& idx, const edm::Handle<std::vector<pat::Jet> >& jets){ return (0<=idx && idx<(int)jets->size()); };
00056 
00057   // -----------------------------------------
00058   // implemet the following two functions
00059   // for a concrete event hypothesis
00060   // -----------------------------------------
00061 
00063   virtual void buildKey() = 0;
00065   virtual void buildHypo(edm::Event& event,
00066                          const edm::Handle<std::vector<pat::Jet> >& jets, 
00067                          std::vector<int>& jetPartonAssociation,
00068                          const unsigned int iComb) = 0;
00069 
00070  protected:
00073   bool getMatch_;
00075   edm::InputTag jets_;
00076   edm::InputTag match_;
00079   std::string jetCorrectionLevel_;
00081   int key_;
00084   reco::ShallowClonePtrCandidate *lightQ_;
00085   reco::ShallowClonePtrCandidate *lightQBar_;
00086   reco::ShallowClonePtrCandidate *b_;
00087   reco::ShallowClonePtrCandidate *bBar_;
00088   reco::ShallowClonePtrCandidate *lightP_;
00089   reco::ShallowClonePtrCandidate *lightPBar_;
00090 };
00091 
00092 // has to be placed in the header since otherwise the function template
00093 // would cause unresolved references in classes derived from this base class
00094 template<typename C>
00095 void
00096 TtFullHadHypothesis::setCandidate(const edm::Handle<C>& handle, const int& idx, reco::ShallowClonePtrCandidate* &clone) {
00097   typedef typename C::value_type O;
00098   edm::Ptr<O> ptr = edm::Ptr<O>(handle, idx);
00099   clone = new reco::ShallowClonePtrCandidate( ptr, ptr->charge(), ptr->p4(), ptr->vertex() );
00100 }
00101 #endif