CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtDefinitions.cc
Go to the documentation of this file.
1 
14 // this class header
16 
17 // system include files
18 #include <cstring>
19 
20 // user include files
22 
23 // forward declarations
24 
25 // L1GtBoardType
27 
28  static L1GtBoardTypeStringToEnum l1GtBoardTypeStringToEnumMap[] = {
29  {"GTFE", GTFE},
30  {"FDL", FDL},
31  {"PSB", PSB},
32  {"GMT", GMT},
33  {"TCS", TCS},
34  {"TIM", TIM},
35  {"BoardNull", BoardNull},
36  {0, (L1GtBoardType) - 1}
37  };
38 
40 
41  bool found = false;
42  for (int i = 0; l1GtBoardTypeStringToEnumMap[i].label && (!found); ++i)
43  if (!std::strcmp(label.c_str(), l1GtBoardTypeStringToEnumMap[i].label)) {
44  found = true;
45  value = l1GtBoardTypeStringToEnumMap[i].value;
46  }
47 
48  // in case of unrecognized L1GtBoardType, return BoardNull
49  // to be dealt by the corresponding module
50  if (!found) {
51  edm::LogInfo("L1GtDefinitions") << "\n '" << label
52  << "' is not a recognized L1GtBoardType. \n Return BoardNull.";
53 
54  value = BoardNull;
55  }
56 
57  if (value == BoardNull) {
58  edm::LogInfo("L1GtDefinitions")
59  << "\n BoardNull means no valid board type defined!";
60  }
61 
62  return value;
63 }
64 
65 std::string l1GtBoardTypeEnumToString(const L1GtBoardType& boardType) {
66 
67  std::string boardTypeString;
68 
69  switch (boardType) {
70 
71  case GTFE: {
72  boardTypeString = "GTFE";
73  }
74  break;
75  case FDL: {
76  boardTypeString = "FDL";
77  }
78  break;
79  case PSB: {
80  boardTypeString = "PSB";
81  }
82  break;
83  case GMT: {
84  boardTypeString = "GMT";
85  }
86  break;
87  case TCS: {
88  boardTypeString = "TCS";
89  }
90  break;
91  case TIM: {
92  boardTypeString = "TIM";
93  }
94  break;
95  case BoardNull: {
96  boardTypeString = "BoardNull";
97  edm::LogInfo("L1GtDefinitions")
98  << "\n BoardNull means no valid board type defined!";
99  }
100  break;
101  default: {
102  boardTypeString = "BoardNull";
103  edm::LogInfo("L1GtDefinitions") << "\n '" << boardType
104  << "' is not a recognized L1GtBoardType. "
105  << "\n Return BoardNull, which means no valid board type defined!";
106 
107  }
108  break;
109  }
110 
111  return boardTypeString;
112 
113 }
114 
115 
116 // L1GtPsbQuad
117 
118 L1GtPsbQuad l1GtPsbQuadStringToEnum(const std::string& label) {
119 
120  static L1GtPsbQuadStringToEnum l1GtPsbQuadStringToEnumMap[] = {
121  {"Free", Free},
122  {"TechTr", TechTr},
123  {"IsoEGQ", IsoEGQ},
124  {"NoIsoEGQ", NoIsoEGQ},
125  {"CenJetQ", CenJetQ},
126  {"ForJetQ", ForJetQ},
127  {"TauJetQ", TauJetQ},
128  {"ESumsQ", ESumsQ},
129  {"JetCountsQ", JetCountsQ},
130  {"MQB1", MQB1},
131  {"MQB2", MQB2},
132  {"MQF3", MQF3},
133  {"MQF4", MQF4},
134  {"MQB5", MQB5},
135  {"MQB6", MQB6},
136  {"MQF7", MQF7},
137  {"MQF8", MQF8},
138  {"MQB9", MQB9},
139  {"MQB10", MQB10},
140  {"MQF11", MQF11},
141  {"MQF12", MQF12},
142  {"CastorQ", CastorQ},
143  {"HfQ", HfQ},
144  {"BptxQ", BptxQ},
145  {"GtExternalQ", GtExternalQ},
146  {"PsbQuadNull", PsbQuadNull},
147  {0, (L1GtPsbQuad) - 1}
148  };
149 
150  L1GtPsbQuad value = (L1GtPsbQuad) - 1;
151 
152  bool found = false;
153  for (int i = 0; l1GtPsbQuadStringToEnumMap[i].label && (!found); ++i)
154  if (!std::strcmp(label.c_str(), l1GtPsbQuadStringToEnumMap[i].label)) {
155  found = true;
156  value = l1GtPsbQuadStringToEnumMap[i].value;
157  }
158 
159  // in case of unrecognized L1GtPsbQuad, return PsbQuadNull
160  // to be dealt by the corresponding module
161  if (!found) {
162  edm::LogInfo("L1GtDefinitions") << "\n '" << label
163  << "' is not a recognized L1GtPsbQuad. \n Return PsbQuadNull.";
164 
165  value = PsbQuadNull;
166  }
167 
168  if (value == PsbQuadNull) {
169  edm::LogInfo("L1GtDefinitions")
170  << "\n PsbQuadNull means no valid PSB quadruplet defined!";
171  }
172 
173  return value;
174 }
175 
176 std::string l1GtPsbQuadEnumToString(const L1GtPsbQuad& psbQuad) {
177 
178  std::string psbQuadString;
179 
180  switch (psbQuad) {
181 
182  case Free: {
183  psbQuadString = "Free";
184  }
185  break;
186  case TechTr: {
187  psbQuadString = "TechTr";
188  }
189  break;
190  case IsoEGQ: {
191  psbQuadString = "IsoEGQ";
192  }
193  break;
194  case NoIsoEGQ: {
195  psbQuadString = "NoIsoEGQ";
196  }
197  break;
198  case CenJetQ: {
199  psbQuadString = "CenJetQ";
200  }
201  break;
202  case ForJetQ: {
203  psbQuadString = "ForJetQ";
204  }
205  break;
206  case TauJetQ: {
207  psbQuadString = "TauJetQ";
208  }
209  break;
210  case ESumsQ: {
211  psbQuadString = "ESumsQ";
212  }
213  break;
214  case JetCountsQ: {
215  psbQuadString = "JetCountsQ";
216  }
217  break;
218  case MQB1: {
219  psbQuadString = "MQB1";
220  }
221  break;
222  case MQB2: {
223  psbQuadString = "MQB2";
224  }
225  break;
226  case MQF3: {
227  psbQuadString = "MQF3";
228  }
229  break;
230  case MQF4: {
231  psbQuadString = "MQF4";
232  }
233  break;
234  case MQB5: {
235  psbQuadString = "MQB5";
236  }
237  break;
238  case MQB6: {
239  psbQuadString = "MQB6";
240  }
241  break;
242  case MQF7: {
243  psbQuadString = "MQF7";
244  }
245  break;
246  case MQF8: {
247  psbQuadString = "MQF9";
248  }
249  break;
250  case MQB9: {
251  psbQuadString = "MQB9";
252  }
253  break;
254  case MQB10: {
255  psbQuadString = "MQB10";
256  }
257  break;
258  case MQF11: {
259  psbQuadString = "MQF11";
260  }
261  break;
262  case MQF12: {
263  psbQuadString = "MQF12";
264  }
265  break;
266  case CastorQ: {
267  psbQuadString = "CastorQ";
268  }
269  break;
270  case HfQ: {
271  psbQuadString = "HfQ";
272  }
273  break;
274  case BptxQ: {
275  psbQuadString = "BptxQ";
276  }
277  break;
278  case GtExternalQ: {
279  psbQuadString = "GtExternalQ";
280  }
281  break;
282  case PsbQuadNull: {
283  psbQuadString = "PsbQuadNull";
284  edm::LogInfo("L1GtDefinitions")
285  << "\n PsbQuadNull means no valid PSB quadruplet defined!";
286  }
287  break;
288  default: {
289  psbQuadString = "PsbQuadNull";
290  edm::LogInfo("L1GtDefinitions") << "\n '" << psbQuad
291  << "' is not a recognized L1GtPsbQuad. "
292  << "\n Return PsbQuadNull, which means no valid PSB quadruplet defined!";
293 
294  }
295  break;
296  }
297 
298  return psbQuadString;
299 
300 }
301 
302 // L1GtConditionType
303 
305 
306  static L1GtConditionTypeStringToEnum l1GtConditionTypeStringToEnumMap[] = {
307  {"TypeNull", TypeNull},
308  {"Type1s", Type1s},
309  {"Type2s", Type2s},
310  {"Type2wsc", Type2wsc},
311  {"Type2cor", Type2cor},
312  {"Type3s", Type3s},
313  {"Type4s", Type4s},
314  {"TypeETM", TypeETM},
315  {"TypeETT", TypeETT},
316  {"TypeHTT", TypeHTT},
317  {"TypeHTM", TypeHTM},
318  {"TypeJetCounts", TypeJetCounts},
319  {"TypeCastor", TypeCastor},
320  {"TypeHfBitCounts", TypeHfBitCounts},
321  {"TypeHfRingEtSums", TypeHfRingEtSums},
322  {"TypeBptx", TypeBptx},
323  {"TypeExternal", TypeExternal},
324  {0, (L1GtConditionType) - 1}
325  };
326 
328 
329  bool found = false;
330  for (int i = 0; l1GtConditionTypeStringToEnumMap[i].label && (!found); ++i)
331  if (!std::strcmp(label.c_str(), l1GtConditionTypeStringToEnumMap[i].label)) {
332  found = true;
333  value = l1GtConditionTypeStringToEnumMap[i].value;
334  }
335 
336  // in case of unrecognized L1GtConditionType, return TypeNull
337  // to be dealt by the corresponding module
338  if (!found) {
339  edm::LogInfo("L1GtDefinitions") << "\n '" << label
340  << "' is not a recognized L1GtConditionType. \n Return TypeNull.";
341 
342  value = TypeNull;
343  }
344 
345  if (value == TypeNull) {
346  edm::LogInfo("L1GtDefinitions")
347  << "\n TypeNull means no valid condition type defined!";
348  }
349 
350  return value;
351 }
352 
354  const L1GtConditionType& conditionType) {
355 
356  std::string conditionTypeString;
357 
358  switch (conditionType) {
359 
360  case TypeNull: {
361  conditionTypeString = "TypeNull";
362  edm::LogInfo("L1GtDefinitions")
363  << "\n TypeNull means no valid condition type defined!";
364  }
365 
366  break;
367  case Type1s: {
368  conditionTypeString = "Type1s";
369  }
370 
371  break;
372  case Type2s: {
373  conditionTypeString = "Type2s";
374  }
375 
376  break;
377  case Type2wsc: {
378  conditionTypeString = "Type2wsc";
379  }
380 
381  break;
382  case Type2cor: {
383  conditionTypeString = "Type2cor";
384  }
385 
386  break;
387  case Type3s: {
388  conditionTypeString = "Type3s";
389  }
390 
391  break;
392  case Type4s: {
393  conditionTypeString = "Type4s";
394  }
395 
396  break;
397  case TypeETM: {
398  conditionTypeString = "TypeETM";
399  }
400 
401  break;
402  case TypeETT: {
403  conditionTypeString = "TypeETT";
404  }
405 
406  break;
407  case TypeHTT: {
408  conditionTypeString = "TypeHTT";
409  }
410 
411  break;
412  case TypeHTM: {
413  conditionTypeString = "TypeHTM";
414  }
415 
416  break;
417  case TypeJetCounts: {
418  conditionTypeString = "TypeJetCounts";
419  }
420 
421  break;
422  case TypeCastor: {
423  conditionTypeString = "TypeCastor";
424  }
425 
426  break;
427  case TypeHfBitCounts: {
428  conditionTypeString = "TypeHfBitCounts";
429  }
430 
431  break;
432  case TypeHfRingEtSums: {
433  conditionTypeString = "TypeHfRingEtSums";
434  }
435 
436  break;
437  case TypeBptx: {
438  conditionTypeString = "TypeBptx";
439  }
440 
441  break;
442  case TypeExternal: {
443  conditionTypeString = "TypeExternal";
444  }
445 
446  break;
447  default: {
448  conditionTypeString = "TypeNull";
449  edm::LogInfo("L1GtDefinitions") << "\n '" << conditionType
450  << "' is not a recognized L1GtConditionType. "
451  << "\n Return TypeNull, which means no valid condition type defined!";
452  }
453  break;
454  }
455 
456  return conditionTypeString;
457 }
458 
459 // L1GtConditionCategory
460 
462 
463  static L1GtConditionCategoryStringToEnum l1GtConditionCategoryStringToEnumMap[] = {
464  {"CondNull", CondNull},
465  {"CondMuon", CondMuon},
466  {"CondCalo", CondCalo},
467  {"CondEnergySum", CondEnergySum},
468  {"CondJetCounts", CondJetCounts},
469  {"CondCorrelation", CondCorrelation},
470  {"CondCastor", CondCastor},
471  {"CondHfBitCounts", CondHfBitCounts},
472  {"CondHfRingEtSums", CondHfRingEtSums},
473  {"CondBptx", CondBptx},
474  {"CondExternal", CondExternal},
475  {0, (L1GtConditionCategory) - 1}
476  };
477 
479 
480  bool found = false;
481  for (int i = 0; l1GtConditionCategoryStringToEnumMap[i].label && (!found); ++i)
482  if (!std::strcmp(label.c_str(),
483  l1GtConditionCategoryStringToEnumMap[i].label)) {
484  found = true;
485  value = l1GtConditionCategoryStringToEnumMap[i].value;
486  }
487 
488  // in case of unrecognized L1GtConditionCategory, return CondNull
489  // to be dealt by the corresponding module
490  if (!found) {
491  edm::LogInfo("L1GtDefinitions") << "\n '" << label
492  << "' is not a recognized L1GtConditionCategory. \n Return CondNull.";
493 
494  value = CondNull;
495  }
496 
497  if (value == CondNull) {
498  edm::LogInfo("L1GtDefinitions")
499  << "\n CondNull means no valid condition category defined!";
500  }
501 
502  return value;
503 }
504 
506  const L1GtConditionCategory& conditionCategory) {
507 
508  std::string conditionCategoryString;
509 
510  switch (conditionCategory) {
511 
512  case CondNull: {
513  conditionCategoryString = "CondNull";
514  edm::LogInfo("L1GtDefinitions")
515  << "\n CondNull means no valid condition category defined!";
516  }
517 
518  break;
519  case CondMuon: {
520  conditionCategoryString = "CondMuon";
521  }
522 
523  break;
524  case CondCalo: {
525  conditionCategoryString = "CondCalo";
526  }
527 
528  break;
529  case CondEnergySum: {
530  conditionCategoryString = "CondEnergySum";
531  }
532 
533  break;
534  case CondJetCounts: {
535  conditionCategoryString = "CondJetCounts";
536  }
537 
538  break;
539  case CondCorrelation: {
540  conditionCategoryString = "CondCorrelation";
541  }
542 
543  break;
544  case CondCastor: {
545  conditionCategoryString = "CondCastor";
546  }
547 
548  break;
549  case CondHfBitCounts: {
550  conditionCategoryString = "CondHfBitCounts";
551  }
552 
553  break;
554  case CondHfRingEtSums: {
555  conditionCategoryString = "CondHfRingEtSums";
556  }
557 
558  break;
559  case CondBptx: {
560  conditionCategoryString = "CondBptx";
561  }
562 
563  break;
564  case CondExternal: {
565  conditionCategoryString = "CondExternal";
566  }
567 
568  break;
569  default: {
570  conditionCategoryString = "CondNull";
571  edm::LogInfo("L1GtDefinitions") << "\n '" << conditionCategory
572  << "' is not a recognized L1GtConditionCategory. "
573  << "\n Return CondNull, which means no valid condition category defined!";
574 
575  }
576  break;
577  }
578 
579  return conditionCategoryString;
580 }
581 
int i
Definition: DBlmapReader.cc:9
std::string l1GtPsbQuadEnumToString(const L1GtPsbQuad &)
std::string l1GtBoardTypeEnumToString(const L1GtBoardType &)
std::string l1GtConditionCategoryEnumToString(const L1GtConditionCategory &)
L1GtConditionType
L1GtPsbQuad
quadruples sent to GT via PSB
L1GtPsbQuad l1GtPsbQuadStringToEnum(const std::string &)
L1GtConditionType l1GtConditionTypeStringToEnum(const std::string &)
L1GtBoardType l1GtBoardTypeStringToEnum(const std::string &)
L1GtBoardType
board types in GT
L1GtConditionCategory
condition categories
L1GtConditionCategory l1GtConditionCategoryStringToEnum(const std::string &)
std::string l1GtConditionTypeEnumToString(const L1GtConditionType &)