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::EDConsumerBase 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT
< reco::JetCorrector
correctorToken
 
double jetEMfracLimit
 
double jetMufracLimit
 
double jetPTthreshold
 
edm::EDGetTokenT
< reco::PFJetCollection
tokenUncorJets
 
edm::EDGetTokenT
< reco::METCollection
tokenUncorMet
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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  tokenUncorMet = consumes<METCollection>(iConfig.getParameter<edm::InputTag>("inputUncorMetLabel"));
17  tokenUncorJets = consumes<PFJetCollection>(iConfig.getParameter<edm::InputTag>("inputUncorJetsTag"));
18  correctorToken = consumes<JetCorrector>(iConfig.getParameter<edm::InputTag>("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
double jetEMfracLimit
Definition: Type1PFMET.h:43
double jetPTthreshold
Definition: Type1PFMET.h:42
double jetMufracLimit
Definition: Type1PFMET.h:44
edm::EDGetTokenT< reco::PFJetCollection > tokenUncorJets
Definition: Type1PFMET.h:40
edm::EDGetTokenT< reco::METCollection > tokenUncorMet
Definition: Type1PFMET.h:39
edm::EDGetTokenT< reco::JetCorrector > correctorToken
Definition: Type1PFMET.h:41
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 mvaPFMET_cff::corrector, edm::Event::getByToken(), 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.getByToken( tokenUncorJets, inputUncorJets );
37  Handle<METCollection> inputUncorMet; //Define Inputs
38  iEvent.getByToken( tokenUncorMet, inputUncorMet ); //Get Inputs
39  std::auto_ptr<METCollection> output( new METCollection() ); //Create empty output
40  run( *(inputUncorMet.product()), *(corrector.product()), *(inputUncorJets.product()),
42  &*output ); //Invoke the algorithm
43  iEvent.put( output ); //Put output into Event
44 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
double jetEMfracLimit
Definition: Type1PFMET.h:43
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
void run(const reco::METCollection &uncorMET, const reco::JetCorrector &corrector, const reco::PFJetCollection &uncorJet, double jetPTthreshold, double jetEMfracLimit, double jetMufracLimit, reco::METCollection *corMET)
Definition: Type1PFMET.cc:46
tuple corrector
Definition: mvaPFMET_cff.py:86
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
double jetPTthreshold
Definition: Type1PFMET.h:42
double jetMufracLimit
Definition: Type1PFMET.h:44
edm::EDGetTokenT< reco::PFJetCollection > tokenUncorJets
Definition: Type1PFMET.h:40
edm::EDGetTokenT< reco::METCollection > tokenUncorMet
Definition: Type1PFMET.h:39
edm::EDGetTokenT< reco::JetCorrector > correctorToken
Definition: Type1PFMET.h:41
void Type1PFMET::run ( const reco::METCollection uncorMET,
const reco::JetCorrector corrector,
const reco::PFJetCollection uncorJet,
double  jetPTthreshold,
double  jetEMfracLimit,
double  jetMufracLimit,
reco::METCollection corMET 
)
private

Definition at line 46 of file Type1PFMET.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, corr, reco::JetCorrector::correction(), delta, metsig::jet, HLT_25ns14e33_v3_cff::MET, 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.EventID::cppID(), and Types.LuminosityBlockID::cppID().

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

edm::EDGetTokenT<reco::JetCorrector> Type1PFMET::correctorToken
private

Definition at line 41 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.

edm::EDGetTokenT<reco::PFJetCollection> Type1PFMET::tokenUncorJets
private

Definition at line 40 of file Type1PFMET.h.

edm::EDGetTokenT<reco::METCollection> Type1PFMET::tokenUncorMet
private

Definition at line 39 of file Type1PFMET.h.