CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  {"ETM2", gtETM2},
41  {"MinBias", gtMinBias},
42  {"External", gtExternal},
43  {"ObjNull", ObjNull},
44  {0, (GlobalObject) - 1}
45  };
46 
48 
49  bool found = false;
50  for (int i = 0; l1TGtObjectStringToEnumMap[i].label && (!found); ++i)
51  if (!std::strcmp(label.c_str(), l1TGtObjectStringToEnumMap[i].label)) {
52  found = true;
53  value = l1TGtObjectStringToEnumMap[i].value;
54  }
55 
56  // in case of unrecognized GlobalObject, returns Mu
57  // and write a warning (to not throw an exception)
58  if (!found) {
59  edm::LogInfo("L1TGlobal") << "\n '" << label
60  << "' is not a recognized GlobalObject. \n Return ObjNull.";
61 
62  value = ObjNull;
63  }
64 
65  if (value == ObjNull) {
66  edm::LogInfo("L1TGlobal")
67  << "\n ObjNull means no valid GlobalObject defined!";
68  }
69 
70  return value;
71 }
72 
74 
75  std::string gtObjectString;
76 
77  switch (gtObject) {
78 
79  case gtMu: {
80  gtObjectString = "Mu";
81  }
82  break;
83 
84  case gtEG: {
85  gtObjectString = "EG";
86  }
87  break;
88 
89  case gtTau: {
90  gtObjectString = "Tau";
91  }
92  break;
93 
94  case gtJet: {
95  gtObjectString = "Jet";
96  }
97  break;
98 
99  case gtETM: {
100  gtObjectString = "ETM";
101  }
102  break;
103 
104  case gtETT: {
105  gtObjectString = "ETT";
106  }
107  break;
108 
109  case gtHTT: {
110  gtObjectString = "HTT";
111  }
112  break;
113 
114  case gtHTM: {
115  gtObjectString = "HTM";
116  }
117  break;
118 
119  case gtETM2: {
120  gtObjectString = "ETM2";
121  }
122  break;
123 
124  case gtMinBias: {
125  gtObjectString = "MinBias";
126  }
127  break;
128 
129  case gtExternal: {
130  gtObjectString = "External";
131  }
132  break;
133 
134  case ObjNull: {
135  gtObjectString = "ObjNull";
136  edm::LogInfo("L1TGlobal")
137  << "\n ObjNull means no valid GlobalObject defined!";
138  }
139  break;
140 
141  default: {
142  edm::LogInfo("L1TGlobal") << "\n '" << gtObject
143  << "' is not a recognized GlobalObject. "
144  << "\n Return ObjNull, which means no valid GlobalObject defined!";
145 
146  gtObjectString = "ObjNull";
147 
148  }
149  break;
150  }
151 
152  return gtObjectString;
153 
154 }
int i
Definition: DBlmapReader.cc:9
l1t::GlobalObject l1TGtObjectStringToEnum(const std::string &)
Definition: GlobalObject.cc:27
GlobalObject
Definition: GlobalObject.h:16
the string to enum and enum to string conversions for GlobalObject
Definition: GlobalObject.h:34
std::string l1TGtObjectEnumToString(const GlobalObject &)
Definition: GlobalObject.cc:73