Belle II Software development
RawDataBlock Class Reference

The RawDataBlock class Base class for rawdata handling. More...

#include <RawDataBlock.h>

Inheritance diagram for RawDataBlock:
RawCOPPER RawFTSW RawTLU RawARICH RawCDC RawECL RawKLM RawSVD RawTOP RawTRG

Public Member Functions

 RawDataBlock ()
 Default constructor.
 
virtual ~RawDataBlock ()
 Destructor.
 
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 GetBufferPos (int n)
 get position of data block in word
 
virtual int * GetBuffer (int n)
 get nth buffer pointer
 
virtual int * GetWholeBuffer ()
 get pointer to buffer(m_buffer)
 
virtual int GetNumEntries ()
 get # of data blocks = (# of nodes)*(# of events)
 
virtual int GetNumNodes ()
 get # of data sources(e.g. # of COPPER boards) in m_buffer
 
virtual int GetNumEvents ()
 get # of events in m_buffer
 
virtual int GetPreAllocFlag ()
 get malloc_flag
 
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 int CheckTLUID (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 void PrintData (int *buf, int nwords)
 print data
 

Public Attributes

RawDataBlockFormatm_access_dblk
 class to access
 

Protected Member Functions

 ClassDef (RawDataBlock, 3)
 not record
 

Protected Attributes

int m_nwords
 do not record
 
int m_num_nodes
 number of nodes in this object
 
int m_num_events
 number of events in this object
 
int * m_buffer
 Buffer.
 
int m_use_prealloc_buf
 flag for deleting m_buffer in destructer( 0:delete, 1: not delete) When using pre-allocated buffer, the buffer should be reused and not deleted in the destructer
 

Detailed Description

The RawDataBlock class Base class for rawdata handling.

Definition at line 27 of file RawDataBlock.h.

Constructor & Destructor Documentation

◆ RawDataBlock()

Default constructor.

Definition at line 14 of file RawDataBlock.cc.

15{
17
18 m_nwords = 0;
20 m_buffer = NULL;
21 m_num_nodes = 0;
22 m_num_events = 0;
23}
The RawDataBlockFormat class Format information for rawdata handling.
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
int * m_buffer
Buffer.
Definition: RawDataBlock.h:154
int m_nwords
do not record
Definition: RawDataBlock.h:145
RawDataBlockFormat * m_access_dblk
class to access
Definition: RawDataBlock.h:141

◆ ~RawDataBlock()

~RawDataBlock ( )
virtual

Destructor.

Definition at line 25 of file RawDataBlock.cc.

26{
27 if (m_access_dblk != NULL) delete m_access_dblk;
28 m_access_dblk = NULL;
29
30 if (!m_use_prealloc_buf && m_buffer != NULL) {
31 delete[] m_buffer;
32 }
33}

Member Function Documentation

◆ CheckFTSWID()

virtual int CheckFTSWID ( int  n)
inlinevirtual

get FTSW ID to check whether this data block is FTSW data or not

Definition at line 101 of file RawDataBlock.h.

102 {
104 return m_access_dblk->CheckFTSWID(n);
105 }
virtual int CheckFTSWID(int n)
get FTSW ID to check whether this data block is FTSW data or not
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 )

◆ CheckTLUID()

virtual int CheckTLUID ( int  n)
inlinevirtual

get FTSW ID to check whether this data block is FTSW data or not

Definition at line 108 of file RawDataBlock.h.

109 {
111 return m_access_dblk->CheckTLUID(n);
112 }
virtual int CheckTLUID(int n)
get FTSW ID to check whether this data block is FTSW data or not

◆ ClassDef()

ClassDef ( RawDataBlock  ,
 
)
protected

not record

To drive from TObject

◆ CopyBlock()

virtual void CopyBlock ( int  n,
int *  buf_to 
)
inlinevirtual

Copy one datablock to buffer.

Definition at line 115 of file RawDataBlock.h.

116 {
118 return m_access_dblk->CopyBlock(n, buf_to);
119 }
virtual void CopyBlock(int n, int *buf_to)
Copy one datablock to buffer.

◆ GetBlockNwords()

virtual int GetBlockNwords ( int  n)
inlinevirtual

get size of a data block

Definition at line 94 of file RawDataBlock.h.

95 {
98 }
virtual int GetBlockNwords(int n)
get size of a data block

◆ GetBuffer()

virtual int * GetBuffer ( int  n)
inlinevirtual

get nth buffer pointer

Definition at line 53 of file RawDataBlock.h.

54 {
56 return m_access_dblk->GetBuffer(n);
57 }
virtual int * GetBuffer(int n)
get nth buffer pointer

◆ GetBufferPos()

