Project
Loading...
Searching...
No Matches
RecEventFlat.h
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#ifndef _ZDC_RECEVENTFLAT_H_
13#define _ZDC_RECEVENTFLAT_H_
14
20#include "ZDCBase/Constants.h"
21#include "MathUtils/Cartesian.h"
22#include <Rtypes.h>
23#include <gsl/span>
24#include <array>
25#include <vector>
26#include <map>
27#include <cmath>
28
32
33namespace o2
34{
35namespace zdc
36{
38using NElem = int;
39
41 static std::array<float, NChannels> fe;
42 static std::array<float, NTDCChannels> fa;
43 static void reset();
44 static void setGeV();
45 static void setGeVZN();
46 static void setGeVZP();
47 static void setTeV();
48 static void setTeVZN();
49 static void setTeVZP();
50 static void setNucleonEnergy(float energy);
51 static void setNucleonEnergyZN(float energy);
52 static void setNucleonEnergyZP(float energy);
53};
54
55struct RecEventFlat { // NOLINT: false positive in clang-tidy !!
57 uint32_t channels = 0;
58 uint32_t ezdcDecoded = 0;
59 uint32_t triggers = 0;
60 std::map<uint8_t, float> ezdc;
61 std::vector<float> TDCVal[NTDCChannels];
62 std::vector<float> TDCAmp[NTDCChannels];
63 std::vector<bool> TDCPile[NTDCChannels];
64 gsl::span<const o2::zdc::BCRecData> mRecBC;
65 gsl::span<const o2::zdc::ZDCEnergy> mEnergy;
66 gsl::span<const o2::zdc::ZDCTDCData> mTDCData;
67 gsl::span<const uint16_t> mInfo;
68 std::vector<uint16_t> mDecodedInfo;
69 uint64_t mEntry = 0;
70 uint64_t mNEntries = 0;
77 NElem mNE = 0;
78 NElem mNT = 0;
79 NElem mNI = 0;
80 std::array<bool, NChannels> isBeg{};
81 std::array<bool, NChannels> isEnd{};
83 std::vector<float> inter[NChannels];
84 std::array<bool, 4> mComputed{};
85
86 // Reconstruction messages
87 std::array<bool, NChannels> genericE{};
88 std::array<bool, NChannels> tdcPedEv{};
89 std::array<bool, NChannels> tdcPedOr{};
90 std::array<bool, NChannels> tdcPedQC{};
91 std::array<bool, NChannels> tdcPedMissing{};
92 std::array<bool, NChannels> adcPedEv{};
93 std::array<bool, NChannels> adcPedOr{};
94 std::array<bool, NChannels> adcPedQC{};
95 std::array<bool, NChannels> adcPedMissing{};
96 std::array<bool, NChannels> offPed{};
97 std::array<bool, NChannels> pilePed{};
98 std::array<bool, NChannels> pileTM{};
99 std::array<bool, NChannels> adcMissingwTDC{};
100 std::array<bool, NChannels> tdcPileEvC{};
101 std::array<bool, NChannels> tdcPileEvE{};
102 std::array<bool, NChannels> tdcPileM1C{};
103 std::array<bool, NChannels> tdcPileM1E{};
104 std::array<bool, NChannels> tdcPileM2C{};
105 std::array<bool, NChannels> tdcPileM2E{};
106 std::array<bool, NChannels> tdcPileM3C{};
107 std::array<bool, NChannels> tdcPileM3E{};
108 std::array<bool, NChannels> tdcSigE{};
109 // End_of_messages
110
111 void clearBitmaps();
112
113 uint8_t mVerbosity = DbgZero;
114 uint32_t mTriggerMask = 0;
115
116 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);
117 void 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);
118
119 int next();
120 int at(int ientry);
121
122 void allocate(int isig)
123 {
124 if (inter[isig].size() != NIS) {
125 inter[isig].resize(NIS);
126 }
127 }
128
130 {
131 return mCurB;
132 }
133
134 inline int getEntries() const
135 {
136 return mNEntries;
137 }
138
139 inline int getNextEntry() const
140 {
141 return mEntry;
142 }
143
144 inline NElem getNEnergy() const
145 {
146 return mNE;
147 }
148
149 inline bool getEnergy(int32_t i, uint8_t& key, float& val) const
150 {
151 if (i < mNE) {
152 auto it = ezdc.begin();
153 std::advance(it, i);
154 key = it->first;
155 val = it->second;
156 return true;
157 }
158 return false;
159 }
160
161 inline NElem getNTDC() const
162 {
163 return mNT;
164 }
165
166 inline NElem getNInfo() const
167 {
168 return mNI;
169 }
170
171 const std::vector<uint16_t>& getDecodedInfo()
172 {
173 return mDecodedInfo;
174 }
175
176 float tdcV(uint8_t ich, uint64_t ipos) const
177 {
178 if (ich < NTDCChannels) {
179 if (ipos < TDCVal[ich].size()) {
180 return FTDCVal * TDCVal[ich][ipos];
181 }
182 }
183 return -std::numeric_limits<float>::infinity();
184 }
185
186 float tdcA(uint8_t ich, uint64_t ipos) const
187 {
188 if (ich < NTDCChannels) {
189 if (ipos < TDCAmp[ich].size()) {
190 return TDCAmp[ich][ipos];
191 }
192 }
193 return -std::numeric_limits<float>::infinity();
194 }
195
196 int NtdcV(uint8_t ich) const
197 {
198 if (ich < NTDCChannels) {
199 return TDCVal[ich].size();
200 } else {
201 return 0;
202 }
203 }
204
205 int NtdcA(uint8_t ich) const
206 {
207 if (ich < NTDCChannels) {
208 return TDCAmp[ich].size();
209 } else {
210 return 0;
211 }
212 }
213
214 float EZDC(uint8_t ich) const
215 {
216 std::map<uint8_t, float>::const_iterator it = ezdc.find(ich);
217 if (it != ezdc.end()) {
218 return it->second;
219 } else {
220 return -std::numeric_limits<float>::infinity();
221 }
222 }
223
224 float EZNAC() const { return EZDC(IdZNAC); }
225 float EZNA1() const { return EZDC(IdZNA1); }
226 float EZNA2() const { return EZDC(IdZNA2); }
227 float EZNA3() const { return EZDC(IdZNA3); }
228 float EZNA4() const { return EZDC(IdZNA4); }
229 float EZNASum() const { return EZDC(IdZNASum); }
230
231 float EZPAC() const { return EZDC(IdZPAC); }
232 float EZPA1() const { return EZDC(IdZPA1); }
233 float EZPA2() const { return EZDC(IdZPA2); }
234 float EZPA3() const { return EZDC(IdZPA3); }
235 float EZPA4() const { return EZDC(IdZPA4); }
236 float EZPASum() const { return EZDC(IdZPASum); }
237
238 float EZEM1() const { return EZDC(IdZEM1); }
239 float EZEM2() const { return EZDC(IdZEM2); }
240
241 float EZNCC() const { return EZDC(IdZNCC); }
242 float EZNC1() const { return EZDC(IdZNC1); }
243 float EZNC2() const { return EZDC(IdZNC2); }
244 float EZNC3() const { return EZDC(IdZNC3); }
245 float EZNC4() const { return EZDC(IdZNC4); }
246 float EZNCSum() const { return EZDC(IdZNCSum); }
247
248 float EZPCC() const { return EZDC(IdZPCC); }
249 float EZPC1() const { return EZDC(IdZPC1); }
250 float EZPC2() const { return EZDC(IdZPC2); }
251 float EZPC3() const { return EZDC(IdZPC3); }
252 float EZPC4() const { return EZDC(IdZPC4); }
253 float EZPCSum() const { return EZDC(IdZPCSum); }
254
255 // Centroid cartesian reference frame as seen by projectile fragments
256 // Side A: X direction towards outside of the ring
257 // Side C: X direction towards inside of the ring
258 // Y direction up
259 // Unit: cm
260 void centroidZNA(float& x, float& y);
261 void centroidZNC(float& x, float& y);
262 void centroidZPA(float& x, float& rms);
263 void centroidZPC(float& x, float& rms);
264 float xZNA();
265 float yZNA();
266 float xZNC();
267 float yZNC();
268 float xZPA(); // Positive
269 float xZPC(); // Negative
270 float rmsZPA();
271 float rmsZPC();
272
273 void decodeInfo(uint8_t ch, uint16_t code);
274 void decodeMapInfo(uint32_t ch, uint16_t code);
275
276 void print() const;
277 void printDecodedMessages() const;
278 void printEvent() const;
280};
281
282} // namespace zdc
283} // namespace o2
284
285#endif
Class to refer to the reconstructed information.
int32_t i
Class to refer to the 1st entry and N elements of some group in the continuous container.
Container class to store energy released in the ZDC.
Container class to store a TDC hit in a ZDC channel.
StringRef key
GLint GLenum GLint x
Definition glcorearb.h:403
GLsizeiptr size
Definition glcorearb.h:659
GLuint GLfloat * val
Definition glcorearb.h:1582
struct o2::upgrades_utils::@463 zdc
structure to keep FT0 information
constexpr int IdZNCSum
constexpr int IdZPC4
constexpr int IdZPA2
constexpr int IdZNA3
constexpr int IdZNA1
constexpr int IdZPA1
constexpr int IdZPCSum
constexpr int IdZNC2
constexpr int IdZEM1
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 int IdZNC1
constexpr int IdZNC3
constexpr int IdZPCC
constexpr int IdZPC1
constexpr int IdZPA3
constexpr int IdZNC4
constexpr int IdZEM2
constexpr int IdZNA2
constexpr int DbgZero
Definition Constants.h:207
constexpr int NIS
Definition Constants.h:97
constexpr int IdZNASum
constexpr int IdZPC3
constexpr int IdZNA4
constexpr int IdZNAC
constexpr int IdZPASum
constexpr float FTDCVal
Definition Constants.h:103
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
ClassDefNV(RecEventFlat, 1)
BCRecData & getCurB()
void centroidZPA(float &x, float &rms)
uint64_t mEntry
Event quality information (decoded)
std::vector< float > inter[NChannels]
Current BC.
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
void allocate(int isig)
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
float tdcV(uint8_t ich, uint64_t ipos) const
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.
bool getEnergy(int32_t i, uint8_t &key, float &val) const
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
float EZNCSum() const
uint32_t triggers
pattern of decoded energies
FirstEntry mFirstI
First TDC.
float tdcA(uint8_t ich, uint64_t ipos) const
void clearBitmaps()
18 Missing TDC signal correction
NElem getNTDC() const
int NtdcA(uint8_t ich) const
float EZPASum() 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.
const std::vector< uint16_t > & getDecodedInfo()
std::array< bool, NChannels > tdcPedEv
0 Generic error
float EZPCSum() const
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.
float EZNASum() const
uint64_t mNEntries
Current entry.
std::vector< bool > TDCPile[NTDCChannels]
TDC signal amplitudes.
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