Belle II Software development
RawTLU Class Reference

The Raw TLU class Class for data from DAQ PC for TLU(Trigger Logic Unit) It is supposed to be used only in the DESY beam test. More...

#include <RawTLU.h>

Inheritance diagram for RawTLU:
RawDataBlock

Public Member Functions

 RawTLU ()
 Default constructor.
 
virtual ~RawTLU ()
 Destructor.
 
int GetNwordsHeader (int n)
 Get the size of the header.
 
unsigned int GetNodeID (int n)
 Get Node ID.
 
unsigned int GetEveNo (int n)
 Get Event #.
 
unsigned int GetMagicTrailer (int n)
 Get Magic Trailer #.
 
int GetRunNo (int n)
 Get Run #.
 
unsigned int GetTLUEventTag (int n)
 Get TLU event tag.
 
void CheckData (int n, unsigned int prev_evenum, unsigned int *cur_evenum)
 check data contents
 
virtual void SetBuffer (int *bufin, int nwords, int delete_flag, int num_events, int num_nodes)
 set buffer ( delete_flag : m_buffer is freed( = 0 )/ not freed( = 1 ) in Destructor )
 
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

RawTLUFormatm_access
 class to access
 
RawDataBlockFormatm_access_dblk
 class to access
 

Protected Member Functions

 ClassDef (RawTLU, 1)
 do not record
 
 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 destructor( 0:delete, 1: not delete) When using pre-allocated buffer, the buffer should be reused and not deleted in the destructor
 

Detailed Description

The Raw TLU class Class for data from DAQ PC for TLU(Trigger Logic Unit) It is supposed to be used only in the DESY beam test.

Definition at line 27 of file RawTLU.h.

Constructor & Destructor Documentation

◆ RawTLU()

RawTLU ( )

Default constructor.

Definition at line 13 of file RawTLU.cc.

14{
15 m_access = new RawTLUFormat;
16}
RawTLUFormat * m_access
class to access
Definition RawTLU.h:88

◆ ~RawTLU()

~RawTLU ( )
virtual

Destructor.

Definition at line 18 of file RawTLU.cc.

19{
20 if (m_access != NULL) delete m_access;
21 m_access = NULL;
22}

Member Function Documentation

◆ CheckData()

void CheckData ( int n,
unsigned int prev_evenum,
unsigned int * cur_evenum )
inline

check data contents

Definition at line 81 of file RawTLU.h.

82 {
83 m_access->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
84 return m_access->CheckData(n, prev_evenum, cur_evenum);
85 }

◆ CheckFTSWID()

virtual int CheckFTSWID ( int n)
inlinevirtualinherited

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

Definition at line 101 of file RawDataBlock.h.

102 {
103 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
104 return m_access_dblk->CheckFTSWID(n);
105 }

◆ CheckTLUID()

virtual int CheckTLUID ( int n)
inlinevirtualinherited

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

Definition at line 108 of file RawDataBlock.h.

109 {
110 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
111 return m_access_dblk->CheckTLUID(n);
112 }

◆ ClassDef() [1/2]

ClassDef ( RawDataBlock ,
3  )
protectedinherited

not record

To drive from TObject

◆ ClassDef() [2/2]

ClassDef ( RawTLU ,
1  )
protected

do not record

To derive from TObject

◆ CopyBlock()

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

Copy one datablock to buffer.

Definition at line 115 of file RawDataBlock.h.

116 {
117 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
118 return m_access_dblk->CopyBlock(n, buf_to);
119 }

◆ GetBlockNwords()

virtual int GetBlockNwords ( int n)
inlinevirtualinherited

get size of a data block

Definition at line 94 of file RawDataBlock.h.

95 {
96 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
97 return m_access_dblk->GetBlockNwords(n);
98 }

◆ GetBuffer()

virtual int * GetBuffer ( int n)
inlinevirtualinherited

get nth buffer pointer

Definition at line 53 of file RawDataBlock.h.

54 {
55 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
56 return m_access_dblk->GetBuffer(n);
57 }

◆ GetBufferPos()

virtual int GetBufferPos ( int n)
inlinevirtualinherited

get position of data block in word

Reimplemented in RawCOPPER.

Definition at line 46 of file RawDataBlock.h.

47 {
48 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
49 return m_access_dblk->GetBufferPos(n);
50 }

◆ GetEveNo()

unsigned int GetEveNo ( int n)
inline

Get Event #.

