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::METUncertaintyLevel level_, const edm::InputTag &baseTag, edm::ConsumesCollector &&cc)
 
void readAndSet (const edm::Event &ev, pat::MET &met)
 

Public Attributes

pat::MET::METUncertaintyLevel level
 
pat::MET::METUncertainty shift
 
edm::EDGetTokenT
< pat::METCollection
token
 

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::METUncertaintyLevel  level_,
const edm::InputTag baseTag,
edm::ConsumesCollector &&  cc 
)

Definition at line 72 of file PATMETSlimmer.cc.

References pat::MET::ElectronEnDown, pat::MET::ElectronEnUp, edm::InputTag::encode(), edm::hlt::Exception, pat::MET::JetEnDown, pat::MET::JetEnUp, pat::MET::JetResDown, pat::MET::JetResUp, pat::MET::MuonEnDown, pat::MET::MuonEnUp, shift, AlCaHLTBitMon_QueryRunRegistry::string, pat::MET::TauEnDown, pat::MET::TauEnUp, token, pat::MET::UnclusteredEnDown, and pat::MET::UnclusteredEnUp.

72  :
73  shift(shift_), level(level_)
74 {
75  std::string baseTagStr = baseTag.encode();
76  char buff[1024];
77  switch (shift) {
78  case pat::MET::JetEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "JetEnUp"); break;
79  case pat::MET::JetEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "JetEnDown"); break;
80  case pat::MET::JetResUp : snprintf(buff, 1023, baseTagStr.c_str(), "JetResUp"); break;
81  case pat::MET::JetResDown: snprintf(buff, 1023, baseTagStr.c_str(), "JetResDown"); break;
82  case pat::MET::MuonEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnUp"); break;
83  case pat::MET::MuonEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnDown"); break;
84  case pat::MET::ElectronEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnUp"); break;
85  case pat::MET::ElectronEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnDown"); break;
86  case pat::MET::TauEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "TauEnUp"); break;
87  case pat::MET::TauEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "TauEnDown"); break;
88  case pat::MET::UnclusteredEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnUp"); break;
89  case pat::MET::UnclusteredEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnDown"); break;
90  default: throw cms::Exception("LogicError", "OneMETShift constructor called wih bogus shift");
91  }
93 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< MET > METCollection
Definition: MET.h:31
std::string encode() const
Definition: InputTag.cc:164
edm::EDGetTokenT< pat::METCollection > token
pat::MET::METUncertainty shift
pat::MET::METUncertaintyLevel level

Member Function Documentation

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

Definition at line 114 of file PATMETSlimmer.cc.

References edm::Event::getByToken(), testEve_cfg::level, reco::LeafCandidate::px(), reco::LeafCandidate::py(), pat::MET::setShift(), edm::shift, alcazmumu_cfi::src, and reco::MET::sumEt().

114  {
116  ev.getByToken(token, src);
117  if (src->size() != 1) throw cms::Exception("CorruptData", "More than one MET in the shifted collection");
118  const pat::MET &met2 = src->front();
119  met.setShift(met2.px(), met2.py(), met2.sumEt(), shift, level);
120 }
Analysis-level MET class.
Definition: MET.h:42
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
edm::EDGetTokenT< pat::METCollection > token
pat::MET::METUncertainty shift
double sumEt() const
Definition: MET.h:53
void setShift(double px, double py, double sumEt, METUncertainty shift, METUncertaintyLevel level=Type1)
Definition: MET.cc:209
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
pat::MET::METUncertaintyLevel level

Member Data Documentation

pat::MET::METUncertaintyLevel pat::PATMETSlimmer::OneMETShift::level

Definition at line 31 of file PATMETSlimmer.cc.

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

Definition at line 30 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

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

Definition at line 32 of file PATMETSlimmer.cc.

Referenced by OneMETShift().