CMS 3D CMS Logo

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 class TtSemiLepHypothesis : public edm::EDProducer {
00020 
00021  public:
00022 
00023   explicit TtSemiLepHypothesis(const edm::ParameterSet&);
00024   ~TtSemiLepHypothesis();
00025 
00026  protected:
00027   
00029   virtual void produce(edm::Event&, const edm::EventSetup&);
00031   void resetCandidates();
00033   template <typename C>
00034   void setCandidate(const edm::Handle<C>& handle, const int& idx, reco::ShallowClonePtrCandidate*& clone);
00036   int key() const { return key_; };
00038   reco::CompositeCandidate hypo();
00040   bool isValid(const int& idx, const edm::Handle<std::vector<pat::Jet> >& jets){ return (0<=idx && idx<(int)jets->size()); };
00041 
00042   // -----------------------------------------
00043   // implemet the following two functions
00044   // for a concrete event hypothesis
00045   // -----------------------------------------
00046 
00048   virtual void buildKey() = 0;
00050   virtual void buildHypo(edm::Event& event,
00051                          const edm::Handle<edm::View<reco::RecoCandidate> >& lepton, 
00052                          const edm::Handle<std::vector<pat::MET> >& neutrino, 
00053                          const edm::Handle<std::vector<pat::Jet> >& jets, 
00054                          std::vector<int>& jetPartonAssociation,
00055                          const unsigned int iComb) = 0;
00056 
00057  protected:
00058 
00059   bool getMatch_;
00060 
00061   edm::InputTag jets_;
00062   edm::InputTag leps_;
00063   edm::InputTag mets_;
00064   edm::InputTag match_;
00065 
00066   int key_;
00067 
00068   reco::ShallowClonePtrCandidate *lightQ_;
00069   reco::ShallowClonePtrCandidate *lightQBar_;
00070   reco::ShallowClonePtrCandidate *hadronicB_;
00071   reco::ShallowClonePtrCandidate *leptonicB_;
00072   reco::ShallowClonePtrCandidate *neutrino_;
00073   reco::ShallowClonePtrCandidate *lepton_;
00074 };
00075 
00076 // has to be placed in the header since otherwise the function template
00077 // would cause unresolved references in classes derived from this base class
00078 template<typename C>
00079 void
00080 TtSemiLepHypothesis::setCandidate(const edm::Handle<C>& handle, const int& idx, reco::ShallowClonePtrCandidate* &clone) {
00081   typedef typename C::value_type O;
00082   edm::Ptr<O> ptr = edm::Ptr<O>(handle, idx);
00083   clone = new reco::ShallowClonePtrCandidate( ptr, ptr->charge(), ptr->p4(), ptr->vertex() );
00084 }
00085 
00086 #endif

Generated on Tue Jun 9 17:48:13 2009 for CMSSW by  doxygen 1.5.4