CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
SmearedJetProducer_namespace::GenJetMatcherT< T > Class Template Reference

#include <SmearedJetProducerT.h>

Public Member Functions

 GenJetMatcherT (const edm::ParameterSet &cfg)
 
const reco::GenJetoperator() (const T &jet, edm::Event *evt=0) const
 
 ~GenJetMatcherT ()
 

Private Attributes

TFormula * dRmaxGenJetMatch_
 
edm::InputTag srcGenJets_
 

Detailed Description

template<typename T>
class SmearedJetProducer_namespace::GenJetMatcherT< T >

Definition at line 52 of file SmearedJetProducerT.h.

Constructor & Destructor Documentation

template<typename T >
SmearedJetProducer_namespace::GenJetMatcherT< T >::GenJetMatcherT ( const edm::ParameterSet cfg)
inline

Definition at line 56 of file SmearedJetProducerT.h.

References data, SmearedJetProducer_namespace::GenJetMatcherT< T >::dRmaxGenJetMatch_, and edm::ParameterSet::getParameter().

57  : srcGenJets_(cfg.getParameter<edm::InputTag>("srcGenJets")),
59  {
60  TString dRmaxGenJetMatch_formula = cfg.getParameter<std::string>("dRmaxGenJetMatch").data();
61  dRmaxGenJetMatch_formula.ReplaceAll("genJetPt", "x");
62  dRmaxGenJetMatch_ = new TFormula("dRmaxGenJetMatch", dRmaxGenJetMatch_formula.Data());
63  }
T getParameter(std::string const &) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
template<typename T >
SmearedJetProducer_namespace::GenJetMatcherT< T >::~GenJetMatcherT ( )
inline

Member Function Documentation

template<typename T >
const reco::GenJet* SmearedJetProducer_namespace::GenJetMatcherT< T >::operator() ( const T jet,
edm::Event evt = 0 
) const
inline

Definition at line 69 of file SmearedJetProducerT.h.

References deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, SmearedJetProducer_namespace::GenJetMatcherT< T >::dRmaxGenJetMatch_, and SmearedJetProducer_namespace::GenJetMatcherT< T >::srcGenJets_.

70  {
71  assert(evt);
72 
74  evt->getByLabel(srcGenJets_, genJets);
75 
76  const reco::GenJet* retVal = 0;
77 
78  double dRbestMatch = 1.e+6;
79  for ( reco::GenJetCollection::const_iterator genJet = genJets->begin();
80  genJet != genJets->end(); ++genJet ) {
81  double dRmax = dRmaxGenJetMatch_->Eval(genJet->pt());
82  //std::cout << "genJetPt = " << genJet->pt() << ": dRmax = " << dRmax << std::endl;
83  double dR = deltaR(jet.p4(), genJet->p4());
84  if ( dR < dRbestMatch && dR < dRmax ) {
85  retVal = &(*genJet);
86  dRbestMatch = dR;
87  }
88  }
89 
90  return retVal;
91  }
Jets made from MC generator particles.
Definition: GenJet.h:25
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17

Member Data Documentation

template<typename T >
TFormula* SmearedJetProducer_namespace::GenJetMatcherT< T >::dRmaxGenJetMatch_
private
template<typename T >
edm::InputTag SmearedJetProducer_namespace::GenJetMatcherT< T >::srcGenJets_
private