#include <EventMsgBuilder.h>
Public Member Functions | |
uint32 | bufferSize () const |
uint8 * | eventAddr () const |
EventMsgBuilder (void *buf, uint32 size, uint32 run, uint32 event, uint32 lumi, uint32 outModId, std::vector< bool > &l1_bits, uint8 *hlt_bits, uint32 hlt_bit_count, uint32 adler32_chksum, const char *host_name) | |
uint32 | headerSize () const |
void | setEventLength (uint32 len) |
void | setOrigDataSize (uint32) |
uint32 | size () const |
uint8 * | startAddress () const |
Private Attributes | |
uint8 * | buf_ |
uint8 * | event_addr_ |
uint32 | size_ |
Definition at line 8 of file EventMsgBuilder.h.
EventMsgBuilder::EventMsgBuilder | ( | void * | buf, |
uint32 | size, | ||
uint32 | run, | ||
uint32 | event, | ||
uint32 | lumi, | ||
uint32 | outModId, | ||
std::vector< bool > & | l1_bits, | ||
uint8 * | hlt_bits, | ||
uint32 | hlt_bit_count, | ||
uint32 | adler32_chksum, | ||
const char * | host_name | ||
) |
Definition at line 9 of file EventMsgBuilder.cc.
References buf_, lhef::cc::convert(), filterCSVwithJSON::copy, EventHeader::event_, event_addr_, h, i, EventHeader::lumi_, MAX_HOSTNAME_LEN, EventHeader::outModId_, pos, EventHeader::protocolVersion_, EventHeader::run_, setEventLength(), and v.
: buf_((uint8*)buf),size_(size) { EventHeader* h = (EventHeader*)buf_; h->protocolVersion_ = 8; convert(run,h->run_); convert(event,h->event_); convert(lumi,h->lumi_); convert(outModId,h->outModId_); uint8* pos = buf_ + sizeof(EventHeader); // l1 count uint32 l1_count = l1_bits.size(); convert(l1_count, pos); pos = pos + sizeof(uint32); // set the l1 uint32 l1_sz = l1_bits.size(); if (l1_sz != 0) l1_sz = 1 + ((l1_sz-1)/8); uint8* pos_end = pos + l1_sz; memset(pos,0x00, pos_end-pos); // clear the bits for(std::vector<bool>::size_type i = 0; i < l1_bits.size(); ++i) { uint8 v = l1_bits[i] ? 1 : 0; pos[i/8] |= (v << (i&0x07)); } pos = pos_end; // hlt count convert(hlt_bit_count, pos); pos = pos + sizeof(uint32); uint32 hlt_sz = hlt_bit_count; if (hlt_sz != 0) hlt_sz = 1+ ((hlt_sz-1)/4); // copy the hlt bits over pos = std::copy(hlt_bits, hlt_bits+hlt_sz, pos); // adler32 check sum of data blob convert(adler_chksum, pos); pos = pos + sizeof(uint32); // put host name (Length and then Name) right after check sum //uint32 host_name_len = strlen(host_name); // actually make the host_name a fixed length as the event header size appears in the // Init message and only one goes to a file whereas events can come from any node // We want the max length to be determined inside this Event Message Builder uint32 host_name_len = MAX_HOSTNAME_LEN; assert(host_name_len < 0x00ff); //Put host_name_len *pos++ = host_name_len; //Put host_name uint32 real_len = strlen(host_name); if(real_len < host_name_len) { char hostname_2use[MAX_HOSTNAME_LEN]; memset(hostname_2use,'\0',host_name_len); memcpy(hostname_2use,host_name,real_len); memcpy(pos,hostname_2use,host_name_len); } else { memcpy(pos,host_name,host_name_len); } pos += host_name_len; event_addr_ = pos + sizeof(char_uint32); setEventLength(0); }
uint32 EventMsgBuilder::bufferSize | ( | ) | const [inline] |
uint8* EventMsgBuilder::eventAddr | ( | ) | const [inline] |
uint32 EventMsgBuilder::headerSize | ( | ) | const [inline] |
Definition at line 21 of file EventMsgBuilder.h.
References buf_, and event_addr_.
Referenced by InitMsgBuilder::InitMsgBuilder().
{return event_addr_-buf_;}
void EventMsgBuilder::setEventLength | ( | uint32 | len | ) |
Definition at line 87 of file EventMsgBuilder.cc.
References buf_, lhef::cc::convert(), Header::EVENT, event_addr_, h, and EventHeader::header_.
Referenced by EventMsgBuilder().
{ convert(len,event_addr_-sizeof(char_uint32)); EventHeader* h = (EventHeader*)buf_; new (&h->header_) Header(Header::EVENT,event_addr_-buf_+len); }
void EventMsgBuilder::setOrigDataSize | ( | uint32 | value | ) |
Definition at line 81 of file EventMsgBuilder.cc.
References buf_, lhef::cc::convert(), h, and EventHeader::origDataSize_.
{ EventHeader* h = (EventHeader*)buf_; convert(value,h->origDataSize_); }
uint32 EventMsgBuilder::size | ( | void | ) | const |
Definition at line 94 of file EventMsgBuilder.cc.
References buf_, HeaderView::size(), and v.
Referenced by edm::FUShmOutputModule::doOutputEvent().
{ HeaderView v(buf_); return v.size(); }
uint8* EventMsgBuilder::startAddress | ( | ) | const [inline] |
Definition at line 18 of file EventMsgBuilder.h.
References buf_.
Referenced by edm::StreamerFileWriter::doOutputEvent(), edm::FUShmOutputModule::doOutputEvent(), and StreamerOutputFile::write().
{ return buf_; }
uint8* EventMsgBuilder::buf_ [private] |
Definition at line 26 of file EventMsgBuilder.h.
Referenced by EventMsgBuilder(), headerSize(), setEventLength(), setOrigDataSize(), size(), and startAddress().
uint8* EventMsgBuilder::event_addr_ [private] |
Definition at line 28 of file EventMsgBuilder.h.
Referenced by eventAddr(), EventMsgBuilder(), headerSize(), and setEventLength().
uint32 EventMsgBuilder::size_ [private] |
Definition at line 27 of file EventMsgBuilder.h.
Referenced by bufferSize().