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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  binningEntryType
 

Public Member Functions

 ShiftedMETcorrInputProducer (const edm::ParameterSet &)
 
 ~ShiftedMETcorrInputProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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_
 
double shiftBy_
 
vInputTag src_
 
std::vector< edm::EDGetTokenT
< CorrMETData > > 
srcTokens_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
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 36 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 {
7  src_ = cfg.getParameter<vInputTag>("src");
8 
9 //--- check that all InputTags refer to the same module label
10 // (i.e. differ by instance label only)
11  for ( vInputTag::const_iterator src_ref = src_.begin();
12  src_ref != src_.end(); ++src_ref ) {
13  for ( vInputTag::const_iterator src_test = src_ref;
14  src_test != src_.end(); ++src_test ) {
15  if ( src_test->label() != src_ref->label() )
16  throw cms::Exception("ShiftedMETcorrInputProducer")
17  << "InputTags specified by 'src' Configuration parameter must not refer to different module labels !!\n";
18  }
19  }
20 
21  shiftBy_ = cfg.getParameter<double>("shiftBy");
22 
23  if ( cfg.exists("binning") ) {
24  typedef std::vector<edm::ParameterSet> vParameterSet;
25  vParameterSet cfgBinning = cfg.getParameter<vParameterSet>("binning");
26  for ( vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin();
27  cfgBinningEntry != cfgBinning.end(); ++cfgBinningEntry ) {
28  binning_.push_back(new binningEntryType(*cfgBinningEntry));
29  }
30  } else {
31  double uncertainty = cfg.getParameter<double>("uncertainty");
32  binning_.push_back(new binningEntryType(uncertainty));
33  }
34 
35  for ( vInputTag::const_iterator src_i = src_.begin();
36  src_i != src_.end(); ++src_i ) {
37  for ( std::vector<binningEntryType*>::const_iterator binningEntry = binning_.begin();
38  binningEntry != binning_.end(); ++binningEntry ) {
39  srcTokens_.push_back(consumes<CorrMETData>(edm::InputTag(src_i->label(), (*binningEntry)->getInstanceLabel_full(src_i->instance()))));
40  produces<CorrMETData>((*binningEntry)->getInstanceLabel_full(src_i->instance()));
41  }
42  }
43 }
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 45 of file ShiftedMETcorrInputProducer.cc.

References binning_.

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

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 53 of file ShiftedMETcorrInputProducer.cc.

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

54 {
55  unsigned countToken(0);
56  for ( vInputTag::const_iterator src_i = src_.begin();
57  src_i != src_.end(); ++src_i ) {
58  for ( std::vector<binningEntryType*>::iterator binningEntry = binning_.begin();
59  binningEntry != binning_.end(); ++binningEntry ) {
60  edm::Handle<CorrMETData> originalObject;
61  evt.getByToken(srcTokens_.at(countToken), originalObject);
62  ++countToken;
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 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
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
double ShiftedMETcorrInputProducer::shiftBy_
private

Definition at line 63 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().

vInputTag ShiftedMETcorrInputProducer::src_
private

Definition at line 37 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().

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

Definition at line 38 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().