Belle II Software  release-05-01-25
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  enum {
149  DATA_FORMAT_VERSION = 1
150  };
151 
154 
157 
158 
159  protected :
161  // ClassDefOverride(RawCOPPERFormat_v1, 2);
162  };
163 
164 
165 
166 
168  {
169  int pos_nwords;
170  if (n == (m_num_events * m_num_nodes) - 1) {
171  pos_nwords = m_nwords - tmp_trailer.GetTrlNwords();
172  } else {
173  pos_nwords = GetBufferPos(n + 1) - tmp_trailer.GetTrlNwords();
174  }
175  return &(m_buffer[ pos_nwords ]);
176  }
177 
179  {
181  return tmp_header.GetExpNo();
182  }
183 
184  inline unsigned int RawCOPPERFormat_v1::GetExpRunSubrun(int n)
185  {
187  return tmp_header.GetExpRunSubrun();
188  }
189 
191  {
193  return tmp_header.GetRunNo();
194  }
195 
196 
198  {
200  return tmp_header.GetSubRunNo();
201  }
202 
203  inline unsigned int RawCOPPERFormat_v1::GetEveNo(int n)
204  {
206  return tmp_header.GetEveNo();
207  }
208 
209 
210  inline unsigned int RawCOPPERFormat_v1::GetNodeID(int n)
211  {
213  return tmp_header.GetNodeID();
214  }
215 
216 
218  {
220  return tmp_header.GetDataType();
221  }
222 
224  {
226  return tmp_header.GetTruncMask();
227  }
228 
229  inline unsigned int RawCOPPERFormat_v1::GetErrorBitFlag(int n)
230  {
232  return tmp_header.GetErrorBitFlag();
233  }
234 
235  inline void RawCOPPERFormat_v1::AddErrorBitFlag(int n, unsigned int error_bit_flag)
236  {
238  tmp_header.AddErrorBitFlag(error_bit_flag);
239  return;
240  }
241 
243  {
244  return GetDetectorNwords(n, 0);
245  }
246 
248  {
249  return GetDetectorNwords(n, 1);
250  }
251 
253  {
254  return GetDetectorNwords(n, 2);
255  }
256 
258  {
259  return GetDetectorNwords(n, 3);
260  }
261 
262 
263 
265  {
266  return GetFINESSENwords(n, 0);
267  }
268 
270  {
271  return GetFINESSENwords(n, 1);
272  }
273 
275  {
276  return GetFINESSENwords(n, 2);
277  }
278 
280  {
281  return GetFINESSENwords(n, 3);
282  }
283 
284 
285 
286  inline unsigned int RawCOPPERFormat_v1::GetTTCtimeTRGType(int n)
287  {
289  return tmp_header.GetTTCtimeTRGType();
290  }
291 
292  inline unsigned int RawCOPPERFormat_v1::GetTTUtime(int n)
293  {
295  return tmp_header.GetTTUtime();
296  }
297 
299  {
301  return tmp_header.GetTTCtime();
302  }
303 
305  {
307  return tmp_header.GetTRGType();
308  }
309 
310  inline void RawCOPPERFormat_v1::GetTTTimeVal(int n, struct timeval* tv)
311  {
314  return ;
315  }
317 }
318 #endif
Belle2::RawCOPPERFormat_v1::GetTRGType
int GetTRGType(int n) OVERRIDE_CPP17
Get trgtype.
Definition: RawCOPPERFormat_v1.h:304
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:264
Belle2::RawCOPPERFormat_v1::tmp_header
RawHeader_v1 tmp_header
header ( not recorded )
Definition: RawCOPPERFormat_v1.h:153
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:167
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:310
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::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:156
Belle2::RawCOPPERFormat_v1::GetNodeID
unsigned int GetNodeID(int n) OVERRIDE_CPP17
get node-ID from data
Definition: RawCOPPERFormat_v1.h:210
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:247
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:223
Belle2::RawCOPPERFormat_v1::Get3rdDetectorNwords
int Get3rdDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot C
Definition: RawCOPPERFormat_v1.h:252
Belle2::RawCOPPERFormat_v1::GetExpRunSubrun
unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17
get Experimental # from header
Definition: RawCOPPERFormat_v1.h:184
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:286
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:178
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:257
Belle2::RawCOPPERFormat_v1::Get1stDetectorNwords
int Get1stDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot A
Definition: RawCOPPERFormat_v1.h:242
Belle2::RawCOPPERFormat_v1::Get4thFINESSENwords
int Get4thFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot D buffer
Definition: RawCOPPERFormat_v1.h:279
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:274
Belle2::RawCOPPERFormat_v1::GetRunNo
int GetRunNo(int n) OVERRIDE_CPP17
Exp# (10bit) run# (14bit) restart # (8bit)
Definition: RawCOPPERFormat_v1.h:190
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:197
Belle2::RawCOPPERFormat_v1::Get2ndFINESSENwords
int Get2ndFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot B buffer
Definition: RawCOPPERFormat_v1.h:269
Belle2::RawCOPPERFormat_v1::GetTTCtime
int GetTTCtime(int n) OVERRIDE_CPP17
Get ctime.
Definition: RawCOPPERFormat_v1.h:298
Belle2::RawCOPPERFormat_v1::GetEveNo
unsigned int GetEveNo(int n) OVERRIDE_CPP17
get subrun #(8bit)
Definition: RawCOPPERFormat_v1.h:203
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:292
Belle2::RawCOPPERFormat_v1::AddErrorBitFlag
void AddErrorBitFlag(int n, unsigned int error_bit_flag) OVERRIDE_CPP17
Add Detected Error bitflag.
Definition: RawCOPPERFormat_v1.h:235
Belle2::RawCOPPERFormat_v1::GetErrorBitFlag
unsigned int GetErrorBitFlag(int n) OVERRIDE_CPP17
get contents of header
Definition: RawCOPPERFormat_v1.h:229
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:217
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