test
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::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  binningEntryType
 

Public Member Functions

 ShiftedMETcorrInputProducer (const edm::ParameterSet &)
 
 ~ShiftedMETcorrInputProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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_
 
std::vector< edm::EDGetTokenT
< CorrMETData > > 
srcTokens_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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

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 5 of file ShiftedMETcorrInputProducer.cc.

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

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

Definition at line 46 of file ShiftedMETcorrInputProducer.cc.

References binning_.

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

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 54 of file ShiftedMETcorrInputProducer.cc.

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

55 {
56  unsigned countToken(0);
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.getByToken(srcTokens_.at(countToken), originalObject);
63  ++countToken;
64 
65  double shift = shiftBy_*(*binningEntry)->binUncertainty_;
66 
67  std::auto_ptr<CorrMETData> shiftedObject(new CorrMETData(*originalObject));
68 //--- MET balances momentum of reconstructed particles,
69 // hence variations of "unclustered energy" and MET are opposite in sign
70  shiftedObject->mex = -shift*originalObject->mex;
71  shiftedObject->mey = -shift*originalObject->mey;
72  shiftedObject->sumet = shift*originalObject->sumet;
73 
74  evt.put(shiftedObject, (*binningEntry)->getInstanceLabel_full(src_i->instance()));
75  }
76  }
77 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::vector< edm::EDGetTokenT< CorrMETData > > srcTokens_
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 65 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().

std::vector<edm::EDGetTokenT<CorrMETData> > ShiftedMETcorrInputProducer::srcTokens_
private

Definition at line 40 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().