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
00021
00022
00023
00024
00025
00026
00027
00028
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);
00056 void buildHypo(const edm::Handle<edm::View<reco::RecoCandidate> >& leps,
00057 const edm::Handle<std::vector<pat::MET> >& mets,
00058 const edm::Handle<std::vector<pat::Jet> >& jets,
00059 std::vector<int>& jetPartonAssociation);
00060 int key() const { return key_; };
00062 reco::CompositeCandidate hypo();
00064 bool isValid(const int& idx, const edm::Handle<std::vector<pat::Jet> >& jets){ return (0<=idx && idx<(int)jets->size()); };
00066 WDecay::LeptonType leptonType(const reco::RecoCandidate* cand);
00067
00068
00069
00070
00071
00072
00074 virtual void buildKey() = 0;
00076 virtual void buildHypo(edm::Event& event,
00077 const edm::Handle<edm::View<reco::RecoCandidate> >& lepton,
00078 const edm::Handle<std::vector<pat::MET> >& neutrino,
00079 const edm::Handle<std::vector<pat::Jet> >& jets,
00080 std::vector<int>& jetPartonAssociation,
00081 const unsigned int iComb) = 0;
00082
00083 protected:
00086 bool getMatch_;
00088 edm::InputTag jets_;
00089 edm::InputTag leps_;
00090 edm::InputTag mets_;
00091 edm::InputTag match_;
00092 edm::InputTag nJetsConsidered_;
00095 std::string jetCorrectionLevel_;
00097 int key_;
00099 int neutrinoSolutionType_;
00102 int numberOfRealNeutrinoSolutions_;
00105 reco::ShallowClonePtrCandidate *lightQ_;
00106 reco::ShallowClonePtrCandidate *lightQBar_;
00107 reco::ShallowClonePtrCandidate *hadronicB_;
00108 reco::ShallowClonePtrCandidate *leptonicB_;
00109 reco::ShallowClonePtrCandidate *neutrino_;
00110 reco::ShallowClonePtrCandidate *lepton_;
00111 };
00112
00113
00114
00115 template<typename C>
00116 void
00117 TtSemiLepHypothesis::setCandidate(const edm::Handle<C>& handle, const int& idx, reco::ShallowClonePtrCandidate* &clone) {
00118 typedef typename C::value_type O;
00119 edm::Ptr<O> ptr = edm::Ptr<O>(handle, idx);
00120 clone = new reco::ShallowClonePtrCandidate( ptr, ptr->charge(), ptr->p4(), ptr->vertex() );
00121 }
00122
00123 #endif