CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
MEtXYcorrectParametersCollection Class Reference

#include <MEtXYcorrectParameters.h>

Public Types

typedef std::vector< pair_typecollection_type
 
typedef int key_type
 
typedef std::string label_type
 
enum  Level_t {
  shiftMC = 0, shiftDY = 1, shiftTTJets = 2, shiftWJets = 3,
  shiftData = 4, N_LEVELS = 5
}
 
typedef std::pair< key_type, value_typepair_type
 
typedef MEtXYcorrectParameters value_type
 

Public Member Functions

void getSections (std::string inputFile, std::vector< std::string > &outputs)
 
key_type getShiftDataFlavBin (std::string const &Flav)
 
key_type getShiftDyFlavBin (std::string const &Flav)
 
key_type getShiftMcFlavBin (std::string const &Flav)
 
key_type getShiftTTJetsFlavBin (std::string const &Flav)
 
key_type getShiftWJetsFlavBin (std::string const &Flav)
 
 MEtXYcorrectParametersCollection ()
 
MEtXYcorrectParameters const & operator[] (key_type k) const
 
MEtXYcorrectParameters const & operator[] (std::string const &label) const
 
void push_back (key_type i, value_type const &j, label_type const &flav="")
 
void validKeys (std::vector< key_type > &keys) const
 

Static Public Member Functions

static std::string findLabel (key_type k)
 
static std::string findShiftDataFlavor (key_type k)
 
static std::string findShiftDYflavor (key_type k)
 
static std::string findShiftMCflavor (key_type k)
 
static std::string findShiftTTJetsFlavor (key_type k)
 
static std::string findShiftWJetsFlavor (key_type k)
 
static bool isShiftData (key_type k)
 
static bool isShiftDY (key_type k)
 
static bool isShiftMC (key_type k)
 
static bool isShiftTTJets (key_type k)
 
static bool isShiftWJets (key_type k)
 
static std::string levelName (key_type k)
 

Protected Member Functions

key_type findKey (std::string const &label) const
 

Protected Attributes

collection_type correctionsShift_
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 111 of file MEtXYcorrectParameters.h.

Member Typedef Documentation

◆ collection_type

Definition at line 119 of file MEtXYcorrectParameters.h.

◆ key_type

Definition at line 115 of file MEtXYcorrectParameters.h.

◆ label_type

Definition at line 116 of file MEtXYcorrectParameters.h.

◆ pair_type

Definition at line 118 of file MEtXYcorrectParameters.h.

◆ value_type

Definition at line 117 of file MEtXYcorrectParameters.h.

Member Enumeration Documentation

◆ Level_t

Enumerator
shiftMC 
shiftDY 
shiftTTJets 
shiftWJets 
shiftData 
N_LEVELS 

Definition at line 113 of file MEtXYcorrectParameters.h.

113 { shiftMC = 0, shiftDY = 1, shiftTTJets = 2, shiftWJets = 3, shiftData = 4, N_LEVELS = 5 };

Constructor & Destructor Documentation

◆ MEtXYcorrectParametersCollection()

MEtXYcorrectParametersCollection::MEtXYcorrectParametersCollection ( )
inline

Definition at line 122 of file MEtXYcorrectParameters.h.

122 { correctionsShift_.clear(); }

References correctionsShift_.

Member Function Documentation

◆ findKey()

key_type MEtXYcorrectParametersCollection::findKey ( std::string const &  label) const
protected

Referenced by operator[]().

◆ findLabel()

std::string MEtXYcorrectParametersCollection::findLabel ( key_type  k)
static

Definition at line 284 of file MEtXYcorrectParameters.cc.

284  {
285  if (isShiftMC(k)) {
286  return findShiftMCflavor(k);
288  return findShiftDYflavor(k);
290  return findShiftTTJetsFlavor(k);
292  return findShiftWJetsFlavor(k);
294  return findShiftDataFlavor(k);
295  }
296  return labels_[k];
297 }

References isShiftData(), isShiftDY(), isShiftTTJets(), isShiftWJets(), and dqmdumpme::k.

Referenced by MultShiftMETcorrDBInputProducer::produce().

◆ findShiftDataFlavor()

std::string MEtXYcorrectParametersCollection::findShiftDataFlavor ( key_type  k)
static

Definition at line 339 of file MEtXYcorrectParameters.cc.

