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 setBufAddr (uint8 *buf_addr)
 
void setEventAddr (uint8 *event_addr)
 
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::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.

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

References cms::cuda::assert(), buf_, fileCollector::convert(), filterCSVwithJSON::copy, event_addr_, mps_fire::i, MAX_HOSTNAME_LEN, writedatasetfile::run, setEventLength(), and findQualityFiles::v.

Member Function Documentation

◆ bufferSize()

uint32 EventMsgBuilder::bufferSize ( ) const
inline

Definition at line 31 of file EventMsgBuilder.h.

31 { return size_; }

References size_.

◆ eventAddr()

uint8* EventMsgBuilder::eventAddr ( ) const
inline

Definition at line 28 of file EventMsgBuilder.h.

28 { return event_addr_; }

References event_addr_.

◆ headerSize()

uint32 EventMsgBuilder::headerSize ( ) const
inline

Definition at line 29 of file EventMsgBuilder.h.

29 { return event_addr_ - buf_; }

References buf_, and event_addr_.

Referenced by InitMsgBuilder::InitMsgBuilder().

◆ setBufAddr()

void EventMsgBuilder::setBufAddr ( uint8 buf_addr)
inline

Definition at line 26 of file EventMsgBuilder.h.

26 { buf_ = buf_addr; }

References buf_.

◆ setEventAddr()

void EventMsgBuilder::setEventAddr ( uint8 event_addr)
inline

Definition at line 27 of file EventMsgBuilder.h.

27 { event_addr_ = event_addr; }

References event_addr_.

◆ setEventLength()

void EventMsgBuilder::setEventLength ( uint32  len)

Definition at line 95 of file EventMsgBuilder.cc.

95  {
96  convert(len, event_addr_ - sizeof(char_uint32));
98  new (&h->header_) Header(Header::EVENT, event_addr_ - buf_ + len);
99 }

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

Referenced by EventMsgBuilder().

◆ setOrigDataSize()

void EventMsgBuilder::setOrigDataSize ( uint32  value)

Definition at line 90 of file EventMsgBuilder.cc.

90  {
92  convert(value, h->origDataSize_);
93 }

References buf_, and fileCollector::convert().

◆ size()

uint32 EventMsgBuilder::size ( void  ) const

Definition at line 101 of file EventMsgBuilder.cc.

101  {
102  HeaderView v(buf_);
103  return v.size();
104 }

References buf_, and findQualityFiles::v.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

◆ startAddress()

uint8* EventMsgBuilder::startAddress ( ) const
inline

Definition at line 24 of file EventMsgBuilder.h.

24 { return buf_; }

References buf_.

Referenced by StreamerOutputFile::write().

Member Data Documentation

◆ buf_

uint8* EventMsgBuilder::buf_
private

◆ event_addr_

uint8* EventMsgBuilder::event_addr_
private

◆ size_

uint32 EventMsgBuilder::size_
private

Definition at line 35 of file EventMsgBuilder.h.

Referenced by bufferSize().

mps_fire.i
i
Definition: mps_fire.py:428
Header
Definition: MsgHeader.h:6
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
uint8
unsigned char uint8
Definition: MsgTools.h:11
EventMsgBuilder::size_
uint32 size_
Definition: EventMsgBuilder.h:35
pos
Definition: PixelAliasList.h:18
EventHeader
Definition: EventHeader.h:18
cms::cuda::assert
assert(be >=bs)
EventMsgBuilder::event_addr_
uint8 * event_addr_
Definition: EventMsgBuilder.h:36
char_uint32
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:16
EventMsgBuilder::buf_
uint8 * buf_
Definition: EventMsgBuilder.h:34
findQualityFiles.v
v
Definition: findQualityFiles.py:179
uint32
unsigned int uint32
Definition: MsgTools.h:13
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
Header::EVENT
Definition: MsgHeader.h:16
HeaderView
Definition: MsgHeader.h:35
h
fileCollector.convert
def convert(infile, ofile)
Definition: fileCollector.py:47
EventMsgBuilder::setEventLength
void setEventLength(uint32 len)
Definition: EventMsgBuilder.cc:95
value
Definition: value.py:1
visDQMUpload.buf
buf
Definition: visDQMUpload.py:160
MAX_HOSTNAME_LEN
#define MAX_HOSTNAME_LEN
Definition: EventMsgBuilder.cc:7
writedatasetfile.run
run
Definition: writedatasetfile.py:27
EventMsgBuilder::size
uint32 size() const
Definition: EventMsgBuilder.cc:101
event
Definition: event.py:1
lumi
Definition: LumiSectionData.h:20