![]() |
![]() |
#include <SysShiftMETcorrInputProducer.h>
Public Member Functions | |
SysShiftMETcorrInputProducer (const edm::ParameterSet &) | |
~SysShiftMETcorrInputProducer () | |
Private Member Functions | |
void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
TFormula * | corrPx_ |
TFormula * | corrPy_ |
std::string | moduleLabel_ |
edm::InputTag | src_ |
edm::InputTag | srcVertices_ |
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 )
Definition at line 27 of file SysShiftMETcorrInputProducer.h.
SysShiftMETcorrInputProducer::SysShiftMETcorrInputProducer | ( | const edm::ParameterSet & | cfg | ) | [explicit] |
Definition at line 13 of file SysShiftMETcorrInputProducer.cc.
References cms::Exception::append(), corrPx_, corrPy_, AlCaHLTBitMon_QueryRunRegistry::data, edm::ParameterSet::getParameter(), edm::InputTag::label(), moduleLabel_, src_, and srcVertices_.
: moduleLabel_(cfg.getParameter<std::string>("@module_label")), corrPx_(0), corrPy_(0) { src_ = cfg.getParameter<edm::InputTag>("src"); edm::ParameterSet cfgCorrParameter = cfg.getParameter<edm::ParameterSet>("parameter"); TString corrPxFormula = cfgCorrParameter.getParameter<std::string>("px"); TString corrPyFormula = cfgCorrParameter.getParameter<std::string>("py").data(); if ( corrPxFormula.Contains("Nvtx") || corrPyFormula.Contains("Nvtx") ) { srcVertices_ = cfg.getParameter<edm::InputTag>("srcVertices"); if ( srcVertices_.label() == "" ) throw cms::Exception("SysShiftMETcorrInputProducer") << "Configuration Parameter 'srcVertices' must be non-empty !!\n"; } corrPxFormula.ReplaceAll("sumEt", "x"); corrPxFormula.ReplaceAll("Nvtx", "y"); std::string corrPxName = std::string(moduleLabel_).append("_corrPx"); corrPx_ = new TFormula(corrPxName.data(), corrPxFormula.Data()); corrPyFormula.ReplaceAll("sumEt", "x"); corrPyFormula.ReplaceAll("Nvtx", "y"); std::string corrPyName = std::string(moduleLabel_).append("_corrPy"); corrPy_ = new TFormula(corrPyName.data(), corrPyFormula.Data()); produces<CorrMETData>(); }
SysShiftMETcorrInputProducer::~SysShiftMETcorrInputProducer | ( | ) |
Definition at line 43 of file SysShiftMETcorrInputProducer.cc.
{
// nothing to be done yet...
}
void SysShiftMETcorrInputProducer::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 48 of file SysShiftMETcorrInputProducer.cc.
References corrPx_, corrPy_, edm::Event::getByLabel(), edm::InputTag::label(), CaloMET_cfi::met, edm::Event::put(), src_, and srcVertices_.
{ //std::cout << "<SysShiftMETcorrInputProducer::produce>:" << std::endl; typedef edm::View<reco::MET> METView; edm::Handle<METView> met; evt.getByLabel(src_, met); if ( met->size() != 1 ) throw cms::Exception("SysShiftMETcorrInputProducer::produce") << "Failed to find unique MET object !!\n"; double sumEt = met->front().sumEt(); //std::cout << " sumEt = " << sumEt << std::endl; size_t Nvtx = 0; if ( srcVertices_.label() != "" ) { edm::Handle<reco::VertexCollection> vertices; evt.getByLabel(srcVertices_, vertices); Nvtx = vertices->size(); } //std::cout << " Nvtx = " << Nvtx << std::endl; std::auto_ptr<CorrMETData> metCorr(new CorrMETData()); metCorr->mex = -corrPx_->Eval(sumEt, Nvtx); metCorr->mey = -corrPy_->Eval(sumEt, Nvtx); //std::cout << "--> metCorr: Px = " << metCorr->mex << ", Py = " << metCorr->mey << std::endl; evt.put(metCorr); }
TFormula* SysShiftMETcorrInputProducer::corrPx_ [private] |
Definition at line 43 of file SysShiftMETcorrInputProducer.h.
Referenced by produce(), and SysShiftMETcorrInputProducer().
TFormula* SysShiftMETcorrInputProducer::corrPy_ [private] |
Definition at line 44 of file SysShiftMETcorrInputProducer.h.
Referenced by produce(), and SysShiftMETcorrInputProducer().
std::string SysShiftMETcorrInputProducer::moduleLabel_ [private] |
Definition at line 38 of file SysShiftMETcorrInputProducer.h.
Referenced by SysShiftMETcorrInputProducer().
Definition at line 40 of file SysShiftMETcorrInputProducer.h.
Referenced by produce(), and SysShiftMETcorrInputProducer().
Definition at line 41 of file SysShiftMETcorrInputProducer.h.
Referenced by produce(), and SysShiftMETcorrInputProducer().