Belle II Software development
RawDataBlockFormat.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 RAWDATABLOCKFORMAT_H
10#define RAWDATABLOCKFORMAT_H
11
12// Includes
13#include <rawdata/switch_basf2_standalone.h>
14
15namespace Belle2 {
26 public:
29
31 virtual ~RawDataBlockFormat();
32
34 virtual void SetBuffer(int* bufin, int nwords, int delete_flag, int num_events, int num_nodes);
35
37 virtual int TotalBufNwords();
38
40 virtual int GetBufferPos(int n);
41
43 virtual int* GetBuffer(int n);
44
46 virtual int* GetWholeBuffer();
47
49 virtual int GetNumEntries() { return m_num_events * m_num_nodes; }
50
52 virtual int GetNumNodes() { return m_num_nodes; }
53
55 virtual int GetNumEvents() { return m_num_events; }
56
58 virtual int GetPreAllocFlag() { return m_use_prealloc_buf; }
59
61 virtual int GetBlockNwords(int n);
62
64 virtual int CheckFTSWID(int n);
65
67 virtual int CheckTLUID(int n);
68
70 virtual void CopyBlock(int n, int* buf_to);
71
73 virtual void PrintData(int* buf, int nwords);
74
75 enum {
76 POS_NWORDS = 0,
77 POS_NODE_ID = 6
78 };
79
80 enum {
81 // Tentatively needed to distinguish new and old FTSW format, which will be changed in Nov. 2013
82 POS_FTSW_ID_OLD = 5,
83 TEMP_POS_NWORDS_HEADER = 1,
84 OLD_FTSW_NWORDS_HEADER = 6
85 };
86
87 protected :
90
93
96
98 int* m_buffer;
99
103
104 /* /// To drive from TObject */
105 /* ClassDef(RawDataBlockFormat, 1); */
106 };
107
109}
110
111#endif
The RawDataBlockFormat class Format information for rawdata handling.
virtual int GetPreAllocFlag()
get malloc_flag
int m_num_events
number of events in this object
int m_num_nodes
number of nodes in this object
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 ~RawDataBlockFormat()
Destructor.
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
int m_nwords
number of words of buffer
virtual int GetNumEvents()
get # of events in m_buffer
RawDataBlockFormat()
Default constructor.
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
Abstract base class for different kinds of events.