339  {
340  if (k == shiftData)
341  return labels_[shiftData];
342  else
343  return shiftFlavors_[k - (shiftData + 1) * 100 - 1];
344 }

References dqmdumpme::k.

◆ findShiftDYflavor()

std::string MEtXYcorrectParametersCollection::findShiftDYflavor ( key_type  k)
static

Definition at line 321 of file MEtXYcorrectParameters.cc.

321  {
322  if (k == shiftDY)
323  return labels_[shiftDY];
324  else
325  return shiftFlavors_[k - (shiftDY + 1) * 100 - 1];
326 }

References dqmdumpme::k.

◆ findShiftMCflavor()

std::string MEtXYcorrectParametersCollection::findShiftMCflavor ( key_type  k)
static

Definition at line 315 of file MEtXYcorrectParameters.cc.

315  {
316  if (k == shiftMC)
317  return labels_[shiftMC];
318  else
319  return shiftFlavors_[k - (shiftMC + 1) * 100 - 1];
320 }

References dqmdumpme::k.

◆ findShiftTTJetsFlavor()

std::string MEtXYcorrectParametersCollection::findShiftTTJetsFlavor ( key_type  k)
static

Definition at line 327 of file MEtXYcorrectParameters.cc.

327  {
328  if (k == shiftTTJets)
329  return labels_[shiftTTJets];
330  else
331  return shiftFlavors_[k - (shiftTTJets + 1) * 100 - 1];
332 }

References dqmdumpme::k.

◆ findShiftWJetsFlavor()

std::string MEtXYcorrectParametersCollection::findShiftWJetsFlavor ( key_type  k)
static

Definition at line 333 of file MEtXYcorrectParameters.cc.

333  {
334  if (k == shiftWJets)
335  return labels_[shiftWJets];
336  else
337  return shiftFlavors_[k - (shiftWJets + 1) * 100 - 1];
338 }

References dqmdumpme::k.

◆ getSections()

void MEtXYcorrectParametersCollection::getSections ( std::string  inputFile,
std::vector< std::string > &  outputs 
)

Definition at line 346 of file MEtXYcorrectParameters.cc.

346  {
347  outputs.clear();
348  std::ifstream input(inputFile.c_str());
349  while (!input.eof()) {
350  char buff[10000];
351  input.getline(buff, 10000);
352  std::string in(buff);
353  if (in[0] == '[') {
354  std::string tok = getSection(in);
355  if (!tok.empty()) {
356  outputs.push_back(tok);
357  }
358  }
359  }
360  //copy(outputs.begin(),outputs.end(), std::ostream_iterator<std::string>(std::cout, "\n") );
361 
362  std::string sectionNames;
363  for (std::vector<std::string>::const_iterator it = outputs.begin(); it != outputs.end(); it++) {
364  sectionNames += *it;
365  sectionNames += "\n";
366  }
367  edm::LogInfo("getSections") << "Sections read from file: "
368  << "\n"
369  << sectionNames;
370 }

References recoMuon::in, input, dtResolutionTest_cfi::inputFile, PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ getShiftDataFlavBin()

MEtXYcorrectParametersCollection::key_type MEtXYcorrectParametersCollection::getShiftDataFlavBin ( std::string const &  Flav)

Definition at line 459 of file MEtXYcorrectParameters.cc.

460  {
461  std::vector<std::string>::const_iterator found = find(shiftFlavors_.begin(), shiftFlavors_.end(), flav);
462  if (found != shiftFlavors_.end()) {
463  return (found - shiftFlavors_.begin() + 1) + (shiftData + 1) * 100;
464  } else {
465  throw cms::Exception("InvalidInput") << "************** Can't find shiftSection: " << flav << std::endl;
466  }
467  return 0;
468 }

References Exception, spr::find(), and newFWLiteAna::found.

◆ getShiftDyFlavBin()

MEtXYcorrectParametersCollection::key_type MEtXYcorrectParametersCollection::getShiftDyFlavBin ( std::string const &  Flav)

Definition at line 430 of file MEtXYcorrectParameters.cc.

430  {
431  std::vector<std::string>::const_iterator found = find(shiftFlavors_.begin(), shiftFlavors_.end(), flav);
432  if (found != shiftFlavors_.end()) {
433  return (found - shiftFlavors_.begin() + 1) + (shiftDY + 1) * 100;
434  } else {
435  throw cms::Exception("InvalidInput") << "************** Can't find ShiftSection: " << flav << std::endl;
436  }
437  return 0;
438 }

