Belle II Software  release-05-02-19
RawCOPPERFormat_v1.h
1 //+
2 // File : RawCOPPERFormat_v1.h
3 // Description : Module to handle raw data from COPPER
4 //
5 // Author : Satoru Yamada, IPNS, KEK
6 // Date : 2 - Aug - 2013
7 //-
8 
9 #ifndef RAWCOPPERFORMAT_V1_H
10 #define RAWCOPPERFORMAT_V1_H
11 
12 // Includes
13 #include <rawdata/dataobjects/RawCOPPERFormat.h>
14 #include <rawdata/dataobjects/RawHeader_v1.h>
15 #include <rawdata/dataobjects/RawTrailer_v1.h>
16 #include <rawdata/CRCCalculator.h>
17 
18 /* #include <framework/datastore/DataStore.h> */
19 /* #include <TObject.h> */
20 
21 //#define USE_B2LFEE_FORMAT_BOTH_VER1_AND_2
22 
23 
24 namespace Belle2 {
36  public:
39 
41  //RawCOPPERFormat_v1(int* bufin, int nwords);
43  virtual ~RawCOPPERFormat_v1();
44 
45  //
46  // Get position of or pointer to data
47  //
49  // POINTER TO "DETECTOR BUFFER"
50  //( after removing "B2link headers" from "FINESSE buffer". THIS IS THE RAW DATA FROM A DETECTOR
52 
53 
55  int Get1stDetectorNwords(int n) OVERRIDE_CPP17;
56 
58  int Get2ndDetectorNwords(int n) OVERRIDE_CPP17;
59 
61  int Get3rdDetectorNwords(int n) OVERRIDE_CPP17;
62 
64  int Get4thDetectorNwords(int n) OVERRIDE_CPP17;
65 
67 
69  int* GetRawTrlBufPtr(int n) OVERRIDE_CPP17;
70 
71  //
72  // Get information from "RawCOPPERFormat_v1 header" attached by DAQ software
73  //
74 
75  int GetExpNo(int n) OVERRIDE_CPP17;
76 
77  unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17;
78 
79  int GetRunNo(int n) OVERRIDE_CPP17;
80 
81  int GetSubRunNo(int n) OVERRIDE_CPP17;
82 
83  unsigned int GetEveNo(int n) OVERRIDE_CPP17;
84 
85  int GetDataType(int n) OVERRIDE_CPP17;
86 
87  int GetTruncMask(int n) OVERRIDE_CPP17;
88 
90  unsigned int GetErrorBitFlag(int n) OVERRIDE_CPP17;
91 
93  void AddErrorBitFlag(int n, unsigned int error_bit_flag) OVERRIDE_CPP17;
94 
96  unsigned int GetNodeID(int n) OVERRIDE_CPP17;
97 
98  //
99  // Get information from 13words "COPPER header" attached by COPPER board
100  //
101 
103  virtual int GetNumFINESSEBlock(int n) OVERRIDE_CPP17;
104 
106  int Get1stFINESSENwords(int n) OVERRIDE_CPP17;
107 
109  int Get2ndFINESSENwords(int n) OVERRIDE_CPP17;
110 
112  int Get3rdFINESSENwords(int n) OVERRIDE_CPP17;
113 
115  int Get4thFINESSENwords(int n) OVERRIDE_CPP17;
116 
117  //
118  // Get information from "B2link(attached by FEE and HLSB) header"
119  //
121  // virtual int* GetFTSW2Words(int n);
122 
123 #ifdef USE_B2LFEE_FORMAT_BOTH_VER1_AND_2
124  void CheckB2LFEEHeaderVersion(int n) OVERRIDE_CPP17;
126 #endif
127 
129  unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17;
130 
132  unsigned int GetTTUtime(int n) OVERRIDE_CPP17;
133 
134  /* //! calc COPPER driver's checksum value */
135  /* virtual unsigned int CalcDriverChkSum(int n) = 0; */
136 
137 
139  int GetTTCtime(int n) OVERRIDE_CPP17;
140 
142  int GetTRGType(int n) OVERRIDE_CPP17;
143 
145  void GetTTTimeVal(int n, struct timeval* tv) OVERRIDE_CPP17;
146 
148  /* cppcheck-suppress missingOverride */
149  int GetMaxNumOfCh(int n) OVERRIDE_CPP17;
150 
152  enum {
153  DATA_FORMAT_VERSION = 1
154  };
155 
158 
161 
162 
163  protected :
165  // ClassDefOverride(RawCOPPERFormat_v1, 2);
166  };
167 
168 
169 
170 
172  {
173  int pos_nwords;
174  if (n == (m_num_events * m_num_nodes) - 1) {
175  pos_nwords = m_nwords - tmp_trailer.GetTrlNwords();
176  } else {
177  pos_nwords = GetBufferPos(n + 1) - tmp_trailer.GetTrlNwords();
178  }
179  return &(m_buffer[ pos_nwords ]);
180  }
181 
183  {
185  return tmp_header.GetExpNo();
186  }
187 
188  inline unsigned int RawCOPPERFormat_v1::GetExpRunSubrun(int n)
189  {
191  return tmp_header.GetExpRunSubrun();
192  }
193 
195  {
197  return tmp_header.GetRunNo();
198  }
199 
200 
202  {
204  return tmp_header.GetSubRunNo();
205  }
206 
207  inline unsigned int RawCOPPERFormat_v1::GetEveNo(int n)
208  {
210  return tmp_header.GetEveNo();
211  }
212 
213 
214  inline unsigned int RawCOPPERFormat_v1::GetNodeID(int n)
215  {
217  return tmp_header.GetNodeID();
218  }
219 
220 
222  {
224  return tmp_header.GetDataType();
225  }
226 
228  {
230  return tmp_header.GetTruncMask();
231  }
232 
233  inline unsigned int RawCOPPERFormat_v1::GetErrorBitFlag(int n)
234  {
236  return tmp_header.GetErrorBitFlag();
237  }
238 
239  inline void RawCOPPERFormat_v1::AddErrorBitFlag(int n, unsigned int error_bit_flag)
240  {
242  tmp_header.AddErrorBitFlag(error_bit_flag);
243  return;
244  }
245 
247  {
248  return GetDetectorNwords(n, 0);
249  }
250 
252  {
253  return GetDetectorNwords(n, 1);
254  }
255 
257  {
258  return GetDetectorNwords(n, 2);
259  }
260 
262  {
263  return GetDetectorNwords(n, 3);
264  }
265 
266 
267 
269  {
270  return GetFINESSENwords(n, 0);
271  }
272 
274  {
275  return GetFINESSENwords(n, 1);
276  }
277 
279  {
280  return GetFINESSENwords(n, 2);
281  }
282 
284  {
285  return GetFINESSENwords(n, 3);
286  }
287 
288 
289 
290  inline unsigned int RawCOPPERFormat_v1::GetTTCtimeTRGType(int n)
291  {
293  return tmp_header.GetTTCtimeTRGType();
294  }
295 
296  inline unsigned int RawCOPPERFormat_v1::GetTTUtime(int n)
297  {
299  return tmp_header.GetTTUtime();
300  }
301 
303  {
305  return tmp_header.GetTTCtime();
306  }
307 
309  {
311  return tmp_header.GetTRGType();
312  }
313 
314  inline void RawCOPPERFormat_v1::GetTTTimeVal(int n, struct timeval* tv)
315  {
318  return ;
319  }
320 
321  inline int RawCOPPERFormat_v1::GetMaxNumOfCh(int/* n */)
322  {
323  return MAX_COPPER_CH;
324  }
326 }
327 #endif
Belle2::RawCOPPERFormat_v1::GetTRGType
int GetTRGType(int n) OVERRIDE_CPP17
Get trgtype.
Definition: RawCOPPERFormat_v1.h:308
Belle2::RawHeader_v1::GetDataType
int GetDataType()
get contents of header
Definition: RawHeader_v1.h:392
Belle2::RawCOPPERFormat::GetDetectorNwords
virtual int GetDetectorNwords(int n, int finesse_num)=0
set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
Belle2::RawHeader_v1::GetRunNo
int GetRunNo()
get contents of header
Definition: RawHeader_v1.h:360
Belle2::RawDataBlockFormat::m_nwords
int m_nwords
number of words of buffer
Definition: RawDataBlockFormat.h:89
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::RawHeader_v1
The Raw Header class ver.1 ( the latest version since May, 2014 ) This class defines the format of th...
Definition: RawHeader_v1.h:31
Belle2::RawCOPPERFormat_v1::Get1stFINESSENwords
int Get1stFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot A buffer
Definition: RawCOPPERFormat_v1.h:268
Belle2::RawCOPPERFormat_v1::tmp_header
RawHeader_v1 tmp_header
header ( not recorded )
Definition: RawCOPPERFormat_v1.h:157
Belle2::RawHeader_v1::GetExpNo
int GetExpNo()
get a run/exp number combined word
Definition: RawHeader_v1.h:353
Belle2::RawCOPPERFormat_v1::GetRawTrlBufPtr
int * GetRawTrlBufPtr(int n) OVERRIDE_CPP17
get buffer pointer of rawcopper trailer
Definition: RawCOPPERFormat_v1.h:171
Belle2::RawHeader_v1::GetTRGType
int GetTRGType()
get TRGType
Definition: RawHeader_v1.h:459
Belle2::RawCOPPERFormat_v1::GetNumFINESSEBlock
virtual int GetNumFINESSEBlock(int n) OVERRIDE_CPP17
get # of FINNESEs which contains data
Definition: RawCOPPERFormat_v1.cc:29
Belle2::RawCOPPERFormat_v1::GetTTTimeVal
void GetTTTimeVal(int n, struct timeval *tv) OVERRIDE_CPP17
Get timeval.
Definition: RawCOPPERFormat_v1.h:314
Belle2::RawDataBlockFormat::GetBuffer
virtual int * GetBuffer(int n)
get nth buffer pointer
Definition: RawDataBlockFormat.cc:124
Belle2::RawHeader_v1::GetTTCtime
int GetTTCtime()
get contents of header
Definition: RawHeader_v1.h:453
Belle2::RawCOPPERFormat_v1::GetMaxNumOfCh
int GetMaxNumOfCh(int n) OVERRIDE_CPP17
Get the max number of channels in a readout board.
Definition: RawCOPPERFormat_v1.h:321
Belle2::RawHeader_v1::GetTTTimeVal
void GetTTTimeVal(struct timeval *tv)
get contents of header
Definition: RawHeader_v1.h:471
Belle2::RawCOPPERFormat_v1::~RawCOPPERFormat_v1
virtual ~RawCOPPERFormat_v1()
Constructor using existing pointer to raw data buffer.
Definition: RawCOPPERFormat_v1.cc:25
Belle2::RawCOPPERFormat_v1::tmp_trailer
RawTrailer_v1 tmp_trailer
trailer ( not recorded )
Definition: RawCOPPERFormat_v1.h:160
Belle2::RawCOPPERFormat_v1::GetNodeID
unsigned int GetNodeID(int n) OVERRIDE_CPP17
get node-ID from data
Definition: RawCOPPERFormat_v1.h:214
Belle2::RawHeader_v1::GetTTCtimeTRGType
unsigned int GetTTCtimeTRGType()
get contents of header
Definition: RawHeader_v1.h:447
Belle2::RawCOPPERFormat_v1::Get2ndDetectorNwords
int Get2ndDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot B
Definition: RawCOPPERFormat_v1.h:251
Belle2::RawDataBlockFormat::m_num_nodes
int m_num_nodes
number of nodes in this object
Definition: RawDataBlockFormat.h:92
Belle2::RawHeader_v1::GetTruncMask
int GetTruncMask()
get contents of header
Definition: RawHeader_v1.h:398
Belle2::RawTrailer_v1::GetTrlNwords
int GetTrlNwords()
Set magic word.
Definition: RawTrailer_v1.h:132
Belle2::RawHeader_v1::GetSubRunNo
int GetSubRunNo()
get run # (14bit)
Definition: RawHeader_v1.h:367
Belle2::RawDataBlockFormat::m_num_events
int m_num_events
number of events in this object
Definition: RawDataBlockFormat.h:95
Belle2::RawCOPPERFormat_v1::GetTruncMask
int GetTruncMask(int n) OVERRIDE_CPP17
get contents of header
Definition: RawCOPPERFormat_v1.h:227
Belle2::RawCOPPERFormat_v1::Get3rdDetectorNwords
int Get3rdDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot C
Definition: RawCOPPERFormat_v1.h:256
Belle2::RawCOPPERFormat_v1::GetExpRunSubrun
unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17
get Experimental # from header
Definition: RawCOPPERFormat_v1.h:188
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::RawCOPPERFormat::GetFINESSENwords
virtual int GetFINESSENwords(int n, int finesse)=0
get data size of FINESSE buffer
Belle2::RawCOPPERFormat_v1::GetTTCtimeTRGType
unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17
get b2l block from "FEE b2link header"
Definition: RawCOPPERFormat_v1.h:290
Belle2::RawHeader_v1::GetEveNo
unsigned int GetEveNo()
get restart #(8bit)
Definition: RawHeader_v1.h:380
Belle2::RawCOPPERFormat_v1::GetExpNo
int GetExpNo(int n) OVERRIDE_CPP17
get Experimental # from header
Definition: RawCOPPERFormat_v1.h:182
Belle2::RawHeader_v1::SetBuffer
void SetBuffer(int *bufin)
set buffer
Definition: RawHeader_v1.h:47
Belle2::RawCOPPERFormat_v1::Get4thDetectorNwords
int Get4thDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot D
Definition: RawCOPPERFormat_v1.h:261
Belle2::RawCOPPERFormat_v1::Get1stDetectorNwords
int Get1stDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot A
Definition: RawCOPPERFormat_v1.h:246
Belle2::RawCOPPERFormat_v1::Get4thFINESSENwords
int Get4thFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot D buffer
Definition: RawCOPPERFormat_v1.h:283
Belle2::RawCOPPERFormat_v1
The Raw COPPER class ver.1 ( the latest version since May, 2014 ) This class stores data received by ...
Definition: RawCOPPERFormat_v1.h:35
Belle2::RawCOPPERFormat_v1::Get3rdFINESSENwords
int Get3rdFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot C buffer
Definition: RawCOPPERFormat_v1.h:278
Belle2::RawCOPPERFormat_v1::GetRunNo
int GetRunNo(int n) OVERRIDE_CPP17
Exp# (10bit) run# (14bit) restart # (8bit)
Definition: RawCOPPERFormat_v1.h:194
Belle2::RawHeader_v1::GetTTUtime
unsigned int GetTTUtime()
get contents of header
Definition: RawHeader_v1.h:465
Belle2::RawCOPPERFormat_v1::GetSubRunNo
int GetSubRunNo(int n) OVERRIDE_CPP17
get run # (14bit)
Definition: RawCOPPERFormat_v1.h:201
Belle2::RawCOPPERFormat_v1::Get2ndFINESSENwords
int Get2ndFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot B buffer
Definition: RawCOPPERFormat_v1.h:273
Belle2::RawCOPPERFormat_v1::GetTTCtime
int GetTTCtime(int n) OVERRIDE_CPP17
Get ctime.
Definition: RawCOPPERFormat_v1.h:302
Belle2::RawCOPPERFormat_v1::GetEveNo
unsigned int GetEveNo(int n) OVERRIDE_CPP17
get subrun #(8bit)
Definition: RawCOPPERFormat_v1.h:207
Belle2::RawHeader_v1::AddErrorBitFlag
void AddErrorBitFlag(unsigned int error_bit_flag)
Add Detected Error bitflag.
Definition: RawHeader_v1.h:410
Belle2::RawCOPPERFormat_v1::RawCOPPERFormat_v1
RawCOPPERFormat_v1()
Default constructor.
Definition: RawCOPPERFormat_v1.cc:21
Belle2::RawCOPPERFormat_v1::GetTTUtime
unsigned int GetTTUtime(int n) OVERRIDE_CPP17
Check if COPPER Magic words are correct.
Definition: RawCOPPERFormat_v1.h:296
Belle2::RawCOPPERFormat_v1::AddErrorBitFlag
void AddErrorBitFlag(int n, unsigned int error_bit_flag) OVERRIDE_CPP17
Add Detected Error bitflag.
Definition: RawCOPPERFormat_v1.h:239
Belle2::RawCOPPERFormat_v1::GetErrorBitFlag
unsigned int GetErrorBitFlag(int n) OVERRIDE_CPP17
get contents of header
Definition: RawCOPPERFormat_v1.h:233
Belle2::RawHeader_v1::GetNodeID
unsigned int GetNodeID()
get contents of header
Definition: RawHeader_v1.h:386
Belle2::RawCOPPERFormat
The Raw COPPER class This class stores data received by COPPER via belle2linkt Data from all detector...
Definition: RawCOPPERFormat.h:53
Belle2::RawCOPPERFormat_v1::GetDataType
int GetDataType(int n) OVERRIDE_CPP17
get contents of header
Definition: RawCOPPERFormat_v1.h:221
Belle2::RawHeader_v1::GetErrorBitFlag
unsigned int GetErrorBitFlag()
get contents of header
Definition: RawHeader_v1.h:404
Belle2::RawTrailer_v1
The Raw Trailer class ver.1 ( the latest version since May, 2014 ) This class defines the format of t...
Definition: RawTrailer_v1.h:36
Belle2::RawHeader_v1::GetExpRunSubrun
unsigned int GetExpRunSubrun()
get contents of header
Definition: RawHeader_v1.h:373