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 Member Functions | Private Attributes
Type1PFMET Class Reference

Computes the Type-1 corrections for pfMET. A specific version of the Type1MET class from the JetMETCorrections/Type1MET package. More...

#include <Type1PFMET.h>

Inheritance diagram for Type1PFMET:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
 Type1PFMET (const edm::ParameterSet &)
 
 Type1PFMET ()
 
virtual ~Type1PFMET ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

void run (const reco::METCollection &uncorMET, const JetCorrector &corrector, const reco::PFJetCollection &uncorJet, double jetPTthreshold, double jetEMfracLimit, double jetMufracLimit, reco::METCollection *corMET)
 

Private Attributes

std::string correctorLabel
 
edm::InputTag inputUncorJetsTag
 
std::string inputUncorMetLabel
 
double jetEMfracLimit
 
double jetMufracLimit
 
double jetPTthreshold
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Computes the Type-1 corrections for pfMET. A specific version of the Type1MET class from the JetMETCorrections/Type1MET package.

Author
Michal Bluj
Date
February 2009

Definition at line 31 of file Type1PFMET.h.

Constructor & Destructor Documentation

Type1PFMET::Type1PFMET ( const edm::ParameterSet iConfig)
explicit

Definition at line 14 of file Type1PFMET.cc.

References edm::ParameterSet::getParameter().

15 {
16  inputUncorMetLabel = iConfig.getParameter<std::string>("inputUncorMetLabel");
17  inputUncorJetsTag = iConfig.getParameter<edm::InputTag>("inputUncorJetsTag");
18  correctorLabel = iConfig.getParameter<std::string>("corrector");
19  jetPTthreshold = iConfig.getParameter<double>("jetPTthreshold");
20  jetEMfracLimit = iConfig.getParameter<double>("jetEMfracLimit");
21  jetMufracLimit = iConfig.getParameter<double>("jetMufracLimit");
22  produces<METCollection>();
23 }
T getParameter(std::string const &) const
std::string correctorLabel
Definition: Type1PFMET.h:41
std::string inputUncorMetLabel
Definition: Type1PFMET.h:39
double jetEMfracLimit
Definition: Type1PFMET.h:43
edm::InputTag inputUncorJetsTag
Definition: Type1PFMET.h:40
double jetPTthreshold
Definition: Type1PFMET.h:42
double jetMufracLimit
Definition: Type1PFMET.h:44
Type1PFMET::Type1PFMET ( )
explicit

Definition at line 24 of file Type1PFMET.cc.

24 {}
Type1PFMET::~Type1PFMET ( )
virtual

Definition at line 27 of file Type1PFMET.cc.

27 {}

Member Function Documentation

void Type1PFMET::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 30 of file Type1PFMET.cc.

References edm::Event::getByLabel(), JetCorrector::getJetCorrector(), convertSQLitetoXML_cfg::output, edm::Event::put(), and DTTTrigCorrFirst::run.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

31 {
32  using namespace edm;
33  Handle<PFJetCollection> inputUncorJets;
34  iEvent.getByLabel( inputUncorJetsTag, inputUncorJets );
35  const JetCorrector* corrector = JetCorrector::getJetCorrector (correctorLabel, iSetup);
36  Handle<METCollection> inputUncorMet; //Define Inputs
37  iEvent.getByLabel( inputUncorMetLabel, inputUncorMet ); //Get Inputs
38  std::auto_ptr<METCollection> output( new METCollection() ); //Create empty output
39  run( *(inputUncorMet.product()), *corrector, *(inputUncorJets.product()),
41  &*output ); //Invoke the algorithm
42  iEvent.put( output ); //Put output into Event
43 }
std::string correctorLabel
Definition: Type1PFMET.h:41
std::string inputUncorMetLabel
Definition: Type1PFMET.h:39
double jetEMfracLimit
Definition: Type1PFMET.h:43
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
edm::InputTag inputUncorJetsTag
Definition: Type1PFMET.h:40
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
Definition: JetCorrector.cc:51
double jetPTthreshold
Definition: Type1PFMET.h:42
double jetMufracLimit
Definition: Type1PFMET.h:44
void run(const reco::METCollection &uncorMET, const JetCorrector &corrector, const reco::PFJetCollection &uncorJet, double jetPTthreshold, double jetEMfracLimit, double jetMufracLimit, reco::METCollection *corMET)
Definition: Type1PFMET.cc:45
void Type1PFMET::run ( const reco::METCollection uncorMET,
const JetCorrector corrector,
const reco::PFJetCollection uncorJet,
double  jetPTthreshold,
double  jetEMfracLimit,
double  jetMufracLimit,
reco::METCollection corMET 
)
private