References Exception, spr::find(), and newFWLiteAna::found.

◆ getShiftMcFlavBin()

MEtXYcorrectParametersCollection::key_type MEtXYcorrectParametersCollection::getShiftMcFlavBin ( std::string const &  Flav)

Definition at line 420 of file MEtXYcorrectParameters.cc.

420  {
421  std::vector<std::string>::const_iterator found = find(shiftFlavors_.begin(), shiftFlavors_.end(), flav);
422  if (found != shiftFlavors_.end()) {
423  return (found - shiftFlavors_.begin() + 1) + (shiftMC + 1) * 100;
424  } else {
425  throw cms::Exception("InvalidInput") << "************** Can't find ShiftSection: " << flav << std::endl;
426  }
427  return 0;
428 }

References Exception, spr::find(), and newFWLiteAna::found.

◆ getShiftTTJetsFlavBin()

MEtXYcorrectParametersCollection::key_type MEtXYcorrectParametersCollection::getShiftTTJetsFlavBin ( std::string const &  Flav)

Definition at line 439 of file MEtXYcorrectParameters.cc.

440  {
441  std::vector<std::string>::const_iterator found = find(shiftFlavors_.begin(), shiftFlavors_.end(), flav);
442  if (found != shiftFlavors_.end()) {
443  return (found - shiftFlavors_.begin() + 1) + (shiftTTJets + 1) * 100;
444  } else {
445  throw cms::Exception("InvalidInput") << "************** Can't find shiftSection: " << flav << std::endl;
446  }
447  return 0;
448 }

References Exception, spr::find(), and newFWLiteAna::found.

◆ getShiftWJetsFlavBin()

MEtXYcorrectParametersCollection::key_type MEtXYcorrectParametersCollection::getShiftWJetsFlavBin ( std::string const &  Flav)

Definition at line 449 of file MEtXYcorrectParameters.cc.

450  {
451  std::vector<std::string>::const_iterator found = find(shiftFlavors_.begin(), shiftFlavors_.end(), flav);
452  if (found != shiftFlavors_.end()) {
453  return (found - shiftFlavors_.begin() + 1) + (shiftWJets + 1) * 100;
454  } else {
455  throw cms::Exception("InvalidInput") << "************** Can't find shiftSection: " << flav << std::endl;
456  }
457  return 0;
458 }

References Exception, spr::find(), and newFWLiteAna::found.

◆ isShiftData()

bool MEtXYcorrectParametersCollection::isShiftData ( key_type  k)
static

Definition at line 482 of file MEtXYcorrectParameters.cc.

482  {
483  return k == shiftData || (k > (shiftData + 1) * 100 && k < (shiftData + 2) * 100);
484 }

References dqmdumpme::k.

Referenced by findLabel(), and MultShiftMETcorrDBInputProducer::produce().

◆ isShiftDY()

bool MEtXYcorrectParametersCollection::isShiftDY ( key_type  k)
static

Definition at line 473 of file MEtXYcorrectParameters.cc.

473  {
474  return k == shiftDY || (k > (shiftDY + 1) * 100 && k < (shiftDY + 2) * 100);
475 }

References dqmdumpme::k.

Referenced by findLabel(), and MultShiftMETcorrDBInputProducer::produce().

◆ isShiftMC()

bool MEtXYcorrectParametersCollection::isShiftMC ( key_type  k)
static

Definition at line 470 of file MEtXYcorrectParameters.cc.

470  {
471  return k == shiftMC || (k > (shiftMC + 1) * 100 && k < (shiftMC + 2) * 100);
472 }

References dqmdumpme::k.

Referenced by MultShiftMETcorrDBInputProducer::produce().

◆ isShiftTTJets()

bool MEtXYcorrectParametersCollection::isShiftTTJets ( key_type  k)
static

Definition at line 476 of file MEtXYcorrectParameters.cc.

476  {
477  return k == shiftTTJets || (k > (shiftTTJets + 1) * 100 && k < (shiftTTJets + 2) * 100);
478 }

References dqmdumpme::k.

Referenced by findLabel(), and MultShiftMETcorrDBInputProducer::produce().

◆ isShiftWJets()

