CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuonMETcorrInputProducer Class Reference

#include <MuonMETcorrInputProducer.h>

Inheritance diagram for MuonMETcorrInputProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 MuonMETcorrInputProducer (const edm::ParameterSet &)
 ~MuonMETcorrInputProducer ()

Private Member Functions

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

Private Attributes

std::string moduleLabel_
edm::InputTag src_
edm::InputTag srcMuonCorrections_

Detailed Description

Sum CaloMET muon corrections, needed to compute Type 2 MET corrections in case muon corrected CaloMET is used as input to CorrectedCaloMETProducer

Author:
Christian Veelken, LLR
Version:
Revision:
1.1
Id:
MuonMETcorrInputProducer.h,v 1.1 2011/09/16 08:03:38 veelken Exp

Definition at line 25 of file MuonMETcorrInputProducer.h.


Constructor & Destructor Documentation

MuonMETcorrInputProducer::MuonMETcorrInputProducer ( const edm::ParameterSet cfg) [explicit]

Definition at line 10 of file MuonMETcorrInputProducer.cc.

References edm::ParameterSet::getParameter(), src_, and srcMuonCorrections_.

  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
{
  src_ = cfg.getParameter<edm::InputTag>("src");

  srcMuonCorrections_ = cfg.getParameter<edm::InputTag>("srcMuonCorrections");

  produces<CorrMETData>();
}
MuonMETcorrInputProducer::~MuonMETcorrInputProducer ( )

Definition at line 20 of file MuonMETcorrInputProducer.cc.

{
// nothing to be done yet...
}

Member Function Documentation

void MuonMETcorrInputProducer::produce ( edm::Event evt,
const edm::EventSetup es 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 25 of file MuonMETcorrInputProducer.cc.

References edm::Event::getByLabel(), metsig::muon, patZpeak::muons, reco::MuonMETCorrectionData::NotUsed, patZpeak::numMuons, reco::LeafCandidate::pt(), edm::Event::put(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), src_, srcMuonCorrections_, and reco::MuonMETCorrectionData::type().

{
  std::auto_ptr<CorrMETData> unclEnergySum(new CorrMETData());

  edm::Handle<reco::MuonCollection> muons;
  evt.getByLabel(src_, muons);

  typedef edm::ValueMap<reco::MuonMETCorrectionData> MuonMETCorrectionMap;
  edm::Handle<MuonMETCorrectionMap> muonCorrections;
  evt.getByLabel(srcMuonCorrections_, muonCorrections);

//--- sum muon corrections. 
//
//    NOTE: MET = -(jets + muon corrections + "unclustered energy"),
//          so "unclustered energy" = -(MET + jets + muons),
//          i.e. muon corrections enter the sum of "unclustered energy" with negative sign.
//
  int numMuons = muons->size();
  for ( int muonIndex = 0; muonIndex < numMuons; ++muonIndex ) {
    const reco::Muon& muon = muons->at(muonIndex);
        
    reco::MuonRef muonRef(muons, muonIndex);

    reco::MuonMETCorrectionData muonCorrection = (*muonCorrections)[muonRef];
    if ( muonCorrection.type() != reco::MuonMETCorrectionData::NotUsed ) {
      unclEnergySum->mex   -= muon.px();
      unclEnergySum->mey   -= muon.py();
      unclEnergySum->sumet -= muon.pt();
    }
  }

//--- add sum of muon corrections to the event
  evt.put(unclEnergySum);
}

Member Data Documentation

Definition at line 36 of file MuonMETcorrInputProducer.h.

Definition at line 38 of file MuonMETcorrInputProducer.h.

Referenced by MuonMETcorrInputProducer(), and produce().

Definition at line 40 of file MuonMETcorrInputProducer.h.

Referenced by MuonMETcorrInputProducer(), and produce().