CMS 3D CMS Logo

TtSemiLepHypGenMatch.cc
Go to the documentation of this file.
5 
7  : TtSemiLepHypothesis(cfg), genEvtToken_(consumes<TtGenEvent>(edm::InputTag("genEvt"))) {}
8 
10 
13  const edm::Handle<std::vector<pat::MET> >& mets,
14  const edm::Handle<std::vector<pat::Jet> >& jets,
15  std::vector<int>& match,
16  const unsigned int iComb) {
17  // -----------------------------------------------------
18  // get genEvent (to distinguish between uds and c quarks
19  // and for the lepton matching)
20  // -----------------------------------------------------
23 
24  // -----------------------------------------------------
25  // add jets
26  // -----------------------------------------------------
27  for (unsigned idx = 0; idx < match.size(); ++idx) {
28  if (isValid(match[idx], jets)) {
29  switch (idx) {
31  if (std::abs(genEvt->hadronicDecayQuark()->pdgId()) == 4)
33  else
35  break;
37  if (std::abs(genEvt->hadronicDecayQuarkBar()->pdgId()) == 4)
39  else
41  break;
44  break;
47  break;
48  }
49  }
50  }
51 
52  // -----------------------------------------------------
53  // add lepton
54  // -----------------------------------------------------
55  int iLepton = findMatchingLepton(genEvt, leps);
56  if (iLepton < 0)
57  return;
58  setCandidate(leps, iLepton, lepton_);
59  match.push_back(iLepton);
60 
61  // -----------------------------------------------------
62  // add neutrino
63  // -----------------------------------------------------
64  if (mets->empty())
65  return;
66  if (neutrinoSolutionType_ == -1)
68  else
70 }
71 
75  int genIdx = -1;
76 
77  // jump out with -1 when the collection is empty
78  if (leps->empty())
79  return genIdx;
80 
81  if (genEvt->isTtBar() && genEvt->isSemiLeptonic(leptonType(&(leps->front()))) && genEvt->singleLepton()) {
82  double minDR = -1;
83  for (unsigned i = 0; i < leps->size(); ++i) {
84  double dR =
85  deltaR(genEvt->singleLepton()->eta(), genEvt->singleLepton()->phi(), (*leps)[i].eta(), (*leps)[i].phi());
86  if (minDR < 0 || dR < minDR) {
87  minDR = dR;
88  genIdx = i;
89  }
90  }
91  }
92  return genIdx;
93 }
mps_fire.i
i
Definition: mps_fire.py:428
TtSemiLepEvtPartons::LightQBar
Definition: TtSemiLepEvtPartons.h:25
HLT_FULL_cff.minDR
minDR
Definition: HLT_FULL_cff.py:20381
TtSemiLepEvtPartons::LepB
Definition: TtSemiLepEvtPartons.h:25
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
TtSemiLepHypothesis::neutrinoSolutionType_
int neutrinoSolutionType_
algorithm used to calculate neutrino solutions (see cfi for further details)
Definition: TtSemiLepHypothesis.h:106
TtGenEvent
Class derived from the TopGenEvent for ttbar events.
Definition: TtGenEvent.h:18
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
singleTopDQM_cfi.mets
mets
Definition: singleTopDQM_cfi.py:43
TtSemiLepEvtPartons.h
edm::Handle
Definition: AssociativeIterator.h:50
TtSemiLepHypothesis::setNeutrino
void setNeutrino(const edm::Handle< std::vector< pat::MET > > &met, const edm::Handle< edm::View< reco::RecoCandidate > > &leps, const int &idx, const int &type)
set neutrino, using mW = 80.4 to calculate the neutrino pz
Definition: TtSemiLepHypothesis.cc:227
TtSemiLepHypothesis::setCandidate
void setCandidate(const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
use one object in a collection to set a ShallowClonePtrCandidate
Definition: TtSemiLepHypothesis.h:123
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
TtSemiLepHitFitProducer_Electrons_cfi.leps
leps
Definition: TtSemiLepHitFitProducer_Electrons_cfi.py:5
TtSemiLepHypGenMatch::genEvtToken_
edm::EDGetTokenT< TtGenEvent > genEvtToken_
Definition: TtSemiLepHypGenMatch.h:25
TtSemiLepHypothesis
Definition: TtSemiLepHypothesis.h:31
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
TtSemiLepHypothesis::leptonicB_
reco::ShallowClonePtrCandidate * leptonicB_
Definition: TtSemiLepHypothesis.h:115
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
TtSemiLepHypothesis::lightQBar_
reco::ShallowClonePtrCandidate * lightQBar_
Definition: TtSemiLepHypothesis.h:113
edm::View
Definition: CaloClusterFwd.h:14
edm::ParameterSet
Definition: ParameterSet.h:47
TtSemiLepHypGenMatch::~TtSemiLepHypGenMatch
~TtSemiLepHypGenMatch() override
Definition: TtSemiLepHypGenMatch.cc:9
TtSemiLepEvtPartons::HadB
Definition: TtSemiLepEvtPartons.h:25
deltaR.h
TtGenEvent.h
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
TtSemiLepEvtPartons::LightQ
Definition: TtSemiLepEvtPartons.h:25
TtSemiLepHypothesis::lightQ_
reco::ShallowClonePtrCandidate * lightQ_
Definition: TtSemiLepHypothesis.h:112
TtSemiLepHypGenMatch::findMatchingLepton
int findMatchingLepton(const edm::Handle< TtGenEvent > &genEvt, const edm::Handle< edm::View< reco::RecoCandidate > > &)
find index of the candidate nearest to the singleLepton of the generator event in the collection; ret...
Definition: TtSemiLepHypGenMatch.cc:73
TtSemiLepHypothesis::jetCorrectionLevel
std::string jetCorrectionLevel(const std::string &quarkType)
helper function to construct the proper correction level string for corresponding quarkType
Definition: TtSemiLepHypothesis.cc:174
looper.cfg
cfg
Definition: looper.py:297
TtSemiLepHypothesis::hadronicB_
reco::ShallowClonePtrCandidate * hadronicB_
Definition: TtSemiLepHypothesis.h:114
TtSemiLepHypGenMatch::TtSemiLepHypGenMatch
TtSemiLepHypGenMatch(const edm::ParameterSet &)
Definition: TtSemiLepHypGenMatch.cc:6
TtSemiLepHypothesis::lepton_
reco::ShallowClonePtrCandidate * lepton_
Definition: TtSemiLepHypothesis.h:117
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
TtSemiLepHypGenMatch::buildHypo
void buildHypo(edm::Event &, const edm::Handle< edm::View< reco::RecoCandidate > > &, const edm::Handle< std::vector< pat::MET > > &, const edm::Handle< std::vector< pat::Jet > > &, std::vector< int > &, const unsigned int iComb) override
build event hypothesis from the reco objects of a semi-leptonic event
Definition: TtSemiLepHypGenMatch.cc:11
TtSemiLepHypGenMatch.h
edm::Event
Definition: Event.h:73
TtSemiLepHypothesis::neutrino_
reco::ShallowClonePtrCandidate * neutrino_
Definition: TtSemiLepHypothesis.h:116
TtGenEvtProducer_cfi.genEvt
genEvt
Definition: TtGenEvtProducer_cfi.py:7
TtSemiLepHypothesis::leptonType
WDecay::LeptonType leptonType(const reco::RecoCandidate *cand)
determine lepton type of reco candidate and return a corresponding WDecay::LeptonType; the type is kN...
Definition: TtSemiLepHypothesis.cc:162
TtSemiLepHypothesis::isValid
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
check if index is in valid range of selected jets
Definition: TtSemiLepHypothesis.h:69