CMS 3D CMS Logo

Classes | Public Member Functions | Private Member Functions | Private Attributes

PFCandMETcorrInputProducer Class Reference

#include <PFCandMETcorrInputProducer.h>

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

List of all members.

Classes

struct  binningEntryType

Public Member Functions

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

Private Member Functions

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

Private Attributes

std::vector< binningEntryType * > binning_
std::string moduleLabel_
edm::InputTag src_

Detailed Description

Sum PFCandidates not within jets ("unclustered energy"), needed as input for Type 2 MET corrections

Authors:
Michael Schmitt, Richard Cavanaugh, The University of Florida Florent Lacroix, University of Illinois at Chicago Christian Veelken, LLR
Version:
Revision:
1.2
Id:
PFCandMETcorrInputProducer.h,v 1.2 2011/10/14 10:14:35 veelken Exp

Definition at line 32 of file PFCandMETcorrInputProducer.h.


Constructor & Destructor Documentation

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

Definition at line 5 of file PFCandMETcorrInputProducer.cc.

References binning_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), and src_.

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

  if ( cfg.exists("binning") ) {
    typedef std::vector<edm::ParameterSet> vParameterSet;
    vParameterSet cfgBinning = cfg.getParameter<vParameterSet>("binning");
    for ( vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin();
          cfgBinningEntry != cfgBinning.end(); ++cfgBinningEntry ) {
      binning_.push_back(new binningEntryType(*cfgBinningEntry));
    }
  } else {
    binning_.push_back(new binningEntryType());
  }
  
  for ( std::vector<binningEntryType*>::const_iterator binningEntry = binning_.begin();
        binningEntry != binning_.end(); ++binningEntry ) {
    produces<CorrMETData>((*binningEntry)->binLabel_);
  }
}
PFCandMETcorrInputProducer::~PFCandMETcorrInputProducer ( )

Definition at line 27 of file PFCandMETcorrInputProducer.cc.

References binning_.

{
  for ( std::vector<binningEntryType*>::const_iterator it = binning_.begin();
        it != binning_.end(); ++it ) {
    delete (*it);
  }
}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 35 of file PFCandMETcorrInputProducer.cc.

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

{
  for ( std::vector<binningEntryType*>::iterator binningEntry = binning_.begin();
        binningEntry != binning_.end(); ++binningEntry ) {
    (*binningEntry)->binUnclEnergySum_ = CorrMETData();
  }

  typedef edm::View<reco::Candidate> CandidateView;
  edm::Handle<CandidateView> cands;
  evt.getByLabel(src_, cands);
  
  for ( edm::View<reco::Candidate>::const_iterator cand = cands->begin();
        cand != cands->end(); ++cand ) {
    for ( std::vector<binningEntryType*>::iterator binningEntry = binning_.begin();
          binningEntry != binning_.end(); ++binningEntry ) {
      if ( !(*binningEntry)->binSelection_ || (*(*binningEntry)->binSelection_)(cand->p4()) ) {
        (*binningEntry)->binUnclEnergySum_.mex   += cand->px();
        (*binningEntry)->binUnclEnergySum_.mey   += cand->py();
        (*binningEntry)->binUnclEnergySum_.sumet += cand->et();
      }
    }
  }

//--- add momentum sum of PFCandidates not within jets ("unclustered energy") to the event
  for ( std::vector<binningEntryType*>::const_iterator binningEntry = binning_.begin();
        binningEntry != binning_.end(); ++binningEntry ) {
    evt.put(std::auto_ptr<CorrMETData>(new CorrMETData((*binningEntry)->binUnclEnergySum_)), (*binningEntry)->binLabel_);
  }
}

Member Data Documentation

Definition at line 43 of file PFCandMETcorrInputProducer.h.

Definition at line 45 of file PFCandMETcorrInputProducer.h.

Referenced by PFCandMETcorrInputProducer(), and produce().