bool MEtXYcorrectParametersCollection::isShiftWJets ( key_type  k)
static

Definition at line 479 of file MEtXYcorrectParameters.cc.

479  {
480  return k == shiftWJets || (k > (shiftWJets + 1) * 100 && k < (shiftWJets + 2) * 100);
481 }

References dqmdumpme::k.

Referenced by findLabel(), and MultShiftMETcorrDBInputProducer::produce().

◆ levelName()

std::string MEtXYcorrectParametersCollection::levelName ( key_type  k)
static

Definition at line 299 of file MEtXYcorrectParameters.cc.

299  {
300  if (isShiftMC(k)) {
301  return labels_[shiftMC];
302  } else if (isShiftDY(k)) {
303  return labels_[shiftDY];
304  } else if (isShiftTTJets(k)) {
305  return labels_[shiftTTJets];
306  } else if (isShiftWJets(k)) {
307  return labels_[shiftWJets];
308  } else if (isShiftData(k)) {
309  return labels_[shiftData];
310  } else {
311  return "Can't find the level name !!!!";
312  }
313 }

References dqmdumpme::k.

◆ operator[]() [1/2]

MEtXYcorrectParameters const & MEtXYcorrectParametersCollection::operator[] ( key_type  k) const

Definition at line 393 of file MEtXYcorrectParameters.cc.

393  {
394  collection_type::const_iterator ibegin, iend, i;
395  if (isShiftMC(k) || isShiftDY(k) || isShiftTTJets(k) || isShiftWJets(k) || isShiftData(k)) {
396  ibegin = correctionsShift_.begin();
397  iend = correctionsShift_.end();
398  i = ibegin;
399  }
400  for (; i != iend; ++i) {
401  if (k == i->first)
402  return i->second;
403  }
404  throw cms::Exception("InvalidInput") << " cannot find key " << static_cast<int>(k)
405  << " in the METC payload, this usually means you have to change the global tag"
406  << std::endl;
407 }

References Exception, mps_fire::i, and dqmdumpme::k.

◆ operator[]() [2/2]

MEtXYcorrectParameters const& MEtXYcorrectParametersCollection::operator[] ( std::string const &  label) const
inline

Definition at line 134 of file MEtXYcorrectParameters.h.

134 { return operator[](findKey(label)); }

References findKey(), label, and operator[]().

Referenced by operator[]().

◆ push_back()

void MEtXYcorrectParametersCollection::push_back ( key_type  i,
value_type const &  j,
label_type const &  flav = "" 
)

Definition at line 373 of file MEtXYcorrectParameters.cc.

373  {
374  if (isShiftMC(i)) {
375  correctionsShift_.push_back(pair_type(getShiftMcFlavBin(flav), j));
376  } else if (isShiftDY(i)) {
377  correctionsShift_.push_back(pair_type(getShiftDyFlavBin(flav), j));
378  } else if (isShiftTTJets(i)) {
380  } else if (isShiftWJets(i)) {
382  } else if (isShiftData(i)) {
384  } else {
385  std::stringstream sserr;
386  sserr << "The level type: " << i << " is not in the level list";
387  handleError("MEtXYcorrectParameters::Definitions", sserr.str());
388  }
389 }

References mps_fire::i, and dqmiolumiharvest::j.

◆ serialize()

template<class Archive >
void MEtXYcorrectParametersCollection::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ validKeys()

void MEtXYcorrectParametersCollection::validKeys ( std::vector< key_type > &  keys) const

Definition at line 411 of file MEtXYcorrectParameters.cc.

411  {
412  keys.clear();
413  for (collection_type::const_iterator ibegin = correctionsShift_.begin(), iend = correctionsShift_.end(), i = ibegin;
414  i != iend;
415  ++i) {
416  keys.push_back(i->first);
417  }
418 }

References mps_fire::i, and relativeConstraints::keys.

Referenced by MultShiftMETcorrDBInputProducer::produce().

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 171 of file MEtXYcorrectParameters.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 171 of file MEtXYcorrectParameters.h.

Member Data Documentation

◆ correctionsShift_

collection_type MEtXYcorrectParametersCollection::correctionsShift_
protected

Definition at line 169 of file MEtXYcorrectParameters.h.

Referenced by MEtXYcorrectParametersCollection().

