CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, uint32 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,
uint32  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_, convert(), filterCSVwithJSON::copy, EventHeader::droppedEventsCount_, EventHeader::event_, event_addr_, h, i, EventHeader::lumi_, MAX_HOSTNAME_LEN, EventHeader::outModId_, pos, EventHeader::protocolVersion_, EventHeader::run_, setEventLength(), and findQualityFiles::v.

14  :
15  buf_((uint8*)buf),size_(size)
16 {
18  h->protocolVersion_ = 9;
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 }
int i
Definition: DBlmapReader.cc:9
char_uint32 event_
Definition: EventMessage.h:62
void setEventLength(uint32 len)
tuple lumi
Definition: fjr2json.py:35
char_uint32 lumi_
Definition: EventMessage.h:63
uint16_t size_type
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
#define MAX_HOSTNAME_LEN
uint8 protocolVersion_
Definition: EventMessage.h:60
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
char_uint32 droppedEventsCount_
Definition: EventMessage.h:66
unsigned int uint32
Definition: MsgTools.h:13
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:16
char_uint32 run_
Definition: EventMessage.h:61
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
char_uint32 outModId_
Definition: EventMessage.h:65
unsigned char uint8
Definition: MsgTools.h:11
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_, and event_addr_.

Referenced by InitMsgBuilder::InitMsgBuilder().

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

Definition at line 89 of file EventMsgBuilder.cc.

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

Referenced by EventMsgBuilder().

90 {
91  convert(len,event_addr_-sizeof(char_uint32));
94 }
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
Header header_
Definition: EventMessage.h:59
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:16
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void EventMsgBuilder::setOrigDataSize ( uint32  value)

Definition at line 83 of file EventMsgBuilder.cc.

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

84 {
87 }
char_uint32 origDataSize_
Definition: EventMessage.h:64
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
uint32 EventMsgBuilder::size ( void  ) const

Definition at line 96 of file EventMsgBuilder.cc.

References buf_, HeaderView::size(), and findQualityFiles::v.

Referenced by edm::FUShmOutputModule::doOutputEvent().

97 {
98  HeaderView v(buf_);
99  return v.size();
100 }
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().