Belle II Software development
RawFTSWFormat_v2.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_V2_H
10#define RAWFTSWFORMAT_V2_H
11#include <rawdata/dataobjects/RawFTSWFormat.h>
12#include "rawdata/switch_basf2_standalone.h"
13
14namespace Belle2 {
26 public:
27
31 //RawFTSWFormat_v2(int* bufin, int nwords);
33 virtual ~RawFTSWFormat_v2();
34
35 /* //! Get # of words in this buffer */
36 /* int GetNwords(int n); */
37
39 /* cppcheck-suppress missingOverride */
40 int GetNwordsHeader(int n) OVERRIDE_CPP17;
41
43 /* cppcheck-suppress missingOverride */
44 unsigned int GetFTSWNodeID(int n) OVERRIDE_CPP17;
45
47 /* cppcheck-suppress missingOverride */
48 unsigned int GetEveNo(int n) OVERRIDE_CPP17;
49
51 /* cppcheck-suppress missingOverride */
52 unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17;
53
55 /* cppcheck-suppress missingOverride */
56 unsigned int GetTTUtime(int n) OVERRIDE_CPP17;
57
59 /* cppcheck-suppress missingOverride */
60 int GetTTCtime(int n) OVERRIDE_CPP17;
61
63 /* cppcheck-suppress missingOverride */
64 int GetTRGType(int n) OVERRIDE_CPP17;
65
67 /* cppcheck-suppress missingOverride */
68 void GetTTTimeVal(int n, struct timeval* tv) OVERRIDE_CPP17;
69
71 /* cppcheck-suppress missingOverride */
72 void GetTTTimeSpec(int n, struct timespec* ts) OVERRIDE_CPP17;
73
75 /* cppcheck-suppress missingOverride */
76 unsigned long long int GetTTTimeNs(int n) OVERRIDE_CPP17;
77
79 /* cppcheck-suppress missingOverride */
80 unsigned int GetMagicTrailer(int n) OVERRIDE_CPP17;
81
82
83
85 /* cppcheck-suppress missingOverride */
86 void CheckData(int n,
87 unsigned int prev_evenum, unsigned int* cur_evenum,
88 unsigned int prev_exprunsubrun_no, unsigned int* cur_exprunsubrun_no) OVERRIDE_CPP17;
89
91 /* cppcheck-suppress missingOverride */
92 unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17;
93
95 /* cppcheck-suppress missingOverride */
96 int GetRunNo(int n) OVERRIDE_CPP17;
97
98
100 /* cppcheck-suppress missingOverride */
101 int GetSubRunNo(int n) OVERRIDE_CPP17;
102
104 /* cppcheck-suppress missingOverride */
105 int GetRunNoSubRunNo(int n) OVERRIDE_CPP17;
106
108 /* cppcheck-suppress missingOverride */
109 int GetExpNo(int n) OVERRIDE_CPP17;
110
112 /* cppcheck-suppress missingOverride */
113 int GetIsHER(int n) OVERRIDE_CPP17;
114
116 /* cppcheck-suppress missingOverride */
117 unsigned int GetTimeSinceLastInjection(int n) OVERRIDE_CPP17;
118
120 /* cppcheck-suppress missingOverride */
121 unsigned int GetTimeSincePrevTrigger(int n) OVERRIDE_CPP17;
122
124 /* cppcheck-suppress missingOverride */
125 unsigned int GetBunchNumber(int n) OVERRIDE_CPP17;
126
128 /* cppcheck-suppress missingOverride */
129 unsigned int GetFrameCount(int n) OVERRIDE_CPP17;
130
132 enum {
133 POS_NWORDS = 0, // same as v.1( late-DESY ver.)
134 POS_HDR_NWORDS = 1, // same as v.1
135 POS_NUMEVE_NUMNODES = 2, // same as v.1
136 POS_EXP_RUN_NO = 3, // same as v.1
137 POS_EVE_NO_1 = 4, // same as v.1
138 POS_NA_1 = 5, // same as v.1
139 POS_NODE_ID = 6, // same as v.1
140 POS_NA_2 = 7 // same as v.1
141 };
142
144 enum {
145 POS_TT_CTIME_TRGTYPE = 8, // same as v.1
146 POS_TT_UTIME = 9, // same as v.1
147 POS_EVE_NO_2 = 10,
148 POS_FRAME_COUNT = 11,
149 POS_TIME_SINCE_PREV_TRG = 12,
150 POS_INJECTION_INFO = 13,
151 POS_BUNCH_NUM = 14
152 };
153
155 enum {
156 POS_RSVD_1 = 20, // same as v.1 but position is shifted
157 POS_MAGIC_1 = 21 // same as v.1 but position is shifted
158 };
159
160 enum {
161 INJ_HER_LER_MASK = 0x80000000,
162 INJ_HER_LER_SHIFT = 31,
163 INJ_TIME_MASK = 0x7FFFFFFF,
164 INJ_TIME_SHIFT = 0,
165 INJ_BUNCH_MASK = 0x000007FF,
166 INJ_BUNCH_SHIFT = 0,
167 EXP_MASK = 0xFFC00000,
168 EXP_SHIFT = 22,
169 RUNNO_MASK = 0x003FFF00,
170 RUNNO_SHIFT = 8,
171 SUBRUNNO_MASK = 0x000000FF,
172 TTCTIME_MASK = 0x7FFFFFF0,
173 TTCTIME_SHIFT = 4,
174 TRGTYPE_MASK = 0xF
175 };
176
177 enum {
178 SIZE_FTSW_PACKET = 22
179 };
180 //#endif
181
182 enum {
183 FTSW_MAGIC_TRAILER = 0x7FFF0000
184 };
185
186 protected :
187
188 };
189
190 inline unsigned int RawFTSWFormat_v2::GetExpRunSubrun(int n)
191 {
192 return (unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]);
193
194 }
195
196
198 {
199 return (((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) & RUNNO_MASK)
200 >> RUNNO_SHIFT);
201 }
202
204 {
205 return (m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ] & SUBRUNNO_MASK);
206 }
207
209 {
210 return ((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) &
211 (RUNNO_MASK | SUBRUNNO_MASK));
212 }
213
215 {
216 return (((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) & EXP_MASK)
217 >> EXP_SHIFT);
218 }
219
221}
222
223#endif
virtual int GetBufferPos(int n)
get position of data block in word
The Raw FTSW class ver.2 .
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.
int GetTRGType(int n) OVERRIDE_CPP17
Get trgtype.
unsigned int GetMagicTrailer(int n) OVERRIDE_CPP17
Get magic number for data corruption check.
void GetTTTimeVal(int n, struct timeval *tv) OVERRIDE_CPP17
Get timeval from ctime and utime.
unsigned int GetTimeSinceLastInjection(int n) OVERRIDE_CPP17
Get time since the last injection.
int GetNwordsHeader(int n) OVERRIDE_CPP17
Get # of words of header.
unsigned int GetBunchNumber(int n) OVERRIDE_CPP17
Get a bunch number.
RawFTSWFormat_v2()
Default constructor.
unsigned int GetTTUtime(int n) OVERRIDE_CPP17
get unixtime of the trigger
virtual ~RawFTSWFormat_v2()
Constructor using existing pointer to raw data buffer.
unsigned int GetTimeSincePrevTrigger(int n) OVERRIDE_CPP17
Get time since the previous trigger.
unsigned int GetFrameCount(int n) OVERRIDE_CPP17
Get a frame count.
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
int GetIsHER(int n) OVERRIDE_CPP17
HER injection = 1 or LER injection = 0.
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.