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  {"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 }
89 
91 
92  std::string gtObjectString;
93 
94  switch (gtObject) {
95 
96  case gtMu: {
97  gtObjectString = "Mu";
98  }
99  break;
100 
101  case gtEG: {
102  gtObjectString = "EG";
103  }
104  break;
105 
106  case gtTau: {
107  gtObjectString = "Tau";
108  }
109  break;
110 
111  case gtJet: {
112  gtObjectString = "Jet";
113  }
114  break;
115 
116  case gtETM: {
117  gtObjectString = "ETM";
118  }
119  break;
120 
121  case gtETT: {
122  gtObjectString = "ETT";
123  }
124  break;
125 
126  case gtHTT: {
127  gtObjectString = "HTT";
128  }
129  break;
130 
131  case gtHTM: {
132  gtObjectString = "HTM";
133  }
134  break;
135 
136  case gtETMHF: {
137  gtObjectString = "ETMHF";
138  }
139  break;
140 
141  case gtTowerCount: {
142  gtObjectString = "TowerCount";
143  }
144  break;
145 
146  case gtMinBiasHFP0: {
147  gtObjectString = "MinBiasHFP0";
148  }
149  break;
150 
151  case gtMinBiasHFM0: {
152  gtObjectString = "MinBiasHFM0";
153  }
154  break;
155 
156  case gtMinBiasHFP1: {
157  gtObjectString = "MinBiasHFP1";
158  }
159  break;
160 
161  case gtMinBiasHFM1: {
162  gtObjectString = "MinBiasHFM1";
163  }
164  break;
165 
166  case gtETTem: {
167  gtObjectString = "ETTem";
168  }
169  break;
170 
171  case gtAsymmetryEt: {
172  gtObjectString = "AsymEt";
173  }
174  break;
175 
176  case gtAsymmetryHt: {
177  gtObjectString = "AsymHt";
178  }
179  break;
180 
181  case gtAsymmetryEtHF: {
182  gtObjectString = "AsymEtHF";
183  }
184  break;
185 
186  case gtAsymmetryHtHF: {
187  gtObjectString = "AsymHtHF";
188  }
189  break;
190 
191  case gtCentrality0: {
192  gtObjectString = "CENT0";
193  }
194  break;
195 
196  case gtCentrality1: {
197  gtObjectString = "CENT1";
198  }
199  break;
200 
201  case gtCentrality2: {
202  gtObjectString = "CENT2";
203  }
204  break;
205 
206  case gtCentrality3: {
207  gtObjectString = "CENT3";
208  }
209  break;
210 
211  case gtCentrality4: {
212  gtObjectString = "CENT4";
213  }
214  break;
215 
216  case gtCentrality5: {
217  gtObjectString = "CENT5";
218  }
219  break;
220 
221  case gtCentrality6: {
222  gtObjectString = "CENT6";
223  }
224  break;
225 
226  case gtCentrality7: {
227  gtObjectString = "CENT7";
228  }
229  break;
230 
231  case gtExternal: {
232  gtObjectString = "External";
233  }
234  break;
235 
236  case ObjNull: {
237  gtObjectString = "ObjNull";
238  edm::LogInfo("L1TGlobal")
239  << "\n ObjNull means no valid GlobalObject defined!";
240  }
241  break;
242 
243  default: {
244  edm::LogInfo("L1TGlobal") << "\n '" << gtObject
245  << "' is not a recognized GlobalObject. "
246  << "\n Return ObjNull, which means no valid GlobalObject defined!";
247 
248  gtObjectString = "ObjNull";
249 
250  }
251  break;
252  }
253 
254  return gtObjectString;
255 
256 }
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:51
std::string l1TGtObjectEnumToString(const GlobalObject &)
Definition: GlobalObject.cc:90
char const * label
Definition: value.py:1