CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
pat::GenJetMatcher Class Reference

#include <SmearedJetProducerT.h>

Public Member Functions

 GenJetMatcher (const edm::ParameterSet &cfg, edm::ConsumesCollector &&collector)
 
void getTokens (const edm::Event &event)
 
template<class T >
const reco::GenJetmatch (const T &jet, double resolution)
 

Static Public Member Functions

static void fillDescriptions (edm::ParameterSetDescription &desc)
 

Private Attributes

double m_dPt_max_factor
 
double m_dR_max
 
edm::Handle< reco::GenJetCollectionm_genJets
 
edm::EDGetTokenT< reco::GenJetCollectionm_genJetsToken
 

Detailed Description

Definition at line 40 of file SmearedJetProducerT.h.

Constructor & Destructor Documentation

◆ GenJetMatcher()

pat::GenJetMatcher::GenJetMatcher ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  collector 
)
inline

Definition at line 42 of file SmearedJetProducerT.h.

43  : m_genJetsToken(collector.consumes<reco::GenJetCollection>(cfg.getParameter<edm::InputTag>("genJets"))),
44  m_dR_max(cfg.getParameter<double>("dRMax")),
45  m_dPt_max_factor(cfg.getParameter<double>("dPtMaxFactor")) {
46  // Empty
47  }

Member Function Documentation

◆ fillDescriptions()

static void pat::GenJetMatcher::fillDescriptions ( edm::ParameterSetDescription desc)
inlinestatic

Definition at line 49 of file SmearedJetProducerT.h.

49  {
50  desc.add<edm::InputTag>("genJets");
51  desc.add<double>("dRMax");
52  desc.add<double>("dPtMaxFactor");
53  }

References submitPVResolutionJobs::desc.

Referenced by SmearedJetProducerT< T >::fillDescriptions().

◆ getTokens()

void pat::GenJetMatcher::getTokens ( const edm::Event event)
inline

Definition at line 55 of file SmearedJetProducerT.h.

55 { event.getByToken(m_genJetsToken, m_genJets); }

References m_genJets, and m_genJetsToken.

◆ match()

template<class T >
const reco::GenJet* pat::GenJetMatcher::match ( const T jet,
double  resolution 
)
inline

Definition at line 58 of file SmearedJetProducerT.h.

58  {
60 
61  // Try to find a gen jet matching
62  // dR < m_dR_max
63  // dPt < m_dPt_max_factor * resolution
64 
65  double min_dR = std::numeric_limits<double>::infinity();
66  const reco::GenJet* matched_genJet = nullptr;
67 
68  for (const auto& genJet : genJets) {
69  double dR = deltaR(genJet, jet);
70 
71  if (dR > min_dR)
72  continue;
73 
74  if (dR < m_dR_max) {
75  double dPt = std::abs(genJet.pt() - jet.pt());
76  if (dPt > m_dPt_max_factor * resolution)
77  continue;
78 
79  min_dR = dR;
80  matched_genJet = &genJet;
81  }
82  }
83 
84  return matched_genJet;
85  }

References funct::abs(), PbPb_ZMuSkimMuonDPG_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, ttbarCategorization_cff::genJets, infinity, metsig::jet, m_dPt_max_factor, m_dR_max, m_genJets, and L1TObjectsTimingClient_cff::resolution.

Member Data Documentation

◆ m_dPt_max_factor

double pat::GenJetMatcher::m_dPt_max_factor
private

Definition at line 92 of file SmearedJetProducerT.h.

Referenced by match().

◆ m_dR_max

double pat::GenJetMatcher::m_dR_max
private

Definition at line 91 of file SmearedJetProducerT.h.

Referenced by match().

◆ m_genJets

edm::Handle<reco::GenJetCollection> pat::GenJetMatcher::m_genJets
private

Definition at line 89 of file SmearedJetProducerT.h.

Referenced by getTokens(), and match().

◆ m_genJetsToken

edm::EDGetTokenT<reco::GenJetCollection> pat::GenJetMatcher::m_genJetsToken
private

Definition at line 88 of file SmearedJetProducerT.h.

Referenced by getTokens().

reco::GenJet
Jets made from MC generator particles.
Definition: GenJet.h:23
reco::GenJetCollection
std::vector< GenJet > GenJetCollection
collection of GenJet objects
Definition: GenJetCollection.h:14
pat::GenJetMatcher::m_dPt_max_factor
double m_dPt_max_factor
Definition: SmearedJetProducerT.h:92
pat::GenJetMatcher::m_dR_max
double m_dR_max
Definition: SmearedJetProducerT.h:91
infinity
const double infinity
Definition: CSCChamberFitter.cc:10
pat::GenJetMatcher::m_genJetsToken
edm::EDGetTokenT< reco::GenJetCollection > m_genJetsToken
Definition: SmearedJetProducerT.h:88
L1TObjectsTimingClient_cff.resolution
resolution
Definition: L1TObjectsTimingClient_cff.py:52
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
pat::GenJetMatcher::m_genJets
edm::Handle< reco::GenJetCollection > m_genJets
Definition: SmearedJetProducerT.h:89
ttbarCategorization_cff.genJets
genJets
Definition: ttbarCategorization_cff.py:29
looper.cfg
cfg
Definition: looper.py:297
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
metsig::jet
Definition: SignAlgoResolutions.h:47
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
edm::InputTag
Definition: InputTag.h:15