Project
Loading...
Searching...
No Matches
RecEventFlat.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include "TString.h"
13#include "Framework/Logger.h"
15
16using namespace o2::zdc;
17
18std::array<float, NChannels> RecEventScale::fe = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
19std::array<float, NTDCChannels> RecEventScale::fa = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
20
22{
23 for (int ich = 0; ich < NChannels; ich++) {
24 fe[ich] = 1;
25 }
26 for (int itdc = 0; itdc < NTDCChannels; itdc++) {
27 fa[itdc] = 1;
28 }
29}
30
32{
33 for (int ich = 0; ich < NChannels; ich++) {
34 fe[ich] = 1;
35 }
36 for (int itdc = 0; itdc < NTDCChannels; itdc++) {
37 fa[itdc] = 1000.;
38 }
39}
40
42{
43 for (int ich = IdZNAC; ich <= IdZNASum; ich++) {
44 fe[ich] = 1;
45 }
46 for (int ich = IdZNCC; ich <= IdZNCSum; ich++) {
47 fe[ich] = 1;
48 }
49 fa[TDCZNAC] = 1000.;
50 fa[TDCZNAS] = 1000.;
51 fa[TDCZNCC] = 1000.;
52 fa[TDCZNCS] = 1000.;
53}
54
56{
57 for (int ich = IdZPAC; ich <= IdZPASum; ich++) {
58 fe[ich] = 1;
59 }
60 for (int ich = IdZPCC; ich <= IdZPCSum; ich++) {
61 fe[ich] = 1;
62 }
63 fa[TDCZPAC] = 1000.;
64 fa[TDCZPAS] = 1000.;
65 fa[TDCZPCC] = 1000.;
66 fa[TDCZPCS] = 1000.;
67}
68
70{
71 for (int ich = 0; ich < NChannels; ich++) {
72 fe[ich] = 0.001;
73 }
74 for (int itdc = 0; itdc < NTDCChannels; itdc++) {
75 fa[itdc] = 1.;
76 }
77};
78
80{
81 for (int ich = IdZNAC; ich <= IdZNASum; ich++) {
82 fe[ich] = 0.001;
83 }
84 for (int ich = IdZNCC; ich <= IdZNCSum; ich++) {
85 fe[ich] = 0.001;
86 }
87 fa[TDCZNAC] = 1.;
88 fa[TDCZNAS] = 1.;
89 fa[TDCZNCC] = 1.;
90 fa[TDCZNCS] = 1.;
91};
92
94{
95 for (int ich = IdZPAC; ich <= IdZPASum; ich++) {
96 fe[ich] = 0.001;
97 }
98 for (int ich = IdZPCC; ich <= IdZPCSum; ich++) {
99 fe[ich] = 0.001;
100 }
101 fa[TDCZPAC] = 1.;
102 fa[TDCZPAS] = 1.;
103 fa[TDCZPCC] = 1.;
104 fa[TDCZPCS] = 1.;
105};
106
108{ // In GeV
109 for (int ich = 0; ich < NChannels; ich++) {
110 fe[ich] = 1. / energy;
111 }
112 for (int itdc = 0; itdc < NTDCChannels; itdc++) {
113 fa[itdc] = 1000. / energy;
114 }
115};
116
118{ // In GeV
119 for (int ich = IdZNAC; ich <= IdZNASum; ich++) {
120 fe[ich] = 1. / energy;
121 }
122 for (int ich = IdZNCC; ich <= IdZNCSum; ich++) {
123 fe[ich] = 1. / energy;
124 }
125 fa[TDCZNAC] = 1000. / energy;
126 fa[TDCZNAS] = 1000. / energy;
127 fa[TDCZNCC] = 1000. / energy;
128 fa[TDCZNCS] = 1000. / energy;
129};
130
132{ // In GeV
133 for (int ich = IdZPAC; ich <= IdZPASum; ich++) {
134 fe[ich] = 1. / energy;
135 }
136 for (int ich = IdZPCC; ich <= IdZPCSum; ich++) {
137 fe[ich] = 1. / energy;
138 }
139 fa[TDCZPAC] = 1000. / energy;
140 fa[TDCZPAS] = 1000. / energy;
141 fa[TDCZPCC] = 1000. / energy;
142 fa[TDCZPCS] = 1000. / energy;
143};
144
145void RecEventFlat::init(const std::vector<o2::zdc::BCRecData>* RecBC, const std::vector<o2::zdc::ZDCEnergy>* Energy, const std::vector<o2::zdc::ZDCTDCData>* TDCData, const std::vector<uint16_t>* Info)
146{
147 mRecBC = *RecBC;
148 mEnergy = *Energy;
149 mTDCData = *TDCData;
150 mInfo = *Info;
151 mEntry = 0;
152 mNEntries = mRecBC.size();
153}
154
155void RecEventFlat::init(const gsl::span<const o2::zdc::BCRecData> RecBC, const gsl::span<const o2::zdc::ZDCEnergy> Energy, const gsl::span<const o2::zdc::ZDCTDCData> TDCData, const gsl::span<const uint16_t> Info)
156{
157 mRecBC = RecBC;
158 mEnergy = Energy;
159 mTDCData = TDCData;
160 mInfo = Info;
161 mEntry = 0;
162 mNEntries = mRecBC.size();
163}
164
166{
167 genericE.fill(false);
168 tdcPedEv.fill(false);
169 tdcPedOr.fill(false);
170 tdcPedQC.fill(false);
171 tdcPedMissing.fill(false);
172 adcPedEv.fill(false);
173 adcPedOr.fill(false);
174 adcPedQC.fill(false);
175 adcPedMissing.fill(false);
176 adcMissingwTDC.fill(false);
177 offPed.fill(false);
178 pilePed.fill(false);
179 pileTM.fill(false);
180 tdcPileEvC.fill(false);
181 tdcPileEvE.fill(false);
182 tdcPileM1C.fill(false);
183 tdcPileM1E.fill(false);
184 tdcPileM2C.fill(false);
185 tdcPileM2E.fill(false);
186 tdcPileM3C.fill(false);
187 tdcPileM3E.fill(false);
188 // End_of_messages
189 // Other bitmaps
190 isBeg.fill(false);
191 isEnd.fill(false);
192 mComputed.fill(false);
193}
194
196{
197 return at(mEntry);
198}
199
200int RecEventFlat::at(int ientry)
201{
202 mEntry = ientry;
203 ezdcDecoded = 0;
204 if (mEntry >= mNEntries) {
205 return 0;
206 }
207 // Reconstruction messages
208 clearBitmaps();
209 // Channel data
210 ezdc.clear();
211 for (int itdc = 0; itdc < NTDCChannels; itdc++) {
212 TDCVal[itdc].clear();
213 TDCAmp[itdc].clear();
214 }
215
216 // Get References
219 mStopE = mFirstE + mNE;
220 mStopT = mFirstT + mNT;
221 mStopI = mFirstI + mNI;
222
223 ir = mCurB.ir;
226
227 // Decode event info
228 mDecodedInfo.clear();
229 int infoState = 0;
230 uint16_t code = 0;
231 uint32_t map = 0;
232 for (int i = mFirstI; i < mStopI; i++) {
233 uint16_t info = mInfo[i];
234 if (infoState == 0) {
235 if (info & 0x8000) {
236 LOGF(error, "Inconsistent info stream at word %d: 0x%4u", i, info);
237 break;
238 }
239 code = info & 0x03ff;
240 uint8_t ch = (info >> 10) & 0x1f;
241 if (ch == 0x1f) {
242 infoState = 1;
243 } else if (ch < NChannels) {
244 decodeInfo(ch, code);
245 } else {
246 LOGF(error, "Info about non existing channel: %u", ch);
247 }
248 } else if (infoState == 1) {
249 if (info & 0x8000) {
250 map = info & 0x7fff;
251 } else {
252 LOGF(error, "Inconsistent info stream at word %d: 0x%4u", i, info);
253 break;
254 }
255 infoState = 2;
256 } else if (infoState == 2) {
257 if (info & 0x8000) {
258 uint32_t maph = info & 0x7fff;
259 map = (maph << 15) | map;
260 decodeMapInfo(map, code);
261 } else {
262 LOGF(error, "Inconsistent info stream at word %d: 0x%4u", i, info);
263 break;
264 }
265 infoState = 0;
266 }
267 }
268
269 // Decode energy
270 for (int i = mFirstE; i < mStopE; i++) {
271 auto myenergy = mEnergy[i];
272 auto ch = myenergy.ch();
273 ezdc[ch] = myenergy.energy() * RecEventScale::fe[ch];
274 // Assign implicit event info
275 if (adcPedOr[ch] == false && adcPedQC[ch] == false && adcPedMissing[ch] == false) {
276 adcPedEv[ch] = true;
277 }
278 ezdcDecoded |= (0x1 << ch);
279 }
280
281 // Decode TDCs
282 for (int i = mFirstT; i < mStopT; i++) {
283 auto mytdc = mTDCData[i];
284 auto ch = mytdc.ch();
285 if (ch < NTDCChannels) {
286 if (mytdc.isBeg()) {
287 isBeg[ch] = true;
288 }
289 if (mytdc.isEnd()) {
290 isEnd[ch] = true;
291 }
292 TDCVal[ch].push_back(mytdc.val);
293 TDCAmp[ch].push_back(mytdc.amp * RecEventScale::fa[ch]);
294 // Assign implicit event info
295 if (tdcPedQC[ch] == false && tdcPedMissing[ch] == false) {
296 tdcPedOr[ch] = true;
297 }
298 }
299 }
300
301 mEntry++;
302 return mEntry;
303}
304
305void RecEventFlat::decodeMapInfo(uint32_t map, uint16_t code)
306{
307#ifdef O2_ZDC_DEBUG
308 printf("decodeMapInfo%08x code=%u\n", map, code);
309#endif
310 for (uint8_t ch = 0; ch < NChannels; ch++) {
311 if (map & (0x1 << ch)) {
312 decodeInfo(ch, code);
313 }
314 }
315}
316
317void RecEventFlat::decodeInfo(uint8_t ch, uint16_t code)
318{
319 if (mVerbosity != DbgZero) {
320 printf("%9u.%04u Info: ch=%2d (%s) code=%-4u (%s)\n", ir.orbit, ir.bc, ch, ch < NChannels ? ChannelNames[ch].data() : "N.D.",
321 code, code < MsgEnd ? MsgText[code].data() : "undefined");
322 }
323 // Reconstruction messages
324 switch (code) {
325 case MsgGeneric:
326 genericE[ch] = true;
327 break;
328 case MsgTDCPedQC:
329 tdcPedQC[ch] = true;
330 break;
331 case MsgTDCPedMissing:
332 tdcPedMissing[ch] = true;
333 break;
334 case MsgADCPedOr:
335 adcPedOr[ch] = true;
336 break;
337 case MsgADCPedQC:
338 adcPedQC[ch] = true;
339 break;
340 case MsgADCPedMissing:
341 adcPedMissing[ch] = true;
342 break;
343 case MsgOffPed:
344 offPed[ch] = true;
345 break;
346 case MsgPilePed:
347 pilePed[ch] = true;
348 break;
349 case MsgPileTM:
350 pileTM[ch] = true;
351 break;
353 adcMissingwTDC[ch] = true;
354 break;
355 case MsgTDCPileEvC:
356 tdcPileEvC[ch] = true;
357 break;
358 case MsgTDCPileEvE:
359 tdcPileEvE[ch] = true;
360 break;
361 case MsgTDCPileM1C:
362 tdcPileM1C[ch] = true;
363 break;
364 case MsgTDCPileM1E:
365 tdcPileM1E[ch] = true;
366 break;
367 case MsgTDCPileM2C:
368 tdcPileM2C[ch] = true;
369 break;
370 case MsgTDCPileM2E:
371 tdcPileM2E[ch] = true;
372 break;
373 case MsgTDCPileM3C:
374 tdcPileM3C[ch] = true;
375 break;
376 case MsgTDCPileM3E:
377 tdcPileM3E[ch] = true;
378 break;
379 case MsgTDCSigE:
380 tdcSigE[ch] = true;
381 break;
382 // End_of_messages
383 default:
384 LOG(error) << "Not managed info code: " << code;
385 return;
386 }
387 mDecodedInfo.emplace_back((code & 0x03ff) | ((ch & 0x1f) << 10));
388}
389
390void RecEventFlat::centroidZNA(float& x, float& y)
391{
392 // Coordinates of tower centers, looking from IP
393 const static float xc[4] = {-1.75, 1.75, -1.75, 1.75};
394 const static float yc[4] = {-1.75, -1.75, 1.75, 1.75};
395 static float c[2] = {0};
396 if (mComputed[0]) {
397 x = c[0];
398 y = c[1];
399 return;
400 }
401 mComputed[0] = true;
402 float e[4], w[4];
403 e[0] = EZDC(IdZNA1);
404 e[1] = EZDC(IdZNA2);
405 e[2] = EZDC(IdZNA3);
406 e[3] = EZDC(IdZNA4);
407 if (e[0] < -1000000 || e[1] < -1000000 || e[2] < -1000000 || e[3] < -1000000) {
408 c[0] = -std::numeric_limits<float>::infinity();
409 c[1] = -std::numeric_limits<float>::infinity();
410 x = c[0];
411 y = c[1];
412 return;
413 }
414 float sumw = 0;
415 c[0] = 0;
416 c[1] = 0;
417 for (int i = 0; i < 4; i++) {
418 if (e[i] < 0) {
419 e[i] = 0;
420 }
421 w[i] = std::sqrt(e[i]);
422 sumw += w[i];
423 c[0] += w[i] * xc[i];
424 c[1] += w[i] * yc[i];
425 }
426 if (sumw <= 0) {
427 c[0] = -std::numeric_limits<float>::infinity();
428 c[1] = -std::numeric_limits<float>::infinity();
429 } else {
430 c[0] /= sumw;
431 c[1] /= sumw;
432 }
433 x = c[0];
434 y = c[1];
435 return;
436}
437
438void RecEventFlat::centroidZNC(float& x, float& y)
439{
440 // Coordinates of tower centers, looking from IP
441 const static float xc[4] = {-1.75, 1.75, -1.75, 1.75};
442 const static float yc[4] = {-1.75, -1.75, 1.75, 1.75};
443 static float c[2] = {0};
444 if (mComputed[1]) {
445 x = c[0];
446 y = c[1];
447 return;
448 }
449 mComputed[1] = true;
450 float e[4], w[4];
451 e[0] = EZDC(IdZNC1);
452 e[1] = EZDC(IdZNC2);
453 e[2] = EZDC(IdZNC3);
454 e[3] = EZDC(IdZNC4);
455 if (e[0] < -1000000 || e[1] < -1000000 || e[2] < -1000000 || e[3] < -1000000) {
456 c[0] = -std::numeric_limits<float>::infinity();
457 c[1] = -std::numeric_limits<float>::infinity();
458 x = c[0];
459 y = c[1];
460 return;
461 }
462 float sumw = 0;
463 c[0] = 0;
464 c[1] = 0;
465 for (int i = 0; i < 4; i++) {
466 if (e[i] < 0) {
467 e[i] = 0;
468 }
469 w[i] = std::sqrt(e[i]);
470 sumw += w[i];
471 c[0] += w[i] * xc[i];
472 c[1] += w[i] * yc[i];
473 }
474 if (sumw <= 0) {
475 c[0] = -std::numeric_limits<float>::infinity();
476 c[1] = -std::numeric_limits<float>::infinity();
477 } else {
478 c[0] /= sumw;
479 c[1] /= sumw;
480 }
481 x = c[0];
482 y = c[1];
483 return;
484}
485
487{
488 float x, y;
489 centroidZNA(x, y);
490 return x;
491}
492
494{
495 float x, y;
496 centroidZNA(x, y);
497 return y;
498}
499
501{
502 float x, y;
503 centroidZNC(x, y);
504 return x;
505}
506
508{
509 float x, y;
510 centroidZNC(x, y);
511 return x;
512}
513
515{
516 float x, rms;
517 centroidZPA(x, rms);
518 return x;
519}
520
522{
523 float x, rms;
524 centroidZPC(x, rms);
525 return x;
526}
527
529{
530 float x, rms;
531 centroidZPA(x, rms);
532 return rms;
533}
534
536{
537 float x, rms;
538 centroidZPC(x, rms);
539 return rms;
540}
541
542void RecEventFlat::centroidZPA(float& x, float& rms)
543{
544 // x coordinates of tower centers
545 // Negative because ZPA calorimeter is on the left of ZNA when looking from IP
546 // rms can result from 0 to sqrt((2.8^2+19.6^2)/2-((2.6+19.4)/2)^2) = 8.66
547 const static float xc[4] = {-19.6, -14.0, -8.4, -2.8};
548 const static float xq[4] = {19.6 * 19.6, 14.0 * 14.0, 8.4 * 8.4, 2.8 * 2.8};
549 static float c = 0;
550 static float d = 0;
551 if (mComputed[2] == true) {
552 x = c;
553 rms = d;
554 }
555 mComputed[2] = true;
556 float e[4], w[4];
557 e[0] = EZDC(IdZPA1);
558 e[1] = EZDC(IdZPA2);
559 e[2] = EZDC(IdZPA3);
560 e[3] = EZDC(IdZPA4);
561 if (e[0] < -1000000 || e[1] < -1000000 || e[2] < -1000000 || e[3] < -1000000) {
562 c = -std::numeric_limits<float>::infinity();
563 d = -std::numeric_limits<float>::infinity();
564 x = c;
565 rms = d;
566 return;
567 }
568 float sumw = 0;
569 c = 0;
570 d = 0;
571 for (int i = 0; i < 4; i++) {
572 if (e[i] < 0) {
573 w[i] = 0;
574 } else {
575 // w[i] = std::sqrt(e[i]);
576 w[i] = e[i];
577 }
578 sumw += w[i];
579 c = c + w[i] * xc[i];
580 d = d + w[i] * xq[i];
581 }
582 if (sumw <= 0) {
583 c = -std::numeric_limits<float>::infinity();
584 d = -std::numeric_limits<float>::infinity();
585 } else {
586 c = c / sumw;
587 d = d / sumw;
588 d = d - c * c; // variance
589 if (d >= 0) {
590 d = TMath::Sqrt(d);
591 } else {
592 LOGF(warn, "%s FOP exception @ %d", __FILE__, __LINE__);
593 d = -std::numeric_limits<float>::infinity();
594 }
595 }
596 x = c;
597 rms = d;
598 return;
599}
600
601void RecEventFlat::centroidZPC(float& x, float& rms)
602{
603 // x coordinates of tower centers
604 // Positive because ZPC calorimeter is on the right of ZNC when looking from IP
605 // x can result in a value from 2.8 to 19.6
606 const static float xc[4] = {2.8, 8.4, 14.0, 19.6};
607 const static float xq[4] = {2.8 * 2.8, 8.4 * 8.4, 14.0 * 14.0, 19.6 * 19.6};
608 static float c = 0;
609 static float d = 0;
610 if (mComputed[3]) {
611 x = c;
612 rms = d;
613 }
614 mComputed[3] = true;
615 float e[4], w[4];
616 e[0] = EZDC(IdZPC1);
617 e[1] = EZDC(IdZPC2);
618 e[2] = EZDC(IdZPC3);
619 e[3] = EZDC(IdZPC4);
620 if (e[0] < -1000000 || e[1] < -1000000 || e[2] < -1000000 || e[3] < -1000000) {
621 c = -std::numeric_limits<float>::infinity();
622 d = -std::numeric_limits<float>::infinity();
623 x = c;
624 rms = d;
625 return;
626 }
627 float sumw = 0;
628 c = 0;
629 d = 0;
630 for (int i = 0; i < 4; i++) {
631 if (e[i] < 0) {
632 w[i] = 0;
633 } else {
634 // w[i] = std::sqrt(e[i]);
635 w[i] = e[i];
636 }
637 sumw += w[i];
638 c += w[i] * xc[i];
639 d += w[i] * xq[i];
640 }
641 if (sumw <= 0) {
642 c = -std::numeric_limits<float>::infinity();
643 d = -std::numeric_limits<float>::infinity();
644 } else {
645 c /= sumw;
646 d /= sumw;
647 d = d - c * c; // variance
648 if (d >= 0) {
649 d = TMath::Sqrt(d);
650 } else {
651 LOGF(warn, "%s FOP exception @ %d", __FILE__, __LINE__);
652 d = -std::numeric_limits<float>::infinity();
653 }
654 }
655 x = c;
656 rms = d;
657 return;
658}
659
661{
662 printf("%9u.%04u ", ir.orbit, ir.bc);
663 printf("nE %2d pos %d nT %2d pos %d nI %2d pos %d\n", mNE, mFirstE, mNT, mFirstT, mNI, mFirstI);
664 printf("%9u.%04u ", ir.orbit, ir.bc);
665 printf("Read:");
666 for (int ic = 0; ic < NDigiChannels; ic++) {
667 if (ic % NChPerModule == 0) {
668 if (ic == 0) {
669 printf(" %d[", ic / NChPerModule);
670 } else {
671 printf("] %d[", ic / NChPerModule);
672 }
673 }
674 if (channels & (0x1 << ic)) {
675 printf("R");
676 } else {
677 printf(" ");
678 }
679 }
680 printf("]\n");
681 printf("%9u.%04u ", ir.orbit, ir.bc);
682 printf("Hits:");
683 for (int ic = 0; ic < NDigiChannels; ic++) {
684 if (ic % NChPerModule == 0) {
685 if (ic == 0) {
686 printf(" %d[", ic / NChPerModule);
687 } else {
688 printf("] %d[", ic / NChPerModule);
689 }
690 }
691 bool is_hit = triggers & (0x1 << ic);
692 bool is_trig = mTriggerMask & (0x1 << ic);
693 if (is_trig) {
694 if (is_hit) {
695 printf("T");
696 } else {
697 printf(".");
698 }
699 } else {
700 if (is_hit) {
701 printf("H");
702 } else {
703 printf(" ");
704 }
705 }
706 }
707 printf("]\n");
708}
709
711{
712 const std::array<bool, NChannels>* maps[MsgEnd];
713 maps[0] = &genericE;
714 maps[1] = &tdcPedQC;
715 maps[2] = &tdcPedMissing;
716 maps[3] = &adcPedOr;
717 maps[4] = &adcPedQC;
718 maps[5] = &adcPedMissing;
719 maps[6] = &offPed;
720 maps[7] = &pilePed;
721 maps[8] = &pileTM;
722 maps[9] = &adcMissingwTDC;
723 maps[10] = &tdcPileEvC;
724 maps[11] = &tdcPileEvE;
725 maps[12] = &tdcPileM1C;
726 maps[13] = &tdcPileM1E;
727 maps[14] = &tdcPileM2C;
728 maps[15] = &tdcPileM2E;
729 maps[16] = &tdcPileM3C;
730 maps[17] = &tdcPileM3E;
731 maps[18] = &tdcSigE;
732 // End_of_messages
733
734 for (int32_t imsg = 0; imsg < MsgEnd; imsg++) {
735 TString msg = TString::Format("%-30s:", MsgText[imsg].data());
736 if (maps[imsg] == nullptr) {
737 continue;
738 }
739 bool found = false;
740 for (int32_t isig = 0; isig < NChannels; isig++) {
741 if (maps[imsg]->at(isig) == true) {
742 found = true;
743 msg += TString::Format(" %s", ChannelNames[isig].data());
744 } else {
745 msg += " ";
746 }
747 }
748 if (found) {
749 printf("%u.%04u Info %s\n", ir.orbit, ir.bc, msg.Data());
750 }
751 }
752}
753
755{
756 print();
757 if (getNInfo() > 0) {
759 }
760 if (getNEnergy() > 0 && mCurB.triggers == 0) {
761 printf("%9u.%04u Untriggered bunch\n", mCurB.ir.orbit, mCurB.ir.bc);
762 }
763 // TDC
764 for (int32_t itdc = 0; itdc < o2::zdc::NTDCChannels; itdc++) {
765 int ich = o2::zdc::TDCSignal[itdc];
766 int nhit = NtdcV(itdc);
767 if (NtdcA(itdc) != nhit) {
768 fprintf(stderr, "Mismatch in TDC %d data length Val=%d Amp=%d values\n", itdc, NtdcV(itdc), NtdcA(ich));
769 continue;
770 }
771 for (int32_t ipos = 0; ipos < nhit; ipos++) {
772 printf("%9u.%04u T %2d %s = %g @ %g \n", mCurB.ir.orbit, mCurB.ir.bc, ich, ChannelNames[ich].data(), TDCAmp[itdc][ipos], FTDCVal * TDCVal[itdc][ipos]);
773 }
774 }
775 // Energy
776 for (const auto& [ich, value] : ezdc) {
777 printf("%9u.%04u E %2d %s = %g\n", mCurB.ir.orbit, mCurB.ir.bc, ich, ChannelNames[ich].data(), value);
778 }
779}
int32_t i
uint32_t c
Definition RawData.h:2
Class to decode the reconstructed ZDC event (single BC with signal in one of detectors)
GLint GLenum GLint x
Definition glcorearb.h:403
GLint y
Definition glcorearb.h:270
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLboolean * data
Definition glcorearb.h:298
GLubyte GLubyte GLubyte GLubyte w
Definition glcorearb.h:852
constexpr int IdZNCSum
constexpr int IdZPC4
constexpr int IdZPA2
@ MsgPilePed
Definition Constants.h:247
@ MsgTDCPileM3E
Definition Constants.h:257
@ MsgTDCPileM2C
Definition Constants.h:254
@ MsgTDCPileEvC
Definition Constants.h:250
@ MsgTDCSigE
Definition Constants.h:258
@ MsgADCPedMissing
Definition Constants.h:245
@ MsgPileTM
Definition Constants.h:248
@ MsgADCPedOr
Definition Constants.h:243
@ MsgTDCPileM1C
Definition Constants.h:252
@ MsgTDCPileM1E
Definition Constants.h:253
@ MsgOffPed
Definition Constants.h:246
@ MsgADCPedQC
Definition Constants.h:244
@ MsgGeneric
Definition Constants.h:240
@ MsgTDCPedQC
Definition Constants.h:241
@ MsgTDCPedMissing
Definition Constants.h:242
@ MsgTDCPileM2E
Definition Constants.h:255
@ MsgTDCPileM3C
Definition Constants.h:256
@ MsgADCMissingwTDC
Definition Constants.h:249
@ MsgTDCPileEvE
Definition Constants.h:251
constexpr int IdZNA3
constexpr int IdZNA1
const int TDCSignal[NTDCChannels]
Definition Constants.h:181
constexpr int IdZPA1
constexpr int IdZPCSum
constexpr int IdZNC2
constexpr int NChPerModule
Definition Constants.h:69
constexpr int NTDCChannels
Definition Constants.h:90
constexpr int IdZNCC
constexpr int IdZPAC
constexpr int NChannels
Definition Constants.h:65
constexpr int IdZPC2
constexpr int IdZPA4
constexpr std::string_view MsgText[]
Definition Constants.h:262
constexpr int IdZNC1
constexpr int IdZNC3
constexpr int IdZPCC
constexpr int IdZPC1
constexpr int IdZPA3
constexpr int IdZNC4
constexpr int IdZNA2
constexpr int DbgZero
Definition Constants.h:207
constexpr int IdZNASum
constexpr int IdZPC3
constexpr int IdZNA4
constexpr int IdZNAC
constexpr std::string_view ChannelNames[]
Definition Constants.h:147
constexpr int IdZPASum
constexpr float FTDCVal
Definition Constants.h:103
constexpr int NDigiChannels
Definition Constants.h:71
uint32_t orbit
LHC orbit.
uint16_t bc
bunch crossing ID of interaction
uint32_t channels
Definition BCRecData.h:33
uint32_t triggers
Definition BCRecData.h:34
o2::InteractionRecord ir
Definition BCRecData.h:32
void getRef(int &firste, int &ne, int &firstt, int &nt, int &firsti, int &ni)
Definition BCRecData.h:94
void centroidZPA(float &x, float &rms)
uint64_t mEntry
Event quality information (decoded)
FirstEntry mStopT
Last + 1 energy.
std::array< bool, NChannels > tdcPileM1C
11 TDC in-bunch pile-up error
gsl::span< const o2::zdc::BCRecData > mRecBC
TDC pile-up correction flag (TODO)
std::array< bool, NChannels > isBeg
N info.
std::array< bool, NChannels > tdcSigE
17 TDC pile-up in bunch -3 error
std::array< bool, 4 > mComputed
Interpolated samples.
std::array< bool, NChannels > adcMissingwTDC
8 Pile-up detection from TM trigger bit
std::array< bool, NChannels > tdcPileM2E
14 TDC pile-up in bunch -2 corrected
std::array< bool, NChannels > tdcPedOr
– Event pedestal for TDC
std::array< bool, NChannels > adcPedQC
3 Orbit pedestal for ADC
gsl::span< const o2::zdc::ZDCTDCData > mTDCData
ZDC energy.
std::array< bool, NChannels > tdcPileM3E
16 TDC pile-up in bunch -3 corrected
std::array< bool, NChannels > tdcPileEvC
9 Missing ADC even if TDC is present
void decodeInfo(uint8_t ch, uint16_t code)
FirstEntry mFirstT
First energy.
int NtdcV(uint8_t ich) const
std::array< bool, NChannels > tdcPedMissing
1 QC pedestal for TDC
std::array< bool, NChannels > tdcPileM3C
15 TDC pile-up in bunch -2 error
void printDecodedMessages() const
std::vector< float > TDCVal[NTDCChannels]
signal in ZDCs
std::array< bool, NChannels > genericE
Centroid computed.
std::map< uint8_t, float > ezdc
pattern of channels with autotrigger bit
std::array< bool, NChannels > isEnd
Beginning of sequence.
BCRecData mCurB
End of sequence.
NElem mNT
N energy.
NElem getNEnergy() const
float EZDC(uint8_t ich) const
std::array< bool, NChannels > adcPedMissing
4 QC pedestal for ADC
void centroidZNC(float &x, float &y)
gsl::span< const o2::zdc::ZDCEnergy > mEnergy
Interaction record and references to data.
NElem mNE
Last + 1 info.
o2::InteractionRecord ir
uint32_t triggers
pattern of decoded energies
FirstEntry mFirstI
First TDC.
void clearBitmaps()
18 Missing TDC signal correction
int NtdcA(uint8_t ich) const
std::array< bool, NChannels > pilePed
6 Anomalous offset from pedestal info
uint32_t mTriggerMask
Verbosity level.
uint32_t ezdcDecoded
pattern of channels acquired
void init(const std::vector< o2::zdc::BCRecData > *RecBC, const std::vector< o2::zdc::ZDCEnergy > *Energy, const std::vector< o2::zdc::ZDCTDCData > *TDCData, const std::vector< uint16_t > *Info)
Trigger mask for printout.
std::array< bool, NChannels > tdcPedEv
0 Generic error
std::vector< uint16_t > mDecodedInfo
Event quality information.
gsl::span< const uint16_t > mInfo
ZDC TDC.
std::array< bool, NChannels > offPed
5 Missing pedestal for ADC
std::array< bool, NChannels > tdcPileEvE
10 TDC in-bunch pile-up corrected
std::array< bool, NChannels > tdcPileM1E
12 TDC pile-up in bunch -1 corrected
FirstEntry mStopI
Last + 1 TDC.
NElem getNInfo() const
std::array< bool, NChannels > pileTM
7 Pile-up detection from pedestal info
std::array< bool, NChannels > tdcPedQC
– Orbit pedestal for TDC
FirstEntry mStopE
First info.
uint64_t mNEntries
Current entry.
FirstEntry mFirstE
Number of entries.
std::array< bool, NChannels > adcPedEv
2 Missing pedestal for ADC
std::vector< float > TDCAmp[NTDCChannels]
TDC values.
std::array< bool, NChannels > adcPedOr
– Event pedestal for ADC
void centroidZNA(float &x, float &y)
void decodeMapInfo(uint32_t ch, uint16_t code)
void centroidZPC(float &x, float &rms)
std::array< bool, NChannels > tdcPileM2C
13 TDC pile-up in bunch -1 error
static void setNucleonEnergyZP(float energy)
static void setNucleonEnergy(float energy)
static std::array< float, NChannels > fe
static void setNucleonEnergyZN(float energy)
static std::array< float, NTDCChannels > fa
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
uint64_t const void const *restrict const msg
Definition x9.h:153