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
00019
00020
00021
00022
00023
00024
00025
00026
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
00059
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
00093
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