CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SysShiftMETcorrInputProducer Class Reference

#include <SysShiftMETcorrInputProducer.h>

Inheritance diagram for SysShiftMETcorrInputProducer:
edm::stream::EDProducer<>

Public Member Functions

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

Private Member Functions

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

Private Attributes

TFormula * corrPx_
 
TFormula * corrPy_
 
std::string moduleLabel_
 
edm::EDGetTokenT< edm::View< reco::MET > > token_
 
bool useNvtx
 
edm::EDGetTokenT< reco::VertexCollectionverticesToken_
 

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

Compute MET correction to compensate systematic shift of MET in x/y-direction (cf. https://indico.cern.ch/getFile.py/access?contribId=1&resId=0&materialId=slides&confId=174318 )

Authors
Christian Veelken, LLR

Definition at line 28 of file SysShiftMETcorrInputProducer.h.

Constructor & Destructor Documentation

◆ SysShiftMETcorrInputProducer()

SysShiftMETcorrInputProducer::SysShiftMETcorrInputProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 11 of file SysShiftMETcorrInputProducer.cc.

12  : moduleLabel_(cfg.getParameter<std::string>("@module_label")), useNvtx(false), corrPx_(nullptr), corrPy_(nullptr) {
13  token_ = consumes<edm::View<reco::MET> >(cfg.getParameter<edm::InputTag>("src"));
14 
15  edm::ParameterSet cfgCorrParameter = cfg.getParameter<edm::ParameterSet>("parameter");
16  TString corrPxFormula = cfgCorrParameter.getParameter<std::string>("px");
17  TString corrPyFormula = cfgCorrParameter.getParameter<std::string>("py").data();
18  if (corrPxFormula.Contains("Nvtx") || corrPyFormula.Contains("Nvtx")) {
19  useNvtx = true, verticesToken_ = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("srcVertices"));
20  }
21 
22  corrPxFormula.ReplaceAll("sumEt", "x");
23  corrPxFormula.ReplaceAll("Nvtx", "y");
24  std::string corrPxName = std::string(moduleLabel_).append("_corrPx");
25  corrPx_ = new TFormula(corrPxName.data(), corrPxFormula.Data());
26 
27  corrPyFormula.ReplaceAll("sumEt", "x");
28  corrPyFormula.ReplaceAll("Nvtx", "y");
29  std::string corrPyName = std::string(moduleLabel_).append("_corrPy");
30  corrPy_ = new TFormula(corrPyName.data(), corrPyFormula.Data());
31 
32  produces<CorrMETData>();
33 }

References looper::cfg, corrPx_, corrPy_, data, edm::ParameterSet::getParameter(), moduleLabel_, AlCaHLTBitMon_QueryRunRegistry::string, token_, useNvtx, and verticesToken_.

◆ ~SysShiftMETcorrInputProducer()

SysShiftMETcorrInputProducer::~SysShiftMETcorrInputProducer ( )
override

Definition at line 35 of file SysShiftMETcorrInputProducer.cc.

35  {
36  // nothing to be done yet...
37 }

Member Function Documentation

◆ produce()

void SysShiftMETcorrInputProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
overrideprivate

Definition at line 39 of file SysShiftMETcorrInputProducer.cc.

39  {
40  //std::cout << "<SysShiftMETcorrInputProducer::produce>:" << std::endl;
41 
42  typedef edm::View<reco::MET> METView;
44  evt.getByToken(token_, met);
45  if (met->size() != 1)
46  throw cms::Exception("SysShiftMETcorrInputProducer::produce") << "Failed to find unique MET object !!\n";
47 
48  double sumEt = met->front().sumEt();
49  //std::cout << " sumEt = " << sumEt << std::endl;
50 
51  size_t Nvtx = 0;
52  if (useNvtx) {
55  Nvtx = vertices->size();
56  }
57  //std::cout << " Nvtx = " << Nvtx << std::endl;
58 
59  std::unique_ptr<CorrMETData> metCorr(new CorrMETData());
60  metCorr->mex = -corrPx_->Eval(sumEt, Nvtx);
61  metCorr->mey = -corrPy_->Eval(sumEt, Nvtx);
62  //std::cout << "--> metCorr: Px = " << metCorr->mex << ", Py = " << metCorr->mey << std::endl;
63 
64  evt.put(std::move(metCorr));
65 }

References corrPx_, corrPy_, edm::Event::getByToken(), BTaggingMonitor_cfi::met, eostools::move(), edm::Event::put(), objects.METAnalyzer::sumEt, token_, useNvtx, pwdgSkimBPark_cfi::vertices, and verticesToken_.

Member Data Documentation

◆ corrPx_

TFormula* SysShiftMETcorrInputProducer::corrPx_
private

Definition at line 43 of file SysShiftMETcorrInputProducer.h.

Referenced by produce(), and SysShiftMETcorrInputProducer().

◆ corrPy_

TFormula* SysShiftMETcorrInputProducer::corrPy_
private

Definition at line 44 of file SysShiftMETcorrInputProducer.h.

Referenced by produce(), and SysShiftMETcorrInputProducer().

◆ moduleLabel_

std::string SysShiftMETcorrInputProducer::moduleLabel_
private

◆ token_

edm::EDGetTokenT<edm::View<reco::MET> > SysShiftMETcorrInputProducer::token_
private

Definition at line 38 of file SysShiftMETcorrInputProducer.h.

Referenced by produce(), and SysShiftMETcorrInputProducer().

◆ useNvtx

bool SysShiftMETcorrInputProducer::useNvtx
private

Definition at line 41 of file SysShiftMETcorrInputProducer.h.

Referenced by produce(), and SysShiftMETcorrInputProducer().

◆ verticesToken_

edm::EDGetTokenT<reco::VertexCollection> SysShiftMETcorrInputProducer::verticesToken_
private

Definition at line 39 of file SysShiftMETcorrInputProducer.h.

Referenced by produce(), and SysShiftMETcorrInputProducer().

SysShiftMETcorrInputProducer::useNvtx
bool useNvtx
Definition: SysShiftMETcorrInputProducer.h:41
objects.METAnalyzer.sumEt
sumEt
Definition: METAnalyzer.py:97
edm::Handle
Definition: AssociativeIterator.h:50
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
CorrMETData
a MET correction term
Definition: CorrMETData.h:14
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
SysShiftMETcorrInputProducer::verticesToken_
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
Definition: SysShiftMETcorrInputProducer.h:39
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View
Definition: CaloClusterFwd.h:14
edm::ParameterSet
Definition: ParameterSet.h:36
SysShiftMETcorrInputProducer::moduleLabel_
std::string moduleLabel_
Definition: SysShiftMETcorrInputProducer.h:36
SysShiftMETcorrInputProducer::corrPy_
TFormula * corrPy_
Definition: SysShiftMETcorrInputProducer.h:44
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
SysShiftMETcorrInputProducer::token_
edm::EDGetTokenT< edm::View< reco::MET > > token_
Definition: SysShiftMETcorrInputProducer.h:38
SysShiftMETcorrInputProducer::corrPx_
TFormula * corrPx_
Definition: SysShiftMETcorrInputProducer.h:43
looper.cfg
cfg
Definition: looper.py:297
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
cms::Exception
Definition: Exception.h:70
edm::InputTag
Definition: InputTag.h:15
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7