CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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::METCollection
token
 
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.

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 147 of file PATMETSlimmer.cc.

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.

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  }
213 }
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 236 of file PATMETSlimmer.cc.

References pat::MET::corPx(), pat::MET::corPy(), pat::MET::corSumEt(), edm::Event::getByToken(), testEve_cfg::level, reco::LeafCandidate::px(), reco::LeafCandidate::py(), pat::MET::setCorShift(), pat::MET::setUncShift(), edm::shift, pat::MET::shiftedPx(), pat::MET::shiftedPy(), pat::MET::shiftedSumEt(), alcazmumu_cfi::src, reco::MET::sumEt(), unpackBuffers-CaloStage2::token, and pat::MET::Type01.

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)
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 }
Analysis-level MET class.
Definition: MET.h:40
double shiftedPx(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:218
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const pat::MET::METCorrectionType level
void setUncShift(double px, double py, double sumEt, METUncertainty shift, bool isSmeared=false)
Definition: MET.cc:336
double corPy(METCorrectionLevel level=Type1) const
Definition: MET.h:236
double corSumEt(METCorrectionLevel level=Type1) const
Definition: MET.cc:329
double shiftedPy(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:221
edm::EDGetTokenT< pat::METCollection > token
double px() const final
x coordinate of momentum vector
double sumEt() const
Definition: MET.h:56
const pat::MET::METUncertainty shift
double shiftedSumEt(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.cc:306
double py() const final
y coordinate of momentum vector
double corPx(METCorrectionLevel level=Type1) const
Definition: MET.h:235
void setCorShift(double px, double py, double sumEt, METCorrectionType level)
Definition: MET.cc:352

Member Data Documentation

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

Definition at line 50 of file PATMETSlimmer.cc.

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

Definition at line 52 of file PATMETSlimmer.cc.

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

Definition at line 47 of file PATMETSlimmer.cc.

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

Definition at line 46 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

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

Definition at line 49 of file PATMETSlimmer.cc.

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

Definition at line 48 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

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

Definition at line 51 of file PATMETSlimmer.cc.