CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EventMsgBuilder Class Reference

#include <EventMsgBuilder.h>

Public Member Functions

uint32 bufferSize () const
 
uint8eventAddr () const
 
 EventMsgBuilder (void *buf, uint32 size, uint32 run, uint64 event, uint32 lumi, uint32 outModId, uint32 droppedEventsCount, 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
 
uint8startAddress () const
 

Private Attributes

uint8buf_
 
uint8event_addr_
 
uint32 size_
 

Detailed Description

Definition at line 8 of file EventMsgBuilder.h.

Constructor & Destructor Documentation

EventMsgBuilder::EventMsgBuilder ( void *  buf,
uint32  size,
uint32  run,
uint64  event,
uint32  lumi,
uint32  outModId,
uint32  droppedEventsCount,
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_, fileCollector::convert(), popcon2dropbox::copy(), EventHeader::droppedEventsCount_, EventHeader::event_, event_addr_, h, mps_fire::i, EventHeader::lumi_, MAX_HOSTNAME_LEN, EventHeader::outModId_, EventHeader::protocolVersion_, EventHeader::run_, setEventLength(), and findQualityFiles::v.

14  :
15  buf_((uint8*)buf),size_(size)
16 {
18  h->protocolVersion_ = 11;
19  convert(run,h->run_);
20  convert(event,h->event_);
21  convert(lumi,h->lumi_);
22  convert(outModId,h->outModId_);
23  convert(droppedEventsCount,h->droppedEventsCount_);
24  uint8* pos = buf_ + sizeof(EventHeader);
25 
26  // l1 count
27  uint32 l1_count = l1_bits.size();
28  convert(l1_count, pos);
29  pos = pos + sizeof(uint32);
30 
31  // set the l1
32  uint32 l1_sz = l1_bits.size();
33  if (l1_sz != 0) l1_sz = 1 + ((l1_sz-1)/8);
34 
35  uint8* pos_end = pos + l1_sz;
36  memset(pos,0x00, pos_end-pos); // clear the bits
37  for(std::vector<bool>::size_type i = 0; i < l1_bits.size(); ++i) {
38  uint8 v = l1_bits[i] ? 1 : 0;
39  pos[i/8] |= (v << (i&0x07));
40  }
41  pos = pos_end;
42 
43  // hlt count
44  convert(hlt_bit_count, pos);
45  pos = pos + sizeof(uint32);
46 
47  uint32 hlt_sz = hlt_bit_count;
48  if (hlt_sz != 0) hlt_sz = 1+ ((hlt_sz-1)/4);
49 
50  // copy the hlt bits over
51  pos = std::copy(hlt_bits, hlt_bits+hlt_sz, pos);
52 
53  // adler32 check sum of data blob
54  convert(adler_chksum, pos);
55  pos = pos + sizeof(uint32);
56 
57  // put host name (Length and then Name) right after check sum
58  //uint32 host_name_len = strlen(host_name);
59  // actually make the host_name a fixed length as the event header size appears in the
60  // Init message and only one goes to a file whereas events can come from any node
61  // We want the max length to be determined inside this Event Message Builder
62  uint32 host_name_len = MAX_HOSTNAME_LEN;
63  assert(host_name_len < 0x00ff);
64  //Put host_name_len
65  *pos++ = host_name_len;
66 
67  //Put host_name
68  uint32 real_len = strlen(host_name);
69  if(real_len < host_name_len) {
70  char hostname_2use[MAX_HOSTNAME_LEN];
71  memset(hostname_2use,'\0',host_name_len);
72  memcpy(hostname_2use,host_name,real_len);
73  memcpy(pos,hostname_2use,host_name_len);
74  } else {
75  memcpy(pos,host_name,host_name_len);
76  }
77  pos += host_name_len;
78 
79  event_addr_ = pos + sizeof(char_uint32);
80  setEventLength(0);
81 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
def copy(args, dbName)
void setEventLength(uint32 len)
char_uint32 lumi_
Definition: EventMessage.h:67
uint16_t size_type
#define MAX_HOSTNAME_LEN
uint8 protocolVersion_
Definition: EventMessage.h:64
def convert(infile, ofile)
char_uint32 droppedEventsCount_
Definition: EventMessage.h:70
unsigned int uint32
Definition: MsgTools.h:13
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:16
char_uint32 run_
Definition: EventMessage.h:65
char_uint64 event_
Definition: EventMessage.h:66
char_uint32 outModId_
Definition: EventMessage.h:69
unsigned char uint8
Definition: MsgTools.h:11
Definition: event.py:1
uint32 size() const

Member Function Documentation

uint32 EventMsgBuilder::bufferSize ( ) const
inline

Definition at line 24 of file EventMsgBuilder.h.

References size_.

24 {return size_;}
uint8* EventMsgBuilder::eventAddr ( ) const
inline

Definition at line 21 of file EventMsgBuilder.h.

References event_addr_.

21 { return event_addr_; }
uint32 EventMsgBuilder::headerSize ( ) const
inline

Definition at line 22 of file EventMsgBuilder.h.

References buf_, event_addr_, and size().

Referenced by InitMsgBuilder::InitMsgBuilder().

22 {return event_addr_-buf_;}
void EventMsgBuilder::setEventLength ( uint32  len)

Definition at line 89 of file EventMsgBuilder.cc.

References buf_, fileCollector::convert(), Header::EVENT, event_addr_, h, and EventHeader::header_.

Referenced by EventMsgBuilder(), and startAddress().

90 {
91  convert(len,event_addr_-sizeof(char_uint32));
94 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Header header_
Definition: EventMessage.h:63
def convert(infile, ofile)
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:16
void EventMsgBuilder::setOrigDataSize ( uint32  value)

Definition at line 83 of file EventMsgBuilder.cc.

References buf_, fileCollector::convert(), h, and EventHeader::origDataSize_.

84 {
87 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
char_uint32 origDataSize_
Definition: EventMessage.h:68
Definition: value.py:1
def convert(infile, ofile)
uint32 EventMsgBuilder::size ( void  ) const
uint8* EventMsgBuilder::startAddress ( ) const
inline

Member Data Documentation

uint8* EventMsgBuilder::buf_
private
uint8* EventMsgBuilder::event_addr_
private

Definition at line 29 of file EventMsgBuilder.h.

Referenced by eventAddr(), EventMsgBuilder(), headerSize(), and setEventLength().

uint32 EventMsgBuilder::size_
private

Definition at line 28 of file EventMsgBuilder.h.

Referenced by bufferSize().