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::METCollection
token
 
const bool uncShift
 

Detailed Description

Definition at line 27 of file PATMETSlimmer.cc.

Constructor & Destructor Documentation

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

Definition at line 29 of file PATMETSlimmer.cc.

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

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

110  :
111  shift(shift_), level(level_), t0FromMiniAOD(t0FromMiniAOD_), corShift(corShift_), uncShift(uncShift_), isSmeared(isSmeared)
112 {
113 
114  std::string baseTagStr = baseTag.encode();
115  char buff[1024];
116  switch (shift) {
117  case pat::MET::NoShift : snprintf(buff, 1023, baseTagStr.c_str(), ""); break;
118  case pat::MET::JetEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "JetEnUp"); break;
119  case pat::MET::JetEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "JetEnDown"); break;
120  case pat::MET::JetResUp : snprintf(buff, 1023, baseTagStr.c_str(), isSmeared?"JetResUp":""); break;
121  case pat::MET::JetResDown: snprintf(buff, 1023, baseTagStr.c_str(), isSmeared?"JetResDown":""); break;
122  case pat::MET::MuonEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnUp"); break;
123  case pat::MET::MuonEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnDown"); break;
124  case pat::MET::ElectronEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnUp"); break;
125  case pat::MET::ElectronEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnDown"); break;
126  case pat::MET::PhotonEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "PhotonEnUp"); break;
127  case pat::MET::PhotonEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "PhotonEnDown"); break;
128  case pat::MET::TauEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "TauEnUp"); break;
129  case pat::MET::TauEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "TauEnDown"); break;
130  case pat::MET::UnclusteredEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnUp"); break;
131  case pat::MET::UnclusteredEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnDown"); break;
132  default: throw cms::Exception("LogicError", "OneMETShift constructor called with bogus shift");
133  }
135 
136 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const pat::MET::METCorrectionType level
std::vector< MET > METCollection
Definition: MET.h:32
std::string encode() const
Definition: InputTag.cc:164
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 160 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(), and pat::MET::Type01.

160  {
162  ev.getByToken(token, src);
163 
164  if (src->size() != 1) throw cms::Exception("CorruptData", "More than one MET in the shifted collection");
165  const pat::MET &met2 = src->front();
166 
167 
168  if(t0FromMiniAOD) {
173  }
174  else {
175  if(uncShift) met.setUncShift(met2.px(), met2.py(), met2.sumEt(), shift, isSmeared);
176  if(corShift) met.setCorShift(met2.px(), met2.py(), met2.sumEt(), level);
177  }
178 
179 }
Analysis-level MET class.
Definition: MET.h:43
double shiftedPx(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:172
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
const pat::MET::METCorrectionType level
void setUncShift(double px, double py, double sumEt, METUncertainty shift, bool isSmeared=false)
Definition: MET.cc:339
double corPy(METCorrectionLevel level=Type1) const
Definition: MET.h:182
double corSumEt(METCorrectionLevel level=Type1) const
Definition: MET.cc:321
double shiftedPy(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:173
edm::EDGetTokenT< pat::METCollection > token
double sumEt() const
Definition: MET.h:56
const pat::MET::METUncertainty shift
double shiftedSumEt(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.cc:290
double corPx(METCorrectionLevel level=Type1) const
Definition: MET.h:181
virtual double px() const
x coordinate of momentum vector
void setCorShift(double px, double py, double sumEt, METCorrectionType level)
Definition: MET.cc:356
virtual double py() const
y coordinate of momentum vector

Member Data Documentation

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

Definition at line 38 of file PATMETSlimmer.cc.

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

Definition at line 40 of file PATMETSlimmer.cc.

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

Definition at line 35 of file PATMETSlimmer.cc.

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

Definition at line 34 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

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

Definition at line 37 of file PATMETSlimmer.cc.

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

Definition at line 36 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

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

Definition at line 39 of file PATMETSlimmer.cc.