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

Constructor & Destructor Documentation

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

Definition at line 29 of file PATMETSlimmer.cc.

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

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

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

112  :
113  shift(shift_), level(level_), t0FromMiniAOD(t0FromMiniAOD_), corShift(corShift_), uncShift(uncShift_), isSmeared(isSmeared)
114 {
115 
116  std::string baseTagStr = baseTag.encode();
117  char buff[1024];
118  switch (shift) {
119  case pat::MET::NoShift : snprintf(buff, 1023, baseTagStr.c_str(), ""); break;
120  case pat::MET::JetEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "JetEnUp"); break;
121  case pat::MET::JetEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "JetEnDown"); break;
122  case pat::MET::JetResUp : snprintf(buff, 1023, baseTagStr.c_str(), "JetResUp"); break;
123  case pat::MET::JetResDown: snprintf(buff, 1023, baseTagStr.c_str(), "JetResDown"); break;
124  case pat::MET::MuonEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnUp"); break;
125  case pat::MET::MuonEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnDown"); break;
126  case pat::MET::ElectronEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnUp"); break;
127  case pat::MET::ElectronEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnDown"); break;
128  case pat::MET::PhotonEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "PhotonEnUp"); break;
129  case pat::MET::PhotonEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "PhotonEnDown"); break;
130  case pat::MET::TauEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "TauEnUp"); break;
131  case pat::MET::TauEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "TauEnDown"); break;
132  case pat::MET::UnclusteredEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnUp"); break;
133  case pat::MET::UnclusteredEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnDown"); break;
134  default: throw cms::Exception("LogicError", "OneMETShift constructor called with bogus shift");
135  }
137 
138 }
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:166
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 162 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().

162  {
164  ev.getByToken(token, src);
165 
166  if (src->size() != 1) throw cms::Exception("CorruptData", "More than one MET in the shifted collection");
167  const pat::MET &met2 = src->front();
168 
169 
170  if(t0FromMiniAOD) {
175  }
176  else {
177  if(uncShift) met.setUncShift(met2.px(), met2.py(), met2.sumEt(), shift, isSmeared);
178  if(corShift) met.setCorShift(met2.px(), met2.py(), met2.sumEt(), level);
179  }
180 
181 }
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:579
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:355
double corPy(METCorrectionLevel level=Type1) const
Definition: MET.h:188
double corSumEt(METCorrectionLevel level=Type1) const
Definition: MET.cc:337
double shiftedPy(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:179
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:306
double corPx(METCorrectionLevel level=Type1) const
Definition: MET.h:187
double py() const final
y coordinate of momentum vector
void setCorShift(double px, double py, double sumEt, METCorrectionType level)
Definition: MET.cc:372

Member Data Documentation

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

Definition at line 38 of file PATMETSlimmer.cc.

Referenced by readAndSet().

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

Definition at line 40 of file PATMETSlimmer.cc.

Referenced by readAndSet().

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

Definition at line 35 of file PATMETSlimmer.cc.

Referenced by readAndSet().

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

Definition at line 34 of file PATMETSlimmer.cc.

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

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

Definition at line 37 of file PATMETSlimmer.cc.

Referenced by readAndSet().

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

Definition at line 36 of file PATMETSlimmer.cc.

Referenced by OneMETShift(), and readAndSet().

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

Definition at line 39 of file PATMETSlimmer.cc.

Referenced by readAndSet().