CMS 3D CMS Logo

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