test
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 52 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 56 of file SmearedJetProducerT.h.

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

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

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

70  {
71  assert(evt);
72 
74  evt->getByToken(srcGenJetsToken_, 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  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
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 96 of file SmearedJetProducerT.h.

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