CMS 3D CMS Logo

GlobalObject.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <cstring>
20 
21 // user include files
23 
24 using namespace l1t;
25 
26 
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  {"External", gtExternal},
48  {"ObjNull", ObjNull},
49  {nullptr, (GlobalObject) - 1}
50  };
51 
53 
54  bool found = false;
55  for (int i = 0; l1TGtObjectStringToEnumMap[i].label && (!found); ++i)
56  if (!std::strcmp(label.c_str(), l1TGtObjectStringToEnumMap[i].label)) {
57  found = true;
58  value = l1TGtObjectStringToEnumMap[i].value;
59  }
60 
61  // in case of unrecognized GlobalObject, returns Mu
62  // and write a warning (to not throw an exception)
63  if (!found) {
64  edm::LogInfo("L1TGlobal") << "\n '" << label
65  << "' is not a recognized GlobalObject. \n Return ObjNull.";
66 
67  value = ObjNull;
68  }
69 
70  if (value == ObjNull) {
71  edm::LogInfo("L1TGlobal")
72  << "\n ObjNull means no valid GlobalObject defined!";
73  }
74 
75  return value;
76 }
77 
79 
80  std::string gtObjectString;
81 
82  switch (gtObject) {
83 
84  case gtMu: {
85  gtObjectString = "Mu";
86  }
87  break;
88 
89  case gtEG: {
90  gtObjectString = "EG";
91  }
92  break;
93 
94  case gtTau: {
95  gtObjectString = "Tau";
96  }
97  break;
98 
99  case gtJet: {
100  gtObjectString = "Jet";
101  }
102  break;
103 
104  case gtETM: {
105  gtObjectString = "ETM";
106  }
107  break;
108 
109  case gtETT: {
110  gtObjectString = "ETT";
111  }
112  break;
113 
114  case gtHTT: {
115  gtObjectString = "HTT";
116  }
117  break;
118 
119  case gtHTM: {
120  gtObjectString = "HTM";
121  }
122  break;
123 
124  case gtETMHF: {
125  gtObjectString = "ETMHF";
126  }
127  break;
128 
129  case gtTowerCount: {
130  gtObjectString = "TowerCount";
131  }
132  break;
133 
134  case gtMinBiasHFP0: {
135  gtObjectString = "MinBiasHFP0";
136  }
137  break;
138 
139  case gtMinBiasHFM0: {
140  gtObjectString = "MinBiasHFM0";
141  }
142  break;
143 
144  case gtMinBiasHFP1: {
145  gtObjectString = "MinBiasHFP1";
146  }
147  break;
148 
149  case gtMinBiasHFM1: {
150  gtObjectString = "MinBiasHFM1";
151  }
152  break;
153 
154  case gtETTem: {
155  gtObjectString = "ETTem";
156  }
157  break;
158 
159  case gtExternal: {
160  gtObjectString = "External";
161  }
162  break;
163 
164  case ObjNull: {
165  gtObjectString = "ObjNull";
166  edm::LogInfo("L1TGlobal")
167  << "\n ObjNull means no valid GlobalObject defined!";
168  }
169  break;
170 
171  default: {
172  edm::LogInfo("L1TGlobal") << "\n '" << gtObject
173  << "' is not a recognized GlobalObject. "
174  << "\n Return ObjNull, which means no valid GlobalObject defined!";
175 
176  gtObjectString = "ObjNull";
177 
178  }
179  break;
180  }
181 
182  return gtObjectString;
183 
184 }
l1t::GlobalObject l1TGtObjectStringToEnum(const std::string &)
Definition: GlobalObject.cc:27
GlobalObject
Definition: GlobalObject.h:16
delete x;
Definition: CaloConfig.h:22
the string to enum and enum to string conversions for GlobalObject
Definition: GlobalObject.h:39
std::string l1TGtObjectEnumToString(const GlobalObject &)
Definition: GlobalObject.cc:78
Definition: value.py:1