Definition at line 19 of file ONSENBinData.h.
◆ ONSENBinData()
◆ ~ONSENBinData()
◆ getBody() [1/2]
unsigned int * getBody |
( |
| ) |
|
|
inlineinherited |
◆ getBody() [2/2]
const unsigned int * getBody |
( |
| ) |
const |
|
inlineinherited |
◆ getBodyByteSize()
int getBodyByteSize |
( |
| ) |
const |
|
inlineinherited |
Definition at line 77 of file BinData.h.
78 {
79 return getByteSize() - sizeof(BinHeader) - sizeof(BinTrailer);
80 }
◆ getBodyWordSize()
int getBodyWordSize |
( |
| ) |
const |
|
inlineinherited |
Definition at line 87 of file BinData.h.
87{ return (getBodyByteSize() / 4); };
◆ getBuffer() [1/2]
◆ getBuffer() [2/2]
const int * getBuffer |
( |
| ) |
const |
|
inlineinherited |
◆ getByteSize()
int getByteSize |
( |
| ) |
const |
|
inlineinherited |
Definition at line 74 of file BinData.h.
74{ return m_header->nword * 4; };
◆ getEventNumber()
unsigned int getEventNumber |
( |
| ) |
const |
Definition at line 39 of file ONSENBinData.cc.
40{
41 unsigned int nframe = getFrameNumber();
42 if (nframe > MAX_PXD_FRAMES) return 0;
43 m_start_frame = reinterpret_cast<sose_frame_t*>(m_body + nframe + 2);
44 return getTrigger();
45}
◆ getExpNumber()
int getExpNumber |
( |
| ) |
const |
|
inlineinherited |
Definition at line 44 of file BinData.h.
44{ return (m_header->exp_run >> 22) & 0x3FF; };
◆ getFrameByteSize()
unsigned int getFrameByteSize |
( |
| ) |
const |
Definition at line 57 of file ONSENBinData.cc.
58{
59 const unsigned int nframe = getFrameNumber();
60 unsigned int nbyte = 0;
61 for (unsigned int i = 0; i < nframe; i++) {
62 nbyte += ntohl(m_body[2 + i]);
63 }
64 if (m_body[2 + nframe] != ntohs(0x3000)) {
65 return nbyte - 8;
66 } else {
67 return nbyte;
68 }
69}
◆ getFrameNumber()
unsigned int getFrameNumber |
( |
| ) |
const |
◆ getHeader() [1/2]
◆ getHeader() [2/2]
◆ getHeaderByteSize()
int getHeaderByteSize |
( |
| ) |
const |
|
inlineinherited |
Definition at line 76 of file BinData.h.
76{ return m_header->nword_in_header * 4; };
◆ getHeaderWordSize()
int getHeaderWordSize |
( |
| ) |
const |
|
inlineinherited |
Definition at line 75 of file BinData.h.
75{ return m_header->nword_in_header; };
◆ getNBoard()
Definition at line 61 of file BinData.h.
61{ return (m_header->nevent_nboard & 0xFFFF); };
◆ getNEvent()
Definition at line 60 of file BinData.h.
60{ return (m_header->nevent_nboard >> 16); };
◆ getNodeId()
Definition at line 93 of file BinData.h.
93{ return m_header->node_id; };
◆ getONSENMagic()
unsigned int getONSENMagic |
( |
| ) |
const |
◆ getRunNumber()
int getRunNumber |
( |
| ) |
const |
|
inlineinherited |
Definition at line 45 of file BinData.h.
45{ return (m_header->exp_run & 0x3FFFFF) >> 8; };
◆ getSubNumber()
int getSubNumber |
( |
| ) |
const |
|
inlineinherited |
Definition at line 46 of file BinData.h.
46{ return (m_header->exp_run & 0x3FFFFF) & 0xFF; };
◆ getTimetag()
unsigned int getTimetag |
( |
| ) |
const |
Definition at line 30 of file ONSENBinData.cc.
31{
32 uint64_t retval =
33 ((uint64_t)ntohs(m_start_frame->time_tag_hi) << 32)
34 | ((uint64_t)ntohs(m_start_frame->time_tag_mid) << 16)
35 | (uint64_t)ntohs(m_start_frame->time_tag_lo_and_type);
36 return (retval >> 4);
37}
◆ getTrailer() [1/2]
◆ getTrailer() [2/2]
◆ getTrailerMagic()
unsigned int getTrailerMagic |
( |
| ) |
|
|
inlineinherited |
Definition at line 88 of file BinData.h.
89 {
90 m_trailer = reinterpret_cast<BinTrailer*>(m_body + getBodyWordSize());
91 return m_trailer->magic;
92 }
◆ getTrigger()
unsigned int getTrigger |
( |
| ) |
const |
Definition at line 24 of file ONSENBinData.cc.
25{
26 return (ntohs(m_start_frame->trigger_hi) << 16)
27 + ntohs(m_start_frame->trigger_lo);
28}
◆ getTriggerType()
unsigned int getTriggerType |
( |
| ) |
const |
Definition at line 47 of file ONSENBinData.cc.
48{
49 return (ntohs(m_start_frame->time_tag_lo_and_type) & 0xF);
50}
◆ getWordSize()
int getWordSize |
( |
| ) |
const |
|
inlineinherited |
Definition at line 73 of file BinData.h.
73{ return m_header->nword; };
◆ print()
Definition at line 69 of file BinData.cc.
70{
71 printf("headerwords=%d, nwords=%d, nboard=%d, nevent=%d, evtno=%d, expno=%d, runno=%d, subno=%d, nodeid=%d, trailer=%04x\n",
72 getHeaderWordSize(),
73 getWordSize(),
74
75 getNBoard(),
76 getNEvent(),
77 getEventNumber(),
78 getExpNumber(),
79 getRunNumber(),
80 getSubNumber(),
81 getNodeId(),
82 getTrailerMagic());
83}
◆ recvEvent()
Definition at line 47 of file BinData.cc.
48{
49 unsigned int count = socket.read(m_header,
sizeof(
BinHeader));
50 if (m_header->nword_in_header * 4 !=
sizeof(
BinHeader)) {
51 throw (
IOException(
"unexpected header size %d words",
52 m_header->nword_in_header));
53 }
54 const int nbytes_remains = getByteSize() -
sizeof(
BinHeader);
55 count += socket.read(m_body, nbytes_remains);
57 if (m_trailer->magic != TRAILER_MAGIC) {
58 throw (
IOException(
"unexpected header trailer magic %08x",
59 m_trailer->magic));
60 }
61 return count;
62}
◆ sendEvent()
unsigned int sendEvent |
( |
TCPSocket & |
socket | ) |
const |
|
inherited |
Definition at line 64 of file BinData.cc.
65{
66 return socket.write(m_buf, getByteSize());
67}
◆ setBodyWordSize()
void setBodyWordSize |
( |
int |
nword | ) |
|
|
inlineinherited |
Definition at line 81 of file BinData.h.
82 {
83 setWordSize(nword + (sizeof(BinHeader) + sizeof(BinTrailer)) / 4);
84 m_trailer = reinterpret_cast<BinTrailer*>(m_body + getBodyWordSize());
85 m_trailer->magic = TRAILER_MAGIC;
86 }
◆ setBuffer()
void setBuffer |
( |
void * |
buf | ) |
|
|
inherited |
Definition at line 36 of file BinData.cc.
37{
38 if (buf != NULL) {
39 m_buf = (int*)buf;
41 m_body = (
unsigned int*)(((
char*)buf) +
sizeof(
BinHeader));
42 } else {
43 m_buf = NULL;
44 }
45}
◆ setEventNumber()
int setEventNumber |
( |
int |
number | ) |
|
|
inlineinherited |
Definition at line 48 of file BinData.h.
48{ return m_header->event_number = number; };
◆ setExpNumber()
int setExpNumber |
( |
int |
exp_no | ) |
|
|
inlineinherited |
Definition at line 49 of file BinData.h.
50 {
51 m_header->exp_run = ((exp_no & 0x3FF) << 22) | (m_header->exp_run & 0x3FFFFF);
52 return getExpNumber();
53 };
◆ setNBoard()
Definition at line 67 of file BinData.h.
68 {
69 m_header->nevent_nboard = (m_header->nevent_nboard & 0xFFFF0000) | (nb & 0xFFFF);
70 return getNBoard();
71 };
◆ setNEvent()
Definition at line 62 of file BinData.h.
63 {
64 m_header->nevent_nboard = ((nev & 0xFFFF) << 16) | (m_header->nevent_nboard & 0xFFFF);
65 return getNEvent();
66 };
◆ setNodeId()
Definition at line 94 of file BinData.h.
94{ m_header->node_id = id; };
◆ setRunNumber()
int setRunNumber |
( |
int |
run_no, |
|
|
int |
sub_no |
|
) |
| |
|
inlineinherited |
Definition at line 54 of file BinData.h.
55 {
56 m_header->exp_run = (m_header->exp_run & 0xFFC00000) |
57 (run_no & 0x3FFFFF) << 8 | (sub_no & 0xFF);
58 return getRunNumber();
59 };
◆ setWordSize()
void setWordSize |
( |
int |
nword | ) |
|
|
inlineinherited |
Definition at line 72 of file BinData.h.
72{ m_header->nword = nword; };
◆ m_body
◆ m_buf
|
mutableprotectedinherited |
◆ m_header
◆ m_start_frame
◆ m_trailer
◆ MAGIC
const unsigned int MAGIC = 0xBEBAFECA |
|
static |
◆ MAX_EVENT_WORDS
const unsigned int MAX_EVENT_WORDS = 2 * 1024 * 1024 |
|
staticinherited |
◆ MAX_PXD_FRAMES
const unsigned int MAX_PXD_FRAMES = 256 |
|
static |
◆ TRAILER_MAGIC
const unsigned int TRAILER_MAGIC = 0x7FFF0007 |
|
staticinherited |
The documentation for this class was generated from the following files: