test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventMsgBuilder.cc
Go to the documentation of this file.
4 #include <cassert>
5 #include <cstring>
6 
7 #define MAX_HOSTNAME_LEN 25
8 
11  uint32 outModId, uint32 droppedEventsCount,
12  std::vector<bool>& l1_bits,
13  uint8* hlt_bits, uint32 hlt_bit_count,
14  uint32 adler_chksum, const char* host_name):
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 }
82 
84 {
86  convert(value,h->origDataSize_);
87 }
88 
90 {
91  convert(len,event_addr_-sizeof(char_uint32));
94 }
95 
97 {
98  HeaderView v(buf_);
99  return v.size();
100 }
int i
Definition: DBlmapReader.cc:9
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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)
void setEventLength(uint32 len)
tuple lumi
Definition: fjr2json.py:35
char_uint32 lumi_
Definition: EventMessage.h:67
assert(m_qm.get())
char_uint32 origDataSize_
Definition: EventMessage.h:68
uint16_t size_type
void setOrigDataSize(uint32)
#define MAX_HOSTNAME_LEN
uint8 protocolVersion_
Definition: EventMessage.h:64
Header header_
Definition: EventMessage.h:63
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: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
unsigned long long uint64
Definition: MsgTools.h:14
uint32 size() const
Definition: MsgHeader.h:35
char_uint32 outModId_
Definition: EventMessage.h:69
unsigned char uint8
Definition: MsgTools.h:11
size_(0)
Definition: OwnArray.h:181
tuple size
Write out results.
uint32 size() const