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 51 of file SmearedJetProducerT.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file SmearedJetProducerT.h.

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

56  : srcGenJets_(cfg.getParameter<edm::InputTag>("srcGenJets")),
58  {
59  TString dRmaxGenJetMatch_formula = cfg.getParameter<std::string>("dRmaxGenJetMatch").data();
60  dRmaxGenJetMatch_formula.ReplaceAll("genJetPt", "x");
61  dRmaxGenJetMatch_ = new TFormula("dRmaxGenJetMatch", dRmaxGenJetMatch_formula.Data());
62  }
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 68 of file SmearedJetProducerT.h.

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

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