CMS 3D CMS Logo

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

ShiftedMETcorrInputProducer Class Reference

#include <ShiftedMETcorrInputProducer.h>

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

List of all members.

Classes

struct  binningEntryType

Public Member Functions

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

Private Types

typedef std::vector
< edm::InputTag
vInputTag

Private Member Functions

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

Private Attributes

std::vector< binningEntryType * > binning_
std::string moduleLabel_
double shiftBy_
vInputTag src_

Detailed Description

Vary px, py and sumEt of "unclustered energy" (PFJets of Pt < 10 GeV plus PFCandidates not within jets) by +/- 1 standard deviation, in order to estimate resulting uncertainty on MET

Author:
Christian Veelken, LLR
Version:
Revision:
1.2
Id:
ShiftedMETcorrInputProducer.h,v 1.2 2011/10/14 12:00:17 veelken Exp

Definition at line 25 of file ShiftedMETcorrInputProducer.h.


Member Typedef Documentation

typedef std::vector<edm::InputTag> ShiftedMETcorrInputProducer::vInputTag [private]

Definition at line 38 of file ShiftedMETcorrInputProducer.h.


Constructor & Destructor Documentation

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

Definition at line 7 of file ShiftedMETcorrInputProducer.cc.

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

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

//--- check that all InputTags refer to the same module label
//   (i.e. differ by instance label only)
  for ( vInputTag::const_iterator src_ref = src_.begin();
        src_ref != src_.end(); ++src_ref ) {
    for ( vInputTag::const_iterator src_test = src_ref;
          src_test != src_.end(); ++src_test ) {
      if ( src_test->label() != src_ref->label() )
        throw cms::Exception("ShiftedMETcorrInputProducer") 
          << "InputTags specified by 'src' Configuration parameter must not refer to different module labels !!\n";
    }
  }

  shiftBy_ = cfg.getParameter<double>("shiftBy");

  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 {
    double uncertainty = cfg.getParameter<double>("uncertainty");
    binning_.push_back(new binningEntryType(uncertainty));
  }
  
  for ( vInputTag::const_iterator src_i = src_.begin();
        src_i != src_.end(); ++src_i ) {
    for ( std::vector<binningEntryType*>::const_iterator binningEntry = binning_.begin();
          binningEntry != binning_.end(); ++binningEntry ) {
      produces<CorrMETData>((*binningEntry)->getInstanceLabel_full(src_i->instance()));
    }
  }
}
ShiftedMETcorrInputProducer::~ShiftedMETcorrInputProducer ( )

Definition at line 47 of file ShiftedMETcorrInputProducer.cc.

References binning_.

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

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 55 of file ShiftedMETcorrInputProducer.cc.

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

{
  for ( vInputTag::const_iterator src_i = src_.begin();
        src_i != src_.end(); ++src_i ) {
    for ( std::vector<binningEntryType*>::iterator binningEntry = binning_.begin();
          binningEntry != binning_.end(); ++binningEntry ) {
      edm::Handle<CorrMETData> originalObject;
      evt.getByLabel(edm::InputTag(src_i->label(), (*binningEntry)->getInstanceLabel_full(src_i->instance())), originalObject);
  
      double shift = shiftBy_*(*binningEntry)->binUncertainty_;
      
      std::auto_ptr<CorrMETData> shiftedObject(new CorrMETData(*originalObject));
//--- MET balances momentum of reconstructed particles,
//    hence variations of "unclustered energy" and MET are opposite in sign
      shiftedObject->mex   = -shift*originalObject->mex;
      shiftedObject->mey   = -shift*originalObject->mey;
      shiftedObject->sumet = shift*originalObject->sumet;
      
      evt.put(shiftedObject, (*binningEntry)->getInstanceLabel_full(src_i->instance()));
    }
  }
}

Member Data Documentation

Definition at line 36 of file ShiftedMETcorrInputProducer.h.

Definition at line 64 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().

Definition at line 39 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().