virtual int GetBufferPos ( int  n)
inlinevirtual

get position of data block in word

Reimplemented in RawCOPPER.

Definition at line 46 of file RawDataBlock.h.

47 {
49 return m_access_dblk->GetBufferPos(n);
50 }
virtual int GetBufferPos(int n)
get position of data block in word

◆ GetNumEntries()

virtual int GetNumEntries ( )
inlinevirtual

get # of data blocks = (# of nodes)*(# of events)

Definition at line 67 of file RawDataBlock.h.

68 {
71 }
virtual int GetNumEntries()
get # of data blocks = (# of nodes)*(# of events)

◆ GetNumEvents()

virtual int GetNumEvents ( )
inlinevirtual

get # of events in m_buffer

Definition at line 81 of file RawDataBlock.h.

82 {
85 }
virtual int GetNumEvents()
get # of events in m_buffer

◆ GetNumNodes()

virtual int GetNumNodes ( )
inlinevirtual

get # of data sources(e.g. # of COPPER boards) in m_buffer

Definition at line 74 of file RawDataBlock.h.

75 {
77 return m_access_dblk->GetNumNodes();
78 }
virtual int GetNumNodes()
get # of data sources(e.g. # of COPPER boards) in m_buffer

◆ GetPreAllocFlag()

virtual int GetPreAllocFlag ( )
inlinevirtual

get malloc_flag

Definition at line 88 of file RawDataBlock.h.

89 {
90 return m_use_prealloc_buf;
91 }

◆ GetWholeBuffer()

virtual int * GetWholeBuffer ( )
inlinevirtual

get pointer to buffer(m_buffer)

Definition at line 60 of file RawDataBlock.h.

61 {
64 }
virtual int * GetWholeBuffer()
get pointer to buffer(m_buffer)

◆ PrintData()

virtual void PrintData ( int *  buf,
int  nwords 
)
inlinevirtual

print data

Definition at line 122 of file RawDataBlock.h.

123 {
125 return m_access_dblk->PrintData(buf, nwords);
126 }
virtual void PrintData(int *buf, int nwords)
print data

◆ SetBuffer()

void SetBuffer ( int *  bufin,
int  nwords,
int  delete_flag,
int  num_events,
int  num_nodes 
)
virtual

set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )

Reimplemented in RawCOPPER, and RawFTSW.

Definition at line 35 of file RawDataBlock.cc.

36{
37
38 if (bufin == NULL) {
39 char err_buf[500];
40 sprintf(err_buf, "[DEBUG] bufin is NULL. Exting...\n");
41 printf("%s", err_buf); fflush(stdout);
42 B2FATAL(err_buf);
43 }
44
45 if (!m_use_prealloc_buf && m_buffer != NULL) delete[] m_buffer;
46
47 if (delete_flag == 0) {
48 m_use_prealloc_buf = true;
49 } else {
50 m_use_prealloc_buf = false;
51 }
52 // m_nwords = bufin[0];
53 m_nwords = nwords;
54 m_buffer = bufin;
55
56 m_num_nodes = num_nodes;
57 m_num_events = num_events;
58
59 // Set to access class
61
62 // Set length at the first word of the buffer
63 //
64 // Assign header and trailer
65 //
66 // m_header.SetBuffer(&(bufin[ 0 ]));
67 // m_trailer.SetBuffer(&(bufin[ m_nwords - m_trailer.GetTrlNwords() ]));
68
69}

◆ TotalBufNwords()

virtual int TotalBufNwords ( )
inlinevirtual

Get total length of m_buffer.

Definition at line 39 of file RawDataBlock.h.

40 {
43 }
virtual int TotalBufNwords()
Get total length of m_buffer.

Member Data Documentation

◆ m_access_dblk

RawDataBlockFormat* m_access_dblk

class to access

Definition at line 141 of file RawDataBlock.h.

◆ m_buffer

int* m_buffer
protected

Buffer.

Definition at line 154 of file RawDataBlock.h.

◆ m_num_events

int m_num_events
protected

number of events in this object

Definition at line 151 of file RawDataBlock.h.

◆ m_num_nodes

int m_num_nodes
protected

number of nodes in this object

Definition at line 148 of file RawDataBlock.h.

◆ m_nwords

int m_nwords
protected

do not record

number of words of buffer

Definition at line 145 of file RawDataBlock.h.

◆ m_use_prealloc_buf

int m_use_prealloc_buf
protected

flag for deleting m_buffer in destructer( 0:delete, 1: not delete) When using pre-allocated buffer, the buffer should be reused and not deleted in the destructer

Definition at line 158 of file RawDataBlock.h.


The documentation for this class was generated from the following files: