CMS 3D CMS Logo

Public Member Functions | Private Attributes

SmearedJetProducer_namespace::GenJetMatcherT< T > Class Template Reference

#include <SmearedJetProducerT.h>

List of all members.

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


Constructor & Destructor Documentation

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

Definition at line 57 of file SmearedJetProducerT.h.

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

       : srcGenJets_(cfg.getParameter<edm::InputTag>("srcGenJets")),
         dRmaxGenJetMatch_(0)
     {
       TString dRmaxGenJetMatch_formula = cfg.getParameter<std::string>("dRmaxGenJetMatch").data();
       dRmaxGenJetMatch_formula.ReplaceAll("genJetPt", "x");
       dRmaxGenJetMatch_ = new TFormula("dRmaxGenJetMatch", dRmaxGenJetMatch_formula.Data());
     }
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 deltaR(), SmearedJetProducer_namespace::GenJetMatcherT< T >::dRmaxGenJetMatch_, and SmearedJetProducer_namespace::GenJetMatcherT< T >::srcGenJets_.

     {
       assert(evt);
       
       edm::Handle<reco::GenJetCollection> genJets;
       evt->getByLabel(srcGenJets_, genJets);

       const reco::GenJet* retVal = 0;

       double dRbestMatch = 1.e+6;
       for ( reco::GenJetCollection::const_iterator genJet = genJets->begin();
             genJet != genJets->end(); ++genJet ) {
         double dRmax = dRmaxGenJetMatch_->Eval(genJet->pt());
         //std::cout << "genJetPt = " << genJet->pt() << ": dRmax = " << dRmax << std::endl;
         double dR = deltaR(jet.p4(), genJet->p4());     
         if ( dR < dRbestMatch && dR < dRmax ) {
           retVal = &(*genJet);
           dRbestMatch = dR;
         }
       }

       return retVal;
     }

Member Data Documentation

template<typename T >
TFormula* SmearedJetProducer_namespace::GenJetMatcherT< T >::dRmaxGenJetMatch_ [private]