18#include <sys/socket.h>
19#include <netinet/in.h>
24#ifndef __MBSDEFINES_HH
61 printf(
"File: dlen=%d type=[%d,%d] used=%d frag=%d buf=%d evt=%d current_i=%d stime=%d.%d free=(%d,%d,%d,%d)\n",
71 printf(
"\n\ttime=%s\n\trun=",
s_time);
72 for (UInt_t i = 0; i <
i_run_l; i++) printf(
"%c",
c_run[i]);
74 for (UInt_t i = 0; i <
i_exp_l; i++) printf(
"%c",
c_exp[i]);
93 time_t t = (time_t)
l_time[0];
94 printf(
"Buffer: dlen=%d type=[%d,%d] used=%d begin=%d end=%d buf=%d evt=%d current_i=%d time=%d.%d free=(%d,%d,%d,%d) %s",
110 printf(
"Event dlen=%d type=[%d,%d] dummy=%d trigger=%d count=%d\n",
155 MBSBufferElem(
unsigned int _type, std::string _descr,
int _hsize,
int _dsize ){
167 void SetType(
unsigned int _type, std::string _descr,
int _hsize,
int _dsize ){
174 void SetType(
unsigned int _type, std::string _descr ){
178 dsize =
sizeof(
unsigned short);
200 std::vector<unsigned short>
data;
212 data.push_back( datum );
215 if( i <
data.size() )
return data.at(i);
222 data.push_back( ( datum >> 16 ) & 0x0000ffff );
223 data.push_back( datum & 0x0000ffff );
226 if( i <
data.size()/2 )
227 return data.at(i*2+1) | ((
data.at(i*2) << 16 ) & 0xffff0000);
255 std::cout <<
", length = " << std::dec <<
data_len;
256 std::cout << std::endl;
258 std::cout << i <<
": " << std::hex <<
GetData(i) << std::endl;
259 std::cout << std::dec << std::endl;
278 if(
data.size() < 1 )
return(0);
279 return(
data[0] >> 16 );
284 if(
data.size() < 2 )
return(0);
290 return(
data.size() < 2 ? 0 :
data.size() - 2 );
295 if(
data.size() < 2 )
return(
nullptr);
308 data.push_back(datum);
313 sevts.push_back(_sevt);
330 void Show( UInt_t verbose = 0 )
const {
332 if( verbose < 1 )
return;
334 for( UInt_t i = 0; i <
GetNData(); i++ ) {
335 if( (i % 4) == 0 && i ) printf(
"\n\t");
476 for(
unsigned int i = 0; i <
event_types.size(); i++ )
480 for(
unsigned int i = 0; i <
triggers.size(); i++ )
void SetType(unsigned int _type, std::string _descr, int _hsize, int _dsize)
int hsize
header size (bytes)
unsigned int GetType() const
MBSBufferElem(unsigned int _type, std::string _descr, int _hsize, int _dsize)
std::string descr
description
int dsize
data size (bytes)
void SetType(unsigned int _type, std::string _descr)
unsigned int type
element type
int GetHeaderSize() const
std::string GetDescription() const
void SetEventID(unsigned long long id)
void StoreSubEvent(MBSSubEvent _sevt)
std::vector< UInt_t > data
const MBSSubEvent * GetSubEvent(unsigned int i) const
unsigned int GetNumberOfSubEvents() const
UInt_t GetTrigger() const
ULong_t GetEventID() const
std::vector< MBSSubEvent > sevts
const UInt_t * GetData() const
void Show(UInt_t verbose=0) const
short GetData(unsigned int i) const
MBSBufferElem stype
type class identifier
void SetSubEventID(unsigned long id)
unsigned int data_len
length of the sub event
int GetData32(unsigned int i) const
std::vector< unsigned short > data
void SetSubEventElement(MBSBufferElem _stype)
unsigned char GetProcessorType() const
unsigned char crateid
crate number
unsigned int GetDataLength() const
MBSBufferElem GetSubEventElement() const
unsigned int GetNumberOfData32() const
unsigned short modid
module ID
unsigned long GetSubEventID() const
unsigned char GetCrateID() const
unsigned int GetSubEventDataSize() const
unsigned short GetModuleID() const
void SetProcessorType(unsigned char ptype)
void SetDataLength(unsigned int len)
unsigned char proctype
processor type
unsigned long seventid
subevent counter
void SetCrateID(unsigned char id)
unsigned int GetSubEventType() const
unsigned int GetNumberOfData() const
std::string GetSubEventDescription() const
void AddData(short datum)
void SetModuleID(unsigned short id)
void AddData32(int datum)
std::vector< short > GetByteSwapShort(char *in, int count, int bo)
MBSBufferElem * current_btype
const MBSEvent * GetNextLmdEvent()
void OpenLmdFile(std::string _filename)
const MBSEvent * GetNextMedEvent()
void OpenMedFile(std::string _filename)
MBSBufferElem * current_stype
std::string GetByteSwapString(char *in, int count, int bo)
UInt_t GetNBuffers() const
int OpenEventServer(std::string _server, unsigned short _port)
const UChar_t * GetNextBuffer()
void SetBufferSize(unsigned int size)
short GetByteSwapShort(char *in, int bo)
const UChar_t * GetBufferFromStream()
const MBSEvent * GetNextEventFromStream()
void ConvertEventHeader()
MBSBufferElem * current_etype
std::vector< MBSBufferElem > event_types
std::vector< MBSBufferElem > sevent_types
void ConvertSubEventHeader()
int GetByteSwapInt(char *in, int bo)
MBSBufferElem * current_trigger
std::vector< MBSBufferElem > buffer_types
std::vector< MBSBufferElem > triggers
MBSBufferElem * sevent_type_raw
std::vector< int > GetByteSwapInt(char *in, int count, int bo)
const UChar_t * GetBuffer(UInt_t i)
UInt_t l_evt
Number of fragments.
UInt_t l_dlen
Length of data field in 16-bit words.
UInt_t l_time[2]
64-bit timestamp since 1970
UInt_t l_buf
Current buffer number.
UChar_t h_end
Fragment at begin of buffer.
UChar_t h_begin
Fragment at end of buffer.
UShort_t i_subtype
Subtype.
UShort_t i_used
Used length of data field in 16-bit words.
UShort_t i_subtype
Subtype.
UInt_t l_dlen
Length of data in 16-bit words.
struct cv_string s_strings[30]
UInt_t l_dlen
Length of data in 16-bit words.
UInt_t l_count
Event number.
UShort_t i_subtype
Subtype.
UShort_t i_dummy
Not used.
UShort_t i_trigger
Trigger.
UChar_t h_control
processor type
UInt_t l_dlen
data length + 2 in words
UChar_t h_subcrate
crate number
UShort_t i_subtype
subtype
UShort_t i_procid
processor ID