CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::PATMETSlimmer::OneMETShift Class Reference

Public Member Functions

 OneMETShift ()
 
 OneMETShift (pat::MET::METUncertainty shift_, pat::MET::METCorrectionType level_, const edm::InputTag &baseTag, edm::ConsumesCollector &&cc, bool t0FromMiniAOD_, bool corShift_, bool uncShift_, bool isSmeared_=false)
 
void readAndSet (const edm::Event &ev, pat::MET &met) const
 

Private Attributes

const bool corShift
 
const bool isSmeared
 
const pat::MET::METCorrectionType level
 
const pat::MET::METUncertainty shift
 
const bool t0FromMiniAOD
 
edm::EDGetTokenT< pat::METCollectiontoken
 
const bool uncShift
 

Detailed Description

Definition at line 26 of file PATMETSlimmer.cc.

Constructor & Destructor Documentation

◆ OneMETShift() [1/2]

pat::PATMETSlimmer::OneMETShift::OneMETShift ( )
inline

Definition at line 28 of file PATMETSlimmer.cc.

31  t0FromMiniAOD(false),
32  corShift(false),
33  uncShift(false),
34  isSmeared(false) {}

◆ OneMETShift() [2/2]

pat::PATMETSlimmer::OneMETShift::OneMETShift ( pat::MET::METUncertainty  shift_,
pat::MET::METCorrectionType  level_,
const edm::InputTag baseTag,
edm::ConsumesCollector &&  cc,
bool  t0FromMiniAOD_,
bool  corShift_,
bool  uncShift_,
bool  isSmeared_ = false 
)

Definition at line 147 of file PATMETSlimmer.cc.

155  : shift(shift_),
156  level(level_),
157  t0FromMiniAOD(t0FromMiniAOD_),
158  corShift(corShift_),
159  uncShift(uncShift_),
161  std::string baseTagStr = baseTag.encode();
162  char buff[1024];
163  switch (shift) {
164  case pat::MET::NoShift:
165  snprintf(buff, 1023, baseTagStr.c_str(), "");
166  break;
167  case pat::MET::JetEnUp:
168  snprintf(buff, 1023, baseTagStr.c_str(), "JetEnUp");
169  break;
170  case pat::MET::JetEnDown:
171  snprintf(buff, 1023, baseTagStr.c_str(), "JetEnDown");
172  break;
173  case pat::MET::JetResUp:
174  snprintf(buff, 1023, baseTagStr.c_str(), "JetResUp");
175  break;
177  snprintf(buff, 1023, baseTagStr.c_str(), "JetResDown");
178  break;
179  case pat::MET::MuonEnUp:
180  snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnUp");
181  break;
183  snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnDown");
184  break;
186  snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnUp");
187  break;
189  snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnDown");
190  break;
192  snprintf(buff, 1023, baseTagStr.c_str(), "PhotonEnUp");
193  break;
195  snprintf(buff, 1023, baseTagStr.c_str(), "PhotonEnDown");
196  break;
197  case pat::MET::TauEnUp:
198  snprintf(buff, 1023, baseTagStr.c_str(), "TauEnUp");
199  break;
200  case pat::MET::TauEnDown:
201  snprintf(buff, 1023, baseTagStr.c_str(), "TauEnDown");
202  break;
204  snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnUp");
205  break;
207  snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnDown");
208  break;
209  default:
210  throw cms::Exception("LogicError", "OneMETShift constructor called with bogus shift");
211  }
212  token = cc.consumes<pat::METCollection>(edm::InputTag(buff));
213 }

References pat::MET::ElectronEnDown, pat::MET::ElectronEnUp, edm::InputTag::encode(), Exception, HLT_FULL_cff::InputTag, pat::MET::JetEnDown, pat::MET::JetEnUp, pat::MET::JetResDown, pat::MET::JetResUp, pat::MET::MuonEnDown, pat::MET::MuonEnUp, pat::MET::NoShift, pat::MET::PhotonEnDown, pat::MET::PhotonEnUp, shift, AlCaHLTBitMon_QueryRunRegistry::string, pat::MET::TauEnDown, pat::MET::TauEnUp, token, pat::MET::UnclusteredEnDown, and pat::MET::UnclusteredEnUp.

Member Function Documentation

◆ readAndSet()

void pat::PATMETSlimmer::OneMETShift::readAndSet ( const edm::Event ev,
pat::MET met 
) const

Definition at line 236 of file PATMETSlimmer.cc.

