File indexing completed on 2024-04-06 12:31:20
0001 #include "TopQuarkAnalysis/TopJetCombination/interface/TtSemiLepHypothesis.h"
0002
0003 #include "DataFormats/PatCandidates/interface/Particle.h"
0004
0005 class TtSemiLepHypHitFit : public TtSemiLepHypothesis {
0006 public:
0007 explicit TtSemiLepHypHitFit(const edm::ParameterSet&);
0008
0009 private:
0010
0011 void buildKey() override { key_ = TtSemiLeptonicEvent::kHitFit; };
0012
0013 void buildHypo(edm::Event&,
0014 const edm::Handle<edm::View<reco::RecoCandidate> >&,
0015 const edm::Handle<std::vector<pat::MET> >&,
0016 const edm::Handle<std::vector<pat::Jet> >&,
0017 std::vector<int>&,
0018 const unsigned int iComb) override;
0019
0020 edm::EDGetTokenT<std::vector<int> > statusToken_;
0021 edm::EDGetTokenT<std::vector<pat::Particle> > partonsHadPToken_;
0022 edm::EDGetTokenT<std::vector<pat::Particle> > partonsHadQToken_;
0023 edm::EDGetTokenT<std::vector<pat::Particle> > partonsHadBToken_;
0024 edm::EDGetTokenT<std::vector<pat::Particle> > partonsLepBToken_;
0025 edm::EDGetTokenT<std::vector<pat::Particle> > leptonsToken_;
0026 edm::EDGetTokenT<std::vector<pat::Particle> > neutrinosToken_;
0027 };
0028
0029 TtSemiLepHypHitFit::TtSemiLepHypHitFit(const edm::ParameterSet& cfg)
0030 : TtSemiLepHypothesis(cfg),
0031 statusToken_(consumes<std::vector<int> >(cfg.getParameter<edm::InputTag>("status"))),
0032 partonsHadPToken_(consumes<std::vector<pat::Particle> >(cfg.getParameter<edm::InputTag>("partonsHadP"))),
0033 partonsHadQToken_(consumes<std::vector<pat::Particle> >(cfg.getParameter<edm::InputTag>("partonsHadQ"))),
0034 partonsHadBToken_(consumes<std::vector<pat::Particle> >(cfg.getParameter<edm::InputTag>("partonsHadB"))),
0035 partonsLepBToken_(consumes<std::vector<pat::Particle> >(cfg.getParameter<edm::InputTag>("partonsLepB"))),
0036 leptonsToken_(consumes<std::vector<pat::Particle> >(cfg.getParameter<edm::InputTag>("leptons"))),
0037 neutrinosToken_(consumes<std::vector<pat::Particle> >(cfg.getParameter<edm::InputTag>("neutrinos"))) {}
0038
0039 void TtSemiLepHypHitFit::buildHypo(edm::Event& evt,
0040 const edm::Handle<edm::View<reco::RecoCandidate> >& leps,
0041 const edm::Handle<std::vector<pat::MET> >& mets,
0042 const edm::Handle<std::vector<pat::Jet> >& jets,
0043 std::vector<int>& match,
0044 const unsigned int iComb) {
0045 edm::Handle<std::vector<int> > status;
0046 evt.getByToken(statusToken_, status);
0047 if ((*status)[iComb] != 0) {
0048
0049 return;
0050 }
0051
0052 edm::Handle<std::vector<pat::Particle> > partonsHadP;
0053 edm::Handle<std::vector<pat::Particle> > partonsHadQ;
0054 edm::Handle<std::vector<pat::Particle> > partonsHadB;
0055 edm::Handle<std::vector<pat::Particle> > partonsLepB;
0056 edm::Handle<std::vector<pat::Particle> > leptons;
0057 edm::Handle<std::vector<pat::Particle> > neutrinos;
0058
0059 evt.getByToken(partonsHadPToken_, partonsHadP);
0060 evt.getByToken(partonsHadQToken_, partonsHadQ);
0061 evt.getByToken(partonsHadBToken_, partonsHadB);
0062 evt.getByToken(partonsLepBToken_, partonsLepB);
0063 evt.getByToken(leptonsToken_, leptons);
0064 evt.getByToken(neutrinosToken_, neutrinos);
0065
0066
0067
0068
0069 if (!(partonsHadP->empty() || partonsHadQ->empty() || partonsHadB->empty() || partonsLepB->empty())) {
0070 lightQ_ = makeCandidate(partonsHadP, iComb);
0071 lightQBar_ = makeCandidate(partonsHadQ, iComb);
0072 hadronicB_ = makeCandidate(partonsHadB, iComb);
0073 leptonicB_ = makeCandidate(partonsLepB, iComb);
0074 }
0075
0076
0077
0078
0079 if (!leptons->empty()) {
0080 lepton_ = makeCandidate(leptons, iComb);
0081 }
0082 match.push_back(0);
0083
0084
0085
0086
0087 if (!neutrinos->empty()) {
0088 neutrino_ = makeCandidate(neutrinos, iComb);
0089 }
0090 }
0091
0092 #include "FWCore/Framework/interface/MakerMacros.h"
0093 DEFINE_FWK_MODULE(TtSemiLepHypHitFit);