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 81 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.

81  :
82  shift(shift_), level(level_)
83 {
84  std::string baseTagStr = baseTag.encode();
85  bool isSmeared=baseTagStr.find("Smeared")!=(size_t)-1; //temporary 74X fix for handling the JER uncertainties
86  char buff[1024];
87  switch (shift) {
88  case pat::MET::NoShift : snprintf(buff, 1023, baseTagStr.c_str(), ""); break;
89  case pat::MET::JetEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "JetEnUp"); break;
90  case pat::MET::JetEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "JetEnDown"); break;
91  case pat::MET::JetResUp : snprintf(buff, 1023, baseTagStr.c_str(), isSmeared?"JetResUp":""); break;
92  case pat::MET::JetResDown: snprintf(buff, 1023, baseTagStr.c_str(), isSmeared?"JetResDown":""); break;
93  case pat::MET::MuonEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnUp"); break;
94  case pat::MET::MuonEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnDown"); break;
95  case pat::MET::ElectronEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnUp"); break;
96  case pat::MET::ElectronEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnDown"); break;
97  case pat::MET::TauEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "TauEnUp"); break;
98  case pat::MET::TauEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "TauEnDown"); break;
99  case pat::MET::UnclusteredEnUp : snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnUp"); break;
100  case pat::MET::UnclusteredEnDown: snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnDown"); break;
101  default: throw cms::Exception("LogicError", "OneMETShift constructor called wih bogus shift");
102  }
104 }
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::METUncertaintyLevel level

Member Function Documentation

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

Definition at line 125 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().

125  {
127  ev.getByToken(token, src);
128  if (src->size() != 1) throw cms::Exception("CorruptData", "More than one MET in the shifted collection");
129  const pat::MET &met2 = src->front();
130  met.setShift(met2.px(), met2.py(), met2.sumEt(), shift, level);
131 }
Analysis-level MET class.
Definition: MET.h:43
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::EDGetTokenT< pat::METCollection > token
pat::MET::METUncertainty shift
double sumEt() const
Definition: MET.h:56
void setShift(double px, double py, double sumEt, METUncertainty shift, METUncertaintyLevel level=Type1)
Definition: MET.cc:145
pat::MET::METUncertaintyLevel level
virtual double px() const
x coordinate of momentum vector
virtual double py() const
y coordinate of momentum vector

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().