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

Constructor & Destructor Documentation

◆ MEtXYcorrectParametersCollection()

MEtXYcorrectParametersCollection::MEtXYcorrectParametersCollection ( )
inline

Definition at line 122 of file MEtXYcorrectParameters.h.

References correctionsShift_.

122 { correctionsShift_.clear(); }

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.

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

Referenced by MultShiftMETcorrDBInputProducer::produce().

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 }
static std::string findShiftWJetsFlavor(key_type k)
static std::string findShiftDataFlavor(key_type k)
static std::string findShiftMCflavor(key_type k)
static std::string findShiftDYflavor(key_type k)
static std::string findShiftTTJetsFlavor(key_type k)

◆ findShiftDataFlavor()

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

Definition at line 339 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

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

◆ findShiftDYflavor()

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

Definition at line 321 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

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

◆ findShiftMCflavor()

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

Definition at line 315 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

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

◆ findShiftTTJetsFlavor()

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

Definition at line 327 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

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

◆ findShiftWJetsFlavor()

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

Definition at line 333 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

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

◆ getSections()

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

Definition at line 346 of file MEtXYcorrectParameters.cc.

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

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 }
static std::string const input
Definition: EdmProvDump.cc:47
Log< level::Info, false > LogInfo

◆ getShiftDataFlavBin()

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

Definition at line 459 of file MEtXYcorrectParameters.cc.

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

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 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ getShiftDyFlavBin()

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

Definition at line 430 of file MEtXYcorrectParameters.cc.

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

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 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ getShiftMcFlavBin()

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

Definition at line 420 of file MEtXYcorrectParameters.cc.

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

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 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ getShiftTTJetsFlavBin()

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

Definition at line 439 of file MEtXYcorrectParameters.cc.

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

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 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ getShiftWJetsFlavBin()

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

Definition at line 449 of file MEtXYcorrectParameters.cc.

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

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 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ isShiftData()

bool MEtXYcorrectParametersCollection::isShiftData ( key_type  k)
static

Definition at line 482 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

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

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

◆ isShiftDY()

bool MEtXYcorrectParametersCollection::isShiftDY ( key_type  k)
static

Definition at line 473 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

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

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

◆ isShiftMC()

bool MEtXYcorrectParametersCollection::isShiftMC ( key_type  k)
static

Definition at line 470 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

Referenced by MultShiftMETcorrDBInputProducer::produce().

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

◆ isShiftTTJets()

bool MEtXYcorrectParametersCollection::isShiftTTJets ( key_type  k)
static

Definition at line 476 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

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

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

◆ isShiftWJets()

bool MEtXYcorrectParametersCollection::isShiftWJets ( key_type  k)
static

Definition at line 479 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

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

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

◆ levelName()

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

Definition at line 299 of file MEtXYcorrectParameters.cc.

References dqmdumpme::k.

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 }

◆ operator[]() [1/2]

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

Definition at line 393 of file MEtXYcorrectParameters.cc.

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

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 }

◆ operator[]() [2/2]

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

Definition at line 134 of file MEtXYcorrectParameters.h.

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

Referenced by operator[]().

134 { return operator[](findKey(label)); }
char const * label
MEtXYcorrectParameters const & operator[](key_type k) const
key_type findKey(std::string const &label) const

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

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

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 }
key_type getShiftDataFlavBin(std::string const &Flav)
key_type getShiftTTJetsFlavBin(std::string const &Flav)
key_type getShiftMcFlavBin(std::string const &Flav)
std::pair< key_type, value_type > pair_type
key_type getShiftDyFlavBin(std::string const &Flav)
key_type getShiftWJetsFlavBin(std::string const &Flav)

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

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

Referenced by MultShiftMETcorrDBInputProducer::produce().

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 }

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