Belle II Software  release-08-01-10
RawFTSWFormat_latest.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_LATEST_H
10 #define RAWFTSWFORMAT_LATEST_H
11 #include <rawdata/dataobjects/RawFTSWFormat.h>
12 
13 namespace Belle2 {
25  public:
26 
30  //RawFTSWFormat_latest(int* bufin, int nwords);
32  virtual ~RawFTSWFormat_latest();
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 GetPCTimeVal(int n, struct timeval* tv) OVERRIDE_CPP17;
84 
86  /* cppcheck-suppress missingOverride */
87  void CheckData(int n,
88  unsigned int prev_evenum, unsigned int* cur_evenum,
89  unsigned int prev_exprunsubrun_no, unsigned int* cur_exprunsubrun_no) OVERRIDE_CPP17;
90 
92  /* cppcheck-suppress missingOverride */
93  unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17;
94 
96  /* cppcheck-suppress missingOverride */
97  int GetRunNo(int n) OVERRIDE_CPP17;
98 
99 
101  /* cppcheck-suppress missingOverride */
102  int GetSubRunNo(int n) OVERRIDE_CPP17;
103 
105  /* cppcheck-suppress missingOverride */
106  int GetRunNoSubRunNo(int n) OVERRIDE_CPP17;
107 
109  /* cppcheck-suppress missingOverride */
110  int GetExpNo(int n) OVERRIDE_CPP17;
111 
113  /* cppcheck-suppress missingOverride */
114  int GetIsHER(int n) OVERRIDE_CPP17;
115 
117  /* cppcheck-suppress missingOverride */
118  unsigned int GetTimeSinceLastInjection(int n) OVERRIDE_CPP17;
119 
121  /* cppcheck-suppress missingOverride */
122  unsigned int GetTimeSincePrevTrigger(int n) OVERRIDE_CPP17;
123 
125  /* cppcheck-suppress missingOverride */
126  unsigned int GetBunchNumber(int n) OVERRIDE_CPP17;
127 
129  /* cppcheck-suppress missingOverride */
130  unsigned int GetFrameCount(int n) OVERRIDE_CPP17;
131 
133  enum {
134  POS_NWORDS = 0, // same as v.1( late-DESY ver.)
135  POS_HDR_NWORDS = 1, // same as v.1
136  POS_NUMEVE_NUMNODES = 2, // same as v.1
137  POS_EXP_RUN_NO = 3, // same as v.1
138  POS_EVE_NO_1 = 4, // same as v.1
139  POS_NA_1 = 5, // same as v.1
140  POS_NODE_ID = 6, // same as v.1
141  POS_NA_2 = 7 // same as v.1
142  };
143 
145  enum {
146  POS_TT_CTIME_TRGTYPE = 8, // same as v.1
147  POS_TT_UTIME = 9, // same as v.1
148  POS_EVE_NO_2 = 10,
149  POS_FRAME_COUNT = 11,
150  POS_TIME_SINCE_PREV_TRG = 12,
151  POS_INJECTION_INFO = 13,
152  POS_BUNCH_NUM = 14,
153  POS_TVSEC_FROM_PC = 15,
154  POS_TVUSEC_FROM_PC = 16
155  };
156 
158  enum {
159  POS_RSVD_1 = 20, // same as v.1 but position is shifted
160  POS_MAGIC_1 = 21 // same as v.1 but position is shifted
161  };
162 
163  enum {
164  INJ_HER_LER_MASK = 0x80000000,
165  INJ_HER_LER_SHIFT = 31,
166  INJ_TIME_MASK = 0x7FFFFFFF,
167  INJ_TIME_SHIFT = 0,
168  INJ_BUNCH_MASK = 0x000007FF,
169  INJ_BUNCH_SHIFT = 0,
170  EXP_MASK = 0xFFC00000,
171  EXP_SHIFT = 22,
172  RUNNO_MASK = 0x003FFF00,
173  RUNNO_SHIFT = 8,
174  SUBRUNNO_MASK = 0x000000FF,
175  TTCTIME_MASK = 0x7FFFFFF0,
176  TTCTIME_SHIFT = 4,
177  TRGTYPE_MASK = 0xF
178  };
179 
180  enum {
181  SIZE_FTSW_PACKET = 22
182  };
183  //#endif
184 
185  enum {
186  FTSW_MAGIC_TRAILER = 0x7FFF0000
187  };
188 
189  protected :
190 
191  };
192 
193  inline unsigned int RawFTSWFormat_latest::GetExpRunSubrun(int n)
194  {
195  return (unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]);
196 
197  }
198 
199 
201  {
202  return (((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) & RUNNO_MASK)
203  >> RUNNO_SHIFT);
204  }
205 
207  {
208  return (m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ] & SUBRUNNO_MASK);
209  }
210 
212  {
213  return ((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) &
214  (RUNNO_MASK | SUBRUNNO_MASK));
215  }
216 
218  {
219  return (((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) & EXP_MASK)
220  >> EXP_SHIFT);
221  }
222 
224 }
225 
226 #endif
virtual int GetBufferPos(int n)
get position of data block in word
The Raw FTSW class 3 ( 2019.8.20 )
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.
virtual ~RawFTSWFormat_latest()
Constructor using existing pointer to raw data buffer.
int GetNwordsHeader(int n) OVERRIDE_CPP17
Get # of words of header.
RawFTSWFormat_latest()
Default constructor.
unsigned int GetBunchNumber(int n) OVERRIDE_CPP17
Get a bunch number.
unsigned int GetTTUtime(int n) OVERRIDE_CPP17
get unixtime of the trigger
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.
void GetPCTimeVal(int n, struct timeval *tv) OVERRIDE_CPP17
Get stored information of getimeofday in a PC.
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.