CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
ShiftedMETcorrInputProducer Class Reference
Inheritance diagram for ShiftedMETcorrInputProducer:
edm::stream::EDProducer<>

Classes

struct  binningEntryType
 

Public Member Functions

 ShiftedMETcorrInputProducer (const edm::ParameterSet &)
 
 ~ShiftedMETcorrInputProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Types

typedef std::vector< edm::InputTagvInputTag
 

Private Member Functions

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

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

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

Member Typedef Documentation

◆ vInputTag

Definition at line 31 of file ShiftedMETcorrInputProducer.cc.

Constructor & Destructor Documentation

◆ ShiftedMETcorrInputProducer()

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

Definition at line 56 of file ShiftedMETcorrInputProducer.cc.

References binning_, looper::cfg, shiftBy_, src_, and srcTokens_.

56  {
57  src_ = cfg.getParameter<vInputTag>("src");
58 
59  //--- check that all InputTags refer to the same module label
60  // (i.e. differ by instance label only)
61  for (vInputTag::const_iterator src_ref = src_.begin(); src_ref != src_.end(); ++src_ref) {
62  for (vInputTag::const_iterator src_test = src_ref; src_test != src_.end(); ++src_test) {
63  if (src_test->label() != src_ref->label())
64  throw cms::Exception("ShiftedMETcorrInputProducer")
65  << "InputTags specified by 'src' Configuration parameter must not refer to different module labels !!\n";
66  }
67  }
68 
69  shiftBy_ = cfg.getParameter<double>("shiftBy");
70 
71  if (cfg.exists("binning")) {
72  typedef std::vector<edm::ParameterSet> vParameterSet;
73  vParameterSet cfgBinning = cfg.getParameter<vParameterSet>("binning");
74  for (vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin(); cfgBinningEntry != cfgBinning.end();
75  ++cfgBinningEntry) {
76  binning_.push_back(new binningEntryType(*cfgBinningEntry));
77  }
78  } else {
79  double uncertainty = cfg.getParameter<double>("uncertainty");
80  binning_.push_back(new binningEntryType(uncertainty));
81  }
82 
83  for (vInputTag::const_iterator src_i = src_.begin(); src_i != src_.end(); ++src_i) {
84  for (std::vector<binningEntryType*>::const_iterator binningEntry = binning_.begin(); binningEntry != binning_.end();
85  ++binningEntry) {
86  srcTokens_.push_back(consumes<CorrMETData>(
87  edm::InputTag(src_i->label(), (*binningEntry)->getInstanceLabel_full(src_i->instance()))));
88  produces<CorrMETData>((*binningEntry)->getInstanceLabel_full(src_i->instance()));
89  }
90  }
91 }
std::vector< edm::EDGetTokenT< CorrMETData > > srcTokens_
std::vector< binningEntryType * > binning_
std::vector< edm::InputTag > vInputTag

◆ ~ShiftedMETcorrInputProducer()

ShiftedMETcorrInputProducer::~ShiftedMETcorrInputProducer ( )
override

Definition at line 93 of file ShiftedMETcorrInputProducer.cc.

References binning_.

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

Member Function Documentation

◆ produce()

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

Definition at line 99 of file ShiftedMETcorrInputProducer.cc.

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

99  {
100  unsigned countToken(0);
101  for (vInputTag::const_iterator src_i = src_.begin(); src_i != src_.end(); ++src_i) {
102  for (std::vector<binningEntryType*>::iterator binningEntry = binning_.begin(); binningEntry != binning_.end();
103  ++binningEntry) {
104  edm::Handle<CorrMETData> originalObject;
105  evt.getByToken(srcTokens_.at(countToken), originalObject);
106  ++countToken;
107 
108  double shift = shiftBy_ * (*binningEntry)->binUncertainty_;
109 
110  auto shiftedObject = std::make_unique<CorrMETData>(*originalObject);
111  //--- MET balances momentum of reconstructed particles,
112  // hence variations of "unclustered energy" and MET are opposite in sign
113  shiftedObject->mex = -shift * originalObject->mex;
114  shiftedObject->mey = -shift * originalObject->mey;
115  shiftedObject->sumet = shift * originalObject->sumet;
116 
117  evt.put(std::move(shiftedObject), (*binningEntry)->getInstanceLabel_full(src_i->instance()));
118  }
119  }
120 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:536
std::vector< edm::EDGetTokenT< CorrMETData > > srcTokens_
std::vector< binningEntryType * > binning_
static unsigned int const shift
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ binning_

std::vector<binningEntryType*> ShiftedMETcorrInputProducer::binning_
private

◆ shiftBy_

double ShiftedMETcorrInputProducer::shiftBy_
private

Definition at line 53 of file ShiftedMETcorrInputProducer.cc.

Referenced by produce(), and ShiftedMETcorrInputProducer().

◆ src_

vInputTag ShiftedMETcorrInputProducer::src_
private

Definition at line 32 of file ShiftedMETcorrInputProducer.cc.

Referenced by produce(), and ShiftedMETcorrInputProducer().

◆ srcTokens_

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

Definition at line 33 of file ShiftedMETcorrInputProducer.cc.

Referenced by produce(), and ShiftedMETcorrInputProducer().