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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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

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

Definition at line 49 of file CorrectedPATMETProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 28 of file CorrectedPATMETProducer.cc.

References corrector, edm::ParameterSet::getParameter(), HiClusterCompatibility_cfi::inputTag, and AddCorrectionsToGenericMET::setCorTokens().

29  : corrector(),
30  token_(consumes<METCollection>(cfg.getParameter<edm::InputTag>("src")))
31  {
32  std::vector<edm::InputTag> corrInputTags = cfg.getParameter<std::vector<edm::InputTag> >("srcCorrections");
33  std::vector<edm::EDGetTokenT<CorrMETData> > corrTokens;
34  for (std::vector<edm::InputTag>::const_iterator inputTag = corrInputTags.begin(); inputTag != corrInputTags.end(); ++inputTag) {
35  corrTokens.push_back(consumes<CorrMETData>(*inputTag));
36  }
37 
38  corrector.setCorTokens(corrTokens);
39 
40  produces<METCollection>("");
41  }
T getParameter(std::string const &) const
edm::EDGetTokenT< METCollection > token_
AddCorrectionsToGenericMET corrector
void setCorTokens(std::vector< edm::EDGetTokenT< CorrMETData > > const &corrTokens)
CorrectedPATMETProducer::~CorrectedPATMETProducer ( )
inlineoverride

Definition at line 43 of file CorrectedPATMETProducer.cc.

43 { }

Member Function Documentation

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

Definition at line 53 of file CorrectedPATMETProducer.cc.

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

54  {
55  edm::Handle<METCollection> srcMETCollection;
56  evt.getByToken(token_, srcMETCollection);
57 
58  const pat::MET& srcMET = (*srcMETCollection)[0];
59 
60  //dispatching to be sure we retrieve all the informations
61  reco::MET corrMET = corrector.getCorrectedMET(srcMET, evt, es);
62  pat::MET outMET(corrMET, srcMET);
63 
64  auto product = std::make_unique<METCollection>();
65 
67  if( !(cov(0,0)==0 && cov(0,1)==0 && cov(1,0)==0 && cov(1,1)==0) ) {
68  outMET.setSignificanceMatrix(cov);
69  double metSig=metsig::METSignificance::getSignificance(cov, outMET);
70  outMET.setMETSignificance(metSig);
71  }
72 
73  product->push_back(outMET);
74  evt.put(std::move(product));
75  }
Analysis-level MET class.
Definition: MET.h:43
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
static double getSignificance(const reco::METCovMatrix &cov, const reco::MET &met)
reco::MET getCorrectedMET(const reco::MET &srcMET, edm::Event &evt, const edm::EventSetup &es)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< METCollection > token_
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:40
AddCorrectionsToGenericMET corrector
Definition: MET.h:42
def move(src, dest)
Definition: eostools.py:510
reco::METCovMatrix getSignificanceMatrix(void) const
Definition: MET.cc:139

Member Data Documentation

AddCorrectionsToGenericMET CorrectedPATMETProducer::corrector
private

Definition at line 47 of file CorrectedPATMETProducer.cc.

Referenced by CorrectedPATMETProducer().

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

Definition at line 51 of file CorrectedPATMETProducer.cc.