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
EventMsgView Class Reference

#include <EventMessage.h>

Public Member Functions

uint32 adler32_chksum () const
 
uint32 code () const
 
uint32 droppedEventsCount () const
 
uint64 event () const
 
const uint8eventData () const
 
uint32 eventLength () const
 
 EventMsgView (void *buf)
 
uint32 headerSize () const
 
uint32 hltCount () const
 
void hltTriggerBits (uint8 *put_here) const
 
std::string hostName () const
 
uint32 hostName_len () const
 
uint32 l1Count () const
 
void l1TriggerBits (std::vector< bool > &put_here) const
 
uint32 lumi () const
 
uint32 origDataSize () const
 
uint32 outModId () const
 
uint32 protocolVersion () const
 
uint32 run () const
 
uint32 size () const
 
uint8startAddress () const
 

Private Attributes

uint32 adler32_chksum_
 
uint8buf_
 
uint32 event_len_
 
uint8event_start_
 
HeaderView head_
 
uint32 hlt_bits_count_
 
uint8hlt_bits_start_
 
uint32 host_name_len_
 
uint8host_name_start_
 
uint32 l1_bits_count_
 
uint8l1_bits_start_
 
bool v2Detected_
 

Detailed Description

Definition at line 73 of file EventMessage.h.

Constructor & Destructor Documentation

EventMsgView::EventMsgView ( void *  buf)

Definition at line 5 of file EventMessage.cc.

References adler32_chksum_, buf_, convert32(), event_len_, event_start_, Exception, hlt_bits_count_, hlt_bits_start_, host_name_len_, host_name_start_, l1_bits_count_, l1_bits_start_, protocolVersion(), and v2Detected_.

5  :
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() != 11) {
19  throw cms::Exception("EventMsgView", "Invalid Message Version:")
20  << "Only message version 10 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 }
uint8 * l1_bits_start_
Definition: EventMessage.h:109
uint8 * event_start_
Definition: EventMessage.h:111
uint32 hlt_bits_count_
Definition: EventMessage.h:108
uint32 l1_bits_count_
Definition: EventMessage.h:110
uint8 * host_name_start_
Definition: EventMessage.h:114
unsigned int uint32
Definition: MsgTools.h:13
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:16
uint32 adler32_chksum_
Definition: EventMessage.h:113
uint8 * hlt_bits_start_
Definition: EventMessage.h:107
HeaderView head_
Definition: EventMessage.h:105
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
unsigned char uint8
Definition: MsgTools.h:11
uint32 host_name_len_
Definition: EventMessage.h:115
uint8 * buf_
Definition: EventMessage.h:104
uint32 event_len_
Definition: EventMessage.h:112
uint32 protocolVersion() const
Definition: EventMessage.cc:67

Member Function Documentation

uint32 EventMsgView::adler32_chksum ( ) const
inline

Definition at line 99 of file EventMessage.h.

References adler32_chksum_.

Referenced by edm::StreamerInputSource::deserializeEvent(), and dumpEventHeader().

99 {return adler32_chksum_;}
uint32 adler32_chksum_
Definition: EventMessage.h:113
uint32 EventMsgView::code ( ) const
inline

Definition at line 79 of file EventMessage.h.

References HeaderView::code(), and head_.

Referenced by edm::StreamerInputSource::deserializeEvent(), and dumpEventHeader().

79 { return head_.code(); }
uint32 code() const
Definition: MsgHeader.h:34
HeaderView head_
Definition: EventMessage.h:105
uint32 EventMsgView::droppedEventsCount ( ) const

Definition at line 103 of file EventMessage.cc.

References buf_, convert32(), EventHeader::droppedEventsCount_, and h.

Referenced by dumpEventHeader().

104 {
106  return convert32(h->droppedEventsCount_);
107  return 0;
108 }
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 droppedEventsCount_
Definition: EventMessage.h:70
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
uint8 * buf_
Definition: EventMessage.h:104
uint64 EventMsgView::event ( ) const

Definition at line 79 of file EventMessage.cc.

References buf_, convert64(), EventHeader::event_, and h.

Referenced by edm::StreamerInputSource::deserializeEvent(), dumpEventHeader(), core.AutoHandle.AutoHandle::Load(), core.AutoHandle.AutoHandle::product(), and edm::StreamerFileReader::skip().

80 {
82  return convert64(h->event_);
83 }
uint64 convert64(char_uint64 v)
Definition: MsgTools.h:21
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
char_uint64 event_
Definition: EventMessage.h:66
uint8 * buf_
Definition: EventMessage.h:104
const uint8* EventMsgView::eventData ( ) const
inline

Definition at line 82 of file EventMessage.h.

References event_start_.

Referenced by edm::StreamerInputSource::deserializeEvent(), and StreamerOutputFile::write().

82 { return event_start_; }
uint8 * event_start_
Definition: EventMessage.h:111
uint32 EventMsgView::eventLength ( ) const
inline

Definition at line 84 of file EventMessage.h.

References event_len_.

Referenced by edm::StreamerInputSource::deserializeEvent(), and dumpEventHeader().

84 { return event_len_; }
uint32 event_len_
Definition: EventMessage.h:112
uint32 EventMsgView::headerSize ( ) const
inline

Definition at line 85 of file EventMessage.h.

References buf_, and event_start_.

Referenced by StreamerOutputFile::write(), and StreamerOutputFile::writeEventHeader().

85 {return event_start_-buf_;}
uint8 * event_start_
Definition: EventMessage.h:111
uint8 * buf_
Definition: EventMessage.h:104
uint32 EventMsgView::hltCount ( ) const
inline

Definition at line 97 of file EventMessage.h.

References hlt_bits_count_.

Referenced by dqmservices::DQMStreamerReader::acceptEvent(), and dumpEventHeader().

97 {return hlt_bits_count_;}
uint32 hlt_bits_count_
Definition: EventMessage.h:108
void EventMsgView::hltTriggerBits ( uint8 put_here) const

Definition at line 119 of file EventMessage.cc.

References filterCSVwithJSON::copy, hlt_bits_count_, hlt_bits_start_, and v2Detected_.

Referenced by dqmservices::DQMStreamerReader::acceptEvent(), and dumpEventHeader().

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 }
uint32 hlt_bits_count_
Definition: EventMessage.h:108
unsigned int uint32
Definition: MsgTools.h:13
uint8 * hlt_bits_start_
Definition: EventMessage.h:107
std::string EventMsgView::hostName ( ) const

