Belle II Software  release-05-02-19
RawDataBlockFormat.h
1 //+
2 // File : RawDataBlockFormat.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 RAWDATABLOCKFORMAT_H
10 #define RAWDATABLOCKFORMAT_H
11 
12 // Includes
13 #include <rawdata/switch_basf2_standalone.h>
14 
15 namespace 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 :
89  int m_nwords;
90 
93 
96 
98  int* m_buffer;
99 
103 
104  /* /// To drive from TObject */
105  /* ClassDef(RawDataBlockFormat, 1); */
106  };
107 
109 }
110 
111 #endif
Belle2::RawDataBlockFormat::m_nwords
int m_nwords
number of words of buffer
Definition: RawDataBlockFormat.h:89
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::m_buffer
int * m_buffer
Buffer.
Definition: RawDataBlockFormat.h:98
Belle2::RawDataBlockFormat::GetBufferPos
virtual int GetBufferPos(int n)
get position of data block in word
Definition: RawDataBlockFormat.cc:30
Belle2::RawDataBlockFormat::RawDataBlockFormat
RawDataBlockFormat()
Default constructor.
Definition: RawDataBlockFormat.cc:14
Belle2::RawDataBlockFormat::GetBuffer
virtual int * GetBuffer(int n)
get nth buffer pointer
Definition: RawDataBlockFormat.cc:124
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::RawDataBlockFormat::~RawDataBlockFormat
virtual ~RawDataBlockFormat()
Destructor.
Definition: RawDataBlockFormat.cc:23
Belle2::RawDataBlockFormat::m_use_prealloc_buf
int m_use_prealloc_buf
not recorded
Definition: RawDataBlockFormat.h:102
Belle2::RawDataBlockFormat::m_num_nodes
int m_num_nodes
number of nodes in this object
Definition: RawDataBlockFormat.h:92
Belle2::RawDataBlockFormat
The RawDataBlockFormat class Format information for rawdata handling.
Definition: RawDataBlockFormat.h:25
Belle2::RawDataBlockFormat::GetNumEvents
virtual int GetNumEvents()
get # of events in m_buffer
Definition: RawDataBlockFormat.h:55
Belle2::RawDataBlockFormat::m_num_events
int m_num_events
number of events in this object
Definition: RawDataBlockFormat.h:95
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
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::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::RawDataBlockFormat::GetPreAllocFlag
virtual int GetPreAllocFlag()
get malloc_flag
Definition: RawDataBlockFormat.h:58
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