236  {
238  ev.getByToken(token, src);
239 
240  if (src->size() != 1)
241  throw cms::Exception("CorruptData", "More than one MET in the shifted collection");
242  const pat::MET &met2 = src->front();
243 
244  if (t0FromMiniAOD) {
245  if (uncShift)
246  met.setUncShift(met2.shiftedPx(shift, pat::MET::Type01),
249  shift,
250  isSmeared);
251  if (corShift)
252  met.setCorShift(
254  } else {
255  if (uncShift)
256  met.setUncShift(met2.px(), met2.py(), met2.sumEt(), shift, isSmeared);
257  if (corShift)
258  met.setCorShift(met2.px(), met2.py(), met2.sumEt(), level);
259  }
260 }

References pat::MET::corPx(), pat::MET::corPy(), pat::MET::corSumEt(), ev, personalPlayback::level, BTaggingMonitor_cfi::met, reco::LeafCandidate::px(), reco::LeafCandidate::py(), edm::shift, pat::MET::shiftedPx(), pat::MET::shiftedPy(), pat::MET::shiftedSumEt(), TrackRefitter_38T_cff::src, reco::MET::sumEt(), unpackBuffers-CaloStage2::token, and pat::MET::Type01.

Member Data Documentation

◆ corShift

const bool pat::PATMETSlimmer::OneMETShift::corShift
private

Definition at line 50 of file PATMETSlimmer.cc.

◆ isSmeared

const bool pat::PATMETSlimmer::OneMETShift::isSmeared
private

Definition at line 52 of file PATMETSlimmer.cc.

◆ level

const pat::MET::METCorrectionType pat::PATMETSlimmer::OneMETShift::level
private

Definition at line 47 of file PATMETSlimmer.cc.

◆ shift

const pat::MET::METUncertainty pat::PATMETSlimmer::OneMETShift::shift
private

Definition at line 46 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

◆ t0FromMiniAOD

const bool pat::PATMETSlimmer::OneMETShift::t0FromMiniAOD
private

Definition at line 49 of file PATMETSlimmer.cc.

◆ token

edm::EDGetTokenT<pat::METCollection> pat::PATMETSlimmer::OneMETShift::token
private

Definition at line 48 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

◆ uncShift

const bool pat::PATMETSlimmer::OneMETShift::uncShift
private

Definition at line 51 of file PATMETSlimmer.cc.

pat::MET::JetEnDown
Definition: MET.h:156
pat::MET::shiftedPx
double shiftedPx(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:218
pat::PATMETSlimmer::OneMETShift::t0FromMiniAOD
const bool t0FromMiniAOD
Definition: PATMETSlimmer.cc:49
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
pat::MET::PhotonEnDown
Definition: MET.h:166
reco::MET::sumEt
double sumEt() const
Definition: MET.h:56
pat::PATMETSlimmer::OneMETShift::token
edm::EDGetTokenT< pat::METCollection > token
Definition: PATMETSlimmer.cc:48
pat::PATMETSlimmer::OneMETShift::level
const pat::MET::METCorrectionType level
Definition: PATMETSlimmer.cc:47
edm::Handle
Definition: AssociativeIterator.h:50
pat::MET::TauEnDown
Definition: MET.h:162
pat::PATMETSlimmer::OneMETShift::corShift
const bool corShift
Definition: PATMETSlimmer.cc:50
pat::MET::shiftedPy
double shiftedPy(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:221
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
pat::MET::JetResUp
Definition: MET.h:153
cc
pat::MET::PhotonEnUp
Definition: MET.h:165
pat::MET::shiftedSumEt
double shiftedSumEt(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.cc:306
pat::MET::TauEnUp
Definition: MET.h:161
pat::PATMETSlimmer::OneMETShift::shift
const pat::MET::METUncertainty shift
Definition: PATMETSlimmer.cc:46
reco::LeafCandidate::py
double py() const final
y coordinate of momentum vector
Definition: LeafCandidate.h:142
pat::MET::corPx
double corPx(METCorrectionLevel level=Type1) const
Definition: MET.h:235
pat::MET::ElectronEnDown
Definition: MET.h:160
pat::PATMETSlimmer::OneMETShift::isSmeared
const bool isSmeared
Definition: PATMETSlimmer.cc:52
pat::MET::JetResDown
Definition: MET.h:154
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
pat::MET::corPy
double corPy(METCorrectionLevel level=Type1) const
Definition: MET.h:236
pat::MET::Type01
Definition: MET.h:176
pat::MET
Analysis-level MET class.
Definition: MET.h:40
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
pat::MET::MuonEnDown
Definition: MET.h:158
pat::METCollection
std::vector< MET > METCollection
Definition: MET.h:31
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pat::MET::ElectronEnUp
Definition: MET.h:159
pat::MET::corSumEt
double corSumEt(METCorrectionLevel level=Type1) const
Definition: MET.cc:329
pat::MET::NoShift
Definition: MET.h:167
pat::MET::None
Definition: MET.h:192
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
Exception
Definition: hltDiff.cc:245
pat::MET::UnclusteredEnUp
Definition: MET.h:163
pat::MET::JetEnUp
Definition: MET.h:155
pat::MET::MuonEnUp
Definition: MET.h:157
cms::Exception
Definition: Exception.h:70
pat::PATMETSlimmer::OneMETShift::uncShift
const bool uncShift
Definition: PATMETSlimmer.cc:51
pat::MET::UnclusteredEnDown
Definition: MET.h:164
reco::LeafCandidate::px
double px() const final
x coordinate of momentum vector
Definition: LeafCandidate.h:140