CbmRoot
Loading...
Searching...
No Matches
PsdGbtDataFormat-v1.00.h
Go to the documentation of this file.
1/* Copyright (C) 2019-2021 Institute for Nuclear Research, Moscow
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Nikolay Karpushkin [committer]*/
4
5#ifndef PSD_GBT_DATA_FORMAT_V100_H_
6#define PSD_GBT_DATA_FORMAT_V100_H_
7
8#include <cstdint>
9#include <cstdio>
10#include <cstring>
11#include <vector>
12
13namespace PsdDataV100
14{
15
16 struct PsdMsHeader {
18 {
19 MWs = 8,
20 E0s = 8,
21 MSs = 64
22 };
23
24 uint8_t uMagicWord : MWs;
25 uint8_t uEmpty0 : E0s;
26 uint64_t ulMicroSlice : MSs;
27
28 void printout()
29 {
30 printf("MS magic word: %x; microslice: %llu\n", uMagicWord, static_cast<long long unsigned int>(ulMicroSlice));
31 }
32
33 void clear()
34 {
35 uMagicWord = 0;
36 uEmpty0 = 0;
37 ulMicroSlice = 0;
38 }
39
41
42 }; //PsdMsHeader;
43
44
47 {
48 MWs = 4,
49 LIs = 4,
50 E0s = 24,
51 HNs = 8,
52 TWs = 8,
53 TMs = 32
54 };
55
56 uint8_t uMagicWord : MWs;
57 uint8_t uLinkIndex : LIs;
58 uint32_t uEmpty0 : E0s;
59 uint8_t uHitsNumber : HNs;
60 uint8_t uTotalWords : TWs;
61 uint32_t uAdcTime : TMs;
62
63 void printout()
64 {
65 printf("Pack magic word: %x; link: %u; total hits: %u; total gbt words: %u; ADC time in microslice: %u\n",
67 }
68
69 void clear()
70 {
71 uMagicWord = 0;
72 uLinkIndex = 0;
73 uEmpty0 = 0;
74 uHitsNumber = 0;
75 uTotalWords = 0;
76 uAdcTime = 0;
77 }
78
80
81 }; //PsdPackHeader;
82
83
84 struct PsdHitHeader {
86 {
87 HCs = 8,
88 WWs = 8,
89 FAs = 16,
90 E0s = 12,
91 SCs = 20,
92 ZLs = 16
93 };
94
95 uint8_t uHitChannel : HCs;
96 uint8_t uWfmWords : WWs;
97 uint32_t uFeeAccum : FAs;
98 uint32_t uEmpty0 : E0s;
99 uint32_t uSignalCharge : SCs;
100 uint16_t uZeroLevel : ZLs;
101
102 void printout()
103 {
104 printf("hit channel: %u; waveform words: %u; fee accumulator: %u; signal charge: %u; zero level: %u\n",
106 }
107
108 void clear()
109 {
110 uHitChannel = 0;
111 uWfmWords = 0;
112 uFeeAccum = 0;
113 uEmpty0 = 0;
114 uSignalCharge = 0;
115 uZeroLevel = 0;
116 }
117
119
120 }; //PsdHitHeader;
121
122
123 struct PsdHitData {
125 {
126 E0s = 16,
127 WPs = 16
128 };
129
130 uint16_t uEmpty0 : E0s;
131 std::vector<uint16_t> uWfm;
132
133 void printout()
134 {
135 printf("waveform: ");
136 for (uint8_t iter = 0; iter < uWfm.size(); iter++)
137 printf("%u ", uWfm.at(iter));
138 printf("\n");
139 }
140
141 void clear()
142 {
143 uEmpty0 = 0;
144 uWfm.clear();
145 }
146
148
149 }; //PsdHitData;
150
151
154 {
155 E0s = 64,
156 };
157
158 uint64_t uEmpty0 : E0s;
159
160 void printout() { printf("trailer: %llu\n", static_cast<long long unsigned int>(uEmpty0)); }
161
162 void clear() { uEmpty0 = 0; }
163
165
166 }; //PsdMsTrailer;
167
168
169} // namespace PsdDataV100
170
171
172#endif /* PSD_GBT_DATA_FORMAT_V100_H_ */
@ WPs
Empty bits size in bits.
std::vector< uint16_t > uWfm
Empty bits.
void printout()
Waveform vector.
uint16_t uZeroLevel
Waveform integral above ZeroLevel.
uint32_t uFeeAccum
Total waveform points per hit.
uint32_t uEmpty0
FEE accumulator.
@ ZLs
Signal charge size in bits.
@ SCs
Empty bits size in bits.
@ FAs
Waveform points size in bits.
@ WWs
Hit channel size in bits.
@ E0s
FEE accumulator bits size in bits.
void printout()
Waveform ZeroLevel.
@ E0s
MagicWord size in bits.
@ MSs
Empty bits size in bits.
uint32_t uAdcTime
Words in data pack.
@ TWs
Hits number size in bits.
@ E0s
Link index size in bits.
@ TMs
Words in pack size in bits.
@ LIs
MagicWord size in bits.
@ HNs
Empty bits size in bits.
void printout()
ADC Time of threshold cross from the begining of MS.