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::METMETCollection
 

Private Member Functions

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

Private Attributes

AddCorrectionsToGenericMET corrector
 
edm::EDGetTokenT< METCollectiontoken_
 

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 23 of file CorrectedPATMETProducer.cc.

Member Typedef Documentation

◆ METCollection

typedef std::vector<pat::MET> CorrectedPATMETProducer::METCollection
private

Definition at line 44 of file CorrectedPATMETProducer.cc.

Constructor & Destructor Documentation

◆ CorrectedPATMETProducer()

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

Definition at line 25 of file CorrectedPATMETProducer.cc.

26  : corrector(), token_(consumes<METCollection>(cfg.getParameter<edm::InputTag>("src"))) {
27  std::vector<edm::InputTag> corrInputTags = cfg.getParameter<std::vector<edm::InputTag> >("srcCorrections");
28  std::vector<edm::EDGetTokenT<CorrMETData> > corrTokens;
29  for (std::vector<edm::InputTag>::const_iterator inputTag = corrInputTags.begin(); inputTag != corrInputTags.end();
30  ++inputTag) {
31  corrTokens.push_back(consumes<CorrMETData>(*inputTag));
32  }
33 
34  corrector.setCorTokens(corrTokens);
35 
36  produces<METCollection>("");
37  }

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

◆ ~CorrectedPATMETProducer()

CorrectedPATMETProducer::~CorrectedPATMETProducer ( )
inlineoverride

Definition at line 39 of file CorrectedPATMETProducer.cc.

39 {}

Member Function Documentation

◆ produce()

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

Definition at line 48 of file CorrectedPATMETProducer.cc.

48  {
49  edm::Handle<METCollection> srcMETCollection;
50  evt.getByToken(token_, srcMETCollection);
51 
52  const pat::MET& srcMET = (*srcMETCollection)[0];
53 
54  //dispatching to be sure we retrieve all the informations
55  reco::MET corrMET = corrector.getCorrectedMET(srcMET, evt);
56  pat::MET outMET(corrMET, srcMET);
57 
58  auto product = std::make_unique<METCollection>();
59 
60  reco::METCovMatrix cov = srcMET.getSignificanceMatrix();
61  if (!(cov(0, 0) == 0 && cov(0, 1) == 0 && cov(1, 0) == 0 && cov(1, 1) == 0)) {
62  outMET.setSignificanceMatrix(cov);
63  double metSig = metsig::METSignificance::getSignificance(cov, outMET);
64  outMET.setMETSignificance(metSig);
65  }
66 
67  product->push_back(outMET);
68  evt.put(std::move(product));
69  }

References corrector, edm::Event::getByToken(), AddCorrectionsToGenericMET::getCorrectedMET(), metsig::METSignificance::getSignificance(), eostools::move(), edm::Event::put(), pat::MET::setMETSignificance(), reco::MET::setSignificanceMatrix(), correctionTermsCaloMet_cff::srcMET, and token_.

Member Data Documentation

◆ corrector

AddCorrectionsToGenericMET CorrectedPATMETProducer::corrector
private

Definition at line 42 of file CorrectedPATMETProducer.cc.

Referenced by CorrectedPATMETProducer(), and produce().

◆ token_

edm::EDGetTokenT<METCollection> CorrectedPATMETProducer::token_
private

Definition at line 46 of file CorrectedPATMETProducer.cc.

Referenced by produce().

CorrectedPATMETProducer::token_
edm::EDGetTokenT< METCollection > token_
Definition: CorrectedPATMETProducer.cc:46
AddCorrectionsToGenericMET::setCorTokens
void setCorTokens(std::vector< edm::EDGetTokenT< CorrMETData > > const &corrTokens)
Definition: AddCorrectionsToGenericMET.cc:3
edm::Handle
Definition: AssociativeIterator.h:50
reco::MET
Definition: MET.h:41
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
AddCorrectionsToGenericMET::getCorrectedMET
reco::MET getCorrectedMET(const reco::MET &srcMET, edm::Event &evt)
Definition: AddCorrectionsToGenericMET.cc:28
CorrectedPATMETProducer::corrector
AddCorrectionsToGenericMET corrector
Definition: CorrectedPATMETProducer.cc:42
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
eostools.move
def move(src, dest)
Definition: eostools.py:511
correctionTermsCaloMet_cff.srcMET
srcMET
Definition: correctionTermsCaloMet_cff.py:14
metsig::METSignificance::getSignificance
static double getSignificance(const reco::METCovMatrix &cov, const reco::MET &met)
Definition: METSignificance.cc:183
SimL1EmulatorRepack_Full_cff.inputTag
inputTag
Definition: SimL1EmulatorRepack_Full_cff.py:56
edm::InputTag
Definition: InputTag.h:15
reco::METCovMatrix
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:39