CMS 3D CMS Logo

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 
27  static const l1t::L1TGtObjectStringToEnum l1TGtObjectStringToEnumMap[] = {{"Mu", gtMu},
28  {"MuShower", gtMuShower},
29  {"EG", gtEG},
30  {"Tau", gtTau},
31  {"Jet", gtJet},
32  {"ETM", gtETM},
33  {"ETT", gtETT},
34  {"HTT", gtHTT},
35  {"HTM", gtHTM},
36  {"ETMHF", gtETMHF},
37  {"TowerCount", gtTowerCount},
38  {"MinBiasHFP0", gtMinBiasHFP0},
39  {"MinBiasHFM0", gtMinBiasHFM0},
40  {"MinBiasHFP1", gtMinBiasHFP1},
41  {"MinBiasHFM1", gtMinBiasHFM1},
42  {"ETTem", gtETTem},
43  {"AsymEt", gtAsymmetryEt},
44  {"AsymHt", gtAsymmetryHt},
45  {"AsymEtHF", gtAsymmetryEtHF},
46  {"AsymEtHF", gtAsymmetryHtHF},
47  {"CENT0", gtCentrality0},
48  {"CENT1", gtCentrality1},
49  {"CENT2", gtCentrality2},
50  {"CENT3", gtCentrality3},
51  {"CENT4", gtCentrality4},
52  {"CENT5", gtCentrality5},
53  {"CENT6", gtCentrality6},
54  {"CENT7", gtCentrality7},
55  {"External", gtExternal},
56  {"ObjNull", ObjNull},
57  {nullptr, (GlobalObject)-1}};
58 
60 
61  bool found = false;
62  for (int i = 0; l1TGtObjectStringToEnumMap[i].label && (!found); ++i)
63  if (!std::strcmp(label.c_str(), l1TGtObjectStringToEnumMap[i].label)) {
64  found = true;
65  value = l1TGtObjectStringToEnumMap[i].value;
66  }
67 
68  // in case of unrecognized GlobalObject, returns Mu
69  // and write a warning (to not throw an exception)
70  if (!found) {
71  edm::LogInfo("L1TGlobal") << "\n '" << label << "' is not a recognized GlobalObject. \n Return ObjNull.";
72 
73  value = ObjNull;
74  }
75 
76  if (value == ObjNull) {
77  edm::LogInfo("L1TGlobal") << "\n ObjNull means no valid GlobalObject defined!";
78  }
79 
80  return value;
81 }
82 
84  std::string gtObjectString;
85 
86  switch (gtObject) {
87  case gtMu: {
88  gtObjectString = "Mu";
89  } break;
90 
91  case gtMuShower: {
92  gtObjectString = "MuShower";
93  } break;
94 
95  case gtEG: {
96  gtObjectString = "EG";
97  } break;
98 
99  case gtTau: {
100  gtObjectString = "Tau";
101  } break;
102 
103  case gtJet: {
104  gtObjectString = "Jet";
105  } break;
106 
107  case gtETM: {
108  gtObjectString = "ETM";
109  } break;
110 
111  case gtETT: {
112  gtObjectString = "ETT";
113  } break;
114 
115  case gtHTT: {
116  gtObjectString = "HTT";
117  } break;
118 
119  case gtHTM: {
120  gtObjectString = "HTM";
121  } break;
122 
123  case gtETMHF: {
124  gtObjectString = "ETMHF";
125  } break;
126 
127  case gtTowerCount: {
128  gtObjectString = "TowerCount";
129  } break;
130 
131  case gtMinBiasHFP0: {
132  gtObjectString = "MinBiasHFP0";
133  } break;
134 
135  case gtMinBiasHFM0: {
136  gtObjectString = "MinBiasHFM0";
137  } break;
138 
139  case gtMinBiasHFP1: {
140  gtObjectString = "MinBiasHFP1";
141  } break;
142 
143  case gtMinBiasHFM1: {
144  gtObjectString = "MinBiasHFM1";
145  } break;
146 
147  case gtETTem: {
148  gtObjectString = "ETTem";
149  } break;
150 
151  case gtAsymmetryEt: {
152  gtObjectString = "AsymEt";
153  } break;
154 
155  case gtAsymmetryHt: {
156  gtObjectString = "AsymHt";
157  } break;
158 
159  case gtAsymmetryEtHF: {
160  gtObjectString = "AsymEtHF";
161  } break;
162 
163  case gtAsymmetryHtHF: {
164  gtObjectString = "AsymHtHF";
165  } break;
166 
167  case gtCentrality0: {
168  gtObjectString = "CENT0";
169  } break;
170 
171  case gtCentrality1: {
172  gtObjectString = "CENT1";
173  } break;
174 
175  case gtCentrality2: {
176  gtObjectString = "CENT2";
177  } break;
178 
179  case gtCentrality3: {
180  gtObjectString = "CENT3";
181  } break;
182 
183  case gtCentrality4: {
184  gtObjectString = "CENT4";
185  } break;
186 
187  case gtCentrality5: {
188  gtObjectString = "CENT5";
189  } break;
190 
191  case gtCentrality6: {
192  gtObjectString = "CENT6";
193  } break;
194 
195  case gtCentrality7: {
196  gtObjectString = "CENT7";
197  } break;
198 
199  case gtExternal: {
200  gtObjectString = "External";
201  } break;
202 
203  case ObjNull: {
204  gtObjectString = "ObjNull";
205  edm::LogInfo("L1TGlobal") << "\n ObjNull means no valid GlobalObject defined!";
206  } break;
207 
208  default: {
209  edm::LogInfo("L1TGlobal") << "\n '" << gtObject << "' is not a recognized GlobalObject. "
210  << "\n Return ObjNull, which means no valid GlobalObject defined!";
211 
212  gtObjectString = "ObjNull";
213 
214  } break;
215  }
216 
217  return gtObjectString;
218 }
l1t::GlobalObject l1TGtObjectStringToEnum(const std::string &)
Definition: GlobalObject.cc:26
GlobalObject
Definition: GlobalObject.h:16
delete x;
Definition: CaloConfig.h:22
the string to enum and enum to string conversions for GlobalObject
Definition: GlobalObject.h:51
std::string l1TGtObjectEnumToString(const GlobalObject &)
Definition: GlobalObject.cc:83
char const * label
Definition: value.py:1
Log< level::Info, false > LogInfo