Definition at line 130 of file EventMessage.cc.

References newFWLiteAna::found, host_name_len_, host_name_start_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::StreamerInputSource::deserializeEvent(), and dumpEventHeader().

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 }
uint8 * host_name_start_
Definition: EventMessage.h:114
uint32 host_name_len_
Definition: EventMessage.h:115
uint32 EventMsgView::hostName_len ( ) const
inline

Definition at line 101 of file EventMessage.h.

References host_name_len_.

101 {return host_name_len_;}
uint32 host_name_len_
Definition: EventMessage.h:115
uint32 EventMsgView::l1Count ( ) const
inline

Definition at line 98 of file EventMessage.h.

References l1_bits_count_.

98 {return l1_bits_count_;}
uint32 l1_bits_count_
Definition: EventMessage.h:110
void EventMsgView::l1TriggerBits ( std::vector< bool > &  put_here) const

Definition at line 110 of file EventMessage.cc.

References i, l1_bits_count_, and l1_bits_start_.

Referenced by dumpEventHeader().

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 }
int i
Definition: DBlmapReader.cc:9
uint8 * l1_bits_start_
Definition: EventMessage.h:109
uint16_t size_type
uint32 l1_bits_count_
Definition: EventMessage.h:110
uint32 EventMsgView::lumi ( void  ) const

Definition at line 85 of file EventMessage.cc.

References buf_, convert32(), h, and EventHeader::lumi_.

Referenced by edm::StreamerInputSource::deserializeEvent(), dumpEventHeader(), and edm::StreamerFileReader::skip().

86 {
88  return convert32(h->lumi_);
89 }
char_uint32 lumi_
Definition: EventMessage.h:67
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
uint8 * buf_
Definition: EventMessage.h:104
uint32 EventMsgView::origDataSize ( ) const

