CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/TopQuarkAnalysis/TopJetCombination/interface/TtSemiLepHypothesis.h

Go to the documentation of this file.
00001 #ifndef TtSemiLepHypothesis_h
00002 #define TtSemiLepHypothesis_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/PatCandidates/interface/MET.h"
00014 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00015 #include "DataFormats/Candidate/interface/ShallowClonePtrCandidate.h"
00016 
00017 #include "AnalysisDataFormats/TopObjects/interface/TtSemiLeptonicEvent.h"
00018 
00019 /*
00020    \class   TtSemiLepHypothesis TtSemiLepHypothesis.h "TopQuarkAnalysis/TopJetCombination/interface/TtSemiLepHypothesis.h"
00021 
00022    \brief   Interface class for the creation of semi-leptonic ttbar event hypotheses
00023 
00024    The class provides an interface for the creation of semi-leptonic ttbar event hypotheses. Input information is read 
00025    from the event content and the proper candidate creation is taken care of. Hypotheses are characterized by the 
00026    CompositeCandidate made of a ttbar pair (including all its decay products in a parton level interpretation) and an 
00027    enumerator type key to specify the algorithm to determine the candidate (hypothesis cklass). The buildKey and the 
00028    buildHypo class have to implemented by derived classes.
00029 **/
00030 
00031 class TtSemiLepHypothesis : public edm::EDProducer {
00032 
00033  public:
00035   explicit TtSemiLepHypothesis(const edm::ParameterSet&);
00037   ~TtSemiLepHypothesis();
00038 
00039  protected:
00041   virtual void produce(edm::Event&, const edm::EventSetup&);
00043   void resetCandidates();
00046   std::string jetCorrectionLevel(const std::string& quarkType);
00048   template <typename C>
00049   void setCandidate(const edm::Handle<C>& handle, const int& idx, reco::ShallowClonePtrCandidate*& clone);
00051   void setCandidate(const edm::Handle<std::vector<pat::Jet> >& handle, const int& idx, reco::ShallowClonePtrCandidate*& clone, const std::string& correctionLevel);
00053   void setNeutrino(const edm::Handle<std::vector<pat::MET> >& met, const edm::Handle<edm::View<reco::RecoCandidate> >& leps, const int& idx, const int& type);
00055   int key() const { return key_; };
00057   reco::CompositeCandidate hypo();
00059   bool isValid(const int& idx, const edm::Handle<std::vector<pat::Jet> >& jets){ return (0<=idx && idx<(int)jets->size()); };
00061   WDecay::LeptonType leptonType(const reco::RecoCandidate* cand);
00062 
00063   // -----------------------------------------
00064   // implemet the following two functions
00065   // for a concrete event hypothesis
00066   // -----------------------------------------
00067 
00069   virtual void buildKey() = 0;
00071   virtual void buildHypo(edm::Event& event,
00072                          const edm::Handle<edm::View<reco::RecoCandidate> >& lepton, 
00073                          const edm::Handle<std::vector<pat::MET> >& neutrino, 
00074                          const edm::Handle<std::vector<pat::Jet> >& jets, 
00075                          std::vector<int>& jetPartonAssociation,
00076                          const unsigned int iComb) = 0;
00077 
00078  protected:
00081   bool getMatch_;
00083   edm::InputTag jets_;
00084   edm::InputTag leps_;
00085   edm::InputTag mets_;
00086   edm::InputTag match_;
00089   std::string jetCorrectionLevel_;
00091   int key_;
00094   int numberOfRealNeutrinoSolutions_;
00097   reco::ShallowClonePtrCandidate *lightQ_;
00098   reco::ShallowClonePtrCandidate *lightQBar_;
00099   reco::ShallowClonePtrCandidate *hadronicB_;
00100   reco::ShallowClonePtrCandidate *leptonicB_;
00101   reco::ShallowClonePtrCandidate *neutrino_;
00102   reco::ShallowClonePtrCandidate *lepton_;
00103 };
00104 
00105 // has to be placed in the header since otherwise the function template
00106 // would cause unresolved references in classes derived from this base class
00107 template<typename C>
00108 void
00109 TtSemiLepHypothesis::setCandidate(const edm::Handle<C>& handle, const int& idx, reco::ShallowClonePtrCandidate* &clone) {
00110   typedef typename C::value_type O;
00111   edm::Ptr<O> ptr = edm::Ptr<O>(handle, idx);
00112   clone = new reco::ShallowClonePtrCandidate( ptr, ptr->charge(), ptr->p4(), ptr->vertex() );
00113 }
00114 
00115 #endif