CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

CorrectedCaloMETProducer2 Class Reference

Inheritance diagram for CorrectedCaloMETProducer2:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 CorrectedCaloMETProducer2 (const edm::ParameterSet &cfg)
 ~CorrectedCaloMETProducer2 ()

Private Types

typedef std::vector
< reco::CaloMET
METCollection

Private Member Functions

reco::CaloMET applyCorrection (const reco::CaloMET &srcMET, const CorrMETData &correction)
reco::Candidate::LorentzVector constructP4From (const reco::CaloMET &met, const CorrMETData &correction)
void produce (edm::Event &evt, const edm::EventSetup &es)
CorrMETData readAndSumCorrections (edm::Event &evt, const edm::EventSetup &es)

Private Attributes

edm::InputTag src_
std::vector< edm::InputTagsrcCorrections_

Detailed Description

Definition at line 21 of file CorrectedCaloMETProducer2.cc.


Member Typedef Documentation

Definition at line 37 of file CorrectedCaloMETProducer2.cc.


Constructor & Destructor Documentation

CorrectedCaloMETProducer2::CorrectedCaloMETProducer2 ( const edm::ParameterSet cfg) [inline, explicit]

Definition at line 26 of file CorrectedCaloMETProducer2.cc.

    : src_(cfg.getParameter<edm::InputTag>("src")),
      srcCorrections_(cfg.getParameter<std::vector<edm::InputTag> >("srcCorrections"))
  {
    produces<METCollection>("");
  }
CorrectedCaloMETProducer2::~CorrectedCaloMETProducer2 ( ) [inline]

Definition at line 33 of file CorrectedCaloMETProducer2.cc.

{ }

Member Function Documentation

reco::CaloMET CorrectedCaloMETProducer2::applyCorrection ( const reco::CaloMET srcMET,
const CorrMETData correction 
) [inline, private]

Definition at line 71 of file CorrectedCaloMETProducer2.cc.

References constructP4From(), reco::CaloMET::getSpecific(), reco::MET::mEtCorr(), CorrMETData::sumet, reco::MET::sumEt(), and reco::LeafCandidate::vertex().

Referenced by produce().

  {
    std::vector<CorrMETData> corrections = srcMET.mEtCorr();
    corrections.push_back(correction);
    return reco::CaloMET(srcMET.getSpecific(), srcMET.sumEt() + correction.sumet, corrections, constructP4From(srcMET, correction), srcMET.vertex());
  }
reco::Candidate::LorentzVector CorrectedCaloMETProducer2::constructP4From ( const reco::CaloMET met,
const CorrMETData correction 
) [inline, private]

Definition at line 78 of file CorrectedCaloMETProducer2.cc.

References CorrMETData::mex, CorrMETData::mey, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and mathSSE::sqrt().

Referenced by applyCorrection().

  {
    double px = met.px() + correction.mex;
    double py = met.py() + correction.mey;
    double pt = sqrt(px*px + py*py);
    return reco::Candidate::LorentzVector(px, py, 0., pt);
  }
void CorrectedCaloMETProducer2::produce ( edm::Event evt,
const edm::EventSetup es 
) [inline, private, virtual]

Implements edm::EDProducer.

Definition at line 42 of file CorrectedCaloMETProducer2.cc.

References applyCorrection(), edm::Event::getByLabel(), edm::Event::put(), readAndSumCorrections(), and src_.

  {
    edm::Handle<METCollection> srcMETCollection;
    evt.getByLabel(src_, srcMETCollection);

    const reco::CaloMET& srcMET = (*srcMETCollection)[0];

    CorrMETData correction = readAndSumCorrections(evt, es);

    reco::CaloMET outMET = applyCorrection(srcMET, correction);

    std::auto_ptr<METCollection> product(new METCollection);
    product->push_back(outMET);
    evt.put(product);
  }
CorrMETData CorrectedCaloMETProducer2::readAndSumCorrections ( edm::Event evt,
const edm::EventSetup es 
) [inline, private]

Definition at line 58 of file CorrectedCaloMETProducer2.cc.

References corr, edm::Event::getByLabel(), run_regression::ret, and srcCorrections_.

Referenced by produce().

  {
    CorrMETData ret;

    edm::Handle<CorrMETData> corr;
    for (std::vector<edm::InputTag>::const_iterator inputTag = srcCorrections_.begin(); inputTag != srcCorrections_.end(); ++inputTag)
      {
        evt.getByLabel(*inputTag, corr);
        ret += (*corr);
      }
    return ret;
  }

Member Data Documentation

Definition at line 39 of file CorrectedCaloMETProducer2.cc.

Referenced by produce().

Definition at line 40 of file CorrectedCaloMETProducer2.cc.

Referenced by readAndSumCorrections().