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, 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,
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::event_, event_addr_, h, i, EventHeader::lumi_, MAX_HOSTNAME_LEN, EventHeader::outModId_, pos, EventHeader::protocolVersion_, EventHeader::run_, setEventLength(), and v.

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

Member Function Documentation

uint32 EventMsgBuilder::bufferSize ( ) const
inline

Definition at line 23 of file EventMsgBuilder.h.

References size_.

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

Definition at line 20 of file EventMsgBuilder.h.

References event_addr_.

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

Definition at line 21 of file EventMsgBuilder.h.

References buf_, and event_addr_.

Referenced by InitMsgBuilder::InitMsgBuilder().

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

Definition at line 87 of file EventMsgBuilder.cc.

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

Referenced by EventMsgBuilder().

88 {
89  convert(len,event_addr_-sizeof(char_uint32));
92 }
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
Header header_
Definition: EventMessage.h:50
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 81 of file EventMsgBuilder.cc.

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

82 {
85 }
char_uint32 origDataSize_
Definition: EventMessage.h:55
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 94 of file EventMsgBuilder.cc.

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

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

95 {
96  HeaderView v(buf_);
97  return v.size();
98 }
mathSSE::Vec4< T > v
uint8* EventMsgBuilder::startAddress ( ) const
inline

Member Data Documentation

uint8* EventMsgBuilder::buf_
private
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().