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