CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Member Functions
TtSemiLepHypGenMatch Class Reference

#include <TtSemiLepHypGenMatch.h>

Inheritance diagram for TtSemiLepHypGenMatch:
TtSemiLepHypothesis edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TtSemiLepHypGenMatch (const edm::ParameterSet &)
 
 ~TtSemiLepHypGenMatch () override
 
- Public Member Functions inherited from TtSemiLepHypothesis
 TtSemiLepHypothesis (const edm::ParameterSet &)
 default constructor More...
 
 ~TtSemiLepHypothesis () override
 default destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Attributes

edm::EDGetTokenT< TtGenEventgenEvtToken_
 
- Protected Attributes inherited from TtSemiLepHypothesis
bool getMatch_
 
reco::ShallowClonePtrCandidatehadronicB_
 
std::string jetCorrectionLevel_
 
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
 input label for all necessary collections More...
 
int key_
 hypothesis key (to be set by the buildKey function) More...
 
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
 
reco::ShallowClonePtrCandidatelepton_
 
reco::ShallowClonePtrCandidateleptonicB_
 
reco::ShallowClonePtrCandidatelightQ_
 
reco::ShallowClonePtrCandidatelightQBar_
 
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
 
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
 
reco::ShallowClonePtrCandidateneutrino_
 
int neutrinoSolutionType_
 algorithm used to calculate neutrino solutions (see cfi for further details) More...
 
edm::EDGetTokenT< int > nJetsConsideredToken_
 
int numberOfRealNeutrinoSolutions_
 

Private Member Functions

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 More...
 
void buildKey () override
 build the event hypothesis key More...
 
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; return -1 if this fails More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from TtSemiLepHypothesis
void buildHypo (const edm::Handle< edm::View< reco::RecoCandidate > > &leps, const edm::Handle< std::vector< pat::MET > > &mets, const edm::Handle< std::vector< pat::Jet > > &jets, std::vector< int > &jetPartonAssociation)
 minimalistic build function for simple hypotheses More...
 
reco::CompositeCandidate hypo ()
 return event hypothesis More...
 
