CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Classes

struct  binningEntryType
 

Public Member Functions

 ShiftedMETcorrInputProducer (const edm::ParameterSet &)
 
 ~ShiftedMETcorrInputProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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

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_.

8  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
9 {
10  src_ = cfg.getParameter<vInputTag>("src");
11 
12 //--- check that all InputTags refer to the same module label
13 // (i.e. differ by instance label only)
14  for ( vInputTag::const_iterator src_ref = src_.begin();
15  src_ref != src_.end(); ++src_ref ) {
16  for ( vInputTag::const_iterator src_test = src_ref;
17  src_test != src_.end(); ++src_test ) {
18  if ( src_test->label() != src_ref->label() )
19  throw cms::Exception("ShiftedMETcorrInputProducer")
20  << "InputTags specified by 'src' Configuration parameter must not refer to different module labels !!\n";
21  }
22  }
23 
24  shiftBy_ = cfg.getParameter<double>("shiftBy");
25 
26  if ( cfg.exists("binning") ) {
27  typedef std::vector<edm::ParameterSet> vParameterSet;
28  vParameterSet cfgBinning = cfg.getParameter<vParameterSet>("binning");
29  for ( vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin();
30  cfgBinningEntry != cfgBinning.end(); ++cfgBinningEntry ) {
31  binning_.push_back(new binningEntryType(*cfgBinningEntry));
32  }
33  } else {
34  double uncertainty = cfg.getParameter<double>("uncertainty");
35  binning_.push_back(new binningEntryType(uncertainty));
36  }
37 
38  for ( vInputTag::const_iterator src_i = src_.begin();
39  src_i != src_.end(); ++src_i ) {
40  for ( std::vector<binningEntryType*>::const_iterator binningEntry = binning_.begin();
41  binningEntry != binning_.end(); ++binningEntry ) {
42  produces<CorrMETData>((*binningEntry)->getInstanceLabel_full(src_i->instance()));
43  }
44  }
45 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< binningEntryType * > binning_
std::vector< edm::InputTag > vInputTag
ShiftedMETcorrInputProducer::~ShiftedMETcorrInputProducer ( )

Definition at line 47 of file ShiftedMETcorrInputProducer.cc.

References binning_.

48 {
49  for ( std::vector<binningEntryType*>::const_iterator it = binning_.begin();
50  it != binning_.end(); ++it ) {
51  delete (*it);
52  }
53 }
std::vector< binningEntryType * > binning_

Member Function Documentation

void ShiftedMETcorrInputProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 55 of file ShiftedMETcorrInputProducer.cc.

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

56 {
57  for ( vInputTag::const_iterator src_i = src_.begin();
58  src_i != src_.end(); ++src_i ) {
59  for ( std::vector<binningEntryType*>::iterator binningEntry = binning_.begin();
60  binningEntry != binning_.end(); ++binningEntry ) {
61  edm::Handle<CorrMETData> originalObject;
62  evt.getByLabel(edm::InputTag(src_i->label(), (*binningEntry)->getInstanceLabel_full(src_i->instance())), originalObject);
63 
64  double shift = shiftBy_*(*binningEntry)->binUncertainty_;
65 
66  std::auto_ptr<CorrMETData> shiftedObject(new CorrMETData(*originalObject));
67 //--- MET balances momentum of reconstructed particles,
68 // hence variations of "unclustered energy" and MET are opposite in sign
69  shiftedObject->mex = -shift*originalObject->mex;
70  shiftedObject->mey = -shift*originalObject->mey;
71  shiftedObject->sumet = shift*originalObject->sumet;
72 
73  evt.put(shiftedObject, (*binningEntry)->getInstanceLabel_full(src_i->instance()));
74  }
75  }
76 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
a MET correction term
Definition: CorrMETData.h:14
std::vector< binningEntryType * > binning_
static unsigned int const shift

Member Data Documentation

std::vector<binningEntryType*> ShiftedMETcorrInputProducer::binning_
private
std::string ShiftedMETcorrInputProducer::moduleLabel_
private
double ShiftedMETcorrInputProducer::shiftBy_
private

Definition at line 64 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().

vInputTag ShiftedMETcorrInputProducer::src_
private

Definition at line 39 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().