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

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

Definition at line 42 of file SmearedJetProducerT.h.

42  :
44  m_dR_max(cfg.getParameter<double>("dRMax")),
45  m_dPt_max_factor(cfg.getParameter<double>("dPtMaxFactor")) {
46  // Empty
47  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< GenJet > GenJetCollection
collection of GenJet objects
edm::EDGetTokenT< reco::GenJetCollection > m_genJetsToken

Member Function Documentation

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

Definition at line 49 of file SmearedJetProducerT.h.

References edm::ParameterSetDescription::add().

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

49  {
50  desc.add<edm::InputTag>("genJets");
51  desc.add<double>("dRMax");
52  desc.add<double>("dPtMaxFactor");
53  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void pat::GenJetMatcher::getTokens ( const edm::Event event)
inline

Definition at line 55 of file SmearedJetProducerT.h.

References m_genJets, and m_genJetsToken.

55  {
56  event.getByToken(m_genJetsToken, m_genJets);
57  }
edm::Handle< reco::GenJetCollection > m_genJets
edm::EDGetTokenT< reco::GenJetCollection > m_genJetsToken
template<class T >
const reco::GenJet* pat::GenJetMatcher::match ( const T jet,
double  resolution 
)
inline

Definition at line 60 of file SmearedJetProducerT.h.

References funct::abs(), deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, patPFMETCorrections_cff::genJets, infinity, m_dPt_max_factor, m_dR_max, and m_genJets.

60  {
62 
63  // Try to find a gen jet matching
64  // dR < m_dR_max
65  // dPt < m_dPt_max_factor * resolution
66 
67  double min_dR = std::numeric_limits<double>::infinity();
68  const reco::GenJet* matched_genJet = nullptr;
69 
70  for (const auto& genJet: genJets) {
71  double dR = deltaR(genJet, jet);
72 
73  if (dR > min_dR)
74  continue;
75 
76  if (dR < m_dR_max) {
77  double dPt = std::abs(genJet.pt() - jet.pt());
78  if (dPt > m_dPt_max_factor * resolution)
79  continue;
80 
81  min_dR = dR;
82  matched_genJet = &genJet;
83  }
84  }
85 
86  return matched_genJet;
87  }
edm::Handle< reco::GenJetCollection > m_genJets
std::vector< GenJet > GenJetCollection
collection of GenJet objects
const double infinity
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Jets made from MC generator particles.
Definition: GenJet.h:24
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17

Member Data Documentation

double pat::GenJetMatcher::m_dPt_max_factor
private

Definition at line 94 of file SmearedJetProducerT.h.

Referenced by match().

double pat::GenJetMatcher::m_dR_max
private

Definition at line 93 of file SmearedJetProducerT.h.

Referenced by match().

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

Definition at line 91 of file SmearedJetProducerT.h.

Referenced by getTokens(), and match().

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

Definition at line 90 of file SmearedJetProducerT.h.

Referenced by getTokens().