15#ifndef ALICEO2_TPC_GBTFRAME_H_
16#define ALICEO2_TPC_GBTFRAME_H_
28#define BIT00(x) ((x & 0x1) >> 0)
29#define BIT01(x) ((x & 0x2) >> 1)
30#define BIT02(x) ((x & 0x4) >> 2)
31#define BIT03(x) ((x & 0x8) >> 3)
32#define BIT04(x) ((x & 0x10) >> 4)
33#define BIT05(x) ((x & 0x20) >> 5)
34#define BIT06(x) ((x & 0x40) >> 6)
35#define BIT07(x) ((x & 0x80) >> 7)
36#define BIT08(x) ((x & 0x100) >> 8)
37#define BIT09(x) ((x & 0x200) >> 9)
38#define BIT10(x) ((x & 0x400) >> 10)
39#define BIT11(x) ((x & 0x800) >> 11)
40#define BIT12(x) ((x & 0x1000) >> 12)
41#define BIT13(x) ((x & 0x2000) >> 13)
42#define BIT14(x) ((x & 0x4000) >> 14)
43#define BIT15(x) ((x & 0x8000) >> 15)
44#define BIT16(x) ((x & 0x10000) >> 16)
45#define BIT17(x) ((x & 0x20000) >> 17)
46#define BIT18(x) ((x & 0x40000) >> 18)
47#define BIT19(x) ((x & 0x80000) >> 19)
48#define BIT20(x) ((x & 0x100000) >> 20)
49#define BIT21(x) ((x & 0x200000) >> 21)
50#define BIT22(x) ((x & 0x400000) >> 22)
51#define BIT23(x) ((x & 0x800000) >> 23)
52#define BIT24(x) ((x & 0x1000000) >> 24)
53#define BIT25(x) ((x & 0x2000000) >> 25)
54#define BIT26(x) ((x & 0x4000000) >> 26)
55#define BIT27(x) ((x & 0x8000000) >> 27)
56#define BIT28(x) ((x & 0x10000000) >> 28)
57#define BIT29(x) ((x & 0x20000000) >> 29)
58#define BIT30(x) ((x & 0x40000000) >> 30)
59#define BIT31(x) ((x & 0x80000000) >> 31)
74 GBTFrame(
unsigned word3,
unsigned word2,
unsigned word1,
unsigned word0);
101 GBTFrame(
short s0hw0l,
short s0hw1l,
short s0hw2l,
short s0hw3l,
102 short s0hw0h,
short s0hw1h,
short s0hw2h,
short s0hw3h,
103 short s1hw0l,
short s1hw1l,
short s1hw2l,
short s1hw3l,
104 short s1hw0h,
short s1hw1h,
short s1hw2h,
short s1hw3h,
105 short s2hw0,
short s2hw1,
short s2hw2,
short s2hw3,
106 short s0adc,
short s1adc,
short s2adc,
unsigned marker = 0);
117 short getMarker()
const {
return (mWords[3] >> 16) & 0xFFFF; };
124 short getHalfWord(
const short sampa,
const short halfword,
const short chan = 0)
const {
return mHalfWords[sampa][chan][halfword]; };
129 short getAdcClock(
short sampa)
const {
return mAdcClock[sampa]; };
146 void setData(
unsigned word3,
unsigned word2,
unsigned word1,
unsigned word0);
173 void setData(
short s0hw0l,
short s0hw1l,
short s0hw2l,
short s0hw3l,
174 short s0hw0h,
short s0hw1h,
short s0hw2h,
short s0hw3h,
175 short s1hw0l,
short s1hw1l,
short s1hw2l,
short s1hw3l,
176 short s1hw0h,
short s1hw1h,
short s1hw2h,
short s1hw3h,
177 short s2hw0,
short s2hw1,
short s2hw2,
short s2hw3,
178 short s0adc,
short s1adc,
short s2adc,
unsigned marker = 0);
185 void getGBTFrame(
unsigned& word3,
unsigned& word2,
unsigned& word1,
unsigned& word0)
const;
194 void calculateHalfWords();
195 void calculateAdcClock();
197 std::array<unsigned, 4> mWords;
203 std::array<std::array<std::array<short, 4>, 2>, 3> mHalfWords;
208 std::array<short, 3> mAdcClock;
211inline void GBTFrame::calculateHalfWords()
214 mHalfWords[0][0][0] = (
BIT19(mWords[0]) << 4) | (
BIT15(mWords[0]) << 3) | (
BIT11(mWords[0]) << 2) | (
BIT07(mWords[0]) << 1) |
BIT03(mWords[0]);
215 mHalfWords[0][0][1] = (
BIT18(mWords[0]) << 4) | (
BIT14(mWords[0]) << 3) | (
BIT10(mWords[0]) << 2) | (
BIT06(mWords[0]) << 1) |
BIT02(mWords[0]);
216 mHalfWords[0][0][2] = (
BIT17(mWords[0]) << 4) | (
BIT13(mWords[0]) << 3) | (
BIT09(mWords[0]) << 2) | (
BIT05(mWords[0]) << 1) |
BIT01(mWords[0]);
217 mHalfWords[0][0][3] = (
BIT16(mWords[0]) << 4) | (
BIT12(mWords[0]) << 3) | (
BIT08(mWords[0]) << 2) | (
BIT04(mWords[0]) << 1) |
BIT00(mWords[0]);
219 mHalfWords[0][1][0] = (
BIT07(mWords[1]) << 4) | (
BIT03(mWords[1]) << 3) | (
BIT31(mWords[0]) << 2) | (
BIT27(mWords[0]) << 1) |
BIT23(mWords[0]);
220 mHalfWords[0][1][1] = (
BIT06(mWords[1]) << 4) | (
BIT02(mWords[1]) << 3) | (
BIT30(mWords[0]) << 2) | (
BIT26(mWords[0]) << 1) |
BIT22(mWords[0]);
221 mHalfWords[0][1][2] = (
BIT05(mWords[1]) << 4) | (
BIT01(mWords[1]) << 3) | (
BIT29(mWords[0]) << 2) | (
BIT25(mWords[0]) << 1) |
BIT21(mWords[0]);
222 mHalfWords[0][1][3] = (
BIT04(mWords[1]) << 4) | (
BIT00(mWords[1]) << 3) | (
BIT28(mWords[0]) << 2) | (
BIT24(mWords[0]) << 1) |
BIT20(mWords[0]);
224 mHalfWords[1][0][0] = (
BIT31(mWords[1]) << 4) | (
BIT27(mWords[1]) << 3) | (
BIT23(mWords[1]) << 2) | (
BIT19(mWords[1]) << 1) |
BIT15(mWords[1]);
225 mHalfWords[1][0][1] = (
BIT30(mWords[1]) << 4) | (
BIT26(mWords[1]) << 3) | (
BIT22(mWords[1]) << 2) | (
BIT18(mWords[1]) << 1) |
BIT14(mWords[1]);
226 mHalfWords[1][0][2] = (
BIT29(mWords[1]) << 4) | (
BIT25(mWords[1]) << 3) | (
BIT21(mWords[1]) << 2) | (
BIT17(mWords[1]) << 1) |
BIT13(mWords[1]);
227 mHalfWords[1][0][3] = (
BIT28(mWords[1]) << 4) | (
BIT24(mWords[1]) << 3) | (
BIT20(mWords[1]) << 2) | (
BIT16(mWords[1]) << 1) |
BIT12(mWords[1]);
229 mHalfWords[1][1][0] = (
BIT19(mWords[2]) << 4) | (
BIT15(mWords[2]) << 3) | (
BIT11(mWords[2]) << 2) | (
BIT07(mWords[2]) << 1) |
BIT03(mWords[2]);
230 mHalfWords[1][1][1] = (
BIT18(mWords[2]) << 4) | (
BIT14(mWords[2]) << 3) | (
BIT10(mWords[2]) << 2) | (
BIT06(mWords[2]) << 1) |
BIT02(mWords[2]);
231 mHalfWords[1][1][2] = (
BIT17(mWords[2]) << 4) | (
BIT13(mWords[2]) << 3) | (
BIT09(mWords[2]) << 2) | (
BIT05(mWords[2]) << 1) |
BIT01(mWords[2]);
232 mHalfWords[1][1][3] = (
BIT16(mWords[2]) << 4) | (
BIT12(mWords[2]) << 3) | (
BIT08(mWords[2]) << 2) | (
BIT04(mWords[2]) << 1) |
BIT00(mWords[2]);
234 mHalfWords[2][0][0] = (
BIT11(mWords[3]) << 4) | (
BIT07(mWords[3]) << 3) | (
BIT03(mWords[3]) << 2) | (
BIT31(mWords[2]) << 1) |
BIT27(mWords[2]);
235 mHalfWords[2][0][1] = (
BIT10(mWords[3]) << 4) | (
BIT06(mWords[3]) << 3) | (
BIT02(mWords[3]) << 2) | (
BIT30(mWords[2]) << 1) |
BIT26(mWords[2]);
236 mHalfWords[2][0][2] = (
BIT09(mWords[3]) << 4) | (
BIT05(mWords[3]) << 3) | (
BIT01(mWords[3]) << 2) | (
BIT29(mWords[2]) << 1) |
BIT25(mWords[2]);
237 mHalfWords[2][0][3] = (
BIT08(mWords[3]) << 4) | (
BIT04(mWords[3]) << 3) | (
BIT00(mWords[3]) << 2) | (
BIT28(mWords[2]) << 1) |
BIT24(mWords[2]);
247inline void GBTFrame::calculateAdcClock()
249 mAdcClock[0] = (mWords[1] >> 8) & 0xF;
250 mAdcClock[1] = (mWords[2] >> 20) & 0xF;
251 mAdcClock[2] = (mWords[3] >> 12) & 0xF;
261 calculateHalfWords();
274 calculateHalfWords();
GBTFrame class for the TPC.
short getAdcClock(short sampa) const
void setAdcClock(int sampa, int clock)
~GBTFrame()=default
Destructor.
GBTFrame(const GBTFrame &other)
void getGBTFrame(unsigned &word3, unsigned &word2, unsigned &word1, unsigned &word0) const
void setData(unsigned word3, unsigned word2, unsigned word1, unsigned word0)
short getHalfWord(const short sampa, const short halfword, const short chan=0) const
std::ostream & Print(std::ostream &output) const
GBTFrame()
Default Constructor.
friend std::ostream & operator<<(std::ostream &out, const GBTFrame &f)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
VectorOfTObjectPtrs other