Belle II Software development
DataStorePackage Class Reference

Public Member Functions

 DataStorePackage (DataStoreStreamer *streamer, int eb2, unsigned int serial=0)
 
bool restore ()
 
unsigned int getSerial () const
 
void setSerial (unsigned int serial)
 
const BinDatagetData () const
 
const BinDatagetHLTData () const
 
const BinDatagetPXDData () const
 

Static Public Attributes

static const unsigned int MAX_BUFFER_WORDS = 10000000
 

Private Types

enum  ETObjectBits {
  c_IsTransient = BIT(19) ,
  c_IsNull = BIT(20)
}
 

Private Attributes

unsigned int m_serial
 
BinData m_data
 
BinData m_data_hlt
 
BinData m_data_pxd
 
int * m_buf
 
int m_eb2
 
DataStoreStreamerm_streamer
 
StoreArray< RawPXDm_rawpxdary
 

Static Private Attributes

static Mutex g_mutex
 
static bool g_init
 

Detailed Description

Definition at line 25 of file DataStorePackage.h.

Member Enumeration Documentation

◆ ETObjectBits

enum ETObjectBits
private

Definition at line 33 of file DataStorePackage.h.

33 {
34 c_IsTransient = BIT(19),
35 c_IsNull = BIT(20)
36 };

Constructor & Destructor Documentation

◆ DataStorePackage()

DataStorePackage ( DataStoreStreamer streamer,
int  eb2,
unsigned int  serial = 0 
)
inline

Definition at line 39 of file DataStorePackage.h.

40 : m_serial(serial)
41 {
42 m_streamer = streamer;
43 m_buf = new int [MAX_BUFFER_WORDS];
44 m_data.setBuffer(m_buf);
45 m_data_hlt.setBuffer(NULL);
46 m_data_pxd.setBuffer(NULL);
47 m_eb2 = eb2;
48 }

◆ ~DataStorePackage()

~DataStorePackage ( )
inline

Definition at line 49 of file DataStorePackage.h.

50 {
51 delete[] m_buf;
52 }

Member Function Documentation

◆ getData()

const BinData & getData ( ) const
inline

Definition at line 58 of file DataStorePackage.h.

58{ return m_data; }

◆ getHLTData()

const BinData & getHLTData ( ) const
inline

Definition at line 59 of file DataStorePackage.h.

59{ return m_data_hlt; }

◆ getPXDData()

const BinData & getPXDData ( ) const
inline

Definition at line 60 of file DataStorePackage.h.

60{ return m_data_pxd; }

◆ getSerial()

unsigned int getSerial ( ) const
inline

Definition at line 56 of file DataStorePackage.h.

56{ return m_serial; }

◆ restore()

bool restore ( )

Definition at line 20 of file DataStorePackage.cc.

21{
22 //(m_sndhdrary.appendNew())->SetBuffer(m_data.getBuffer());
23 int nboard = m_data.getNBoard();
24 if (m_eb2 == 0 && nboard == 1) {
25 m_data_hlt.setBuffer(m_data.getBuffer());
26 } else if (m_eb2 > 0 || nboard > 1) {
27 m_data_hlt.setBuffer(m_data.getBody());
28 }
29
30 if (m_data_hlt.getBuffer() == NULL || m_data_hlt.getTrailerMagic() != BinData::TRAILER_MAGIC) {
31 static int count = 0; //TODO has it any meaning?
32 B2FATAL("Bad tarailer magic for HLT = " << m_data_hlt.getTrailerMagic()
33 << " count = " << count);
34 }
35 EvtMessage* msg = new EvtMessage((char*)m_data_hlt.getBody());
36 if (msg->type() == MSG_TERMINATE) {
37 B2INFO("Got Termination message");
38 delete msg;
39 return false;
40 }
41 //B2INFO("nbyte : " << m_data_hlt.getBody()[0]);
42 m_streamer->restoreDataStore(msg);
43 delete msg;
44 if (nboard > 1) {
45 unsigned int offset = m_data_hlt.getWordSize() + m_data.getHeaderWordSize();
46 for (int i = 0; i < nboard - 1; ++i) {
47 m_data_pxd.setBuffer(m_data.getBuffer() + offset);
48 offset += m_data_pxd.getWordSize();
49 if (m_data_pxd.getBody()[0] != ONSENBinData::MAGIC) {
50 B2FATAL("Bad ONSEN magic for PXD = " << m_data_pxd.getTrailerMagic());
51 return false;
52 } else if (m_data_pxd.getTrailerMagic() != BinData::TRAILER_MAGIC) {
53 B2FATAL("Bad tarailer magic for PXD = " << m_data_pxd.getTrailerMagic());
54 return false;
55 }
56 if (m_data_pxd.getBuffer() != NULL) {
57 m_rawpxdary.appendNew((int*)m_data_pxd.getBody(), m_data_pxd.getBodyByteSize());
58 //(m_sndhdrary.appendNew())->SetBuffer(m_data_pxd.getBuffer());
59 }
60 }
61 } else {
62 m_data_pxd.setBuffer(NULL);
63 }
64 return true;
65}
int restoreDataStore(EvtMessage *msg)
Restore DataStore objects from EvtMessage.
Class to manage streamed object.
Definition: EvtMessage.h:59
ERecordType type() const
Get record type.
Definition: EvtMessage.cc:114

◆ setSerial()

void setSerial ( unsigned int  serial)
inline

Definition at line 57 of file DataStorePackage.h.

57{ m_serial = serial; }

Member Data Documentation

◆ g_init

bool g_init
staticprivate

Definition at line 32 of file DataStorePackage.h.

◆ g_mutex

Mutex g_mutex
staticprivate

Definition at line 31 of file DataStorePackage.h.

◆ m_buf

int* m_buf
private

Definition at line 67 of file DataStorePackage.h.

◆ m_data

BinData m_data
private

Definition at line 64 of file DataStorePackage.h.

◆ m_data_hlt

BinData m_data_hlt
private

Definition at line 65 of file DataStorePackage.h.

◆ m_data_pxd

BinData m_data_pxd
private

Definition at line 66 of file DataStorePackage.h.

◆ m_eb2

int m_eb2
private

Definition at line 68 of file DataStorePackage.h.

◆ m_rawpxdary

StoreArray<RawPXD> m_rawpxdary
private

Definition at line 71 of file DataStorePackage.h.

◆ m_serial

unsigned int m_serial
private

Definition at line 63 of file DataStorePackage.h.

◆ m_streamer

DataStoreStreamer* m_streamer
private

Definition at line 70 of file DataStorePackage.h.

◆ MAX_BUFFER_WORDS

const unsigned int MAX_BUFFER_WORDS = 10000000
static

Definition at line 28 of file DataStorePackage.h.


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