CMS 3D CMS Logo

Functions
GlobalObject.cc File Reference
#include "DataFormats/L1TGlobal/interface/GlobalObject.h"
#include <cstring>
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

l1t::GlobalObject l1TGtObjectStringToEnum (const std::string &label)
 

Function Documentation

l1t::GlobalObject l1TGtObjectStringToEnum ( const std::string &  label)

Definition at line 27 of file GlobalObject.cc.

References runEdmFileComparison::found, l1t::gtAsymmetryEt, l1t::gtAsymmetryEtHF, l1t::gtAsymmetryHt, l1t::gtAsymmetryHtHF, l1t::gtCentrality0, l1t::gtCentrality1, l1t::gtCentrality2, l1t::gtCentrality3, l1t::gtCentrality4, l1t::gtCentrality5, l1t::gtCentrality6, l1t::gtCentrality7, l1t::gtEG, l1t::gtETM, l1t::gtETMHF, l1t::gtETT, l1t::gtETTem, l1t::gtExternal, l1t::gtHTM, l1t::gtHTT, l1t::gtJet, l1t::gtMinBiasHFM0, l1t::gtMinBiasHFM1, l1t::gtMinBiasHFP0, l1t::gtMinBiasHFP1, l1t::gtMu, l1t::gtTau, l1t::gtTowerCount, mps_fire::i, l1t::L1TGtObjectStringToEnum::label, l1t::ObjNull, relativeConstraints::value, and l1t::L1TGtObjectStringToEnum::value.

27  {
28 
29 
30 
31  static const l1t::L1TGtObjectStringToEnum l1TGtObjectStringToEnumMap[] = {
32  {"Mu", gtMu},
33  {"EG", gtEG},
34  {"Tau", gtTau},
35  {"Jet", gtJet},
36  {"ETM", gtETM},
37  {"ETT", gtETT},
38  {"HTT", gtHTT},
39  {"HTM", gtHTM},
40  {"ETMHF", gtETMHF},
41  {"TowerCount",gtTowerCount},
42  {"MinBiasHFP0", gtMinBiasHFP0},
43  {"MinBiasHFM0", gtMinBiasHFM0},
44  {"MinBiasHFP1", gtMinBiasHFP1},
45  {"MinBiasHFM1", gtMinBiasHFM1},
46  {"ETTem", gtETTem},
47  {"AsymEt", gtAsymmetryEt},
48  {"AsymHt", gtAsymmetryHt},
49  {"AsymEtHF", gtAsymmetryEtHF},
50  {"AsymEtHF", gtAsymmetryHtHF},
51  {"CENT0", gtCentrality0},
52  {"CENT1", gtCentrality1},
53  {"CENT2", gtCentrality2},
54  {"CENT3", gtCentrality3},
55  {"CENT4", gtCentrality4},
56  {"CENT5", gtCentrality5},
57  {"CENT6", gtCentrality6},
58  {"CENT7", gtCentrality7},
59  {"External", gtExternal},
60  {"ObjNull", ObjNull},
61  {nullptr, (GlobalObject) - 1}
62  };
63 
65 
66  bool found = false;
67  for (int i = 0; l1TGtObjectStringToEnumMap[i].label && (!found); ++i)
68  if (!std::strcmp(label.c_str(), l1TGtObjectStringToEnumMap[i].label)) {
69  found = true;
70  value = l1TGtObjectStringToEnumMap[i].value;
71  }
72 
73  // in case of unrecognized GlobalObject, returns Mu
74  // and write a warning (to not throw an exception)
75  if (!found) {
76  edm::LogInfo("L1TGlobal") << "\n '" << label
77  << "' is not a recognized GlobalObject. \n Return ObjNull.";
78 
79  value = ObjNull;
80  }
81 
82  if (value == ObjNull) {
83  edm::LogInfo("L1TGlobal")
84  << "\n ObjNull means no valid GlobalObject defined!";
85  }
86 
87  return value;
88 }
GlobalObject
Definition: GlobalObject.h:16
the string to enum and enum to string conversions for GlobalObject
Definition: GlobalObject.h:51
char const * label
Definition: value.py:1