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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
|
#include "DQM/HcalCommon/interface/ElectronicsQuantity.h"
namespace hcaldqm {
using namespace constants;
namespace quantity {
int getValue_FED(HcalElectronicsId const &eid) {
unsigned int fed = utilities::crate2fed(eid.crateId(), eid.slot());
auto it_fed = std::find(std::begin(fedList), std::end(fedList), fed);
return ((it_fed == std::end(fedList)) ? -1 : std::distance(fedList.begin(), it_fed));
}
int getValue_FEDuTCA(HcalElectronicsId const &eid) {
unsigned int fed = utilities::crate2fed(eid.crateId(), eid.slot());
auto it_fed = std::find(std::begin(fedListuTCA), std::end(fedListuTCA), fed);
return ((it_fed == std::end(fedListuTCA)) ? -1 : std::distance(fedListuTCA.begin(), it_fed));
}
int getValue_FEDVME(HcalElectronicsId const &eid) {
unsigned int fed = utilities::crate2fed(eid.crateId(), eid.slot());
auto it_fed = std::find(std::begin(fedListVME), std::end(fedListVME), fed);
return ((it_fed == std::end(fedListVME)) ? -1 : std::distance(fedListVME.begin(), it_fed));
}
int getValue_Crate(HcalElectronicsId const &eid) {
unsigned int crate = eid.crateId();
auto it_crate = std::find(std::begin(crateList), std::end(crateList), crate);
return ((it_crate == std::end(crateList)) ? -1 : std::distance(crateList.begin(), it_crate));
}
int getValue_CrateuTCA(HcalElectronicsId const &eid) {
unsigned int crate = eid.crateId();
auto it_crate = std::find(std::begin(crateListuTCA), std::end(crateListuTCA), crate);
return ((it_crate == std::end(crateListuTCA)) ? -1 : std::distance(crateListuTCA.begin(), it_crate));
}
int getValue_CrateVME(HcalElectronicsId const &eid) {
unsigned int crate = eid.crateId();
auto it_crate = std::find(std::begin(crateListVME), std::end(crateListVME), crate);
return ((it_crate == std::end(crateListVME)) ? -1 : std::distance(crateListVME.begin(), it_crate));
}
int getValue_SlotuTCA(HcalElectronicsId const &eid) { return eid.slot() - SLOT_uTCA_MIN; }
int getValue_SlotVME(HcalElectronicsId const &eid) {
int slot = eid.slot();
if (slot <= SLOT_VME_MAX1)
slot -= SLOT_VME_MIN1;
else
slot = SLOT_VME_NUM1 + slot - SLOT_VME_MIN2;
return slot;
}
int getValue_Spigot(HcalElectronicsId const &eid) { return eid.spigot(); }
int getValue_FiberuTCA(HcalElectronicsId const &eid) {
int fiber = eid.fiberIndex();
if (fiber <= FIBER_uTCA_MAX1)
fiber -= FIBER_uTCA_MIN1;
else
fiber = (FIBER_uTCA_MAX1 - FIBER_uTCA_MIN1 + 1) + fiber - FIBER_uTCA_MIN2;
return fiber;
}
int getValue_FiberVME(HcalElectronicsId const &eid) { return eid.fiberIndex() - 1; }
int getValue_FiberCh(HcalElectronicsId const &eid) { return eid.fiberChanId(); }
int getValue_FEDuTCASlot(HcalElectronicsId const &eid) {
int ifed = getValue_FEDuTCA(eid);
int islot = getValue_SlotuTCA(eid);
return ifed * SLOT_uTCA_NUM + islot;
}
int getValue_FEDVMESpigot(HcalElectronicsId const &eid) {
int ifed = getValue_FEDVME(eid);
int ispigot = getValue_Spigot(eid);
return ifed * SPIGOT_NUM + ispigot;
}
int getValue_FiberuTCAFiberCh(HcalElectronicsId const &eid) {
int ifiber = getValue_FiberuTCA(eid);
int ifch = getValue_FiberCh(eid);
return ifiber * FIBERCH_NUM + ifch;
}
int getValue_FiberVMEFiberCh(HcalElectronicsId const &eid) {
int ifiber = getValue_FiberVME(eid);
int ifch = getValue_FiberCh(eid);
return ifiber * FIBERCH_NUM + ifch;
}
int getValue_SLB(HcalElectronicsId const &eid) {
int slbsite = eid.slbSiteNumber();
return slbsite - SLB_MIN;
}
int getValue_SLBCh(HcalElectronicsId const &eid) { return eid.slbChannelIndex() - SLBCH_MIN; }
int getValue_SLBSLBCh(HcalElectronicsId const &eid) {
int islb = getValue_SLB(eid);
int islbch = getValue_SLBCh(eid);
return islb * SLBCH_NUM + islbch;
}
int getValue_FiberuTCATP(HcalElectronicsId const &eid) { return eid.fiberIndex() - TPFIBER_MIN; }
int getValue_FiberChuTCATP(HcalElectronicsId const &eid) { return eid.fiberChanId() - TPFIBERCH_MIN; }
int getValue_FiberuTCATPFiberChuTCATP(HcalElectronicsId const &eid) {
int ifib = getValue_FiberuTCATP(eid);
int ifibch = getValue_FiberChuTCATP(eid);
return ifib * TPFIBERCH_NUM + ifibch;
}
uint32_t getBin_FED(HcalElectronicsId const &eid) { return (uint32_t)(getValue_FED(eid) + 1); }
uint32_t getBin_FEDuTCA(HcalElectronicsId const &eid) { return (uint32_t)(getValue_FEDuTCA(eid) + 1); }
uint32_t getBin_FEDVME(HcalElectronicsId const &eid) { return (uint32_t)(getValue_FEDVME(eid) + 1); }
uint32_t getBin_Crate(HcalElectronicsId const &eid) { return (uint32_t)(getValue_Crate(eid) + 1); }
uint32_t getBin_CrateuTCA(HcalElectronicsId const &eid) { return (uint32_t)(getValue_CrateuTCA(eid) + 1); }
uint32_t getBin_CrateVME(HcalElectronicsId const &eid) { return (uint32_t)(getValue_CrateVME(eid) + 1); }
uint32_t getBin_SlotuTCA(HcalElectronicsId const &eid) { return (uint32_t)(getValue_SlotuTCA(eid) + 1); }
uint32_t getBin_SlotVME(HcalElectronicsId const &eid) { return (uint32_t)(getValue_SlotVME(eid) + 1); }
uint32_t getBin_Spigot(HcalElectronicsId const &eid) { return (uint32_t)(getValue_Spigot(eid) + 1); }
uint32_t getBin_FiberuTCA(HcalElectronicsId const &eid) { return (uint32_t)(getValue_FiberuTCA(eid) + 1); }
uint32_t getBin_FiberVME(HcalElectronicsId const &eid) { return (uint32_t)(getValue_FiberVME(eid) + 1); }
uint32_t getBin_FiberCh(HcalElectronicsId const &eid) { return (uint32_t)(getValue_FiberCh(eid) + 1); }
uint32_t getBin_FEDuTCASlot(HcalElectronicsId const &eid) { return (uint32_t)(getValue_FEDuTCASlot(eid) + 1); }
uint32_t getBin_FEDVMESpigot(HcalElectronicsId const &eid) { return (uint32_t)(getValue_FEDVMESpigot(eid) + 1); }
uint32_t getBin_FiberuTCAFiberCh(HcalElectronicsId const &eid) {
return (uint32_t)(getValue_FiberuTCAFiberCh(eid) + 1);
}
uint32_t getBin_FiberVMEFiberCh(HcalElectronicsId const &eid) {
return (uint32_t)(getValue_FiberVMEFiberCh(eid) + 1);
}
uint32_t getBin_SLB(HcalElectronicsId const &eid) { return (uint32_t)(getValue_SLB(eid) + 1); }
uint32_t getBin_SLBCh(HcalElectronicsId const &eid) { return (uint32_t)(getValue_SLBCh(eid) + 1); }
uint32_t getBin_SLBSLBCh(HcalElectronicsId const &eid) { return (uint32_t)(getValue_SLBSLBCh(eid) + 1); }
uint32_t getBin_FiberuTCATP(HcalElectronicsId const &eid) { return (uint32_t)(getValue_FiberuTCATP(eid) + 1); }
uint32_t getBin_FiberChuTCATP(HcalElectronicsId const &eid) { return (uint32_t)(getValue_FiberChuTCATP(eid) + 1); }
uint32_t getBin_FiberuTCATPFiberChuTCATP(HcalElectronicsId const &eid) {
return (uint32_t)(getValue_FiberuTCATPFiberChuTCATP(eid) + 1);
}
HcalElectronicsId getEid_FED(int v) {
return v < FED_VME_NUM ? HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, v)
: HcalElectronicsId(utilities::fed2crate(v - FED_VME_NUM + 1100).first,
utilities::fed2crate(v - FED_VME_NUM + 1100).second,
FIBER_uTCA_MIN1,
FIBERCH_MIN,
false);
}
HcalElectronicsId getEid_FEDVME(int v) { return HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, v); }
HcalElectronicsId getEid_FEDuTCA(int v) {
return HcalElectronicsId(utilities::fed2crate(v + 1100).first,
utilities::fed2crate(v - FED_VME_NUM + 1100).second,
FIBER_uTCA_MIN1,
FIBERCH_MIN,
false);
}
HcalElectronicsId getEid_Crate(int v) {
return v < CRATE_VME_NUM
? HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, v)
: HcalElectronicsId(
v - CRATE_VME_NUM + CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false);
}
HcalElectronicsId getEid_CrateVME(int v) { return HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, v); }
HcalElectronicsId getEid_CrateuTCA(int v) {
return HcalElectronicsId(v + CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false);
}
HcalElectronicsId getEid_SlotuTCA(int v) {
return HcalElectronicsId(CRATE_uTCA_MIN, v + SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false);
}
// nothing for now...
HcalElectronicsId getEid_SlotVME(int v) {
return HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN);
}
HcalElectronicsId getEid_Spigot(int v) { return HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, v, CRATE_VME_MIN); }
HcalElectronicsId getEid_FiberuTCA(int v) {
return HcalElectronicsId(CRATE_uTCA_MIN,
SLOT_uTCA_MIN,
v < (FIBER_uTCA_MAX1 - FIBER_uTCA_MIN1 + 1)
? v + FIBER_uTCA_MIN1
: v - (FIBER_uTCA_MAX1 - FIBER_uTCA_MIN1 + 1) + FIBER_uTCA_MIN2,
FIBERCH_MIN,
false);
}
HcalElectronicsId getEid_FiberVME(int v) {
return HcalElectronicsId(FIBERCH_MIN, v + 1, SPIGOT_MIN, CRATE_VME_MIN);
}
HcalElectronicsId getEid_FiberCh(int v) {
return HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, v, false);
}
HcalElectronicsId getEid_FEDuTCASlot(int v) {
HcalElectronicsId fedeid = getEid_FEDuTCA(v / SLOT_uTCA_NUM);
HcalElectronicsId sloteid = getEid_SlotuTCA(v % SLOT_uTCA_NUM);
return HcalElectronicsId(fedeid.crateId(), sloteid.slot(), FIBER_uTCA_MIN1, FIBERCH_MIN, false);
}
HcalElectronicsId getEid_FEDVMESpigot(int v) {
HcalElectronicsId fedeid = getEid_FEDVME(v / SPIGOT_NUM);
HcalElectronicsId spid = getEid_Spigot(v % SPIGOT_NUM);
return HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, spid.spigot(), fedeid.dccid());
}
HcalElectronicsId getEid_FiberuTCAFiberCh(int v) {
HcalElectronicsId fibereid = getEid_FiberuTCA(v / FIBERCH_NUM);
HcalElectronicsId fcheid = getEid_FiberCh(v % FIBERCH_NUM);
return HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, fibereid.fiberIndex(), fcheid.fiberChanId(), false);
}
HcalElectronicsId getEid_FiberVMEFiberCh(int v) {
HcalElectronicsId fibereid = getEid_FiberVME(v / FIBERCH_NUM);
HcalElectronicsId fcheid = getEid_FiberCh(v % FIBERCH_NUM);
return HcalElectronicsId(fcheid.fiberChanId(), fibereid.fiberIndex(), SPIGOT_MIN, CRATE_VME_MIN);
}
HcalElectronicsId getEid_SLB(int v) {
return HcalElectronicsId(SLBCH_MIN, v + SLB_MIN, SPIGOT_MIN, CRATE_VME_MIN, CRATE_VME_MIN, SLOT_VME_MIN1, 0);
}
HcalElectronicsId getEid_SLBCh(int v) {
return HcalElectronicsId(v + SLBCH_MIN, SLB_MIN, SPIGOT_MIN, CRATE_VME_MIN, CRATE_VME_MIN, SLOT_VME_MIN1, 0);
}
HcalElectronicsId getEid_SLBSLBCh(int v) {
HcalElectronicsId slbeid = getEid_SLB(v / SLBCH_NUM);
HcalElectronicsId slbcheid = getEid_SLBCh(v % SLBCH_NUM);
return HcalElectronicsId(slbcheid.slbChannelIndex(),
slbeid.slbSiteNumber(),
SPIGOT_MIN,
CRATE_VME_MIN,
CRATE_VME_MIN,
SLOT_VME_MIN1,
0);
}
HcalElectronicsId getEid_FiberuTCATP(int v) {
return HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, v + TPFIBER_MIN, TPFIBERCH_MIN, true);
}
HcalElectronicsId getEid_FiberChuTCATP(int v) {
return HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, TPFIBER_MIN, v + TPFIBERCH_MIN, true);
}
HcalElectronicsId getEid_FiberuTCATPFiberChuTCATP(int v) {
HcalElectronicsId fibeid = getEid_FiberuTCATP(v / TPFIBERCH_NUM);
HcalElectronicsId fibcheid = getEid_FiberChuTCATP(v % TPFIBERCH_NUM);
return HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, fibeid.fiberIndex(), fibcheid.fiberChanId(), true);
}
std::vector<std::string> getLabels_FED() {
std::vector<std::string> labels;
char name[12];
for (int i = 0; i < FED_TOTAL_NUM; i++) {
HcalElectronicsId eid = getEid_FED(i);
sprintf(name, "%d", eid.isVMEid() ? eid.dccid() + 700 : utilities::crate2fed(eid.crateId(), eid.slot()));
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FEDuTCA() {
std::vector<std::string> labels;
char name[12];
for (int i = 0; i < FED_uTCA_NUM; i++) {
HcalElectronicsId eid = getEid_FEDuTCA(i);
sprintf(name, "%d", utilities::crate2fed(eid.crateId(), eid.slot()));
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FEDVME() {
std::vector<std::string> labels;
char name[12];
for (int i = 0; i < FED_VME_NUM; i++) {
sprintf(name, "%d", getEid_FEDVME(i).dccid() + 700);
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_Crate() {
std::vector<std::string> labels;
char name[10];
for (auto &it_crate : hcaldqm::constants::crateList) {
HcalElectronicsId eid = getEid_Crate(it_crate);
sprintf(name, "%d%c", it_crate, eid.isVMEid() ? 'v' : 'u');
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_CrateVME() {
std::vector<std::string> labels;
char name[10];
for (auto &it_crate : hcaldqm::constants::crateListVME) {
sprintf(name, "%dv", it_crate);
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_CrateuTCA() {
std::vector<std::string> labels;
char name[10];
for (auto &it_crate : hcaldqm::constants::crateListuTCA) {
sprintf(name, "%du", it_crate);
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_SlotuTCA() {
std::vector<std::string> labels;
char name[10];
for (int i = 0; i < SLOT_uTCA_NUM; i++) {
HcalElectronicsId eid = getEid_SlotuTCA(i);
sprintf(name, "%d", eid.slot());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_SlotVME() { return std::vector<std::string>(); }
std::vector<std::string> getLabels_Spigot() {
return std::vector<std::string>();
/* std::vector<std::string> labels;
char name[10];
for (int i=0; i<SPIGOT_NUM; i++)
{
HcalElectronicsId eid = getEid_Spigot(i);
sprintf(name, "%d",
eid.spigot());
labels.push_back(std::string(name));
}
return labels;
*/
}
std::vector<std::string> getLabels_FiberuTCA() {
std::vector<std::string> labels;
char name[10];
for (int i = 0; i < FIBER_uTCA_NUM; i++) {
HcalElectronicsId eid = getEid_FiberuTCA(i);
sprintf(name, "%d", eid.fiberIndex());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FiberVME() {
std::vector<std::string> labels;
char name[10];
for (int i = 0; i < FIBER_VME_NUM; i++) {
HcalElectronicsId eid = getEid_FiberVME(i);
sprintf(name, "%d", eid.fiberIndex());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FiberCh() {
std::vector<std::string> labels;
char name[10];
for (int i = 0; i < FIBERCH_NUM; i++) {
HcalElectronicsId eid = getEid_FiberCh(i);
sprintf(name, "%d", eid.fiberChanId());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FEDuTCASlot() {
std::vector<std::string> labels;
char name[10];
for (int i = 0; i < FED_uTCA_NUM; i++)
for (int j = 0; j < SLOT_uTCA_NUM; j++) {
if (j > 0) {
labels.push_back(std::string(""));
continue;
}
HcalElectronicsId eid = getEid_FEDuTCASlot(i * SLOT_uTCA_NUM + j);
sprintf(name, "%d-%d", utilities::crate2fed(eid.crateId(), eid.slot()), eid.slot());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FEDVMESpigot() {
std::vector<std::string> labels;
char name[23];
for (int i = 0; i < FED_VME_NUM; i++)
for (int j = 0; j < SPIGOT_NUM; j++) {
if (j > 0) {
labels.push_back(std::string(""));
continue;
}
HcalElectronicsId eid = getEid_FEDVMESpigot(i * SPIGOT_NUM + j);
sprintf(name, "%d-%d", eid.dccid() + FED_VME_MIN, eid.spigot());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FiberuTCAFiberCh() {
std::vector<std::string> labels;
char name[23];
for (int i = 0; i < FIBER_uTCA_NUM; i++)
for (int j = 0; j < FIBERCH_NUM; j++) {
if (j > 0) {
labels.push_back(std::string(""));
continue;
}
HcalElectronicsId eid = getEid_FiberuTCAFiberCh(i * FIBERCH_NUM + j);
sprintf(name, "%d-%d", eid.fiberIndex(), eid.fiberChanId());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FiberVMEFiberCh() {
std::vector<std::string> labels;
char name[23];
for (int i = 0; i < FIBER_VME_NUM; i++)
for (int j = 0; j < FIBERCH_NUM; j++) {
if (j > 0) {
labels.push_back(std::string(""));
continue;
}
HcalElectronicsId eid = getEid_FiberVMEFiberCh(i * FIBERCH_NUM + j);
sprintf(name, "%d-%d", eid.fiberIndex(), eid.fiberChanId());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_SLB() {
std::vector<std::string> labels;
char name[23];
for (int i = 0; i < SLB_NUM; i++) {
HcalElectronicsId eid = getEid_SLB(i);
sprintf(name, "%d", eid.slbSiteNumber());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_SLBCh() {
std::vector<std::string> labels;
char name[23];
for (int i = 0; i < SLBCH_NUM; i++) {
HcalElectronicsId eid = getEid_SLBCh(i);
sprintf(name, "%d", eid.slbChannelIndex());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_SLBSLBCh() {
std::vector<std::string> labels;
char name[23];
for (int i = 0; i < SLB_NUM; i++)
for (int j = 0; j < SLBCH_NUM; j++) {
HcalElectronicsId eid = getEid_SLBSLBCh(i * SLBCH_NUM + j);
sprintf(name, "%d-%d", eid.slbSiteNumber(), eid.slbChannelIndex());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FiberuTCATP() {
std::vector<std::string> labels;
char name[23];
for (int i = 0; i < TPFIBER_NUM; i++) {
HcalElectronicsId eid = getEid_FiberuTCATP(i);
sprintf(name, "%d", eid.fiberIndex());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FiberChuTCATP() {
std::vector<std::string> labels;
char name[23];
for (int i = 0; i < TPFIBERCH_NUM; i++) {
HcalElectronicsId eid = getEid_FiberChuTCATP(i);
sprintf(name, "%d", eid.fiberChanId());
labels.push_back(std::string(name));
}
return labels;
}
std::vector<std::string> getLabels_FiberuTCATPFiberChuTCATP() {
std::vector<std::string> labels;
char name[10];
for (int i = 0; i < TPFIBER_NUM; i++)
for (int j = 0; j < TPFIBERCH_NUM; j++) {
HcalElectronicsId eid = getEid_FiberuTCATPFiberChuTCATP(i * TPFIBERCH_NUM + j);
sprintf(name, "%d-%d", eid.fiberIndex(), eid.fiberChanId());
labels.push_back(std::string(name));
}
return labels;
}
void FEDQuantity::setup(std::vector<int> const &vFEDs) {
for (uint32_t i = 0; i < vFEDs.size(); i++)
_feds.insert(std::make_pair(vFEDs[i], i));
}
int FEDQuantity::getValue(HcalElectronicsId const &eid) {
int fed = eid.isVMEid() ? eid.dccid() + FED_VME_MIN : utilities::crate2fed(eid.crateId(), eid.slot());
return _feds[fed];
}
uint32_t FEDQuantity::getBin(HcalElectronicsId const &eid) { return getValue(eid) + 1; }
std::vector<std::string> FEDQuantity::getLabels() {
std::vector<std::string> labels(_feds.size());
char name[5];
for (auto const &v : _feds) {
sprintf(name, "%d", v.first);
labels[v.second] = std::string(name);
}
return labels;
}
void CrateQuantity::setup(HcalElectronicsMap const *emap) {
_crates = utilities::getCrateList(emap);
_crateHashes = utilities::getCrateHashMap(emap);
}
void CrateQuantity::setup(std::vector<int> crates, std::map<int, uint32_t> crateHashes) {
for (auto &it_crate : crates) {
_crates.push_back(it_crate);
_crateHashes[it_crate] = crateHashes[it_crate];
}
}
int CrateQuantity::getValue(HcalElectronicsId const &eid) { return eid.crateId(); }
uint32_t CrateQuantity::getBin(HcalElectronicsId const &eid) {
int crate = eid.crateId();
auto it = std::find(_crates.begin(), _crates.end(), crate);
if (it == _crates.end()) {
return 0;
} else {
return std::distance(_crates.begin(), it) + 1;
}
}
std::vector<std::string> CrateQuantity::getLabels() {
std::vector<std::string> labels;
char name[5];
for (auto &it_crate : _crates) {
HcalElectronicsId eid(_crateHashes[it_crate]);
if (eid.isVMEid()) {
sprintf(name, "%dv", it_crate);
} else {
sprintf(name, "%du", it_crate);
}
labels.push_back(name);
}
return labels;
}
} // namespace quantity
} // namespace hcaldqm
|