CMS 3D CMS Logo

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

Classes

struct  binningEntryType
 

Public Member Functions

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

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 25 of file ShiftedMETcorrInputProducer.h.

Member Typedef Documentation

◆ vInputTag

Definition at line 33 of file ShiftedMETcorrInputProducer.h.

Constructor & Destructor Documentation

◆ ShiftedMETcorrInputProducer()

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

Definition at line 5 of file ShiftedMETcorrInputProducer.cc.

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

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

◆ ~ShiftedMETcorrInputProducer()

ShiftedMETcorrInputProducer::~ShiftedMETcorrInputProducer ( )
override

Definition at line 42 of file ShiftedMETcorrInputProducer.cc.

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

References binning_.

Member Function Documentation

◆ produce()

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

Definition at line 48 of file ShiftedMETcorrInputProducer.cc.

48  {
49  unsigned countToken(0);
50  for (vInputTag::const_iterator src_i = src_.begin(); src_i != src_.end(); ++src_i) {
51  for (std::vector<binningEntryType*>::iterator binningEntry = binning_.begin(); binningEntry != binning_.end();
52  ++binningEntry) {
53  edm::Handle<CorrMETData> originalObject;
54  evt.getByToken(srcTokens_.at(countToken), originalObject);
55  ++countToken;
56 
57  double shift = shiftBy_ * (*binningEntry)->binUncertainty_;
58 
59  auto shiftedObject = std::make_unique<CorrMETData>(*originalObject);
60  //--- MET balances momentum of reconstructed particles,
61  // hence variations of "unclustered energy" and MET are opposite in sign
62  shiftedObject->mex = -shift * originalObject->mex;
63  shiftedObject->mey = -shift * originalObject->mey;
64  shiftedObject->sumet = shift * originalObject->sumet;
65 
66  evt.put(std::move(shiftedObject), (*binningEntry)->getInstanceLabel_full(src_i->instance()));
67  }
68  }
69 }

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

Member Data Documentation

◆ binning_

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

◆ shiftBy_

double ShiftedMETcorrInputProducer::shiftBy_
private

Definition at line 55 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().

◆ src_

vInputTag ShiftedMETcorrInputProducer::src_
private

Definition at line 34 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().

◆ srcTokens_

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

Definition at line 35 of file ShiftedMETcorrInputProducer.h.

Referenced by produce(), and ShiftedMETcorrInputProducer().

ShiftedMETcorrInputProducer::vInputTag
std::vector< edm::InputTag > vInputTag
Definition: ShiftedMETcorrInputProducer.h:33
CorrMETData::mey
double mey
Definition: CorrMETData.h:16
CorrMETData::mex
double mex
Definition: CorrMETData.h:15
edm::Handle
Definition: AssociativeIterator.h:50
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
CorrMETData::sumet
double sumet
Definition: CorrMETData.h:18
ShiftedMETcorrInputProducer::srcTokens_
std::vector< edm::EDGetTokenT< CorrMETData > > srcTokens_
Definition: ShiftedMETcorrInputProducer.h:35
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
ShiftedMETcorrInputProducer::shiftBy_
double shiftBy_
Definition: ShiftedMETcorrInputProducer.h:55
looper.cfg
cfg
Definition: looper.py:297
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
ShiftedMETcorrInputProducer::src_
vInputTag src_
Definition: ShiftedMETcorrInputProducer.h:34
ShiftedMETcorrInputProducer::binning_
std::vector< binningEntryType * > binning_
Definition: ShiftedMETcorrInputProducer.h:53
cms::Exception
Definition: Exception.h:70
edm::InputTag
Definition: InputTag.h:15