CbmRoot
Loading...
Searching...
No Matches
PsdGbtReader-v0.00.cxx
Go to the documentation of this file.
1/* Copyright (C) 2019-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Nikolay Karpushkin [committer], David Emschermann, Pierre-Alain Loizeau */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- PsdGbtDataReader -----
8// ----- Created 14.09.2019 by N.Karpushkin -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#include "PsdGbtReader-v0.00.h"
13
14#include <cstdint>
15
16namespace PsdDataV000
17{
18
20 {
21 EvHdrAb.clear();
22 EvHdrAc.clear();
23 HitHdr.clear();
24 HitData.clear();
25 VectHitHdr.clear();
26 VectHitData.clear();
27 }
28
30 {
31 EvHdrAb.clear();
32 buffer_shift = 0;
33 EvHdrAb.ulMicroSlice = (buffer[gbt_word_index] >> buffer_shift) & 0xffffffffffffffff;
35
36 buffer_shift = 0;
37 EvHdrAb.uHitsNumber = (buffer[gbt_word_index] >> buffer_shift) & (((static_cast<uint32_t>(1)) << EvHdrAb.HNs) - 1);
39 EvHdrAb.uMagicWordAB = (buffer[gbt_word_index] >> buffer_shift) & (((static_cast<uint32_t>(1)) << EvHdrAb.MWs) - 1);
41
43 }
44
46 {
47 EvHdrAc.clear();
48 buffer_shift = 0;
49 EvHdrAc.uAdcTime = (buffer[gbt_word_index] >> buffer_shift) & (((static_cast<uint64_t>(1)) << EvHdrAc.TMs) - 1);
51
52 buffer_shift = 0;
54 (buffer[gbt_word_index] >> buffer_shift) & (((static_cast<uint32_t>(1)) << EvHdrAc.PVs) - 1);
56 EvHdrAc.uMagicWordAC = (buffer[gbt_word_index] >> buffer_shift) & (((static_cast<uint32_t>(1)) << EvHdrAc.MWs) - 1);
58
60 }
61
63 {
64 HitHdr.clear();
65 buffer_shift = 0;
66 HitHdr.uZeroLevel = (buffer[gbt_word_index] >> buffer_shift) & (((static_cast<uint32_t>(1)) << HitHdr.ZLs) - 1);
68 HitHdr.uSignalCharge = (buffer[gbt_word_index] >> buffer_shift) & (((static_cast<uint32_t>(1)) << HitHdr.SCs) - 1);
70
71 buffer_shift = 0;
72 HitHdr.uHitChannel = (buffer[gbt_word_index] >> buffer_shift) & (((static_cast<uint32_t>(1)) << HitHdr.HCs) - 1);
74 HitHdr.uWfmPoints = (buffer[gbt_word_index] >> buffer_shift) & (((static_cast<uint32_t>(1)) << HitHdr.WPSs) - 1);
76
78 }
79
81 {
82 HitData.clear();
83 buffer_shift = 64;
84 for (int wfm_pt_iter = 0; wfm_pt_iter < HitHdr.uWfmPoints; wfm_pt_iter++) {
86 uint16_t wfm_point = (buffer[gbt_word_index] >> buffer_shift) & (((static_cast<uint32_t>(1)) << HitData.WPs) - 1);
87 HitData.uWfm.push_back(wfm_point);
88 if (buffer_shift == 0) {
89 gbt_word_index += 2;
90 buffer_shift = 64;
91 }
92 }
93
95 }
96
98 {
99 bool IsAbHeaderInMessage = false;
100 bool IsAcHeaderInMessage = false;
101
104 IsAbHeaderInMessage = (EvHdrAb.uMagicWordAB == 171);
105 IsAcHeaderInMessage = (EvHdrAc.uMagicWordAC == 172);
106
107 if (IsAbHeaderInMessage && IsAcHeaderInMessage) {
108 VectHitHdr.clear();
109 VectHitData.clear();
110
111 //hit loop
112 for (int hit_iter = 0; hit_iter < EvHdrAb.uHitsNumber; hit_iter++) {
114 VectHitHdr.push_back(HitHdr);
116 VectHitData.push_back(HitData);
117
118 if (VectHitHdr.at(hit_iter).uWfmPoints != 8) { return 2; }
119 } //hit loop
120
121 if (EvHdrAb.uHitsNumber != VectHitHdr.size()) { return 3; }
122 }
123 else {
124 return 1;
125 }
126
127 return 0;
128 }
129} // namespace PsdDataV000
std::vector< PsdHitData > VectHitData
std::vector< PsdHitHeader > VectHitHdr
uint64_t ulMicroSlice
Total number of hits.
void printout()
ADC Time of threshold cross from the begining of TS.
@ WPs
Empty bits size in bits.
void printout()
Waveform vector.
std::vector< uint16_t > uWfm
Empty bits.
uint8_t uHitChannel
Total waveform points per hit.
@ SCs
Empty bits size in bits.
@ HCs
Waveform points size in bits.
@ ZLs
Signal charge size in bits.
uint16_t uZeroLevel
Waveform integral above ZeroLevel.
void printout()
Waveform ZeroLevel.