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

Constructor & Destructor Documentation

◆ OneMETShift() [1/2]

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

Definition at line 28 of file PATMETSlimmer.cc.

31  t0FromMiniAOD(false),
32  corShift(false),
33  uncShift(false),
34  isSmeared(false) {}
const pat::MET::METCorrectionType level
const pat::MET::METUncertainty shift

◆ OneMETShift() [2/2]

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

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

155  : shift(shift_),
156  level(level_),
157  t0FromMiniAOD(t0FromMiniAOD_),
158  corShift(corShift_),
159  uncShift(uncShift_),
161  std::string baseTagStr = baseTag.encode();
162  char buff[1024];
163  switch (shift) {
164  case pat::MET::NoShift:
165  snprintf(buff, 1023, baseTagStr.c_str(), "");
166  break;
167  case pat::MET::JetEnUp:
168  snprintf(buff, 1023, baseTagStr.c_str(), "JetEnUp");
169  break;
170  case pat::MET::JetEnDown:
171  snprintf(buff, 1023, baseTagStr.c_str(), "JetEnDown");
172  break;
173  case pat::MET::JetResUp:
174  snprintf(buff, 1023, baseTagStr.c_str(), "JetResUp");
175  break;
177  snprintf(buff, 1023, baseTagStr.c_str(), "JetResDown");
178  break;
179  case pat::MET::MuonEnUp:
180  snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnUp");
181  break;
183  snprintf(buff, 1023, baseTagStr.c_str(), "MuonEnDown");
184  break;
186  snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnUp");
187  break;
189  snprintf(buff, 1023, baseTagStr.c_str(), "ElectronEnDown");
190  break;
192  snprintf(buff, 1023, baseTagStr.c_str(), "PhotonEnUp");
193  break;
195  snprintf(buff, 1023, baseTagStr.c_str(), "PhotonEnDown");
196  break;
197  case pat::MET::TauEnUp:
198  snprintf(buff, 1023, baseTagStr.c_str(), "TauEnUp");
199  break;
200  case pat::MET::TauEnDown:
201  snprintf(buff, 1023, baseTagStr.c_str(), "TauEnDown");
202  break;
204  snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnUp");
205  break;
207  snprintf(buff, 1023, baseTagStr.c_str(), "UnclusteredEnDown");
208  break;
209  default:
210  throw cms::Exception("LogicError", "OneMETShift constructor called with bogus shift");
211  }
213 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::string encode() const
Definition: InputTag.cc:159
const pat::MET::METCorrectionType level
std::vector< MET > METCollection
Definition: MET.h:31
edm::EDGetTokenT< pat::METCollection > token
const pat::MET::METUncertainty shift

Member Function Documentation

◆ readAndSet()

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

Definition at line 236 of file PATMETSlimmer.cc.

References pat::MET::corPx(), pat::MET::corPy(), pat::MET::corSumEt(), makeMEIFBenchmarkPlots::ev, personalPlayback::level, BTaggingMonitor_cfi::met, reco::LeafCandidate::px(), reco::LeafCandidate::py(), edm::shift, pat::MET::shiftedPx(), pat::MET::shiftedPy(), pat::MET::shiftedSumEt(), TrackRefitter_38T_cff::src, reco::MET::sumEt(), unpackBuffers-CaloStage2::token, and pat::MET::Type01.

236  {
238  ev.getByToken(token, src);
239 
240  if (src->size() != 1)
241  throw cms::Exception("CorruptData", "More than one MET in the shifted collection");
242  const pat::MET &met2 = src->front();
243 
244  if (t0FromMiniAOD) {
245  if (uncShift)
246  met.setUncShift(met2.shiftedPx(shift, pat::MET::Type01),
249  shift,
250  isSmeared);
251  if (corShift)
252  met.setCorShift(
254  } else {
255  if (uncShift)
256  met.setUncShift(met2.px(), met2.py(), met2.sumEt(), shift, isSmeared);
257  if (corShift)
258  met.setCorShift(met2.px(), met2.py(), met2.sumEt(), level);
259  }
260 }
Analysis-level MET class.
Definition: MET.h:40
const pat::MET::METCorrectionType level
double sumEt() const
Definition: MET.h:56
double shiftedPy(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:221
edm::EDGetTokenT< pat::METCollection > token
double corPx(METCorrectionLevel level=Type1) const
Definition: MET.h:235
double px() const final
x coordinate of momentum vector
double corPy(METCorrectionLevel level=Type1) const
Definition: MET.h:236
const pat::MET::METUncertainty shift
double py() const final
y coordinate of momentum vector
double shiftedSumEt(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.cc:306
double shiftedPx(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:218
double corSumEt(METCorrectionLevel level=Type1) const
Definition: MET.cc:329

Member Data Documentation

◆ corShift

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

Definition at line 50 of file PATMETSlimmer.cc.

◆ isSmeared

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

Definition at line 52 of file PATMETSlimmer.cc.

◆ level

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

Definition at line 47 of file PATMETSlimmer.cc.

◆ shift

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

Definition at line 46 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

◆ t0FromMiniAOD

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

Definition at line 49 of file PATMETSlimmer.cc.

◆ token

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

Definition at line 48 of file PATMETSlimmer.cc.

Referenced by OneMETShift().

◆ uncShift

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

Definition at line 51 of file PATMETSlimmer.cc.