-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathGlobalObject.cc
228 lines (180 loc) · 7.06 KB
/
GlobalObject.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/**
* \class GlobalObject
*
*
* Description: define an enumeration of L1 GT objects.
*
* Implementation:
* <TODO: enter implementation details>
*
* \author: Vasile Mihai Ghete - HEPHY Vienna
*
*
*/
// this class header
#include "DataFormats/L1TGlobal/interface/GlobalObject.h"
// system include files
#include <cstring>
// user include files
#include "FWCore/MessageLogger/interface/MessageLogger.h"
using namespace l1t;
l1t::GlobalObject l1TGtObjectStringToEnum(const std::string& label) {
static const l1t::L1TGtObjectStringToEnum l1TGtObjectStringToEnumMap[] = {{"Mu", gtMu},
{"MuShower", gtMuShower},
{"EG", gtEG},
{"Tau", gtTau},
{"Jet", gtJet},
{"ETM", gtETM},
{"ETT", gtETT},
{"HTT", gtHTT},
{"HTM", gtHTM},
{"ETMHF", gtETMHF},
{"TowerCount", gtTowerCount},
{"MinBiasHFP0", gtMinBiasHFP0},
{"MinBiasHFM0", gtMinBiasHFM0},
{"MinBiasHFP1", gtMinBiasHFP1},
{"MinBiasHFM1", gtMinBiasHFM1},
{"ETTem", gtETTem},
{"AsymEt", gtAsymmetryEt},
{"AsymHt", gtAsymmetryHt},
{"AsymEtHF", gtAsymmetryEtHF},
{"AsymEtHF", gtAsymmetryHtHF},
{"CENT0", gtCentrality0},
{"CENT1", gtCentrality1},
{"CENT2", gtCentrality2},
{"CENT3", gtCentrality3},
{"CENT4", gtCentrality4},
{"CENT5", gtCentrality5},
{"CENT6", gtCentrality6},
{"CENT7", gtCentrality7},
{"External", gtExternal},
{"ZDCP", gtZDCP},
{"ZDCM", gtZDCM},
{"ObjNull", ObjNull},
{nullptr, (GlobalObject)-1}};
l1t::GlobalObject value = (GlobalObject)-1;
bool found = false;
for (int i = 0; l1TGtObjectStringToEnumMap[i].label && (!found); ++i)
if (!std::strcmp(label.c_str(), l1TGtObjectStringToEnumMap[i].label)) {
found = true;
value = l1TGtObjectStringToEnumMap[i].value;
}
// in case of unrecognized GlobalObject, returns Mu
// and write a warning (to not throw an exception)
if (!found) {
edm::LogInfo("L1TGlobal") << "\n '" << label << "' is not a recognized GlobalObject. \n Return ObjNull.";
value = ObjNull;
}
if (value == ObjNull) {
edm::LogInfo("L1TGlobal") << "\n ObjNull means no valid GlobalObject defined!";
}
return value;
}
std::string l1t::l1TGtObjectEnumToString(const GlobalObject& gtObject) {
std::string gtObjectString;
switch (gtObject) {
case gtMu: {
gtObjectString = "Mu";
} break;
case gtMuShower: {
gtObjectString = "MuShower";
} break;
case gtEG: {
gtObjectString = "EG";
} break;
case gtTau: {
gtObjectString = "Tau";
} break;
case gtJet: {
gtObjectString = "Jet";
} break;
case gtETM: {
gtObjectString = "ETM";
} break;
case gtETT: {
gtObjectString = "ETT";
} break;
case gtHTT: {
gtObjectString = "HTT";
} break;
case gtHTM: {
gtObjectString = "HTM";
} break;
case gtETMHF: {
gtObjectString = "ETMHF";
} break;
case gtTowerCount: {
gtObjectString = "TowerCount";
} break;
case gtMinBiasHFP0: {
gtObjectString = "MinBiasHFP0";
} break;
case gtMinBiasHFM0: {
gtObjectString = "MinBiasHFM0";
} break;
case gtMinBiasHFP1: {
gtObjectString = "MinBiasHFP1";
} break;
case gtMinBiasHFM1: {
gtObjectString = "MinBiasHFM1";
} break;
case gtETTem: {
gtObjectString = "ETTem";
} break;
case gtAsymmetryEt: {
gtObjectString = "AsymEt";
} break;
case gtAsymmetryHt: {
gtObjectString = "AsymHt";
} break;
case gtAsymmetryEtHF: {
gtObjectString = "AsymEtHF";
} break;
case gtAsymmetryHtHF: {
gtObjectString = "AsymHtHF";
} break;
case gtCentrality0: {
gtObjectString = "CENT0";
} break;
case gtCentrality1: {
gtObjectString = "CENT1";
} break;
case gtCentrality2: {
gtObjectString = "CENT2";
} break;
case gtCentrality3: {
gtObjectString = "CENT3";
} break;
case gtCentrality4: {
gtObjectString = "CENT4";
} break;
case gtCentrality5: {
gtObjectString = "CENT5";
} break;
case gtCentrality6: {
gtObjectString = "CENT6";
} break;
case gtCentrality7: {
gtObjectString = "CENT7";
} break;
case gtExternal: {
gtObjectString = "External";
} break;
case gtZDCP: {
gtObjectString = "ZDCP";
} break;
case gtZDCM: {
gtObjectString = "ZDCM";
} break;
case ObjNull: {
gtObjectString = "ObjNull";
edm::LogInfo("L1TGlobal") << "\n ObjNull means no valid GlobalObject defined!";
} break;
default: {
edm::LogInfo("L1TGlobal") << "\n '" << gtObject << "' is not a recognized GlobalObject. "
<< "\n Return ObjNull, which means no valid GlobalObject defined!";
gtObjectString = "ObjNull";
} break;
}
return gtObjectString;
}