CMS 3D CMS Logo

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

void produce (edm::Event &, const edm::EventSetup &) override
 
 Type1PFMET (const edm::ParameterSet &)
 
 Type1PFMET ()
 
 ~Type1PFMET () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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::JetCorrectorcorrectorToken
 
double jetEMfracLimit
 
double jetMufracLimit
 
double jetPTthreshold
 
edm::EDGetTokenT< reco::PFJetCollectiontokenUncorJets
 
edm::EDGetTokenT< reco::METCollectiontokenUncorMet
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 ( )
override

Definition at line 27 of file Type1PFMET.cc.

27 {}

Member Function Documentation

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

Definition at line 30 of file Type1PFMET.cc.

References mitigatedMETSequence_cff::corrector, edm::Event::getByToken(), eostools::move(), convertSQLitetoXML_cfg::output, edm::Handle< T >::product(), edm::Event::put(), and writedatasetfile::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 );
36  iEvent.getByToken( correctorToken, corrector );
37  Handle<METCollection> inputUncorMet; //Define Inputs
38  iEvent.getByToken( tokenUncorMet, inputUncorMet ); //Get Inputs
39  std::unique_ptr<METCollection> output( new METCollection() ); //Create empty output
40  run( *(inputUncorMet.product()), *(corrector.product()), *(inputUncorJets.product()),
42  &*output ); //Invoke the algorithm
43  iEvent.put(std::move(output)); //Put output into Event
44 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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
T const * product() const
Definition: Handle.h:74
double jetPTthreshold
Definition: Type1PFMET.h:42
double jetMufracLimit
Definition: Type1PFMET.h:44
HLT enums.
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
def move(src, dest)
Definition: eostools.py:511
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 MessageLogger_cfi::cerr, corr, reco::JetCorrector::correction(), delta, metsig::jet, nanoDQM_cfi::MET, reco::MET::mEtCorr(), CorrMETData::mex, CorrMETData::mey, reco::LeafCandidate::px(), reco::LeafCandidate::py(), mps_fire::result, mathSSE::sqrt(), CorrMETData::sumet, reco::MET::sumEt(), and reco::LeafCandidate::vertex().

Referenced by Types.EventID::cppID(), Types.LuminosityBlockID::cppID(), and o2olib.O2OTool::execute().

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
double px() const final
x coordinate of momentum vector
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:49
double jetEMfracLimit
Definition: Type1PFMET.h:43
double sumEt() const
Definition: MET.h:56
Definition: MET.h:42
T sqrt(T t)
Definition: SSEVec.h:18
const Point & vertex() const override
vertex position (overwritten by PF...)
double sumet
Definition: CorrMETData.h:20
JetCorrectorParameters corr
Definition: classes.h:5
std::vector< CorrMETData > mEtCorr() const
Definition: MET.h:70
double py() const final
y 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
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.