bool isValid (const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
 check if index is in valid range of selected jets More...
 
std::string jetCorrectionLevel (const std::string &quarkType)
 helper function to construct the proper correction level string for corresponding quarkType More...
 
int key () const
 
WDecay::LeptonType leptonType (const reco::RecoCandidate *cand)
 determine lepton type of reco candidate and return a corresponding WDecay::LeptonType; the type is kNone if it is whether a muon nor an electron More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 produce the event hypothesis as CompositeCandidate and Key More...
 
void resetCandidates ()
 reset candidate pointers before hypo build process More...
 
template<typename C >
void setCandidate (const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
 use one object in a collection to set a ShallowClonePtrCandidate More...
 
void setCandidate (const edm::Handle< std::vector< pat::Jet > > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone, const std::string &correctionLevel)
 use one object in a jet collection to set a ShallowClonePtrCandidate with proper jet corrections More...
 
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 More...
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 6 of file TtSemiLepHypGenMatch.h.

Constructor & Destructor Documentation

◆ TtSemiLepHypGenMatch()

TtSemiLepHypGenMatch::TtSemiLepHypGenMatch ( const edm::ParameterSet cfg)
explicit

Definition at line 6 of file TtSemiLepHypGenMatch.cc.

7  : TtSemiLepHypothesis(cfg), genEvtToken_(consumes<TtGenEvent>(edm::InputTag("genEvt"))) {}

◆ ~TtSemiLepHypGenMatch()

TtSemiLepHypGenMatch::~TtSemiLepHypGenMatch ( )
override

Definition at line 9 of file TtSemiLepHypGenMatch.cc.

9 {}

Member Function Documentation

◆ buildHypo()

void TtSemiLepHypGenMatch::buildHypo ( edm::Event evt,
const edm::Handle< edm::View< reco::RecoCandidate > > &  leps,
const edm::Handle< std::vector< pat::MET > > &  mets,
const edm::Handle< std::vector< pat::Jet > > &  jets,
std::vector< int > &  match,
const unsigned int  iComb 
)
overrideprivatevirtual

build event hypothesis from the reco objects of a semi-leptonic event

Implements TtSemiLepHypothesis.

Definition at line 11 of file TtSemiLepHypGenMatch.cc.

16  {
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 }

References funct::abs(), findMatchingLepton(), TtGenEvtProducer_cfi::genEvt, genEvtToken_, edm::Event::getByToken(), TtSemiLepEvtPartons::HadB, TtSemiLepHypothesis::hadronicB_, heavyIonCSV_trainingSettings::idx, TtSemiLepHypothesis::isValid(), TtSemiLepHypothesis::jetCorrectionLevel(), singleTopDQM_cfi::jets, TtSemiLepEvtPartons::LepB, TtSemiLepHitFitProducer_Electrons_cfi::leps, TtSemiLepHypothesis::lepton_, TtSemiLepHypothesis::leptonicB_, TtSemiLepEvtPartons::LightQ, TtSemiLepHypothesis::lightQ_, TtSemiLepEvtPartons::LightQBar, TtSemiLepHypothesis::lightQBar_, match(), singleTopDQM_cfi::mets, TtSemiLepHypothesis::neutrino_, TtSemiLepHypothesis::neutrinoSolutionType_, TtSemiLepHypothesis::setCandidate(), and TtSemiLepHypothesis::setNeutrino().

◆ buildKey()

void TtSemiLepHypGenMatch::buildKey ( )
inlineoverrideprivatevirtual

build the event hypothesis key

Implements TtSemiLepHypothesis.

Definition at line 13 of file TtSemiLepHypGenMatch.h.

References TtSemiLepHypothesis::key_, and TtEvent::kGenMatch.

◆ findMatchingLepton()

int TtSemiLepHypGenMatch::findMatchingLepton ( const edm::Handle< TtGenEvent > &  genEvt,
const edm::Handle< edm::View< reco::RecoCandidate > > &  leps 
)
private

find index of the candidate nearest to the singleLepton of the generator event in the collection; return -1 if this fails

Definition at line 73 of file TtSemiLepHypGenMatch.cc.

74  {
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 }

References PbPb_ZMuSkimMuonDPG_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, TtGenEvtProducer_cfi::genEvt, mps_fire::i, TtSemiLepHitFitProducer_Electrons_cfi::leps, TtSemiLepHypothesis::leptonType(), and HLT_FULL_cff::minDR.

Referenced by buildHypo().

Member Data Documentation

◆ genEvtToken_

edm::EDGetTokenT<TtGenEvent> TtSemiLepHypGenMatch::genEvtToken_
protected

Definition at line 25 of file TtSemiLepHypGenMatch.h.

Referenced by buildHypo().

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:20394
TtSemiLepHypothesis::key_
int key_
hypothesis key (to be set by the buildKey function)
Definition: TtSemiLepHypothesis.h:104
TtSemiLepEvtPartons::LepB
Definition: TtSemiLepEvtPartons.h:25
TtSemiLepHypothesis::neutrinoSolutionType_
int neutrinoSolutionType_
algorithm used to calculate neutrino solutions (see cfi for further details)
Definition: TtSemiLepHypothesis.h:106
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
singleTopDQM_cfi.mets
mets
Definition: singleTopDQM_cfi.py:43
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
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
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
TtSemiLepEvtPartons::HadB
Definition: TtSemiLepEvtPartons.h:25
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:296
TtSemiLepHypothesis::hadronicB_
reco::ShallowClonePtrCandidate * hadronicB_
Definition: TtSemiLepHypothesis.h:114
TtEvent::kGenMatch
Definition: TtEvent.h:30
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
TtSemiLepHypothesis::TtSemiLepHypothesis
TtSemiLepHypothesis(const edm::ParameterSet &)
default constructor
Definition: TtSemiLepHypothesis.cc:10
TtSemiLepHypothesis::neutrino_
reco::ShallowClonePtrCandidate * neutrino_
Definition: TtSemiLepHypothesis.h:116
edm::InputTag
Definition: InputTag.h:15
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