CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/TopQuarkAnalysis/TopJetCombination/interface/TtFullLepHypothesis.h

Go to the documentation of this file.
00001 #ifndef TtFullLepHypothesis_h
00002 #define TtFullLepHypothesis_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 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012 
00013 #include "DataFormats/PatCandidates/interface/Electron.h"
00014 #include "DataFormats/PatCandidates/interface/Muon.h"
00015 #include "DataFormats/PatCandidates/interface/Jet.h"
00016 #include "DataFormats/PatCandidates/interface/MET.h"
00017 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00018 #include "DataFormats/Candidate/interface/ShallowClonePtrCandidate.h"
00019 
00020 #include "AnalysisDataFormats/TopObjects/interface/TtFullLeptonicEvent.h"
00021 
00022 /*
00023    \class   TtFullLepHypothesis TtFullLepHypothesis.h "TopQuarkAnalysis/TopJetCombination/interface/TtFullLepHypothesis.h"
00024 
00025    \brief   Interface class for the creation of full leptonic ttbar event hypotheses
00026 
00027    The class provides an interface for the creation of full leptonic ttbar event hypotheses. Input information is read 
00028    from the event content and the proper candidate creation is taken care of. Hypotheses are characterized by the 
00029    CompositeCandidate made of a ttbar pair (including all its decay products in a parton level interpretation) and an 
00030    enumerator type key to specify the algorithm to determine the candidate (hypothesis class). The buildKey and the 
00031    buildHypo class have to implemented by derived classes.
00032 **/
00033 
00034 class TtFullLepHypothesis : public edm::EDProducer {
00035 
00036  public:
00038   explicit TtFullLepHypothesis(const edm::ParameterSet&);
00040   ~TtFullLepHypothesis();
00041 
00042  protected:
00044   virtual void produce(edm::Event&, const edm::EventSetup&);
00046   void resetCandidates();
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   int key() const { return key_; };
00055   reco::CompositeCandidate hypo();
00057   bool isValid(const int& idx, const edm::Handle<std::vector<pat::Jet> >& jets){ return (0<=idx && idx<(int)jets->size()); };
00058 
00059   // -----------------------------------------
00060   // implemet the following two functions
00061   // for a concrete event hypothesis
00062   // -----------------------------------------
00063 
00065   virtual void buildKey() = 0;
00067   virtual void buildHypo(edm::Event& evt,
00068                          const edm::Handle<std::vector<pat::Electron > >& elecs, 
00069                          const edm::Handle<std::vector<pat::Muon> >& mus, 
00070                          const edm::Handle<std::vector<pat::Jet> >& jets, 
00071                          const edm::Handle<std::vector<pat::MET> >& mets, 
00072                          std::vector<int>& match,
00073                          const unsigned int iComb) = 0;
00074 
00075  protected:
00078   bool getMatch_;
00080   edm::InputTag match_;
00081   edm::InputTag elecs_;
00082   edm::InputTag mus_;
00083   edm::InputTag jets_;
00084   edm::InputTag mets_;
00087   std::string jetCorrectionLevel_;
00089   int key_;
00092   reco::ShallowClonePtrCandidate *lepton_;
00093   reco::ShallowClonePtrCandidate *leptonBar_;
00094   reco::ShallowClonePtrCandidate *b_;
00095   reco::ShallowClonePtrCandidate *bBar_;
00096   reco::ShallowClonePtrCandidate *neutrino_;
00097   reco::ShallowClonePtrCandidate *neutrinoBar_;
00098   //reco::ShallowClonePtrCandidate *met_;
00099   
00101   reco::LeafCandidate* recNu;
00102   reco::LeafCandidate* recNuBar;        
00103 };
00104 
00105 // unfortunately this 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 TtFullLepHypothesis::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