CMS 3D CMS Logo

TtFullLepHypKinSolution.cc
Go to the documentation of this file.
3 
5 public:
7 
8 private:
10  void buildKey() override { key_ = TtEvent::kKinSolution; };
12  void buildHypo(edm::Event& evt,
13  const edm::Handle<std::vector<pat::Electron> >& elecs,
14  const edm::Handle<std::vector<pat::Muon> >& mus,
15  const edm::Handle<std::vector<pat::Jet> >& jets,
16  const edm::Handle<std::vector<pat::MET> >& mets,
17  std::vector<int>& match,
18  const unsigned int iComb) override;
19 
20  // edm::EDGetTokenT<std::vector<std::vector<int> > > particleIdcsToken_;
24 };
25 
28  nusToken_(consumes<std::vector<reco::LeafCandidate> >(cfg.getParameter<edm::InputTag>("Neutrinos"))),
29  nuBarsToken_(consumes<std::vector<reco::LeafCandidate> >(cfg.getParameter<edm::InputTag>("NeutrinoBars"))),
30  solWeightToken_(consumes<std::vector<double> >(cfg.getParameter<edm::InputTag>("solutionWeight"))) {}
31 
33  const edm::Handle<std::vector<pat::Electron> >& elecs,
34  const edm::Handle<std::vector<pat::Muon> >& mus,
35  const edm::Handle<std::vector<pat::Jet> >& jets,
36  const edm::Handle<std::vector<pat::MET> >& mets,
37  std::vector<int>& match,
38  const unsigned int iComb) {
40  // edm::Handle<std::vector<std::vector<int> > > idcsVec;
43 
45  // evt.getByToken(particleIdcsToken_, idcsVec );
46  evt.getByToken(nusToken_, nus);
47  evt.getByToken(nuBarsToken_, nuBars);
48 
49  if ((*solWeight)[iComb] < 0) {
50  // create empty hypothesis if no solution exists
51  return;
52  }
53 
54  // -----------------------------------------------------
55  // add jets
56  // -----------------------------------------------------
57  if (!jets->empty()) {
60  }
61  // -----------------------------------------------------
62  // add leptons
63  // -----------------------------------------------------
64  if (!elecs->empty() && match[2] >= 0)
66 
67  if (!elecs->empty() && match[3] >= 0)
69 
70  if (!mus->empty() && match[4] >= 0 && match[2] < 0)
71  leptonBar_ = makeCandidate(mus, match[4]);
72 
73  // this 'else' happens if you have a wrong charge electron-muon-
74  // solution so the indices are (b-idx, bbar-idx, 0, -1, 0, -1)
75  // so the mu^+ is stored as l^-
76  else if (!mus->empty() && match[4] >= 0)
77  lepton_ = makeCandidate(mus, match[4]);
78 
79  if (!mus->empty() && match[5] >= 0 && match[3] < 0)
80  lepton_ = makeCandidate(mus, match[5]);
81 
82  // this 'else' happens if you have a wrong charge electron-muon-
83  // solution so the indices are (b-idx, bbar-idx, -1, 0, -1, 0)
84  // so the mu^- is stored as l^+
85  else if (!mus->empty() && match[5] >= 0)
86  leptonBar_ = makeCandidate(mus, match[5]);
87 
88  // -----------------------------------------------------
89  // add neutrinos
90  // -----------------------------------------------------
91  if (!nus->empty())
92  neutrino_ = makeCandidate(nus, iComb);
93 
94  if (!nuBars->empty())
95  neutrinoBar_ = makeCandidate(nuBars, iComb);
96 }
97 
std::unique_ptr< reco::ShallowClonePtrCandidate > leptonBar_
int key_
hypothesis key (to be set by the buildKey function)
edm::EDGetTokenT< std::vector< reco::LeafCandidate > > nuBarsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::unique_ptr< reco::ShallowClonePtrCandidate > neutrino_
std::unique_ptr< reco::ShallowClonePtrCandidate > neutrinoBar_
void buildHypo(edm::Event &evt, const edm::Handle< std::vector< pat::Electron > > &elecs, const edm::Handle< std::vector< pat::Muon > > &mus, const edm::Handle< std::vector< pat::Jet > > &jets, const edm::Handle< std::vector< pat::MET > > &mets, std::vector< int > &match, const unsigned int iComb) override
build event hypothesis from the reco objects of a full-leptonic event
std::string jetCorrectionLevel_
edm::EDGetTokenT< std::vector< reco::LeafCandidate > > nusToken_
std::unique_ptr< reco::ShallowClonePtrCandidate > lepton_
fixed size matrix
HLT enums.
edm::EDGetTokenT< std::vector< double > > solWeightToken_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
std::unique_ptr< reco::ShallowClonePtrCandidate > b_
std::unique_ptr< reco::ShallowClonePtrCandidate > makeCandidate(const edm::Handle< C > &handle, const int &idx)
use one object in a collection to set a ShallowClonePtrCandidate
TtFullLepHypKinSolution(const edm::ParameterSet &)
void buildKey() override
build the event hypothesis key
std::unique_ptr< reco::ShallowClonePtrCandidate > bBar_