Belle II Software  release-05-01-25
RawCOPPERFormat_latest.h
1 //+
2 // File : RawCOPPERFormat_latest.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_LATEST_H
10 #define RAWCOPPERFORMAT_LATEST_H
11 
12 // Includes
13 #include <rawdata/dataobjects/RawCOPPERFormat.h>
14 #include <rawdata/dataobjects/RawHeader_latest.h>
15 #include <rawdata/dataobjects/RawTrailer_latest.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 {
37  public:
40 
42  //RawCOPPERFormat_latest(int* bufin, int nwords);
44  virtual ~RawCOPPERFormat_latest();
45 
46  //
47  // Get position of or pointer to data
48  //
50  // POINTER TO "DETECTOR BUFFER"
51  //( after removing "B2link headers" from "FINESSE buffer". THIS IS THE RAW DATA FROM A DETECTOR
53 
54 
56  int Get1stDetectorNwords(int n) OVERRIDE_CPP17;
57 
59  int Get2ndDetectorNwords(int n) OVERRIDE_CPP17;
60 
62  int Get3rdDetectorNwords(int n) OVERRIDE_CPP17;
63 
65  int Get4thDetectorNwords(int n) OVERRIDE_CPP17;
66 
68 
70  int* GetRawTrlBufPtr(int n) OVERRIDE_CPP17;
71 
72  //
73  // Get information from "RawCOPPERFormat_latest header" attached by DAQ software
74  //
75 
76  int GetExpNo(int n) OVERRIDE_CPP17;
77 
78  unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17;
79 
80  int GetRunNo(int n) OVERRIDE_CPP17;
81 
82  int GetSubRunNo(int n) OVERRIDE_CPP17;
83 
84  unsigned int GetEveNo(int n) OVERRIDE_CPP17;
85 
86  int GetDataType(int n) OVERRIDE_CPP17;
87 
88  int GetTruncMask(int n) OVERRIDE_CPP17;
89 
91  unsigned int GetErrorBitFlag(int n) OVERRIDE_CPP17;
92 
94  void AddErrorBitFlag(int n, unsigned int error_bit_flag) OVERRIDE_CPP17;
95 
97  int GetPacketCRCError(int n) OVERRIDE_CPP17;
98 
100  int GetEventCRCError(int n) OVERRIDE_CPP17;
101 
103  unsigned int GetNodeID(int n) OVERRIDE_CPP17;
104 
105  //
106  // Get information from 13words "COPPER header" attached by COPPER board
107  //
108 
110  virtual int GetNumFINESSEBlock(int n) OVERRIDE_CPP17;
111 
113  int Get1stFINESSENwords(int n) OVERRIDE_CPP17;
114 
116  int Get2ndFINESSENwords(int n) OVERRIDE_CPP17;
117 
119  int Get3rdFINESSENwords(int n) OVERRIDE_CPP17;
120 
122  int Get4thFINESSENwords(int n) OVERRIDE_CPP17;
123 
124  //
125  // Get information from "B2link(attached by FEE and HLSB) header"
126  //
128  // virtual int* GetFTSW2Words(int n);
129 
130 #ifdef USE_B2LFEE_FORMAT_BOTH_VER1_AND_2
131  void CheckB2LFEEHeaderVersion(int n) OVERRIDE_CPP17;
133 #endif
134 
136  unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17;
137 
139  unsigned int GetTTUtime(int n) OVERRIDE_CPP17;
140 
141  /* //! calc COPPER driver's checksum value */
142  /* virtual unsigned int CalcDriverChkSum(int n) = 0; */
143 
144 
146  int GetTTCtime(int n) OVERRIDE_CPP17;
147 
149  int GetTRGType(int n) OVERRIDE_CPP17;
150 
152  void GetTTTimeVal(int n, struct timeval* tv) OVERRIDE_CPP17;
153 
155  enum {
156  DATA_FORMAT_VERSION = 2
157  };
158 
161 
164 
165 
166  protected :
168  // ClassDefOverride(RawCOPPERFormat_latest, 2);
169  };
170 
171 
172 
173 
175  {
176  int pos_nwords;
177  if (n == (m_num_events * m_num_nodes) - 1) {
178  pos_nwords = m_nwords - tmp_trailer.GetTrlNwords();
179  } else {
180  pos_nwords = GetBufferPos(n + 1) - tmp_trailer.GetTrlNwords();
181  }
182  return &(m_buffer[ pos_nwords ]);
183  }
184 
186  {
188  return tmp_header.GetExpNo();
189  }
190 
191 
192  inline unsigned int RawCOPPERFormat_latest::GetExpRunSubrun(int n)
193  {
195  return tmp_header.GetExpRunSubrun();
196  }
197 
198 
200  {
202  return tmp_header.GetRunNo();
203  }
204 
205 
207  {
209  return tmp_header.GetSubRunNo();
210  }
211 
212  inline unsigned int RawCOPPERFormat_latest::GetEveNo(int n)
213  {
215  return tmp_header.GetEveNo();
216  }
217 
218 
219  inline unsigned int RawCOPPERFormat_latest::GetNodeID(int n)
220  {
222  return tmp_header.GetNodeID();
223  }
224 
225 
227  {
229  return tmp_header.GetDataType();
230  }
231 
233  {
235  return tmp_header.GetTruncMask();
236  }
237 
238  inline unsigned int RawCOPPERFormat_latest::GetErrorBitFlag(int n)
239  {
241  return tmp_header.GetErrorBitFlag();
242  }
243 
244  inline void RawCOPPERFormat_latest::AddErrorBitFlag(int n, unsigned int error_bit_flag)
245  {
247  tmp_header.AddErrorBitFlag(error_bit_flag);
248  return;
249  }
250 
252  {
254  return tmp_header.GetPacketCRCError();
255  }
256 
258  {
260  return tmp_header.GetEventCRCError();
261  }
262 
263 
265  {
266  return GetDetectorNwords(n, 0);
267  }
268 
270  {
271  return GetDetectorNwords(n, 1);
272  }
273 
275  {
276  return GetDetectorNwords(n, 2);
277  }
278 
280  {
281  return GetDetectorNwords(n, 3);
282  }
283 
284 
285 
287  {
288  return GetFINESSENwords(n, 0);
289  }
290 
292  {
293  return GetFINESSENwords(n, 1);
294  }
295 
297  {
298  return GetFINESSENwords(n, 2);
299  }
300 
302  {
303  return GetFINESSENwords(n, 3);
304  }
305 
306 
307 
308  inline unsigned int RawCOPPERFormat_latest::GetTTCtimeTRGType(int n)
309  {
311  return tmp_header.GetTTCtimeTRGType();
312  }
313 
314  inline unsigned int RawCOPPERFormat_latest::GetTTUtime(int n)
315  {
317  return tmp_header.GetTTUtime();
318  }
319 
321  {
323  return tmp_header.GetTTCtime();
324  }
325 
327  {
329  return tmp_header.GetTRGType();
330  }
331 
332  inline void RawCOPPERFormat_latest::GetTTTimeVal(int n, struct timeval* tv)
333  {
336  return ;
337  }
339 }
340 #endif
Belle2::RawCOPPERFormat_latest::GetTRGType
int GetTRGType(int n) OVERRIDE_CPP17
Get trgtype.
Definition: RawCOPPERFormat_latest.h:326
Belle2::RawHeader_latest::GetPacketCRCError
int GetPacketCRCError()
Get Packet CRC error flag.
Definition: RawHeader_latest.h:432
Belle2::RawHeader_latest::GetDataType
int GetDataType()
get contents of header
Definition: RawHeader_latest.h:407
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::RawCOPPERFormat_latest::GetEventCRCError
int GetEventCRCError(int n) OVERRIDE_CPP17
check CRC event Error
Definition: RawCOPPERFormat_latest.h:257
Belle2::RawHeader_latest::GetRunNo
int GetRunNo()
get contents of header
Definition: RawHeader_latest.h:375
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::RawCOPPERFormat_latest::Get1stFINESSENwords
int Get1stFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot A buffer
Definition: RawCOPPERFormat_latest.h:286
Belle2::RawHeader_latest::GetExpNo
int GetExpNo()
get a run/exp number combined word
Definition: RawHeader_latest.h:367
Belle2::RawCOPPERFormat_latest::GetRawTrlBufPtr
int * GetRawTrlBufPtr(int n) OVERRIDE_CPP17
get buffer pointer of rawcopper trailer
Definition: RawCOPPERFormat_latest.h:174
Belle2::RawHeader_latest::GetTRGType
int GetTRGType()
get TRGType
Definition: RawHeader_latest.h:494
Belle2::RawCOPPERFormat_latest::GetTTTimeVal
void GetTTTimeVal(int n, struct timeval *tv) OVERRIDE_CPP17
Get timeval.
Definition: RawCOPPERFormat_latest.h:332
Belle2::RawDataBlockFormat::GetBuffer
virtual int * GetBuffer(int n)
get nth buffer pointer
Definition: RawDataBlockFormat.cc:124
Belle2::RawHeader_latest::GetTTCtime
int GetTTCtime()
get contents of header
Definition: RawHeader_latest.h:488
Belle2::RawHeader_latest::GetTTTimeVal
void GetTTTimeVal(struct timeval *tv)
get contents of header
Definition: RawHeader_latest.h:506
Belle2::RawCOPPERFormat_latest::GetNodeID
unsigned int GetNodeID(int n) OVERRIDE_CPP17
get node-ID from data
Definition: RawCOPPERFormat_latest.h:219
Belle2::RawHeader_latest::GetTTCtimeTRGType
unsigned int GetTTCtimeTRGType()
get contents of header
Definition: RawHeader_latest.h:482
Belle2::RawCOPPERFormat_latest::Get2ndDetectorNwords
int Get2ndDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot B
Definition: RawCOPPERFormat_latest.h:269
Belle2::RawCOPPERFormat_latest::RawCOPPERFormat_latest
RawCOPPERFormat_latest()
Default constructor.
Definition: RawCOPPERFormat_latest.cc:21
Belle2::RawHeader_latest
The Raw Header class ver.1 ( the latest version since May, 2014 ) This class defines the format of th...
Definition: RawHeader_latest.h:32
Belle2::RawDataBlockFormat::m_num_nodes
int m_num_nodes
number of nodes in this object
Definition: RawDataBlockFormat.h:92
Belle2::RawHeader_latest::GetTruncMask
int GetTruncMask()
get contents of header
Definition: RawHeader_latest.h:413
Belle2::RawTrailer_latest::GetTrlNwords
int GetTrlNwords()
Set magic word.
Definition: RawTrailer_latest.h:130
Belle2::RawHeader_latest::GetSubRunNo
int GetSubRunNo()
get run # (14bit)
Definition: RawHeader_latest.h:382
Belle2::RawCOPPERFormat_latest::tmp_header
RawHeader_latest tmp_header
header ( not recorded )
Definition: RawCOPPERFormat_latest.h:160
Belle2::RawCOPPERFormat_latest::~RawCOPPERFormat_latest
virtual ~RawCOPPERFormat_latest()
Constructor using existing pointer to raw data buffer.
Definition: RawCOPPERFormat_latest.cc:25
Belle2::RawDataBlockFormat::m_num_events
int m_num_events
number of events in this object
Definition: RawDataBlockFormat.h:95
Belle2::RawCOPPERFormat_latest::GetTruncMask
int GetTruncMask(int n) OVERRIDE_CPP17
get contents of header
Definition: RawCOPPERFormat_latest.h:232
Belle2::RawCOPPERFormat_latest::Get3rdDetectorNwords
int Get3rdDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot C
Definition: RawCOPPERFormat_latest.h:274
Belle2::RawCOPPERFormat_latest::GetExpRunSubrun
unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17
get Experimental # from header
Definition: RawCOPPERFormat_latest.h:192
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_latest::tmp_trailer
RawTrailer_latest tmp_trailer
trailer ( not recorded )
Definition: RawCOPPERFormat_latest.h:163
Belle2::RawCOPPERFormat_latest::GetTTCtimeTRGType
unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17
get b2l block from "FEE b2link header"
Definition: RawCOPPERFormat_latest.h:308
Belle2::RawHeader_latest::GetEveNo
unsigned int GetEveNo()
get restart #(8bit)
Definition: RawHeader_latest.h:395
Belle2::RawCOPPERFormat_latest
The Raw COPPER class ver.1 ( the latest version since May, 2014 ) This class stores data received by ...
Definition: RawCOPPERFormat_latest.h:36
Belle2::RawCOPPERFormat_latest::GetPacketCRCError
int GetPacketCRCError(int n) OVERRIDE_CPP17
check CRC packet Error
Definition: RawCOPPERFormat_latest.h:251
Belle2::RawCOPPERFormat_latest::GetExpNo
int GetExpNo(int n) OVERRIDE_CPP17
get Experimental # from header
Definition: RawCOPPERFormat_latest.h:185
Belle2::RawCOPPERFormat_latest::Get4thDetectorNwords
int Get4thDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot D
Definition: RawCOPPERFormat_latest.h:279
Belle2::RawCOPPERFormat_latest::Get1stDetectorNwords
int Get1stDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot A
Definition: RawCOPPERFormat_latest.h:264
Belle2::RawCOPPERFormat_latest::Get4thFINESSENwords
int Get4thFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot D buffer
Definition: RawCOPPERFormat_latest.h:301
Belle2::RawCOPPERFormat_latest::Get3rdFINESSENwords
int Get3rdFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot C buffer
Definition: RawCOPPERFormat_latest.h:296
Belle2::RawCOPPERFormat_latest::GetRunNo
int GetRunNo(int n) OVERRIDE_CPP17
Exp# (10bit) run# (14bit) restart # (8bit)
Definition: RawCOPPERFormat_latest.h:199
Belle2::RawHeader_latest::GetTTUtime
unsigned int GetTTUtime()
get contents of header
Definition: RawHeader_latest.h:500
Belle2::RawCOPPERFormat_latest::GetSubRunNo
int GetSubRunNo(int n) OVERRIDE_CPP17
get run # (14bit)
Definition: RawCOPPERFormat_latest.h:206
Belle2::RawCOPPERFormat_latest::Get2ndFINESSENwords
int Get2ndFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot B buffer
Definition: RawCOPPERFormat_latest.h:291
Belle2::RawCOPPERFormat_latest::GetTTCtime
int GetTTCtime(int n) OVERRIDE_CPP17
Get ctime.
Definition: RawCOPPERFormat_latest.h:320
Belle2::RawCOPPERFormat_latest::GetNumFINESSEBlock
virtual int GetNumFINESSEBlock(int n) OVERRIDE_CPP17
get # of FINNESEs which contains data
Definition: RawCOPPERFormat_latest.cc:29
Belle2::RawCOPPERFormat_latest::GetEveNo
unsigned int GetEveNo(int n) OVERRIDE_CPP17
get subrun #(8bit)
Definition: RawCOPPERFormat_latest.h:212
Belle2::RawHeader_latest::AddErrorBitFlag
void AddErrorBitFlag(unsigned int error_bit_flag)
Add Detected Error bitflag.
Definition: RawHeader_latest.h:425
Belle2::RawCOPPERFormat_latest::GetTTUtime
unsigned int GetTTUtime(int n) OVERRIDE_CPP17
Check if COPPER Magic words are correct.
Definition: RawCOPPERFormat_latest.h:314
Belle2::RawHeader_latest::SetBuffer
void SetBuffer(int *bufin)
set buffer
Definition: RawHeader_latest.h:47
Belle2::RawCOPPERFormat_latest::AddErrorBitFlag
void AddErrorBitFlag(int n, unsigned int error_bit_flag) OVERRIDE_CPP17
Add Detected Error bitflag.
Definition: RawCOPPERFormat_latest.h:244
Belle2::RawCOPPERFormat_latest::GetErrorBitFlag
unsigned int GetErrorBitFlag(int n) OVERRIDE_CPP17
get contents of header
Definition: RawCOPPERFormat_latest.h:238
Belle2::RawHeader_latest::GetNodeID
unsigned int GetNodeID()
get contents of header
Definition: RawHeader_latest.h:401
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_latest::GetDataType
int GetDataType(int n) OVERRIDE_CPP17
get contents of header
Definition: RawCOPPERFormat_latest.h:226
Belle2::RawHeader_latest::GetErrorBitFlag
unsigned int GetErrorBitFlag()
get contents of header
Definition: RawHeader_latest.h:419
Belle2::RawHeader_latest::GetExpRunSubrun
unsigned int GetExpRunSubrun()
get contents of header
Definition: RawHeader_latest.h:388
Belle2::RawTrailer_latest
The Raw Trailer class ver.1 ( the latest version since May, 2014 ) This class defines the format of t...
Definition: RawTrailer_latest.h:34
Belle2::RawHeader_latest::GetEventCRCError
int GetEventCRCError()
Get Detected Error bitflag.
Definition: RawHeader_latest.h:442