CMS 3D CMS Logo

L1GtObject.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 
25  static const L1GtObjectStringToEnum l1GtObjectStringToEnumMap[] = {{"Mu", Mu},
26  {"NoIsoEG", NoIsoEG},
27  {"IsoEG", IsoEG},
28  {"CenJet", CenJet},
29  {"ForJet", ForJet},
30  {"TauJet", TauJet},
31  {"ETM", ETM},
32  {"ETT", ETT},
33  {"HTT", HTT},
34  {"HTM", HTM},
35  {"JetCounts", JetCounts},
36  {"HfBitCounts", HfBitCounts},
37  {"HfRingEtSums", HfRingEtSums},
38  {"TechTrig", TechTrig},
39  {"Castor", Castor},
40  {"BPTX", BPTX},
41  {"GtExternal", GtExternal},
42  {"ObjNull", ObjNull},
43  {nullptr, (L1GtObject)-1}};
44 
46 
47  bool found = false;
48  for (int i = 0; l1GtObjectStringToEnumMap[i].label && (!found); ++i)
49  if (!std::strcmp(label.c_str(), l1GtObjectStringToEnumMap[i].label)) {
50  found = true;
51  value = l1GtObjectStringToEnumMap[i].value;
52  }
53 
54  // in case of unrecognized L1GtObject, returns Mu
55  // and write a warning (to not throw an exception)
56  if (!found) {
57  edm::LogInfo("L1GtObject") << "\n '" << label << "' is not a recognized L1GtObject. \n Return ObjNull.";
58 
59  value = ObjNull;
60  }
61 
62  if (value == ObjNull) {
63  edm::LogInfo("L1GtObject") << "\n ObjNull means no valid L1GtObject defined!";
64  }
65 
66  return value;
67 }
68 
70  std::string gtObjectString;
71 
72  switch (gtObject) {
73  case Mu: {
74  gtObjectString = "Mu";
75  } break;
76 
77  case NoIsoEG: {
78  gtObjectString = "NoIsoEG";
79  } break;
80 
81  case IsoEG: {
82  gtObjectString = "IsoEG";
83  } break;
84 
85  case CenJet: {
86  gtObjectString = "CenJet";
87  } break;
88 
89  case ForJet: {
90  gtObjectString = "ForJet";
91  } break;
92 
93  case TauJet: {
94  gtObjectString = "TauJet";
95  } break;
96 
97  case ETM: {
98  gtObjectString = "ETM";
99  } break;
100 
101  case ETT: {
102  gtObjectString = "ETT";
103  } break;
104 
105  case HTT: {
106  gtObjectString = "HTT";
107  } break;
108 
109  case HTM: {
110  gtObjectString = "HTM";
111  } break;
112 
113  case JetCounts: {
114  gtObjectString = "JetCounts";
115  } break;
116 
117  case HfBitCounts: {
118  gtObjectString = "HfBitCounts";
119  } break;
120 
121  case HfRingEtSums: {
122  gtObjectString = "HfRingEtSums";
123  } break;
124 
125  case TechTrig: {
126  gtObjectString = "TechTrig";
127  } break;
128 
129  case Castor: {
130  gtObjectString = "Castor";
131  } break;
132 
133  case BPTX: {
134  gtObjectString = "BPTX";
135  } break;
136 
137  case GtExternal: {
138  gtObjectString = "GtExternal";
139  } break;
140 
141  case ObjNull: {
142  gtObjectString = "ObjNull";
143  edm::LogInfo("L1GtObject") << "\n ObjNull means no valid L1GtObject defined!";
144  } break;
145 
146  default: {
147  edm::LogInfo("L1GtObject") << "\n '" << gtObject << "' is not a recognized L1GtObject. "
148  << "\n Return ObjNull, which means no valid L1GtObject defined!";
149 
150  gtObjectString = "ObjNull";
151 
152  } break;
153  }
154 
155  return gtObjectString;
156 }
Definition: L1GtObject.h:38
L1GtObject
Definition: L1GtObject.h:28
Definition: L1GtObject.h:36
Definition: L1GtObject.h:29
L1GtObject l1GtObjectStringToEnum(const std::string &label)
Definition: L1GtObject.cc:24
const char * label
Definition: L1GtObject.h:52
char const * label
Definition: L1GtObject.h:35
Definition: value.py:1
std::string l1GtObjectEnumToString(const L1GtObject &gtObject)
Definition: L1GtObject.cc:69
Log< level::Info, false > LogInfo
the string to enum and enum to string conversions for L1GtObject
Definition: L1GtObject.h:51
Definition: L1GtObject.h:37