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
16
namespace
PsdDataV000
17
{
18
19
PsdGbtReader::~PsdGbtReader
()
20
{
21
EvHdrAb
.
clear
();
22
EvHdrAc
.
clear
();
23
HitHdr
.
clear
();
24
HitData
.
clear
();
25
VectHitHdr
.clear();
26
VectHitData
.clear();
27
}
28
29
void
PsdGbtReader::ReadEventHeaderAbFles
()
30
{
31
EvHdrAb
.
clear
();
32
buffer_shift
= 0;
33
EvHdrAb
.
ulMicroSlice
= (
buffer
[
gbt_word_index
] >>
buffer_shift
) & 0xffffffffffffffff;
34
gbt_word_index
++;
35
36
buffer_shift
= 0;
37
EvHdrAb
.
uHitsNumber
= (
buffer
[
gbt_word_index
] >>
buffer_shift
) & (((
static_cast<
uint32_t
>
(1)) <<
EvHdrAb
.
HNs
) - 1);
38
buffer_shift
+=
EvHdrAb
.
HNs
;
39
EvHdrAb
.
uMagicWordAB
= (
buffer
[
gbt_word_index
] >>
buffer_shift
) & (((
static_cast<
uint32_t
>
(1)) <<
EvHdrAb
.
MWs
) - 1);
40
gbt_word_index
++;
41
42
if
(
PrintOut
)
EvHdrAb
.
printout
();
43
}
44
45
void
PsdGbtReader::ReadEventHeaderAcFles
()
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);
50
gbt_word_index
++;
51
52
buffer_shift
= 0;
53
EvHdrAc
.
uPacketVersion
=
54
(
buffer
[
gbt_word_index
] >>
buffer_shift
) & (((
static_cast<
uint32_t
>
(1)) <<
EvHdrAc
.
PVs
) - 1);
55
buffer_shift
+=
EvHdrAc
.
PVs
;
56
EvHdrAc
.
uMagicWordAC
= (
buffer
[
gbt_word_index
] >>
buffer_shift
) & (((
static_cast<
uint32_t
>
(1)) <<
EvHdrAc
.
MWs
) - 1);
57
gbt_word_index
++;
58
59
if
(
PrintOut
)
EvHdrAc
.
printout
();
60
}
61
62
void
PsdGbtReader::ReadHitHeaderFles
()
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);
67
buffer_shift
+=
HitHdr
.
ZLs
;
68
HitHdr
.
uSignalCharge
= (
buffer
[
gbt_word_index
] >>
buffer_shift
) & (((
static_cast<
uint32_t
>
(1)) <<
HitHdr
.
SCs
) - 1);
69
gbt_word_index
++;
70
71
buffer_shift
= 0;
72
HitHdr
.
uHitChannel
= (
buffer
[
gbt_word_index
] >>
buffer_shift
) & (((
static_cast<
uint32_t
>
(1)) <<
HitHdr
.
HCs
) - 1);
73
buffer_shift
+=
HitHdr
.
HCs
;
74
HitHdr
.
uWfmPoints
= (
buffer
[
gbt_word_index
] >>
buffer_shift
) & (((
static_cast<
uint32_t
>
(1)) <<
HitHdr
.
WPSs
) - 1);
75
gbt_word_index
++;
76
77
if
(
PrintOut
)
HitHdr
.
printout
();
78
}
79
80
void
PsdGbtReader::ReadHitDataFles
()
81
{
82
HitData
.
clear
();
83
buffer_shift
= 64;
84
for
(
int
wfm_pt_iter = 0; wfm_pt_iter <
HitHdr
.
uWfmPoints
; wfm_pt_iter++) {
85
buffer_shift
-=
HitData
.
WPs
;
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
94
if
(
PrintOut
)
HitData
.
printout
();
95
}
96
97
int
PsdGbtReader::ReadEventFles
()
98
{
99
bool
IsAbHeaderInMessage =
false
;
100
bool
IsAcHeaderInMessage =
false
;
101
102
ReadEventHeaderAbFles
();
103
ReadEventHeaderAcFles
();
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++) {
113
ReadHitHeaderFles
();
114
VectHitHdr
.push_back(
HitHdr
);
115
ReadHitDataFles
();
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
PsdGbtReader-v0.00.h
PsdDataV000::PsdGbtReader::HitData
PsdHitData HitData
Definition
PsdGbtReader-v0.00.h:30
PsdDataV000::PsdGbtReader::EvHdrAb
PsdEventHeaderAB EvHdrAb
Definition
PsdGbtReader-v0.00.h:27
PsdDataV000::PsdGbtReader::ReadEventFles
int ReadEventFles()
Definition
PsdGbtReader-v0.00.cxx:97
PsdDataV000::PsdGbtReader::PrintOut
bool PrintOut
Definition
PsdGbtReader-v0.00.h:53
PsdDataV000::PsdGbtReader::ReadHitHeaderFles
void ReadHitHeaderFles()
Definition
PsdGbtReader-v0.00.cxx:62
PsdDataV000::PsdGbtReader::ReadEventHeaderAcFles
void ReadEventHeaderAcFles()
Definition
PsdGbtReader-v0.00.cxx:45
PsdDataV000::PsdGbtReader::VectHitData
std::vector< PsdHitData > VectHitData
Definition
PsdGbtReader-v0.00.h:33
PsdDataV000::PsdGbtReader::EvHdrAc
PsdEventHeaderAC EvHdrAc
Definition
PsdGbtReader-v0.00.h:28
PsdDataV000::PsdGbtReader::ReadHitDataFles
void ReadHitDataFles()
Definition
PsdGbtReader-v0.00.cxx:80
PsdDataV000::PsdGbtReader::buffer
const uint64_t * buffer
Definition
PsdGbtReader-v0.00.h:51
PsdDataV000::PsdGbtReader::VectHitHdr
std::vector< PsdHitHeader > VectHitHdr
Definition
PsdGbtReader-v0.00.h:32
PsdDataV000::PsdGbtReader::gbt_word_index
uint32_t gbt_word_index
Definition
PsdGbtReader-v0.00.h:54
PsdDataV000::PsdGbtReader::HitHdr
PsdHitHeader HitHdr
Definition
PsdGbtReader-v0.00.h:29
PsdDataV000::PsdGbtReader::buffer_shift
int buffer_shift
Definition
PsdGbtReader-v0.00.h:55
PsdDataV000::PsdGbtReader::~PsdGbtReader
~PsdGbtReader()
Definition
PsdGbtReader-v0.00.cxx:19
PsdDataV000::PsdGbtReader::ReadEventHeaderAbFles
void ReadEventHeaderAbFles()
Definition
PsdGbtReader-v0.00.cxx:29
PsdDataV000
Definition
PsdGbtDataFormat-v0.00.h:14
PsdDataV000::PsdEventHeaderAB::uMagicWordAB
uint8_t uMagicWordAB
Definition
PsdGbtDataFormat-v0.00.h:24
PsdDataV000::PsdEventHeaderAB::ulMicroSlice
uint64_t ulMicroSlice
Total number of hits.
Definition
PsdGbtDataFormat-v0.00.h:26
PsdDataV000::PsdEventHeaderAB::printout
void printout()
Epoch.
Definition
PsdGbtDataFormat-v0.00.h:28
PsdDataV000::PsdEventHeaderAB::clear
void clear()
Definition
PsdGbtDataFormat-v0.00.h:34
PsdDataV000::PsdEventHeaderAB::HNs
@ HNs
MagicWord size in bits.
Definition
PsdGbtDataFormat-v0.00.h:20
PsdDataV000::PsdEventHeaderAB::MWs
@ MWs
Definition
PsdGbtDataFormat-v0.00.h:19
PsdDataV000::PsdEventHeaderAB::uHitsNumber
uint8_t uHitsNumber
Should be AB.
Definition
PsdGbtDataFormat-v0.00.h:25
PsdDataV000::PsdEventHeaderAC::printout
void printout()
ADC Time of threshold cross from the begining of TS.
Definition
PsdGbtDataFormat-v0.00.h:59
PsdDataV000::PsdEventHeaderAC::MWs
@ MWs
Definition
PsdGbtDataFormat-v0.00.h:48
PsdDataV000::PsdEventHeaderAC::PVs
@ PVs
MagicWord size in bits.
Definition
PsdGbtDataFormat-v0.00.h:49
PsdDataV000::PsdEventHeaderAC::TMs
@ TMs
Empty bits size in bits.
Definition
PsdGbtDataFormat-v0.00.h:51
PsdDataV000::PsdEventHeaderAC::clear
void clear()
Definition
PsdGbtDataFormat-v0.00.h:65
PsdDataV000::PsdEventHeaderAC::uPacketVersion
uint8_t uPacketVersion
Should be AC.
Definition
PsdGbtDataFormat-v0.00.h:55
PsdDataV000::PsdEventHeaderAC::uMagicWordAC
uint8_t uMagicWordAC
Definition
PsdGbtDataFormat-v0.00.h:54
PsdDataV000::PsdEventHeaderAC::uAdcTime
uint32_t uAdcTime
Empty bits.
Definition
PsdGbtDataFormat-v0.00.h:57
PsdDataV000::PsdHitData::WPs
@ WPs
Empty bits size in bits.
Definition
PsdGbtDataFormat-v0.00.h:117
PsdDataV000::PsdHitData::printout
void printout()
Waveform vector.
Definition
PsdGbtDataFormat-v0.00.h:123
PsdDataV000::PsdHitData::clear
void clear()
Definition
PsdGbtDataFormat-v0.00.h:131
PsdDataV000::PsdHitData::uWfm
std::vector< uint16_t > uWfm
Empty bits.
Definition
PsdGbtDataFormat-v0.00.h:121
PsdDataV000::PsdHitHeader::clear
void clear()
Definition
PsdGbtDataFormat-v0.00.h:100
PsdDataV000::PsdHitHeader::uSignalCharge
uint16_t uSignalCharge
Empty bits.
Definition
PsdGbtDataFormat-v0.00.h:90
PsdDataV000::PsdHitHeader::uWfmPoints
uint8_t uWfmPoints
Definition
PsdGbtDataFormat-v0.00.h:87
PsdDataV000::PsdHitHeader::uHitChannel
uint8_t uHitChannel
Total waveform points per hit.
Definition
PsdGbtDataFormat-v0.00.h:88
PsdDataV000::PsdHitHeader::SCs
@ SCs
Empty bits size in bits.
Definition
PsdGbtDataFormat-v0.00.h:83
PsdDataV000::PsdHitHeader::WPSs
@ WPSs
Definition
PsdGbtDataFormat-v0.00.h:80
PsdDataV000::PsdHitHeader::HCs
@ HCs
Waveform points size in bits.
Definition
PsdGbtDataFormat-v0.00.h:81
PsdDataV000::PsdHitHeader::ZLs
@ ZLs
Signal charge size in bits.
Definition
PsdGbtDataFormat-v0.00.h:84
PsdDataV000::PsdHitHeader::uZeroLevel
uint16_t uZeroLevel
Waveform integral above ZeroLevel.
Definition
PsdGbtDataFormat-v0.00.h:91
PsdDataV000::PsdHitHeader::printout
void printout()
Waveform ZeroLevel.
Definition
PsdGbtDataFormat-v0.00.h:93
core
data
raw
PsdGbtReader-v0.00.cxx
Generated on Sun Dec 22 2024 23:04:08 for CbmRoot by
1.12.0