CbmRoot
PsdGbtDataFormat.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // ----- -----
3 // ----- PsdGbtDataFormat -----
4 // ----- Created 14.09.2019 by N.Karpushkin -----
5 // ----- -----
6 // -----------------------------------------------------------------------------
7 
8 #ifndef PSD_GBT_DATA_FORMAT_H_
9 #define PSD_GBT_DATA_FORMAT_H_
10 
11 #include <stdint.h>
12 #include <stdio.h>
13 #include <string.h>
14 #include <vector>
15 
16 namespace PsdData {
17 
20  MWs = 8,
21  HNs = 8,
22  MSs = 64
23  };
24 
25  uint8_t uMagicWordAB : MWs;
26  uint8_t uHitsNumber : HNs;
27  uint64_t ulMicroSlice : MSs;
28 
29  void printout() {
30  printf("magic word AB: %u; hits number: %u; microslice: %llu\n",
33  static_cast<long long unsigned int>(ulMicroSlice));
34  }
35 
36  void clear() {
37  uMagicWordAB = 0;
38  uHitsNumber = 0;
39  ulMicroSlice = 0;
40  }
41 
43  };
44 
45 
48  MWs = 8,
49  PVs = 8,
50  E0s = 32,
51  TMs = 32
52  };
53 
54  uint8_t uMagicWordAC : MWs;
55  uint8_t uPacketVersion : PVs;
56  uint32_t uEmpty0 : E0s;
57  uint32_t uAdcTime :
58  TMs;
59 
60  void printout() {
61  printf(
62  "magic word AC: %u; packet version: %u; ADC time in microslice: %u\n",
65  uAdcTime);
66  }
67 
68  void clear() {
69  uMagicWordAC = 0;
70  uPacketVersion = 0;
71  uEmpty0 = 0;
72  uAdcTime = 0;
73  }
74 
76  };
77 
78 
79  struct PsdHitHeader {
81  WPSs = 8,
82  HCs = 8,
83  E0s = 32,
84  SCs = 16,
85  ZLs = 16
86  };
87 
88  uint8_t uWfmPoints : WPSs;
89  uint8_t uHitChannel : HCs;
90  uint32_t uEmpty0 : E0s;
91  uint16_t uSignalCharge : SCs;
92  uint16_t uZeroLevel : ZLs;
93 
94  void printout() {
95  printf("waveform points: %u; hit channel: %u; signal charge: %u; zero "
96  "level: %u\n",
97  uWfmPoints,
100  uZeroLevel);
101  }
102 
103  void clear() {
104  uWfmPoints = 0;
105  uHitChannel = 0;
106  uEmpty0 = 0;
107  uSignalCharge = 0;
108  uZeroLevel = 0;
109  }
110 
112  };
113 
114 
115  struct PsdHitData {
117  E0s = 16,
118  WPs = 16
119  };
120 
121  uint16_t uEmpty0 : E0s;
122  std::vector<uint16_t> uWfm;
123 
124  void printout() {
125  printf("waveform: ");
126  for (uint8_t iter = 0; iter < uWfm.size(); iter++)
127  printf("%u ", uWfm.at(iter));
128  printf("\n");
129  }
130 
131  void clear() {
132  uEmpty0 = 0;
133  uWfm.clear();
134  }
135 
136  PsdHitData() { clear(); }
137  };
138 
139 } // namespace PsdData
140 
141 
142 #endif /* PSD_GBT_DATA_FORMAT_H_ */
PsdData::PsdEventHeaderAC::PsdEventHeaderAC
PsdEventHeaderAC()
Definition: PsdGbtDataFormat.h:75
PsdData::PsdHitData::PsdHitData
PsdHitData()
Definition: PsdGbtDataFormat.h:136
PsdData::PsdEventHeaderAC::uMagicWordAC
uint8_t uMagicWordAC
Definition: PsdGbtDataFormat.h:54
PsdData::PsdHitData::E0s
@ E0s
Definition: PsdGbtDataFormat.h:117
PsdData::PsdEventHeaderAC::bitFieldSizes
bitFieldSizes
Definition: PsdGbtDataFormat.h:47
PsdData::PsdHitHeader::uSignalCharge
uint16_t uSignalCharge
Empty bits.
Definition: PsdGbtDataFormat.h:91
PsdData::PsdEventHeaderAC::E0s
@ E0s
PacketVersion size in bits.
Definition: PsdGbtDataFormat.h:50
PsdData::PsdHitHeader::uHitChannel
uint8_t uHitChannel
Total waveform points per hit.
Definition: PsdGbtDataFormat.h:89
PsdData::PsdEventHeaderAB::bitFieldSizes
bitFieldSizes
Definition: PsdGbtDataFormat.h:19
PsdData::PsdHitData::uEmpty0
uint16_t uEmpty0
Definition: PsdGbtDataFormat.h:121
PsdData::PsdEventHeaderAB::HNs
@ HNs
MagicWord size in bits.
Definition: PsdGbtDataFormat.h:21
PsdData::PsdHitData
Definition: PsdGbtDataFormat.h:115
PsdData::PsdEventHeaderAC::clear
void clear()
Definition: PsdGbtDataFormat.h:68
PsdData::PsdEventHeaderAB::PsdEventHeaderAB
PsdEventHeaderAB()
Definition: PsdGbtDataFormat.h:42
PsdData::PsdEventHeaderAC::printout
void printout()
ADC Time of threshold cross from the begining of TS.
Definition: PsdGbtDataFormat.h:60
PsdData::PsdHitData::WPs
@ WPs
Empty bits size in bits.
Definition: PsdGbtDataFormat.h:118
PsdData::PsdEventHeaderAB
Definition: PsdGbtDataFormat.h:18
PsdData::PsdHitHeader::ZLs
@ ZLs
Signal charge size in bits.
Definition: PsdGbtDataFormat.h:85
PsdData::PsdEventHeaderAB::MWs
@ MWs
Definition: PsdGbtDataFormat.h:20
PsdData::PsdHitData::uWfm
std::vector< uint16_t > uWfm
Empty bits.
Definition: PsdGbtDataFormat.h:122
PsdData
Definition: PsdGbtDataFormat.h:16
PsdData::PsdEventHeaderAC::uAdcTime
uint32_t uAdcTime
Empty bits.
Definition: PsdGbtDataFormat.h:58
PsdData::PsdEventHeaderAC::uPacketVersion
uint8_t uPacketVersion
Should be AC.
Definition: PsdGbtDataFormat.h:55
PsdData::PsdHitHeader::uZeroLevel
uint16_t uZeroLevel
Waveform integral above ZeroLevel.
Definition: PsdGbtDataFormat.h:92
PsdData::PsdHitData::bitFieldSizes
bitFieldSizes
Definition: PsdGbtDataFormat.h:116
PsdData::PsdHitHeader::SCs
@ SCs
Empty bits size in bits.
Definition: PsdGbtDataFormat.h:84
PsdData::PsdHitData::printout
void printout()
Waveform vector.
Definition: PsdGbtDataFormat.h:124
PsdData::PsdEventHeaderAC::PVs
@ PVs
MagicWord size in bits.
Definition: PsdGbtDataFormat.h:49
PsdData::PsdHitHeader::clear
void clear()
Definition: PsdGbtDataFormat.h:103
PsdData::PsdEventHeaderAC
Definition: PsdGbtDataFormat.h:46
PsdData::PsdHitHeader::PsdHitHeader
PsdHitHeader()
Definition: PsdGbtDataFormat.h:111
PsdData::PsdEventHeaderAB::MSs
@ MSs
HitsNumber size in bits.
Definition: PsdGbtDataFormat.h:22
PsdData::PsdHitHeader
Definition: PsdGbtDataFormat.h:79
PsdData::PsdEventHeaderAB::printout
void printout()
Epoch.
Definition: PsdGbtDataFormat.h:29
PsdData::PsdHitData::clear
void clear()
Definition: PsdGbtDataFormat.h:131
PsdData::PsdHitHeader::uWfmPoints
uint8_t uWfmPoints
Definition: PsdGbtDataFormat.h:88
PsdData::PsdEventHeaderAB::uHitsNumber
uint8_t uHitsNumber
Should be AB.
Definition: PsdGbtDataFormat.h:26
PsdData::PsdEventHeaderAC::MWs
@ MWs
Definition: PsdGbtDataFormat.h:48
PsdData::PsdHitHeader::uEmpty0
uint32_t uEmpty0
Hit channel.
Definition: PsdGbtDataFormat.h:90
PsdData::PsdHitHeader::bitFieldSizes
bitFieldSizes
Definition: PsdGbtDataFormat.h:80
PsdData::PsdEventHeaderAC::TMs
@ TMs
Empty bits size in bits.
Definition: PsdGbtDataFormat.h:51
PsdData::PsdEventHeaderAB::uMagicWordAB
uint8_t uMagicWordAB
Definition: PsdGbtDataFormat.h:25
PsdData::PsdHitHeader::WPSs
@ WPSs
Definition: PsdGbtDataFormat.h:81
PsdData::PsdHitHeader::HCs
@ HCs
Waveform points size in bits.
Definition: PsdGbtDataFormat.h:82
PsdData::PsdEventHeaderAB::clear
void clear()
Definition: PsdGbtDataFormat.h:36
PsdData::PsdHitHeader::E0s
@ E0s
Hit channel size in bits.
Definition: PsdGbtDataFormat.h:83
PsdData::PsdHitHeader::printout
void printout()
Waveform ZeroLevel.
Definition: PsdGbtDataFormat.h:94
PsdData::PsdEventHeaderAB::ulMicroSlice
uint64_t ulMicroSlice
Total number of hits.
Definition: PsdGbtDataFormat.h:27
PsdData::PsdEventHeaderAC::uEmpty0
uint32_t uEmpty0
Version of gbt package.
Definition: PsdGbtDataFormat.h:56