Belle II Software development
RawFTSW.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#ifndef RAWFTSW_H
10#define RAWFTSW_H
11
12// Includes
13#include <rawdata/dataobjects/RawDataBlock.h>
14#include <rawdata/dataobjects/RawFTSWFormat.h>
15#include <rawdata/dataobjects/RawFTSWFormat_v1.h>
16#include <rawdata/dataobjects/RawFTSWFormat_v2.h>
17#include <rawdata/dataobjects/RawFTSWFormat_latest.h>
18
19namespace Belle2 {
30 class RawFTSW : public RawDataBlock {
31 public:
33 RawFTSW();
34
36 //RawFTSW(int* bufin, int nwords);
38 virtual ~RawFTSW();
39
41 /* cppcheck-suppress missingOverride */
42 void SetBuffer(int* bufin, int nwords, int delete_flag, int num_events, int num_nodes) OVERRIDE_CPP17;
43
45 void SetVersion();
46
49
51 int GetNwordsHeader(int n)
52 {
54 return m_access->GetNwordsHeader(n);
55 }
56
58 unsigned int GetFTSWNodeID(int n)
59 {
61 return m_access->GetFTSWNodeID(n);
62 }
63
65 unsigned int GetEveNo(int n)
66 {
68 return m_access->GetEveNo(n);
69 }
70
72 unsigned int GetTTCtimeTRGType(int n)
73 {
75 return m_access->GetTTCtimeTRGType(n);
76 }
77
79 unsigned int GetTTUtime(int n)
80 {
82 return m_access->GetTTUtime(n);
83 }
84
86 int GetTTCtime(int n)
87 {
89 return m_access->GetTTCtime(n);
90 }
91
93 int GetTRGType(int n)
94 {
96 return m_access->GetTRGType(n);
97 }
98
100 void GetTTTimeVal(int n, struct timeval* tv)
101 {
103 return m_access->GetTTTimeVal(n, tv);
104 }
105
107 void GetPCTimeVal(int n, struct timeval* tv)
108 {
110 return m_access->GetPCTimeVal(n, tv);
111 }
112
114 unsigned int GetMagicTrailer(int n)
115 {
117 return m_access->GetMagicTrailer(n);
118 }
119
121 void CheckData(int n,
122 unsigned int prev_evenum, unsigned int* cur_evenum,
123 unsigned int prev_exprunsubrun_no, unsigned int* cur_exprunsubrun_no)
124 {
126 return m_access->CheckData(n, prev_evenum, cur_evenum, prev_exprunsubrun_no, cur_exprunsubrun_no);
127 }
128
130 unsigned int GetExpRunSubrun(int n)
131 {
133 return m_access->GetExpRunSubrun(n);
134 }
135
137 int GetRunNo(int n)
138 {
140 return m_access->GetRunNo(n);
141 }
142
143
145 int GetSubRunNo(int n)
146 {
148 return m_access->GetSubRunNo(n);
149 }
150
153 {
155 return m_access->GetRunNoSubRunNo(n);
156 }
157
159 int GetExpNo(int n)
160 {
162 return m_access->GetExpNo(n);
163 }
164
166 int Get15bitTLUTag(int n)
167 {
169 return m_access->Get15bitTLUTag(n);
170 }
171
173 int GetIsHER(int n)
174 {
176 return m_access->GetIsHER(n);
177 }
178
180 unsigned int GetTimeSinceLastInjection(int n)
181 {
184 }
185
187 unsigned int GetTimeSincePrevTrigger(int n)
188 {
191 }
192
194 unsigned int GetBunchNumber(int n)
195 {
197 return m_access->GetBunchNumber(n);
198 }
199
201 unsigned int GetFrameCount(int n)
202 {
204 return m_access->GetFrameCount(n);
205 }
206
207 enum {
217 POS_NODE_FORMAT_ID = 6, // Position of format ID in header
218 FTSW_FORMAT_MASK = 0x000000FF,
219
220 FORMAT_ID_VER_0TO2 = 0x54544420,
221 FORMAT_ID_VER_0TO3 = 0x54544431,
222
223 POS_HEADER_SIZE = 1,
224 // header size is used to distinguish different version number for ver. 0, 1, and 2
226 VER_1_HEADER_SIZE = 0, // ! Unpacker for ver.1(late DESY version) is available but it is unlikely for a user to read this ver. Until there is a request to read ver.1, it is closed.
227 VER_2_HEADER_SIZE = 8,
228 VER_3_HEADER_SIZE = 8
229 };
230
233
235 int m_version = -1;
236
237 protected :
245 };
246
248 {
249 if (m_version < 0 || m_access == NULL) {
250 // Since both ver.0, 1 and ver.2 will show m_buffer[ POS_NODE_ID ] & FORMAT_MASK == 0x0, I need to ignore the check for ver.0 and 1
251 SetVersion();
252 }
254 }
255
257}
258
259#endif
virtual void SetBuffer(int *bufin, int nwords, int delete_flag, int num_events, int num_nodes)
set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
The RawDataBlock class Base class for rawdata handling.
Definition: RawDataBlock.h:27
int m_num_events
number of events in this object
Definition: RawDataBlock.h:151
int m_num_nodes
number of nodes in this object
Definition: RawDataBlock.h:148
int * m_buffer
Buffer.
Definition: RawDataBlock.h:154
int m_nwords
do not record
Definition: RawDataBlock.h:145
The Raw FTSW class.
Definition: RawFTSWFormat.h:24
virtual int GetIsHER(int n)
HER injection = 1 or LER injection = 0.
virtual unsigned int GetEveNo(int n)=0
Get event #.
virtual void GetPCTimeVal(int n, struct timeval *tv)
Get stored information of getimeofday in a PC.
virtual unsigned int GetFrameCount(int n)
Get a frame count.
virtual unsigned int GetTimeSinceLastInjection(int n)
Get time since the last injection.
virtual int GetTRGType(int n)=0
Get trgtype.
virtual int GetExpNo(int n)=0
Get Exp #.
virtual int GetRunNoSubRunNo(int n)=0
get a word cotaining run # and subrun #
virtual unsigned int GetMagicTrailer(int n)=0
Get magic number for data corruption check.
virtual void CheckData(int n, unsigned int prev_evenum, unsigned int *cur_evenum, unsigned int prev_exprunsubrun_no, unsigned int *cur_exprunsubrun_no)=0
check the data contents
virtual int Get15bitTLUTag(int n)
DESY test only (ver.1)
virtual unsigned int GetExpRunSubrun(int n)=0
Exp# (10bit) run# (14bit) restart # (8bit)
virtual int GetTTCtime(int n)=0
Get ctime of the trigger.
virtual unsigned int GetTTUtime(int n)=0
get unixtime of the trigger
virtual unsigned int GetTimeSincePrevTrigger(int n)
Get time since the previous trigger.
virtual void GetTTTimeVal(int n, struct timeval *tv)=0
Get timeval from ctime and utime.
virtual unsigned int GetFTSWNodeID(int n)=0
Get Node # ( should be "TTD " )
virtual unsigned int GetTTCtimeTRGType(int n)=0
Get a word containing ctime and trigger type info.
virtual int GetSubRunNo(int n)=0
Get subrun #.
virtual unsigned int GetBunchNumber(int n)
Get a bunch number.
virtual int GetNwordsHeader(int n)=0
Get # of words of header.
virtual int GetRunNo(int n)=0
Get run #.
The Raw FTSW class.
Definition: RawFTSW.h:30
unsigned int GetTTCtimeTRGType(int n)
Get a word containing ctime and trigger type info.
Definition: RawFTSW.h:72
void SetVersion()
read data, detect and set the version number of the data format
Definition: RawFTSW.cc:25
int GetIsHER(int n)
HER injection = 1 or LER injection = 0.
Definition: RawFTSW.h:173
RawFTSW()
Default constructor.
Definition: RawFTSW.cc:13
int GetExpNo(int n)
Get Exp #.
Definition: RawFTSW.h:159
unsigned int GetExpRunSubrun(int n)
Exp# (10bit) run# (14bit) restart # (8bit)
Definition: RawFTSW.h:130
void GetPCTimeVal(int n, struct timeval *tv)
Get timeval obtained from gettimeval()
Definition: RawFTSW.h:107
unsigned int GetFTSWNodeID(int n)
Get Node # ( should be "TTD " )
Definition: RawFTSW.h:58
unsigned int GetFrameCount(int n)
Get a frame count.
Definition: RawFTSW.h:201
unsigned int GetTimeSinceLastInjection(int n)
Get time since the last injection.
Definition: RawFTSW.h:180
unsigned int GetEveNo(int n)
Get event #.
Definition: RawFTSW.h:65
unsigned int GetTTUtime(int n)
get unixtime of the trigger
Definition: RawFTSW.h:79
virtual ~RawFTSW()
Constructor using existing pointer to raw data buffer.
Definition: RawFTSW.cc:19
int GetRunNoSubRunNo(int n)
get a word cotaining run # and subrun #
Definition: RawFTSW.h:152
int GetSubRunNo(int n)
Get subrun #.
Definition: RawFTSW.h:145
int Get15bitTLUTag(int n)
DESY test only.
Definition: RawFTSW.h:166
@ POS_NODE_FORMAT_ID
Added to distinguish different version.
Definition: RawFTSW.h:217
@ VER_1_HEADER_SIZE
Unpacker for ver.0(early DESY version) is not available.
Definition: RawFTSW.h:226
@ VER_0_HEADER_SIZE
The same number of this information must appear in RawFTSWFormat*.h. Information should be placed in ...
Definition: RawFTSW.h:225
ClassDefOverride(RawFTSW, 2)
do not record
int GetNwordsHeader(int n)
Get # of words of header.
Definition: RawFTSW.h:51
unsigned int GetMagicTrailer(int n)
Get magic number for data corruption check.
Definition: RawFTSW.h:114
RawFTSWFormat * m_access
class to access
Definition: RawFTSW.h:232
unsigned int GetTimeSincePrevTrigger(int n)
Get time since the previous trigger.
Definition: RawFTSW.h:187
int m_version
do not record
Definition: RawFTSW.h:235
void GetTTTimeVal(int n, struct timeval *tv)
Get timeval from ctime and utime.
Definition: RawFTSW.h:100
int GetTTCtime(int n)
Get ctime of the trigger.
Definition: RawFTSW.h:86
unsigned int GetBunchNumber(int n)
Get a bunch number.
Definition: RawFTSW.h:194
void SetBuffer(int *bufin, int nwords, int delete_flag, int num_events, int num_nodes) OVERRIDE_CPP17
set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
Definition: RawFTSW.cc:107
int GetTRGType(int n)
Get trgtype.
Definition: RawFTSW.h:93
void CheckData(int n, unsigned int prev_evenum, unsigned int *cur_evenum, unsigned int prev_exprunsubrun_no, unsigned int *cur_exprunsubrun_no)
check the data contents
Definition: RawFTSW.h:121
int GetRunNo(int n)
Get run #.
Definition: RawFTSW.h:137
void CheckVersionSetBuffer()
Check the version number of data format.
Definition: RawFTSW.h:247
Abstract base class for different kinds of events.