Project
Loading...
Searching...
No Matches
RecEvent.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
13
14using namespace o2::zdc;
15
16void RecEvent::print() const
17{
18 for (auto bcdata : mRecBC) {
19 bcdata.ir.print();
20 int fe, ne, ft, nt, fi, ni;
21 bcdata.getRef(fe, ne, ft, nt, fi, ni);
22 for (int ie = 0; ie < ne; ie++) {
23 mEnergy[fe + ie].print();
24 }
25 for (int it = 0; it < nt; it++) {
26 mTDCData[ft + it].print();
27 }
28 // TODO: event info
29 }
30}
31
32uint32_t RecEvent::addInfo(const RecEventAux& reca, const std::array<bool, NChannels>& vec, const uint16_t code)
33{
34 // Prepare list of channels interested by this message
35 int cnt = 0;
36 std::array<int, NChannels> active;
37 for (uint8_t ich = 0; ich < NChannels; ich++) {
38 if (vec[ich]) {
39 active[cnt] = ich;
40 cnt++;
41 }
42 }
43 if (cnt == 0) {
44 return cnt;
45 }
46 // Add bunch crossing info to current event if needed
47 if (mRecBC.size() == 0 || reca.ir != mRecBC.back().ir) {
48 addBC(reca);
49 }
50 if (cnt <= 3) {
51 // Transmission of single channels
52 for (uint8_t i = 0; i < cnt; i++) {
53 addInfo(active[i], code);
54 }
55 } else {
56 // Transmission of channel pattern
57 uint16_t ch = 0x1f;
58 addInfo(ch, code);
59 uint16_t info = 0x8000;
60 uint8_t i = 0;
61 for (; i < cnt && active[i] < 15; i++) {
62 info = info | (0x1 << active[i]);
63 }
64 addInfo(info);
65#ifdef O2_ZDC_DEBUG
66 if (info & 0x7fff) {
67 for (uint8_t ich = 0; ich < 15; ich++) {
68 if (vec[ich]) {
69 printf(" %s", ChannelNames[ich].data());
70 }
71 }
72 printf("\n");
73 }
74#endif
75 info = 0x8000;
76 for (; i < cnt; i++) {
77 info = info | (0x1 << (active[i] - 15));
78 }
79#ifdef O2_ZDC_DEBUG
80 if (info & 0x7fff) {
81 for (uint8_t ich = 15; ich < NChannels; ich++) {
82 if (vec[ich]) {
83 printf(" %s", ChannelNames[ich].data());
84 }
85 }
86 printf("\n");
87 }
88#endif
89 addInfo(info);
90 }
91 return cnt;
92}
93
94uint32_t RecEvent::addInfos(const RecEventAux& reca)
95{
96 // Reconstruction messages
97 uint32_t ninfo = 0;
98 ninfo += addInfo(reca, reca.genericE, MsgGeneric); // 0
99 ninfo += addInfo(reca, reca.tdcPedQC, MsgTDCPedQC); // 1
100 ninfo += addInfo(reca, reca.tdcPedMissing, MsgTDCPedMissing); // 2
101 ninfo += addInfo(reca, reca.adcPedOr, MsgADCPedOr); // 3
102 ninfo += addInfo(reca, reca.adcPedQC, MsgADCPedQC); // 4
103 ninfo += addInfo(reca, reca.adcPedMissing, MsgADCPedMissing); // 5
104 ninfo += addInfo(reca, reca.offPed, MsgOffPed); // 6
105 ninfo += addInfo(reca, reca.pilePed, MsgPilePed); // 7
106 ninfo += addInfo(reca, reca.pileTM, MsgPileTM); // 8
107 ninfo += addInfo(reca, reca.adcPedMissing, MsgADCMissingwTDC); // 9
108 ninfo += addInfo(reca, reca.tdcPileEvC, MsgTDCPileEvC); // 10
109 ninfo += addInfo(reca, reca.tdcPileEvE, MsgTDCPileEvE); // 11
110 ninfo += addInfo(reca, reca.tdcPileM1C, MsgTDCPileM1C); // 12
111 ninfo += addInfo(reca, reca.tdcPileM1E, MsgTDCPileM1E); // 13
112 ninfo += addInfo(reca, reca.tdcPileM2C, MsgTDCPileM2C); // 14
113 ninfo += addInfo(reca, reca.tdcPileM2E, MsgTDCPileM2E); // 15
114 ninfo += addInfo(reca, reca.tdcPileM3C, MsgTDCPileM3C); // 16
115 ninfo += addInfo(reca, reca.tdcPileM3E, MsgTDCPileM3E); // 17
116 ninfo += addInfo(reca, reca.tdcSigE, MsgTDCSigE); // 18
117 return ninfo;
118}
int32_t i
Class to describe reconstructed ZDC event (single BC with signal in one of detectors)
GLboolean * data
Definition glcorearb.h:298
@ 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 NChannels
Definition Constants.h:65
constexpr std::string_view ChannelNames[]
Definition Constants.h:147
std::array< bool, NChannels > tdcPileM1C
11 TDC in-bunch pile-up error
std::array< bool, NChannels > tdcSigE
17 TDC pile-up in bunch -3 error
std::array< bool, NChannels > tdcPileM2E
14 TDC pile-up in bunch -2 corrected
std::array< bool, NChannels > adcPedQC
3 Orbit pedestal for ADC
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
std::array< bool, NChannels > tdcPedMissing
1 QC pedestal for TDC
std::array< bool, NChannels > tdcPileM3C
15 TDC pile-up in bunch -2 error
std::array< bool, NChannels > genericE
Centroid computed.
std::array< bool, NChannels > adcPedMissing
4 QC pedestal for ADC
o2::InteractionRecord ir
std::array< bool, NChannels > pilePed
6 Anomalous offset from pedestal info
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
std::array< bool, NChannels > pileTM
7 Pile-up detection from pedestal info
std::array< bool, NChannels > tdcPedQC
– Orbit pedestal for TDC
std::array< bool, NChannels > adcPedOr
– Event pedestal for ADC
std::array< bool, NChannels > tdcPileM2C
13 TDC pile-up in bunch -1 error
uint32_t addInfos(const RecEventAux &reca)
Definition RecEvent.cxx:94
void addInfo(uint16_t info)
Definition RecEvent.h:86
void print() const
Definition RecEvent.cxx:16
std::vector< o2::zdc::ZDCEnergy > mEnergy
Interaction record and references to data.
Definition RecEvent.h:39
void addBC(const RecEventAux &reca)
ZDC waveform.
Definition RecEvent.h:45
std::vector< o2::zdc::BCRecData > mRecBC
Definition RecEvent.h:38
std::vector< o2::zdc::ZDCTDCData > mTDCData
ZDC energy.
Definition RecEvent.h:40
std::vector< o2::ctf::BufferType > vec