CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventMessage.cc
Go to the documentation of this file.
3 
4 
6  buf_((uint8*)buf),head_(buf),
7  v2Detected_(false)
8 {
9  // 29-Jan-2008, KAB - adding an explicit version number.
10  // We'll start with 5 to match the new version of the INIT message.
11  // We support earlier versions of the full protocol, of course, but since
12  // we didn't have an explicit version number in the Event Message before
13  // now, we have to limit what we can handle to versions that have the
14  // version number included (>= 5).
15 
16  // 18-Jul-2008, wmtan - payload changed for version 7.
17  // So we no longer support previous formats.
18  if (protocolVersion() != 9) {
19  throw cms::Exception("EventMsgView", "Invalid Message Version:")
20  << "Only message version 9 is currently supported \n"
21  << "(invalid value = " << protocolVersion() << ").\n"
22  << "We support only reading and converting streamer files\n"
23  << "using the same version of CMSSW used to created the\n"
24  << "streamer file. This is because the streamer format is\n"
25  << "only a temporary format, as such we do not support\n"
26  << "backwards compatibility. If you really need a streamer\n"
27  << "file for some reason, the work around is that you convert\n"
28  << "the streamer file to a Root file using the CMSSW version\n"
29  << "that created the streamer file, then convert the Root file\n"
30  << "to a streamer file using a newer release that will produce\n"
31  << "the version of streamer file that you desire.\n";
32  }
33 
34  uint8* l1_bit_size_ptr = buf_ + sizeof(EventHeader); //Just after Header
35  l1_bits_count_ = convert32(l1_bit_size_ptr);
36  uint32 l1_sz = l1_bits_count_;
37 // No point! Not supporting older versions and causes problems in unit
38 // tests that uses l1_bits_count_ == 11, and could cause problems later if using 11
39  //Lets detect if thats V2 message
40  //if (l1_bits_count_ == 11) {
41  // l1_sz = 1;
42  // v2Detected_=true;
43  //}
44 
45  l1_bits_start_ = buf_ + sizeof(EventHeader) + sizeof(uint32);
46 
47  if (v2Detected_ == false) {
48  if (l1_sz != 0) l1_sz = 1 + ((l1_sz-1)/8);
49  }
50  uint8* hlt_bit_size_ptr = l1_bits_start_ + l1_sz;
51  hlt_bits_count_ = convert32(hlt_bit_size_ptr);
52  hlt_bits_start_ = hlt_bit_size_ptr + sizeof(uint32);
53  uint32 hlt_sz = hlt_bits_count_;
54  if (hlt_sz != 0) hlt_sz = 1+ ((hlt_sz-1)/4);
55 
56  if(v2Detected_) hlt_sz=2;
57  uint8* adler32_start = hlt_bits_start_ + hlt_sz;
58  adler32_chksum_ = convert32(adler32_start);
59  host_name_start_ = adler32_start + sizeof(uint32);
61  host_name_start_ += sizeof(uint8);
64  event_start_ += sizeof(char_uint32);
65 }
66 
68 {
70  return h->protocolVersion_;
71 }
72 
74 {
76  return convert32(h->run_);
77 }
78 
80 {
82  return convert32(h->event_);
83 }
84 
86 {
88  return convert32(h->lumi_);
89 }
90 
92 {
94  return convert32(h->origDataSize_);
95 }
96 
98 {
100  return convert32(h->outModId_);
101 }
102 
104 {
106  return convert32(h->droppedEventsCount_);
107  return 0;
108 }
109 
110 void EventMsgView::l1TriggerBits(std::vector<bool>& put_here) const
111 {
112  put_here.clear();
113  put_here.resize(l1_bits_count_);
114 
116  put_here[i] = (bool)(l1_bits_start_[i/8] & (1<<((i&0x07))));
117 }
118 
119 void EventMsgView::hltTriggerBits(uint8* put_here) const
120 {
121  uint32 hlt_sz = hlt_bits_count_;
122  if (hlt_sz != 0) hlt_sz = 1 + ((hlt_sz-1)/4);
123 
124  if(v2Detected_) hlt_sz=2;
125 
127  put_here);
128 }
129 
131 {
132  //return std::string(reinterpret_cast<char *>(host_name_start_),host_name_len_);
133  std::string host_name(reinterpret_cast<char *>(host_name_start_),host_name_len_);
134  size_t found = host_name.find('\0');
135  if(found != std::string::npos) {
136  return std::string(host_name, 0, found);
137  } else {
138  return host_name;
139  }
140 }
141 
142 
int i
Definition: DBlmapReader.cc:9
uint32 lumi() const
Definition: EventMessage.cc:85
char_uint32 event_
Definition: EventMessage.h:62
uint8 * l1_bits_start_
Definition: EventMessage.h:105
void hltTriggerBits(uint8 *put_here) const
std::string hostName() const
char_uint32 lumi_
Definition: EventMessage.h:63
char_uint32 origDataSize_
Definition: EventMessage.h:64
uint32 outModId() const
Definition: EventMessage.cc:97
uint16_t size_type
EventMsgView(void *buf)
Definition: EventMessage.cc:5
uint32 run() const
Definition: EventMessage.cc:73
uint8 * event_start_
Definition: EventMessage.h:107
uint32 hlt_bits_count_
Definition: EventMessage.h:104
uint32 l1_bits_count_
Definition: EventMessage.h:106
uint8 protocolVersion_
Definition: EventMessage.h:60
uint32 event() const
Definition: EventMessage.cc:79
char_uint32 droppedEventsCount_
Definition: EventMessage.h:66
uint8 * host_name_start_
Definition: EventMessage.h:110
unsigned int uint32
Definition: MsgTools.h:13
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:16
char_uint32 run_
Definition: EventMessage.h:61
uint32 adler32_chksum_
Definition: EventMessage.h:109
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
uint8 * hlt_bits_start_
Definition: EventMessage.h:103
uint32 droppedEventsCount() const
uint32 origDataSize() const
Definition: EventMessage.cc:91
char_uint32 outModId_
Definition: EventMessage.h:65
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
unsigned char uint8
Definition: MsgTools.h:11
uint32 host_name_len_
Definition: EventMessage.h:111
uint8 * buf_
Definition: EventMessage.h:100
uint32 event_len_
Definition: EventMessage.h:108
void l1TriggerBits(std::vector< bool > &put_here) const
uint32 protocolVersion() const
Definition: EventMessage.cc:67