Belle II Software  release-05-02-19
RawDataBlock.h
1 //+
2 // File : RawDataBlock.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 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
Belle2::RawDataBlock::GetBufferPos
virtual int GetBufferPos(int n)
get position of data block in word
Definition: RawDataBlock.h:46
Belle2::RawDataBlock::SetBuffer
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
Belle2::RawDataBlockFormat::SetBuffer
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: RawDataBlockFormat.cc:131
Belle2::RawDataBlockFormat::GetBufferPos
virtual int GetBufferPos(int n)
get position of data block in word
Definition: RawDataBlockFormat.cc:30
Belle2::RawDataBlockFormat::GetBuffer
virtual int * GetBuffer(int n)
get nth buffer pointer
Definition: RawDataBlockFormat.cc:124
Belle2::RawDataBlock::GetNumEntries
virtual int GetNumEntries()
get # of data blocks = (# of nodes)*(# of events)
Definition: RawDataBlock.h:67
Belle2::RawDataBlock::m_num_events
int m_num_events
number of events in this object
Definition: RawDataBlock.h:151
Belle2::RawDataBlockFormat::CopyBlock
virtual void CopyBlock(int n, int *buf_to)
Copy one datablock to buffer.
Definition: RawDataBlockFormat.cc:173
Belle2::RawDataBlockFormat::PrintData
virtual void PrintData(int *buf, int nwords)
print data
Definition: RawDataBlockFormat.cc:161
Belle2::RawDataBlockFormat::GetNumNodes
virtual int GetNumNodes()
get # of data sources(e.g. # of COPPER boards) in m_buffer
Definition: RawDataBlockFormat.h:52
Belle2::RawDataBlock::CheckFTSWID
virtual int CheckFTSWID(int n)
get FTSW ID to check whether this data block is FTSW data or not
Definition: RawDataBlock.h:101
Belle2::RawDataBlock::PrintData
virtual void PrintData(int *buf, int nwords)
print data
Definition: RawDataBlock.h:122
Belle2::RawDataBlockFormat
The RawDataBlockFormat class Format information for rawdata handling.
Definition: RawDataBlockFormat.h:25
Belle2::RawDataBlock::m_num_nodes
int m_num_nodes
number of nodes in this object
Definition: RawDataBlock.h:148
Belle2::RawDataBlock::~RawDataBlock
virtual ~RawDataBlock()
Destructor.
Definition: RawDataBlock.cc:25
Belle2::RawDataBlock::RawDataBlock
RawDataBlock()
Default constructor.
Definition: RawDataBlock.cc:14
Belle2::RawDataBlockFormat::GetNumEvents
virtual int GetNumEvents()
get # of events in m_buffer
Definition: RawDataBlockFormat.h:55
Belle2::RawDataBlock::TotalBufNwords
virtual int TotalBufNwords()
Get total length of m_buffer.
Definition: RawDataBlock.h:39
Belle2::RawDataBlock::GetBlockNwords
virtual int GetBlockNwords(int n)
get size of a data block
Definition: RawDataBlock.h:94
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::RawDataBlock::GetNumEvents
virtual int GetNumEvents()
get # of events in m_buffer
Definition: RawDataBlock.h:81
Belle2::RawDataBlockFormat::GetBlockNwords
virtual int GetBlockNwords(int n)
get size of a data block
Definition: RawDataBlockFormat.cc:107
Belle2::RawDataBlockFormat::GetWholeBuffer
virtual int * GetWholeBuffer()
get pointer to buffer(m_buffer)
Definition: RawDataBlockFormat.cc:119
Belle2::RawDataBlock::CopyBlock
virtual void CopyBlock(int n, int *buf_to)
Copy one datablock to buffer.
Definition: RawDataBlock.h:115
Belle2::RawDataBlock::ClassDef
ClassDef(RawDataBlock, 3)
not record
Belle2::RawDataBlockFormat::TotalBufNwords
virtual int TotalBufNwords()
Get total length of m_buffer.
Definition: RawDataBlockFormat.cc:101
Belle2::RawDataBlockFormat::CheckFTSWID
virtual int CheckFTSWID(int n)
get FTSW ID to check whether this data block is FTSW data or not
Definition: RawDataBlockFormat.cc:73
Belle2::RawDataBlock::GetNumNodes
virtual int GetNumNodes()
get # of data sources(e.g. # of COPPER boards) in m_buffer
Definition: RawDataBlock.h:74
Belle2::RawDataBlock::m_nwords
int m_nwords
do not record
Definition: RawDataBlock.h:145
Belle2::RawDataBlock::GetWholeBuffer
virtual int * GetWholeBuffer()
get pointer to buffer(m_buffer)
Definition: RawDataBlock.h:60
Belle2::RawDataBlock::m_use_prealloc_buf
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
Belle2::RawDataBlock::GetPreAllocFlag
virtual int GetPreAllocFlag()
get malloc_flag
Definition: RawDataBlock.h:88
Belle2::RawDataBlock
The RawDataBlock class Base class for rawdata handling.
Definition: RawDataBlock.h:27
Belle2::RawDataBlock::m_buffer
int * m_buffer
Buffer.
Definition: RawDataBlock.h:154
Belle2::RawDataBlock::CheckTLUID
virtual int CheckTLUID(int n)
get FTSW ID to check whether this data block is FTSW data or not
Definition: RawDataBlock.h:108
Belle2::RawDataBlockFormat::CheckTLUID
virtual int CheckTLUID(int n)
get FTSW ID to check whether this data block is FTSW data or not
Definition: RawDataBlockFormat.cc:88
Belle2::RawDataBlockFormat::GetNumEntries
virtual int GetNumEntries()
get # of data blocks = (# of nodes)*(# of events)
Definition: RawDataBlockFormat.h:49
Belle2::RawDataBlock::m_access_dblk
RawDataBlockFormat * m_access_dblk
class to access
Definition: RawDataBlock.h:141
Belle2::RawDataBlock::GetBuffer
virtual int * GetBuffer(int n)
get nth buffer pointer
Definition: RawDataBlock.h:53