Belle II Software development
RawFTSWFormat_v1.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 RAWFTSWFORMAT_V1_H
10#define RAWFTSWFORMAT_V1_H
11#include <rawdata/dataobjects/RawFTSWFormat.h>
12
13namespace Belle2 {
25 public:
26
30 //RawFTSWFormat_v1(int* bufin, int nwords);
32 virtual ~RawFTSWFormat_v1();
33
34 /* //! Get # of words in this buffer */
35 /* int GetNwords(int n); */
36
38 /* cppcheck-suppress missingOverride */
39 int GetNwordsHeader(int n) OVERRIDE_CPP17;
40
42 /* cppcheck-suppress missingOverride */
43 unsigned int GetFTSWNodeID(int n) OVERRIDE_CPP17;
44
46 /* cppcheck-suppress missingOverride */
47 unsigned int GetEveNo(int n) OVERRIDE_CPP17;
48
50 /* cppcheck-suppress missingOverride */
51 unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17;
52
54 /* cppcheck-suppress missingOverride */
55 unsigned int GetTTUtime(int n) OVERRIDE_CPP17;
56
58 /* cppcheck-suppress missingOverride */
59 int GetTTCtime(int n) OVERRIDE_CPP17;
60
62 /* cppcheck-suppress missingOverride */
63 int GetTRGType(int n) OVERRIDE_CPP17;
64
66 /* cppcheck-suppress missingOverride */
67 void GetTTTimeVal(int n, struct timeval* tv) OVERRIDE_CPP17;
68
70 /* cppcheck-suppress missingOverride */
71 void GetTTTimeSpec(int n, struct timespec* ts) OVERRIDE_CPP17;
72
74 /* cppcheck-suppress missingOverride */
75 unsigned long long int GetTTTimeNs(int n) OVERRIDE_CPP17;
76
78 /* cppcheck-suppress missingOverride */
79 unsigned int GetMagicTrailer(int n) OVERRIDE_CPP17;
80
82 /* cppcheck-suppress missingOverride */
83 void CheckData(int n,
84 unsigned int prev_evenum, unsigned int* cur_evenum,
85 unsigned int prev_exprunsubrun_no, unsigned int* cur_exprunsubrun_no) OVERRIDE_CPP17;
86
88 /* cppcheck-suppress missingOverride */
89 unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17;
90
92 /* cppcheck-suppress missingOverride */
93 int GetRunNo(int n) OVERRIDE_CPP17;
94
95
97 /* cppcheck-suppress missingOverride */
98 int GetSubRunNo(int n) OVERRIDE_CPP17;
99
101 /* cppcheck-suppress missingOverride */
102 int GetRunNoSubRunNo(int n) OVERRIDE_CPP17;
103
105 /* cppcheck-suppress missingOverride */
106 int GetExpNo(int n) OVERRIDE_CPP17;
107
109 /* cppcheck-suppress missingOverride */
110 int Get15bitTLUTag(int n) OVERRIDE_CPP17;
111
112 enum {
113 POS_NWORDS = 0,
114 POS_HDR_NWORDS = 1,
115 POS_NUMEVE_NUMNODES = 2,
116 POS_EXP_RUN_NO = 3,
117 POS_EVE_NO = 4,
118 POS_NA_1 = 5,
119 POS_NODE_ID = 6,
120 POS_NA_2 = 7,
121 POS_TT_CTIME_TRGTYPE = 8,
122 POS_TT_UTIME = 9,
123 POS_FTSW_3 = 10,
124 POS_FTSW_4 = 11,
125 POS_RSVD_1 = 12,
126 POS_MAGIC_1 = 13
127 };
128
129 enum {
130 EXP_MASK = 0xFFC00000,
131 EXP_SHIFT = 22,
132 RUNNO_MASK = 0x003FFF00,
133 RUNNO_SHIFT = 8,
134 SUBRUNNO_MASK = 0x000000FF,
135 TTCTIME_MASK = 0x7FFFFFF0,
136 TTCTIME_SHIFT = 4,
137 TRGTYPE_MASK = 0xF
138 };
139
140 enum {
141 SIZE_FTSW_PACKET = 14
142 };
143 //#endif
144
145 enum {
146 FTSW_MAGIC_TRAILER = 0x7FFF0000
147 };
148
149 protected :
150
151 };
152
153 inline unsigned int RawFTSWFormat_v1::GetExpRunSubrun(int n)
154 {
155 return (unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]);
156
157 }
158
159
161 {
162 return (((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) & RUNNO_MASK)
163 >> RUNNO_SHIFT);
164 }
165
167 {
168 return (m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ] & SUBRUNNO_MASK);
169 }
170
172 {
173 return ((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) &
174 (RUNNO_MASK | SUBRUNNO_MASK));
175 }
176
178 {
179 return (((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) & EXP_MASK)
180 >> EXP_SHIFT);
181 }
182
184}
185
186#endif
virtual int GetBufferPos(int n)
get position of data block in word
The Raw FTSW class ver.1 .
int GetTTCtime(int n) OVERRIDE_CPP17
Get ctime of the trigger.
unsigned int GetEveNo(int n) OVERRIDE_CPP17
Get event #.
void GetTTTimeSpec(int n, struct timespec *ts) OVERRIDE_CPP17
Get timespec from ctime and utime.
RawFTSWFormat_v1()
Default constructor.
int GetTRGType(int n) OVERRIDE_CPP17
Get trgtype.
unsigned int GetMagicTrailer(int n) OVERRIDE_CPP17
Get magic number for data corruption check.
int Get15bitTLUTag(int n) OVERRIDE_CPP17
DESY test only.
void GetTTTimeVal(int n, struct timeval *tv) OVERRIDE_CPP17
Get timeval from ctime and utime.
int GetNwordsHeader(int n) OVERRIDE_CPP17
Get # of words of header.
virtual ~RawFTSWFormat_v1()
Constructor using existing pointer to raw data buffer.
unsigned int GetTTUtime(int n) OVERRIDE_CPP17
get unixtime of the trigger
unsigned int GetFTSWNodeID(int n) OVERRIDE_CPP17
Get Node # ( should be "TTD " )
unsigned long long int GetTTTimeNs(int n) OVERRIDE_CPP17
Get time in ns since epoch from ctime and utime.
unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17
Get a word containing ctime and trigger type info.
void CheckData(int n, unsigned int prev_evenum, unsigned int *cur_evenum, unsigned int prev_exprunsubrun_no, unsigned int *cur_exprunsubrun_no) OVERRIDE_CPP17
check the data contents
The Raw FTSW class.
Definition: RawFTSWFormat.h:24
unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17
Exp# (10bit) run# (14bit) restart # (8bit)
int GetExpNo(int n) OVERRIDE_CPP17
Get Exp #.
int GetRunNo(int n) OVERRIDE_CPP17
Get run #.
int GetRunNoSubRunNo(int n) OVERRIDE_CPP17
get a word cotaining run # and subrun #
int GetSubRunNo(int n) OVERRIDE_CPP17
Get subrun #.
Abstract base class for different kinds of events.