CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
CorrectedPatMETProducer Class Reference
Inheritance diagram for CorrectedPatMETProducer:
edm::stream::EDProducer<>

Public Member Functions

 CorrectedPatMETProducer (const edm::ParameterSet &cfg)
 
 ~CorrectedPatMETProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Types

typedef std::vector< pat::METpatMETCollection
 
typedef std::vector< reco::PFMETpfMETCollection
 

Private Member Functions

void produce (edm::Event &evt, const edm::EventSetup &es) override
 

Private Attributes

AddCorrectionsToGenericMET corrector
 
bool isMiniAod
 
edm::EDGetTokenT< patMETCollectionpatToken_
 
edm::EDGetTokenT< pfMETCollectionpfToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 22 of file CorrectedPatMETProducer.cc.

Member Typedef Documentation

◆ patMETCollection

Definition at line 54 of file CorrectedPatMETProducer.cc.

◆ pfMETCollection

Definition at line 55 of file CorrectedPatMETProducer.cc.

Constructor & Destructor Documentation

◆ CorrectedPatMETProducer()

CorrectedPatMETProducer::CorrectedPatMETProducer ( const edm::ParameterSet cfg)
inlineexplicit

Definition at line 24 of file CorrectedPatMETProducer.cc.

25  : corrector()
26  //token_(consumes<METCollection>(cfg.getParameter<edm::InputTag>("src")))
27  {
28  isMiniAod = (cfg.exists("isMiniAod")) ? cfg.getParameter<bool>("isMiniAod") : true;
29  if (isMiniAod) {
30  patToken_ = consumes<patMETCollection>(cfg.getParameter<edm::InputTag>("src"));
31  } else {
32  pfToken_ = consumes<pfMETCollection>(cfg.getParameter<edm::InputTag>("src"));
33  }
34 
35  std::vector<edm::InputTag> corrInputTags = cfg.getParameter<std::vector<edm::InputTag> >("srcCorrections");
36  std::vector<edm::EDGetTokenT<CorrMETData> > corrTokens;
37  for (std::vector<edm::InputTag>::const_iterator inputTag = corrInputTags.begin(); inputTag != corrInputTags.end();
38  ++inputTag) {
39  corrTokens.push_back(consumes<CorrMETData>(*inputTag));
40  }
41 
42  corrector.setCorTokens(corrTokens);
43 
44  produces<patMETCollection>("");
45  }

References looper::cfg, corrector, SimL1EmulatorRepack_Full_cff::inputTag, isMiniAod, patToken_, pfToken_, and AddCorrectionsToGenericMET::setCorTokens().

◆ ~CorrectedPatMETProducer()

CorrectedPatMETProducer::~CorrectedPatMETProducer ( )
inlineoverride

Definition at line 47 of file CorrectedPatMETProducer.cc.

47 {}

Member Function Documentation

◆ produce()

void CorrectedPatMETProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
inlineoverrideprivate

Definition at line 60 of file CorrectedPatMETProducer.cc.

60  {
61  edm::Handle<patMETCollection> srcPatMETCollection;
62  edm::Handle<pfMETCollection> srcPfMETCollection;
63  if (isMiniAod) {
64  evt.getByToken(patToken_, srcPatMETCollection);
65  } else {
66  evt.getByToken(pfToken_, srcPfMETCollection);
67  }
68 
69  if (isMiniAod) {
70  //std::unique_ptr<patMETCollection> product(new patMETCollection);
71  std::unique_ptr<patMETCollection> product(new patMETCollection);
72  const reco::MET& srcMET = (*srcPatMETCollection)[0];
73  pat::MET outMEtPat = corrector.getCorrectedMET(srcMET, evt);
74  product->push_back(outMEtPat);
75  evt.put(std::move(product));
76  } else {
77  std::unique_ptr<pfMETCollection> product(new pfMETCollection);
78  const reco::PFMET& srcMET = (*srcPfMETCollection)[0];
79  reco::PFMET outPfMEtReco = corrector.getCorrectedPFMET(srcMET, evt);
80  product->push_back(outPfMEtReco);
81  evt.put(std::move(product));
82  }
83  }

References corrector, edm::Event::getByToken(), AddCorrectionsToGenericMET::getCorrectedMET(), AddCorrectionsToGenericMET::getCorrectedPFMET(), isMiniAod, eostools::move(), patToken_, pfToken_, edm::Event::put(), and correctionTermsCaloMet_cff::srcMET.

Member Data Documentation

◆ corrector

AddCorrectionsToGenericMET CorrectedPatMETProducer::corrector
private

Definition at line 52 of file CorrectedPatMETProducer.cc.

Referenced by CorrectedPatMETProducer(), and produce().

◆ isMiniAod

bool CorrectedPatMETProducer::isMiniAod
private

Definition at line 50 of file CorrectedPatMETProducer.cc.

Referenced by CorrectedPatMETProducer(), and produce().

◆ patToken_

edm::EDGetTokenT<patMETCollection> CorrectedPatMETProducer::patToken_
private

Definition at line 57 of file CorrectedPatMETProducer.cc.

Referenced by CorrectedPatMETProducer(), and produce().

◆ pfToken_

edm::EDGetTokenT<pfMETCollection> CorrectedPatMETProducer::pfToken_
private

Definition at line 58 of file CorrectedPatMETProducer.cc.

Referenced by CorrectedPatMETProducer(), and produce().

CorrectedPatMETProducer::corrector
AddCorrectionsToGenericMET corrector
Definition: CorrectedPatMETProducer.cc:52
AddCorrectionsToGenericMET::setCorTokens
void setCorTokens(std::vector< edm::EDGetTokenT< CorrMETData > > const &corrTokens)
Definition: AddCorrectionsToGenericMET.cc:3
CorrectedPatMETProducer::pfToken_
edm::EDGetTokenT< pfMETCollection > pfToken_
Definition: CorrectedPatMETProducer.cc:58
edm::Handle
Definition: AssociativeIterator.h:50
CorrectedPatMETProducer::pfMETCollection
std::vector< reco::PFMET > pfMETCollection
Definition: CorrectedPatMETProducer.cc:55
reco::MET
Definition: MET.h:41
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
CorrectedPatMETProducer::patMETCollection
std::vector< pat::MET > patMETCollection
Definition: CorrectedPatMETProducer.cc:54
reco::PFMET
Definition: PFMET.h:18
AddCorrectionsToGenericMET::getCorrectedMET
reco::MET getCorrectedMET(const reco::MET &srcMET, edm::Event &evt)
Definition: AddCorrectionsToGenericMET.cc:28
CorrectedPatMETProducer::patToken_
edm::EDGetTokenT< patMETCollection > patToken_
Definition: CorrectedPatMETProducer.cc:57
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
pat::MET
Analysis-level MET class.
Definition: MET.h:40
looper.cfg
cfg
Definition: looper.py:297
AddCorrectionsToGenericMET::getCorrectedPFMET
reco::PFMET getCorrectedPFMET(const reco::PFMET &srcMET, edm::Event &evt)
Definition: AddCorrectionsToGenericMET.cc:36
eostools.move
def move(src, dest)
Definition: eostools.py:511
correctionTermsCaloMet_cff.srcMET
srcMET
Definition: correctionTermsCaloMet_cff.py:14
SimL1EmulatorRepack_Full_cff.inputTag
inputTag
Definition: SimL1EmulatorRepack_Full_cff.py:56
edm::InputTag
Definition: InputTag.h:15
CorrectedPatMETProducer::isMiniAod
bool isMiniAod
Definition: CorrectedPatMETProducer.cc:50