Belle II Software  release-05-01-25
RawFTSWFormat_latest.h
1 //+
2 // File : RawFTSWFormat_latest.h
3 // Description : Module to handle raw data from COPPER
4 //
5 // Author : Satoru Yamada, IPNS, KEK
6 // Date : 7 - Mar - 2016
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  int GetNwordsHeader(int n) OVERRIDE_CPP17;
39 
41  unsigned int GetFTSWNodeID(int n) OVERRIDE_CPP17;
42 
44  unsigned int GetEveNo(int n) OVERRIDE_CPP17;
45 
47  unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17;
48 
50  unsigned int GetTTUtime(int n) OVERRIDE_CPP17;
51 
53  int GetTTCtime(int n) OVERRIDE_CPP17;
54 
56  int GetTRGType(int n) OVERRIDE_CPP17;
57 
59  void GetTTTimeVal(int n, struct timeval* tv) OVERRIDE_CPP17;
60 
62  void GetTTTimeSpec(int n, struct timespec* ts) OVERRIDE_CPP17;
63 
65  unsigned long long int GetTTTimeNs(int n) OVERRIDE_CPP17;
66 
68  unsigned int GetMagicTrailer(int n) OVERRIDE_CPP17;
69 
71  void GetPCTimeVal(int n, struct timeval* tv) OVERRIDE_CPP17;
72 
74  void CheckData(int n,
75  unsigned int prev_evenum, unsigned int* cur_evenum,
76  unsigned int prev_exprunsubrun_no, unsigned int* cur_exprunsubrun_no) OVERRIDE_CPP17;
77 
79  unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17;
80 
82  int GetRunNo(int n) OVERRIDE_CPP17;
83 
84 
86  int GetSubRunNo(int n) OVERRIDE_CPP17;
87 
89  int GetRunNoSubRunNo(int n) OVERRIDE_CPP17;
90 
92  int GetExpNo(int n) OVERRIDE_CPP17;
93 
95  int GetIsHER(int n) OVERRIDE_CPP17;
96 
98  unsigned int GetTimeSinceLastInjection(int n) OVERRIDE_CPP17;
99 
101  unsigned int GetTimeSincePrevTrigger(int n) OVERRIDE_CPP17;
102 
104  unsigned int GetBunchNumber(int n) OVERRIDE_CPP17;
105 
107  unsigned int GetFrameCount(int n) OVERRIDE_CPP17;
108 
110  enum {
111  POS_NWORDS = 0, // same as v.1( late-DESY ver.)
112  POS_HDR_NWORDS = 1, // same as v.1
113  POS_NUMEVE_NUMNODES = 2, // same as v.1
114  POS_EXP_RUN_NO = 3, // same as v.1
115  POS_EVE_NO_1 = 4, // same as v.1
116  POS_NA_1 = 5, // same as v.1
117  POS_NODE_ID = 6, // same as v.1
118  POS_NA_2 = 7 // same as v.1
119  };
120 
122  enum {
123  POS_TT_CTIME_TRGTYPE = 8, // same as v.1
124  POS_TT_UTIME = 9, // same as v.1
125  POS_EVE_NO_2 = 10,
126  POS_FRAME_COUNT = 11,
127  POS_TIME_SINCE_PREV_TRG = 12,
128  POS_INJECTION_INFO = 13,
129  POS_BUNCH_NUM = 14,
130  POS_TVSEC_FROM_PC = 15,
131  POS_TVUSEC_FROM_PC = 16
132  };
133 
135  enum {
136  POS_RSVD_1 = 20, // same as v.1 but position is shifted
137  POS_MAGIC_1 = 21 // same as v.1 but position is shifted
138  };
139 
140  enum {
141  INJ_HER_LER_MASK = 0x80000000,
142  INJ_HER_LER_SHIFT = 31,
143  INJ_TIME_MASK = 0x7FFFFFFF,
144  INJ_TIME_SHIFT = 0,
145  INJ_BUNCH_MASK = 0x000007FF,
146  INJ_BUNCH_SHIFT = 0,
147  EXP_MASK = 0xFFC00000,
148  EXP_SHIFT = 22,
149  RUNNO_MASK = 0x003FFF00,
150  RUNNO_SHIFT = 8,
151  SUBRUNNO_MASK = 0x000000FF,
152  TTCTIME_MASK = 0x7FFFFFF0,
153  TTCTIME_SHIFT = 4,
154  TRGTYPE_MASK = 0xF
155  };
156 
157  enum {
158  SIZE_FTSW_PACKET = 22
159  };
160  //#endif
161 
162  enum {
163  FTSW_MAGIC_TRAILER = 0x7FFF0000
164  };
165 
166  protected :
167 
168  };
169 
170  inline unsigned int RawFTSWFormat_latest::GetExpRunSubrun(int n)
171  {
172  return (unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]);
173 
174  }
175 
176 
178  {
179  return (((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) & RUNNO_MASK)
180  >> RUNNO_SHIFT);
181  }
182 
184  {
185  return (m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ] & SUBRUNNO_MASK);
186  }
187 
189  {
190  return ((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) &
191  (RUNNO_MASK | SUBRUNNO_MASK));
192  }
193 
195  {
196  return (((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) & EXP_MASK)
197  >> EXP_SHIFT);
198  }
199 
201 }
202 
203 #endif
Belle2::RawFTSWFormat_latest::GetTimeSinceLastInjection
unsigned int GetTimeSinceLastInjection(int n) OVERRIDE_CPP17
Get time since the last injection.
Definition: RawFTSWFormat_latest.cc:103
Belle2::RawDataBlockFormat::m_buffer
int * m_buffer
Buffer.
Definition: RawDataBlockFormat.h:98
Belle2::RawDataBlockFormat::GetBufferPos
virtual int GetBufferPos(int n)
get position of data block in word
Definition: RawDataBlockFormat.cc:30
Belle2::RawFTSWFormat_latest::GetTTTimeNs
unsigned long long int GetTTTimeNs(int n) OVERRIDE_CPP17
Get time in ns since epoch from ctime and utime.
Definition: RawFTSWFormat_latest.cc:69
Belle2::RawFTSWFormat_latest::GetTTCtimeTRGType
unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17
Get a word containing ctime and trigger type info.
Definition: RawFTSWFormat_latest.cc:23
Belle2::RawFTSWFormat_latest::~RawFTSWFormat_latest
virtual ~RawFTSWFormat_latest()
Constructor using existing pointer to raw data buffer.
Definition: RawFTSWFormat_latest.cc:18
Belle2::RawFTSWFormat_latest::GetPCTimeVal
void GetPCTimeVal(int n, struct timeval *tv) OVERRIDE_CPP17
Get stored information of getimeofday in a PC.
Definition: RawFTSWFormat_latest.cc:61
Belle2::RawFTSWFormat_latest::GetEveNo
unsigned int GetEveNo(int n) OVERRIDE_CPP17
Get event #.
Definition: RawFTSWFormat_latest.cc:85
Belle2::RawFTSWFormat_latest::GetRunNoSubRunNo
int GetRunNoSubRunNo(int n) OVERRIDE_CPP17
get a word cotaining run # and subrun #
Definition: RawFTSWFormat_latest.h:188
Belle2::RawFTSWFormat_latest::GetFTSWNodeID
unsigned int GetFTSWNodeID(int n) OVERRIDE_CPP17
Get Node # ( should be "TTD " )
Definition: RawFTSWFormat_latest.cc:80
Belle2::RawFTSWFormat_latest::GetTTTimeSpec
void GetTTTimeSpec(int n, struct timespec *ts) OVERRIDE_CPP17
Get timespec from ctime and utime.
Definition: RawFTSWFormat_latest.cc:53
Belle2::RawFTSWFormat_latest::GetExpRunSubrun
unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17
Exp# (10bit) run# (14bit) restart # (8bit)
Definition: RawFTSWFormat_latest.h:170
Belle2::RawFTSWFormat_latest::CheckData
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
Definition: RawFTSWFormat_latest.cc:132
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::RawFTSWFormat_latest::GetTRGType
int GetTRGType(int n) OVERRIDE_CPP17
Get trgtype.
Definition: RawFTSWFormat_latest.cc:35
Belle2::RawFTSWFormat_latest::GetMagicTrailer
unsigned int GetMagicTrailer(int n) OVERRIDE_CPP17
Get magic number for data corruption check.
Definition: RawFTSWFormat_latest.cc:90
Belle2::RawFTSWFormat_latest::GetExpNo
int GetExpNo(int n) OVERRIDE_CPP17
Get Exp #.
Definition: RawFTSWFormat_latest.h:194
Belle2::RawFTSWFormat_latest
The Raw FTSW class 3 ( 2019.8.20 )
Definition: RawFTSWFormat_latest.h:24
Belle2::RawFTSWFormat_latest::GetTTUtime
unsigned int GetTTUtime(int n) OVERRIDE_CPP17
get unixtime of the trigger
Definition: RawFTSWFormat_latest.cc:40
Belle2::RawFTSWFormat
The Raw FTSW class.
Definition: RawFTSWFormat.h:24
Belle2::RawFTSWFormat_latest::GetRunNo
int GetRunNo(int n) OVERRIDE_CPP17
Get run #.
Definition: RawFTSWFormat_latest.h:177
Belle2::RawFTSWFormat_latest::GetFrameCount
unsigned int GetFrameCount(int n) OVERRIDE_CPP17
Get a frame count.
Definition: RawFTSWFormat_latest.cc:124
Belle2::RawFTSWFormat_latest::GetNwordsHeader
int GetNwordsHeader(int n) OVERRIDE_CPP17
Get # of words of header.
Definition: RawFTSWFormat_latest.cc:74
Belle2::RawFTSWFormat_latest::GetSubRunNo
int GetSubRunNo(int n) OVERRIDE_CPP17
Get subrun #.
Definition: RawFTSWFormat_latest.h:183
Belle2::RawFTSWFormat_latest::GetTTCtime
int GetTTCtime(int n) OVERRIDE_CPP17
Get ctime of the trigger.
Definition: RawFTSWFormat_latest.cc:30
Belle2::RawFTSWFormat_latest::GetTTTimeVal
void GetTTTimeVal(int n, struct timeval *tv) OVERRIDE_CPP17
Get timeval from ctime and utime.
Definition: RawFTSWFormat_latest.cc:45
Belle2::RawFTSWFormat_latest::RawFTSWFormat_latest
RawFTSWFormat_latest()
Default constructor.
Definition: RawFTSWFormat_latest.cc:14
Belle2::RawFTSWFormat_latest::GetTimeSincePrevTrigger
unsigned int GetTimeSincePrevTrigger(int n) OVERRIDE_CPP17
Get time since the previous trigger.
Definition: RawFTSWFormat_latest.cc:110
Belle2::RawFTSWFormat_latest::GetBunchNumber
unsigned int GetBunchNumber(int n) OVERRIDE_CPP17
Get a bunch number.
Definition: RawFTSWFormat_latest.cc:117
Belle2::RawFTSWFormat_latest::GetIsHER
int GetIsHER(int n) OVERRIDE_CPP17
HER injection = 1 or LER injection = 0.
Definition: RawFTSWFormat_latest.cc:95