CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

Definition at line 28 of file PATMETSlimmer.cc.

References ev, BTaggingMonitor_cfi::met, and readAndSet().

31  t0FromMiniAOD(false),
32  corShift(false),
33  uncShift(false),
34  isSmeared(false) {}
const pat::MET::METCorrectionType level
const pat::MET::METUncertainty shift
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 143 of file PATMETSlimmer.cc.

References pat::MET::ElectronEnDown, pat::MET::ElectronEnUp, edm::InputTag::encode(), Exception, HLT_2018_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.

151  : shift(shift_),
152  level(level_),
153  t0FromMiniAOD(t0FromMiniAOD_),
154  corShift(corShift_),
155  uncShift(uncShift_),
157  std::string baseTagStr = baseTag.encode();
158  char buff[1024];
159  switch (shift) {
160  case pat::MET::NoShift:
161  snprintf(buff, 1023, baseTagStr.c_str(), "");
162  break;
163  case pat::MET::JetEnUp:
164  snprintf(buff, 1023, baseTagStr.c_str(), "JetEnUp");
165  break;
166  case pat::MET::JetEnDown:
167  snprintf(buff, 1023, baseTagStr.c_str(), "JetEnDown");
168  break;
169  case pat::MET::JetResUp:
170  snprintf(buff, 1023, baseTagStr.c_str(), "JetResUp");
171  break;
173  snprintf(buff, 1023, baseTagStr.c_str(), "JetResDown");
174  break;
175  case pat::MET::MuonEnUp:
176  snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnUp");
177  break;
179  snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnDown");
180  break;
182  snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnUp");
183  break;
185  snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnDown");
186  break;
188  snprintf(buff, 1023, baseTagStr.c_str(), "PhotonEnUp");
189  break;
191  snprintf(buff, 1023, baseTagStr.c_str(), "PhotonEnDown");
192  break;
193  case pat::MET::TauEnUp:
194  snprintf(buff, 1023, baseTagStr.c_str(), "TauEnUp");
195  break;
196  case pat::MET::TauEnDown:
197  snprintf(buff, 1023, baseTagStr.c_str(), "TauEnDown");
198  break;
200  snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnUp");
201  break;
203  snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnDown");
204  break;
205  default:
206  throw cms::Exception("LogicError", "OneMETShift constructor called with bogus shift");
207  }
209 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const pat::MET::METCorrectionType level
std::vector< MET > METCollection
Definition: MET.h:31
std::string encode() const
Definition: InputTag.cc:159
edm::EDGetTokenT< pat::METCollection > token
const pat::MET::METUncertainty shift

Member Function Documentation

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

Definition at line 232 of file PATMETSlimmer.cc.

References pat::MET::corPx(), pat::MET::corPy(), corShift, pat::MET::corSumEt(), DEFINE_FWK_MODULE, edm::Event::getByToken(), isSmeared, level, reco::LeafCandidate::px(), reco::LeafCandidate::py(), pat::MET::setCorShift(), pat::MET::setUncShift(), shift, pat::MET::shiftedPx(), pat::MET::shiftedPy(), pat::MET::shiftedSumEt(), TrackRefitter_38T_cff::src, reco::MET::sumEt(), t0FromMiniAOD, token, pat::MET::Type01, and uncShift.

Referenced by OneMETShift().

232  {
234  ev.getByToken(token, src);
235 
236  if (src->size() != 1)
237  throw cms::Exception("CorruptData", "More than one MET in the shifted collection");
238  const pat::MET &met2 = src->front();
239 
240  if (t0FromMiniAOD) {
241  if (uncShift)
245  shift,
246  isSmeared);
247  if (corShift)
248  met.setCorShift(
250  } else {
251  if (uncShift)
252  met.setUncShift(met2.px(), met2.py(), met2.sumEt(), shift, isSmeared);
253  if (corShift)
254  met.setCorShift(met2.px(), met2.py(), met2.sumEt(), level);
255  }
256 }
Analysis-level MET class.
Definition: MET.h:40
double shiftedPx(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:214
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const pat::MET::METCorrectionType level
double px() const final
x coordinate of momentum vector
void setUncShift(double px, double py, double sumEt, METUncertainty shift, bool isSmeared=false)
Definition: MET.cc:326
double corPy(METCorrectionLevel level=Type1) const
Definition: MET.h:232
double corSumEt(METCorrectionLevel level=Type1) const
Definition: MET.cc:319
double shiftedPy(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:217
edm::EDGetTokenT< pat::METCollection > token
double sumEt() const
Definition: MET.h:52
const pat::MET::METUncertainty shift
double shiftedSumEt(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.cc:296
double corPx(METCorrectionLevel level=Type1) const
Definition: MET.h:231
double py() const final
y coordinate of momentum vector
void setCorShift(double px, double py, double sumEt, METCorrectionType level)
Definition: MET.cc:342

Member Data Documentation

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

Definition at line 50 of file PATMETSlimmer.cc.

Referenced by readAndSet().

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

Definition at line 52 of file PATMETSlimmer.cc.

Referenced by readAndSet().

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

Definition at line 47 of file PATMETSlimmer.cc.

Referenced by readAndSet().

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

Definition at line 46 of file PATMETSlimmer.cc.

Referenced by OneMETShift(), pat::PATMETSlimmer::produce(), and readAndSet().

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

Definition at line 49 of file PATMETSlimmer.cc.

Referenced by readAndSet().

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

Definition at line 48 of file PATMETSlimmer.cc.

Referenced by OneMETShift(), and readAndSet().

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

Definition at line 51 of file PATMETSlimmer.cc.

Referenced by readAndSet().