Definition at line 45 of file Type1PFMET.cc.

References dtNoiseDBValidation_cfg::cerr, corr, JetCorrector::correction(), delta, metsig::jet, reco::MET::mEtCorr(), CorrMETData::mex, CorrMETData::mey, reco::LeafCandidate::px(), reco::LeafCandidate::py(), query::result, mathSSE::sqrt(), CorrMETData::sumet, reco::MET::sumEt(), and reco::LeafCandidate::vertex().

Referenced by Types.LuminosityBlockID::cppID().

52 {
53  if (!corMET) {
54  std::cerr << "Type1METAlgo_run-> undefined output MET collection. Stop. " << std::endl;
55  return;
56  }
57 
58  double DeltaPx = 0.0;
59  double DeltaPy = 0.0;
60  double DeltaSumET = 0.0;
61  // ---------------- Calculate jet corrections, but only for those uncorrected jets
62  // ---------------- which are above the given threshold. This requires that the
63  // ---------------- uncorrected jets be matched with the corrected jets.
64  for( PFJetCollection::const_iterator jet = uncorJet.begin(); jet != uncorJet.end(); ++jet) {
65  if( jet->pt() > jetPTthreshold ) {
66  double emEFrac =
67  jet->chargedEmEnergyFraction() + jet->neutralEmEnergyFraction();
68  double muEFrac = jet->chargedMuEnergyFraction();
69  if( emEFrac < jetEMfracLimit
70  && muEFrac < jetMufracLimit ) {
71  double corr = corrector.correction (*jet) - 1.; // correction itself
72  DeltaPx += jet->px() * corr;
73  DeltaPy += jet->py() * corr;
74  DeltaSumET += jet->et() * corr;
75  }
76  }
77  }
78  //----------------- Calculate and set deltas for new MET correction
80  delta.mex = - DeltaPx; //correction to MET (from Jets) is negative,
81  delta.mey = - DeltaPy; //since MET points in direction opposite of jets
82  delta.sumet = DeltaSumET;
83  //----------------- Fill holder with corrected MET (= uncorrected + delta) values
84  const MET* u = &(uncorMET.front());
85  double corrMetPx = u->px()+delta.mex;
86  double corrMetPy = u->py()+delta.mey;
87  MET::LorentzVector correctedMET4vector( corrMetPx, corrMetPy, 0.,
88  sqrt (corrMetPx*corrMetPx + corrMetPy*corrMetPy)
89  );
90  //----------------- get previous corrections and push into new corrections
91  std::vector<CorrMETData> corrections = u->mEtCorr();
92  corrections.push_back( delta );
93  //----------------- Push onto MET Collection
94  MET result = MET(u->sumEt()+delta.sumet,
95  corrections,
96  correctedMET4vector,
97  u->vertex() );
98  corMET->push_back(result);
99 
100  return;
101 }
dbl * delta
Definition: mlp_gen.cc:36
virtual const Point & vertex() const
vertex position
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
double jetEMfracLimit
Definition: Type1PFMET.h:43
double sumEt() const
Definition: MET.h:48
Definition: MET.h:32
T sqrt(T t)
Definition: SSEVec.h:46
tuple result
Definition: query.py:137
double sumet
Definition: CorrMETData.h:20
JetCorrectorParameters corr
Definition: classes.h:9
std::vector< CorrMETData > mEtCorr() const
Definition: MET.h:63
virtual double px() const
x coordinate of momentum vector
double jetPTthreshold
Definition: Type1PFMET.h:42
a MET correction term
Definition: CorrMETData.h:14
double jetMufracLimit
Definition: Type1PFMET.h:44
double mey
Definition: CorrMETData.h:18
double mex
Definition: CorrMETData.h:17
virtual double py() const
y coordinate of momentum vector
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

std::string Type1PFMET::correctorLabel
private

Definition at line 41 of file Type1PFMET.h.

edm::InputTag Type1PFMET::inputUncorJetsTag
private

Definition at line 40 of file Type1PFMET.h.

std::string Type1PFMET::inputUncorMetLabel
private

Definition at line 39 of file Type1PFMET.h.

double Type1PFMET::jetEMfracLimit
private

Definition at line 43 of file Type1PFMET.h.

double Type1PFMET::jetMufracLimit
private

Definition at line 44 of file Type1PFMET.h.

double Type1PFMET::jetPTthreshold
private

Definition at line 42 of file Type1PFMET.h.