Belle II Software
development
RawDataBlock.cc
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
#include <rawdata/dataobjects/RawDataBlock.h>
10
11
using namespace
std
;
12
using namespace
Belle2
;
13
14
RawDataBlock::RawDataBlock
()
15
{
16
m_access_dblk
=
new
RawDataBlockFormat
;
17
18
m_nwords
= 0;
19
m_use_prealloc_buf
= 0;
20
m_buffer
= NULL;
21
m_num_nodes
= 0;
22
m_num_events
= 0;
23
}
24
25
RawDataBlock::~RawDataBlock
()
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
}
34
35
void
RawDataBlock::SetBuffer
(
int
* bufin,
int
nwords,
int
delete_flag,
int
num_events,
int
num_nodes)
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
60
m_access_dblk
->SetBuffer(
m_buffer
,
m_nwords
, 0,
m_num_events
,
m_num_nodes
);
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
}
Belle2::RawDataBlockFormat
The RawDataBlockFormat class Format information for rawdata handling.
Definition
RawDataBlockFormat.h:25
Belle2::RawDataBlock::m_num_events
int m_num_events
number of events in this object
Definition
RawDataBlock.h:151
Belle2::RawDataBlock::m_num_nodes
int m_num_nodes
number of nodes in this object
Definition
RawDataBlock.h:148
Belle2::RawDataBlock::m_use_prealloc_buf
int m_use_prealloc_buf
flag for deleting m_buffer in destructor( 0:delete, 1: not delete) When using pre-allocated buffer,...
Definition
RawDataBlock.h:158
Belle2::RawDataBlock::m_buffer
int * m_buffer
Buffer.
Definition
RawDataBlock.h:154
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 freed( = 0 )/ not freed( = 1 ) in Destructor )
Definition
RawDataBlock.cc:35
Belle2::RawDataBlock::RawDataBlock
RawDataBlock()
Default constructor.
Definition
RawDataBlock.cc:14
Belle2::RawDataBlock::~RawDataBlock
virtual ~RawDataBlock()
Destructor.
Definition
RawDataBlock.cc:25
Belle2::RawDataBlock::m_nwords
int m_nwords
do not record
Definition
RawDataBlock.h:145
Belle2::RawDataBlock::m_access_dblk
RawDataBlockFormat * m_access_dblk
class to access
Definition
RawDataBlock.h:141
Belle2
Abstract base class for different kinds of events.
Definition
MillepedeAlgorithm.h:17
std
STL namespace.
rawdata
dataobjects
src
RawDataBlock.cc
Generated on Mon Sep 1 2025 02:55:17 for Belle II Software by
1.13.2