Definition at line 91 of file EventMessage.cc.

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

Referenced by edm::StreamerInputSource::deserializeEvent(), and dumpEventHeader().

92 {
94  return convert32(h->origDataSize_);
95 }
char_uint32 origDataSize_
Definition: EventMessage.h:68
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
uint8 * buf_
Definition: EventMessage.h:104
uint32 EventMsgView::outModId ( ) const

Definition at line 97 of file EventMessage.cc.

References buf_, convert32(), h, and EventHeader::outModId_.

Referenced by dumpEventHeader().

98 {
100  return convert32(h->outModId_);
101 }
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:69
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
uint8 * buf_
Definition: EventMessage.h:104
uint32 EventMsgView::protocolVersion ( ) const

Definition at line 67 of file EventMessage.cc.

References buf_, h, and EventHeader::protocolVersion_.

Referenced by dumpEventHeader(), and EventMsgView().

68 {
70  return h->protocolVersion_;
71 }
uint8 protocolVersion_
Definition: EventMessage.h:64
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
uint8 * buf_
Definition: EventMessage.h:104
uint32 EventMsgView::run ( void  ) const

Definition at line 73 of file EventMessage.cc.

References buf_, convert32(), h, and EventHeader::run_.

Referenced by edm::StreamerInputSource::deserializeEvent(), dumpEventHeader(), and edm::StreamerFileReader::skip().

74 {
76  return convert32(h->run_);
77 }
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 run_
Definition: EventMessage.h:65
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
uint8 * buf_
Definition: EventMessage.h:104
uint32 EventMsgView::size ( void  ) const
inline

Definition at line 80 of file EventMessage.h.

References head_, and HeaderView::size().

Referenced by edm::StreamerInputSource::deserializeEvent(), dumpEventHeader(), and StreamerOutputFile::write().

80 { return head_.size(); }
uint32 size() const
Definition: MsgHeader.h:35
HeaderView head_
Definition: EventMessage.h:105
uint8* EventMsgView::startAddress ( ) const
inline

Definition at line 83 of file EventMessage.h.

References buf_.

Referenced by StreamerOutputFile::writeEventHeader().

83 { return buf_; }
uint8 * buf_
Definition: EventMessage.h:104

Member Data Documentation

uint32 EventMsgView::adler32_chksum_
private

Definition at line 113 of file EventMessage.h.

Referenced by adler32_chksum(), and EventMsgView().

uint8* EventMsgView::buf_
private
uint32 EventMsgView::event_len_
private

Definition at line 112 of file EventMessage.h.

Referenced by eventLength(), and EventMsgView().

uint8* EventMsgView::event_start_
private

Definition at line 111 of file EventMessage.h.

Referenced by eventData(), EventMsgView(), and headerSize().

HeaderView EventMsgView::head_
private

Definition at line 105 of file EventMessage.h.

Referenced by code(), and size().

uint32 EventMsgView::hlt_bits_count_
private

Definition at line 108 of file EventMessage.h.

Referenced by EventMsgView(), hltCount(), and hltTriggerBits().

uint8* EventMsgView::hlt_bits_start_
private

Definition at line 107 of file EventMessage.h.

Referenced by EventMsgView(), and hltTriggerBits().

uint32 EventMsgView::host_name_len_
private

Definition at line 115 of file EventMessage.h.

Referenced by EventMsgView(), hostName(), and hostName_len().

uint8* EventMsgView::host_name_start_
private

Definition at line 114 of file EventMessage.h.

Referenced by EventMsgView(), and hostName().

uint32 EventMsgView::l1_bits_count_
private

Definition at line 110 of file EventMessage.h.

Referenced by EventMsgView(), l1Count(), and l1TriggerBits().

uint8* EventMsgView::l1_bits_start_
private

Definition at line 109 of file EventMessage.h.

Referenced by EventMsgView(), and l1TriggerBits().

bool EventMsgView::v2Detected_
private

Definition at line 116 of file EventMessage.h.

Referenced by EventMsgView(), and hltTriggerBits().