CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
pat::PATMETSlimmer::OneMETShift Struct 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)
 

Public Attributes

bool corShift
 
bool isSmeared
 
pat::MET::METCorrectionType level
 
pat::MET::METUncertainty shift
 
bool t0FromMiniAOD
 
edm::EDGetTokenT
< pat::METCollection
token
 
bool uncShift
 

Detailed Description

Definition at line 27 of file PATMETSlimmer.cc.

Constructor & Destructor Documentation

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

Definition at line 28 of file PATMETSlimmer.cc.

28 {}
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 108 of file PATMETSlimmer.cc.

References pat::MET::ElectronEnDown, pat::MET::ElectronEnUp, edm::InputTag::encode(), edm::hlt::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, shift, AlCaHLTBitMon_QueryRunRegistry::string, pat::MET::TauEnDown, pat::MET::TauEnUp, token, pat::MET::UnclusteredEnDown, and pat::MET::UnclusteredEnUp.

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

Member Function Documentation

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

Definition at line 156 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.

156  {
157 
159  ev.getByToken(token, src);
160 
161  if (src->size() != 1) throw cms::Exception("CorruptData", "More than one MET in the shifted collection");
162  const pat::MET &met2 = src->front();
163 
164 
165  if(t0FromMiniAOD) {
170  }
171  else {
172  if(uncShift) met.setUncShift(met2.px(), met2.py(), met2.sumEt(), shift, isSmeared);
173  if(corShift) met.setCorShift(met2.px(), met2.py(), met2.sumEt(), level);
174  }
175 
176 }
Analysis-level MET class.
Definition: MET.h:43
double shiftedPx(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:178
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
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:188
edm::EDGetTokenT< pat::METCollection > token
double corSumEt(METCorrectionLevel level=Type1) const
Definition: MET.cc:321
pat::MET::METUncertainty shift
double shiftedPy(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:179
double sumEt() const
Definition: MET.h:56
double shiftedSumEt(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.cc:290
double corPx(METCorrectionLevel level=Type1) const
Definition: MET.h:187
pat::MET::METCorrectionType level
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

bool pat::PATMETSlimmer::OneMETShift::corShift

Definition at line 35 of file PATMETSlimmer.cc.

bool pat::PATMETSlimmer::OneMETShift::isSmeared

Definition at line 37 of file PATMETSlimmer.cc.

pat::MET::METCorrectionType pat::PATMETSlimmer::OneMETShift::level

Definition at line 32 of file PATMETSlimmer.cc.

pat::MET::METUncertainty pat::PATMETSlimmer::OneMETShift::shift

Definition at line 31 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

bool pat::PATMETSlimmer::OneMETShift::t0FromMiniAOD

Definition at line 34 of file PATMETSlimmer.cc.

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

Definition at line 33 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

bool pat::PATMETSlimmer::OneMETShift::uncShift

Definition at line 36 of file PATMETSlimmer.cc.