Belle II Software  release-08-01-10
RawDataBlock.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 RAWDATABLOCK_H
10 #define RAWDATABLOCK_H
11 
12 // Includes
13 #include <TObject.h>
14 #include <rawdata/dataobjects/RawDataBlockFormat.h>
15 
16 
17 namespace Belle2 {
27  class RawDataBlock : public TObject {
28  public:
30  RawDataBlock();
31 
33  virtual ~RawDataBlock();
34 
36  virtual void SetBuffer(int* bufin, int nwords, int delete_flag, int num_events, int num_nodes);
37 
39  virtual int TotalBufNwords()
40  {
42  return m_access_dblk->TotalBufNwords();
43  }
44 
46  virtual int GetBufferPos(int n)
47  {
49  return m_access_dblk->GetBufferPos(n);
50  }
51 
53  virtual int* GetBuffer(int n)
54  {
56  return m_access_dblk->GetBuffer(n);
57  }
58 
60  virtual int* GetWholeBuffer()
61  {
63  return m_access_dblk->GetWholeBuffer();
64  }
65 
67  virtual int GetNumEntries()
68  {
70  return m_access_dblk->GetNumEntries();
71  }
72 
74  virtual int GetNumNodes()
75  {
77  return m_access_dblk->GetNumNodes();
78  }
79 
81  virtual int GetNumEvents()
82  {
84  return m_access_dblk->GetNumEvents();
85  }
86 
88  virtual int GetPreAllocFlag()
89  {
90  return m_use_prealloc_buf;
91  }
92 
94  virtual int GetBlockNwords(int n)
95  {
97  return m_access_dblk->GetBlockNwords(n);
98  }
99 
101  virtual int CheckFTSWID(int n)
102  {
104  return m_access_dblk->CheckFTSWID(n);
105  }
106 
108  virtual int CheckTLUID(int n)
109  {
111  return m_access_dblk->CheckTLUID(n);
112  }
113 
115  virtual void CopyBlock(int n, int* buf_to)
116  {
118  return m_access_dblk->CopyBlock(n, buf_to);
119  }
120 
122  virtual void PrintData(int* buf, int nwords)
123  {
125  return m_access_dblk->PrintData(buf, nwords);
126  }
127 
128  /* enum { */
129  /* POS_NWORDS = 0, */
130  /* POS_NODE_ID = 6 */
131  /* }; */
132 
133  /* enum { */
134  /* // Tentatively needed to distinguish new and old FTSW format, which will be changed in Nov. 2013 */
135  /* POS_FTSW_ID_OLD = 5, */
136  /* TEMP_POS_NWORDS_HEADER = 1, */
137  /* OLD_FTSW_NWORDS_HEADER = 6 */
138  /* }; */
139 
142 
143  protected :
145  int m_nwords;
146 
149 
152 
154  int* m_buffer; //[m_nwords]
155 
159 
162  };
163 
165 }
166 
167 #endif
The RawDataBlockFormat class Format information for rawdata handling.
virtual int GetBlockNwords(int n)
get size of a data block
virtual int CheckFTSWID(int n)
get FTSW ID to check whether this data block is FTSW data or not
virtual void CopyBlock(int n, int *buf_to)
Copy one datablock to buffer.
virtual int GetBufferPos(int n)
get position of data block in word
virtual int * GetWholeBuffer()
get pointer to buffer(m_buffer)
virtual int GetNumEntries()
get # of data blocks = (# of nodes)*(# of events)
virtual void SetBuffer(int *bufin, int nwords, int delete_flag, int num_events, int num_nodes)
set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
virtual int TotalBufNwords()
Get total length of m_buffer.
virtual int GetNumNodes()
get # of data sources(e.g. # of COPPER boards) in m_buffer
virtual int * GetBuffer(int n)
get nth buffer pointer
virtual int GetNumEvents()
get # of events in m_buffer
virtual void PrintData(int *buf, int nwords)
print data
virtual int CheckTLUID(int n)
get FTSW ID to check whether this data block is FTSW data or not
The RawDataBlock class Base class for rawdata handling.
Definition: RawDataBlock.h:27
virtual int GetPreAllocFlag()
get malloc_flag
Definition: RawDataBlock.h:88
virtual void PrintData(int *buf, int nwords)
print data
Definition: RawDataBlock.h:122
int m_num_events
number of events in this object
Definition: RawDataBlock.h:151
int m_num_nodes
number of nodes in this object
Definition: RawDataBlock.h:148
int m_use_prealloc_buf
flag for deleting m_buffer in destructer( 0:delete, 1: not delete) When using pre-allocated buffer,...
Definition: RawDataBlock.h:158
virtual int GetBufferPos(int n)
get position of data block in word
Definition: RawDataBlock.h:46
int * m_buffer
Buffer.
Definition: RawDataBlock.h:154
virtual int CheckFTSWID(int n)
get FTSW ID to check whether this data block is FTSW data or not
Definition: RawDataBlock.h:101
virtual int GetNumEntries()
get # of data blocks = (# of nodes)*(# of events)
Definition: RawDataBlock.h:67
virtual int * GetBuffer(int n)
get nth buffer pointer
Definition: RawDataBlock.h:53
virtual void SetBuffer(int *bufin, int nwords, int delete_flag, int num_events, int num_nodes)
set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
Definition: RawDataBlock.cc:35
virtual int GetNumNodes()
get # of data sources(e.g. # of COPPER boards) in m_buffer
Definition: RawDataBlock.h:74
ClassDef(RawDataBlock, 3)
not record
virtual int CheckTLUID(int n)
get FTSW ID to check whether this data block is FTSW data or not
Definition: RawDataBlock.h:108
RawDataBlock()
Default constructor.
Definition: RawDataBlock.cc:14
virtual int GetBlockNwords(int n)
get size of a data block
Definition: RawDataBlock.h:94
virtual ~RawDataBlock()
Destructor.
Definition: RawDataBlock.cc:25
virtual void CopyBlock(int n, int *buf_to)
Copy one datablock to buffer.
Definition: RawDataBlock.h:115
int m_nwords
do not record
Definition: RawDataBlock.h:145
RawDataBlockFormat * m_access_dblk
class to access
Definition: RawDataBlock.h:141
virtual int GetNumEvents()
get # of events in m_buffer
Definition: RawDataBlock.h:81
virtual int TotalBufNwords()
Get total length of m_buffer.
Definition: RawDataBlock.h:39
virtual int * GetWholeBuffer()
get pointer to buffer(m_buffer)
Definition: RawDataBlock.h:60
Abstract base class for different kinds of events.