Definition at line 53 of file RawTLU.h.

54 {
55 m_access->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
56 return m_access->GetEveNo(n);
57 }

◆ GetMagicTrailer()

unsigned int GetMagicTrailer ( int n)
inline

Get Magic Trailer #.

Definition at line 60 of file RawTLU.h.

61 {
62 m_access->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
63 return m_access->GetMagicTrailer(n);
64 }

◆ GetNodeID()

unsigned int GetNodeID ( int n)
inline

Get Node ID.

Definition at line 46 of file RawTLU.h.

47 {
48 m_access->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
49 return m_access->GetNodeID(n);
50 }

◆ GetNumEntries()

virtual int GetNumEntries ( )
inlinevirtualinherited

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

Definition at line 67 of file RawDataBlock.h.

68 {
69 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
70 return m_access_dblk->GetNumEntries();
71 }

◆ GetNumEvents()

virtual int GetNumEvents ( )
inlinevirtualinherited

get # of events in m_buffer

Definition at line 81 of file RawDataBlock.h.

82 {
83 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
84 return m_access_dblk->GetNumEvents();
85 }

◆ GetNumNodes()

virtual int GetNumNodes ( )
inlinevirtualinherited

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

Definition at line 74 of file RawDataBlock.h.

75 {
76 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
77 return m_access_dblk->GetNumNodes();
78 }

◆ GetNwordsHeader()

int GetNwordsHeader ( int n)
inline

Get the size of the header.

Definition at line 39 of file RawTLU.h.

40 {
41 m_access->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
42 return m_access->GetNwordsHeader(n);
43 }

◆ GetPreAllocFlag()

virtual int GetPreAllocFlag ( )
inlinevirtualinherited

get malloc_flag

Definition at line 88 of file RawDataBlock.h.

89 {
90 return m_use_prealloc_buf;
91 }

◆ GetRunNo()

int GetRunNo ( int n)
inline

Get Run #.

Definition at line 67 of file RawTLU.h.

68 {
69 m_access->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
70 return m_access->GetRunNo(n);
71 }

◆ GetTLUEventTag()

unsigned int GetTLUEventTag ( int n)
inline

Get TLU event tag.

Definition at line 74 of file RawTLU.h.

75 {
76 m_access->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
77 return m_access->GetTLUEventTag(n);
78 }

◆ GetWholeBuffer()

virtual int * GetWholeBuffer ( )
inlinevirtualinherited

get pointer to buffer(m_buffer)

Definition at line 60 of file RawDataBlock.h.

61 {
62 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
63 return m_access_dblk->GetWholeBuffer();
64 }

◆ PrintData()

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

print data

Definition at line 122 of file RawDataBlock.h.

123 {
124 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
125 return m_access_dblk->PrintData(buf, nwords);
126 }

◆ SetBuffer()

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

set buffer ( delete_flag : m_buffer is freed( = 0 )/ not freed( = 1 ) in Destructor )

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. Exiting...\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}
int m_num_events
number of events in this object
int m_num_nodes
number of nodes in this object
int m_use_prealloc_buf
flag for deleting m_buffer in destructor( 0:delete, 1: not delete) When using pre-allocated buffer,...
int * m_buffer
Buffer.
int m_nwords
do not record
RawDataBlockFormat * m_access_dblk
class to access

◆ TotalBufNwords()

virtual int TotalBufNwords ( )
inlinevirtualinherited

Get total length of m_buffer.

Definition at line 39 of file RawDataBlock.h.

40 {
41 m_access_dblk->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
42 return m_access_dblk->TotalBufNwords();
43 }

Member Data Documentation

◆ m_access

RawTLUFormat* m_access

class to access

Definition at line 88 of file RawTLU.h.

◆ m_access_dblk

RawDataBlockFormat* m_access_dblk
inherited

class to access

Definition at line 141 of file RawDataBlock.h.

◆ m_buffer

int* m_buffer
protectedinherited

Buffer.

Definition at line 154 of file RawDataBlock.h.

◆ m_num_events

int m_num_events
protectedinherited

number of events in this object

Definition at line 151 of file RawDataBlock.h.

◆ m_num_nodes

int m_num_nodes
protectedinherited

number of nodes in this object

Definition at line 148 of file RawDataBlock.h.

◆ m_nwords

int m_nwords
protectedinherited

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
protectedinherited

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

Definition at line 158 of file RawDataBlock.h.


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