MEtXYcorrectParametersCollection::getShiftMcFlavBin
key_type getShiftMcFlavBin(std::string const &Flav)
Definition: MEtXYcorrectParameters.cc:420
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
MEtXYcorrectParametersCollection::shiftTTJets
Definition: MEtXYcorrectParameters.h:113
MEtXYcorrectParametersCollection::isShiftDY
static bool isShiftDY(key_type k)
Definition: MEtXYcorrectParameters.cc:473
MEtXYcorrectParametersCollection::isShiftTTJets
static bool isShiftTTJets(key_type k)
Definition: MEtXYcorrectParameters.cc:476
MEtXYcorrectParametersCollection::N_LEVELS
Definition: MEtXYcorrectParameters.h:113
MEtXYcorrectParametersCollection::correctionsShift_
collection_type correctionsShift_
Definition: MEtXYcorrectParameters.h:169
MEtXYcorrectParametersCollection::getShiftWJetsFlavBin
key_type getShiftWJetsFlavBin(std::string const &Flav)
Definition: MEtXYcorrectParameters.cc:449
MEtXYcorrectParametersCollection::findShiftWJetsFlavor
static std::string findShiftWJetsFlavor(key_type k)
Definition: MEtXYcorrectParameters.cc:333
PatBasicFWLiteJetAnalyzer_Selector_cfg.outputs
outputs
Definition: PatBasicFWLiteJetAnalyzer_Selector_cfg.py:48
MEtXYcorrectParametersCollection::isShiftData
static bool isShiftData(key_type k)
Definition: MEtXYcorrectParameters.cc:482
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
MEtXYcorrectParametersCollection::pair_type
std::pair< key_type, value_type > pair_type
Definition: MEtXYcorrectParameters.h:118
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
MEtXYcorrectParametersCollection::shiftDY
Definition: MEtXYcorrectParameters.h:113
MEtXYcorrectParametersCollection::getShiftDataFlavBin
key_type getShiftDataFlavBin(std::string const &Flav)
Definition: MEtXYcorrectParameters.cc:459
MEtXYcorrectParametersCollection::findShiftTTJetsFlavor
static std::string findShiftTTJetsFlavor(key_type k)
Definition: MEtXYcorrectParameters.cc:327
MEtXYcorrectParametersCollection::shiftData
Definition: MEtXYcorrectParameters.h:113
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MEtXYcorrectParametersCollection::isShiftWJets
static bool isShiftWJets(key_type k)
Definition: MEtXYcorrectParameters.cc:479
recoMuon::in
Definition: RecoMuonEnumerators.h:6
dtResolutionTest_cfi.inputFile
inputFile
Definition: dtResolutionTest_cfi.py:14
MEtXYcorrectParametersCollection::findShiftDataFlavor
static std::string findShiftDataFlavor(key_type k)
Definition: MEtXYcorrectParameters.cc:339
MEtXYcorrectParametersCollection::findShiftMCflavor
static std::string findShiftMCflavor(key_type k)
Definition: MEtXYcorrectParameters.cc:315
MEtXYcorrectParametersCollection::getShiftTTJetsFlavBin
key_type getShiftTTJetsFlavBin(std::string const &Flav)
Definition: MEtXYcorrectParameters.cc:439
MEtXYcorrectParametersCollection::findKey
key_type findKey(std::string const &label) const
MEtXYcorrectParametersCollection::shiftWJets
Definition: MEtXYcorrectParameters.h:113
MEtXYcorrectParametersCollection::operator[]
MEtXYcorrectParameters const & operator[](key_type k) const
Definition: MEtXYcorrectParameters.cc:393
Exception
Definition: hltDiff.cc:245
MEtXYcorrectParametersCollection::findShiftDYflavor
static std::string findShiftDYflavor(key_type k)
Definition: MEtXYcorrectParameters.cc:321
MEtXYcorrectParametersCollection::getShiftDyFlavBin
key_type getShiftDyFlavBin(std::string const &Flav)
Definition: MEtXYcorrectParameters.cc:430
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
MEtXYcorrectParametersCollection::shiftMC
Definition: MEtXYcorrectParameters.h:113
label
const char * label
Definition: PFTauDecayModeTools.cc:11
MEtXYcorrectParametersCollection::isShiftMC
static bool isShiftMC(key_type k)
Definition: MEtXYcorrectParameters.cc:470