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, edm::ConsumesCollector &&iC)
 
const reco::GenJetoperator() (const T &jet, edm::Event *evt=0) const
 
 ~GenJetMatcherT ()
 

Private Attributes

TFormula * dRmaxGenJetMatch_
 
edm::InputTag srcGenJets_
 
edm::EDGetTokenT
< reco::GenJetCollection
srcGenJetsToken_
 

Detailed Description

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

Definition at line 53 of file SmearedJetProducerT.h.

Constructor & Destructor Documentation

template<typename T >
SmearedJetProducer_namespace::GenJetMatcherT< T >::GenJetMatcherT ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 57 of file SmearedJetProducerT.h.

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

60  {
61  TString dRmaxGenJetMatch_formula = cfg.getParameter<std::string>("dRmaxGenJetMatch").data();
62  dRmaxGenJetMatch_formula.ReplaceAll("genJetPt", "x");
63  dRmaxGenJetMatch_ = new TFormula("dRmaxGenJetMatch", dRmaxGenJetMatch_formula.Data());
64  }
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 > srcGenJetsToken_
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 70 of file SmearedJetProducerT.h.

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

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

Member Data Documentation

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

Definition at line 97 of file SmearedJetProducerT.h.

template<typename T >
edm::EDGetTokenT<reco::GenJetCollection> SmearedJetProducer_namespace::GenJetMatcherT< T >::srcGenJetsToken_
private