CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::streamer::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
 
bool isEventMetaData () 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 72 of file EventMessage.h.

Constructor & Destructor Documentation

◆ EventMsgView()

EventMsgView::EventMsgView ( void *  buf)

Definition at line 6 of file EventMessage.cc.

References adler32_chksum_, buf_, edm::streamer::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_.

6  : buf_((uint8*)buf), head_(buf), v2Detected_(false) {
7  // 29-Jan-2008, KAB - adding an explicit version number.
8  // We'll start with 5 to match the new version of the INIT message.
9  // We support earlier versions of the full protocol, of course, but since
10  // we didn't have an explicit version number in the Event Message before
11  // now, we have to limit what we can handle to versions that have the
12  // version number included (>= 5).
13 
14  // 18-Jul-2008, wmtan - payload changed for version 7.
15  // So we no longer support previous formats.
16  if (protocolVersion() != 11) {
17  throw cms::Exception("EventMsgView", "Invalid Message Version:")
18  << "Only message version 10 is currently supported \n"
19  << "(invalid value = " << protocolVersion() << ").\n"
20  << "We support only reading and converting streamer files\n"
21  << "using the same version of CMSSW used to created the\n"
22  << "streamer file. This is because the streamer format is\n"
23  << "only a temporary format, as such we do not support\n"
24  << "backwards compatibility. If you really need a streamer\n"
25  << "file for some reason, the work around is that you convert\n"
26  << "the streamer file to a Root file using the CMSSW version\n"
27  << "that created the streamer file, then convert the Root file\n"
28  << "to a streamer file using a newer release that will produce\n"
29  << "the version of streamer file that you desire.\n";
30  }
31 
32  uint8* l1_bit_size_ptr = buf_ + sizeof(EventHeader); //Just after Header
33  l1_bits_count_ = convert32(l1_bit_size_ptr);
34  uint32 l1_sz = l1_bits_count_;
35  // No point! Not supporting older versions and causes problems in unit
36  // tests that uses l1_bits_count_ == 11, and could cause problems later if using 11
37  //Lets detect if thats V2 message
38  //if (l1_bits_count_ == 11) {
39  // l1_sz = 1;
40  // v2Detected_=true;
41  //}
42 
43  l1_bits_start_ = buf_ + sizeof(EventHeader) + sizeof(uint32);
44 
45  if (v2Detected_ == false) {
46  if (l1_sz != 0)
47  l1_sz = 1 + ((l1_sz - 1) / 8);
48  }
49  uint8* hlt_bit_size_ptr = l1_bits_start_ + l1_sz;
50  hlt_bits_count_ = convert32(hlt_bit_size_ptr);
51  hlt_bits_start_ = hlt_bit_size_ptr + sizeof(uint32);
52  uint32 hlt_sz = hlt_bits_count_;
53  if (hlt_sz != 0)
54  hlt_sz = 1 + ((hlt_sz - 1) / 4);
55 
56  if (v2Detected_)
57  hlt_sz = 2;
58  uint8* adler32_start = hlt_bits_start_ + hlt_sz;
59  adler32_chksum_ = convert32(adler32_start);
60  host_name_start_ = adler32_start + sizeof(uint32);
62  host_name_start_ += sizeof(uint8);
65  event_start_ += sizeof(char_uint32);
66 }
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:29
uint32 protocolVersion() const
Definition: EventMessage.cc:68
unsigned char uint8
Definition: MsgTools.h:12
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:17
unsigned int uint32
Definition: MsgTools.h:14

Member Function Documentation

◆ adler32_chksum()

uint32 edm::streamer::EventMsgView::adler32_chksum ( ) const
inline

◆ code()

uint32 edm::streamer::EventMsgView::code ( ) const
inline

◆ droppedEventsCount()

uint32 EventMsgView::droppedEventsCount ( ) const

Definition at line 98 of file EventMessage.cc.

References buf_, edm::streamer::convert32(), and h.

Referenced by edm::streamer::dumpEventHeader().

98  {
99  EventHeader* h = reinterpret_cast<EventHeader*>(buf_);
100  return convert32(h->droppedEventsCount_);
101  return 0;
102 }
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:29
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ event()

uint64 EventMsgView::event ( ) const

Definition at line 78 of file EventMessage.cc.

References buf_, edm::streamer::convert64(), and h.

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

78  {
79  EventHeader* h = reinterpret_cast<EventHeader*>(buf_);
80  return convert64(h->event_);
81 }
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

◆ eventData()

const uint8* edm::streamer::EventMsgView::eventData ( ) const
inline

◆ eventLength()

uint32 edm::streamer::EventMsgView::eventLength ( ) const
inline

◆ headerSize()

uint32 edm::streamer::EventMsgView::headerSize ( ) const
inline

◆ hltCount()

uint32 edm::streamer::EventMsgView::hltCount ( ) const
inline

◆ hltTriggerBits()

void EventMsgView::hltTriggerBits ( uint8 put_here) const

Definition at line 114 of file EventMessage.cc.

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

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

114  {
115  uint32 hlt_sz = hlt_bits_count_;
116  if (hlt_sz != 0)
117  hlt_sz = 1 + ((hlt_sz - 1) / 4);
118 
119  if (v2Detected_)
120  hlt_sz = 2;
121 
122  std::copy(hlt_bits_start_, hlt_bits_start_ + hlt_sz, put_here);
123 }
unsigned int uint32
Definition: MsgTools.h:14

◆ hostName()

std::string EventMsgView::hostName ( ) const

Definition at line 125 of file EventMessage.cc.

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

Referenced by edm::streamer::StreamerInputSource::deserializeEventCommon(), and edm::streamer::dumpEventHeader().

125  {
126  //return std::string(reinterpret_cast<char *>(host_name_start_),host_name_len_);
127  std::string host_name(reinterpret_cast<char*>(host_name_start_), host_name_len_);
128  size_t found = host_name.find('\0');
129  if (found != std::string::npos) {
130  return std::string(host_name, 0, found);
131  } else {
132  return host_name;
133  }
134 }

◆ hostName_len()

uint32 edm::streamer::EventMsgView::hostName_len ( ) const
inline

Definition at line 99 of file EventMessage.h.

References host_name_len_.

99 { return host_name_len_; }

◆ isEventMetaData()

bool EventMsgView::isEventMetaData ( ) const

◆ l1Count()

uint32 edm::streamer::EventMsgView::l1Count ( ) const
inline

Definition at line 96 of file EventMessage.h.

References l1_bits_count_.

96 { return l1_bits_count_; }

◆ l1TriggerBits()

void EventMsgView::l1TriggerBits ( std::vector< bool > &  put_here) const

Definition at line 106 of file EventMessage.cc.

References mps_fire::i, l1_bits_count_, and l1_bits_start_.

Referenced by edm::streamer::dumpEventHeader().

106  {
107  put_here.clear();
108  put_here.resize(l1_bits_count_);
109 
111  put_here[i] = (bool)(l1_bits_start_[i / 8] & (1 << ((i & 0x07))));
112 }
uint16_t size_type

◆ lumi()

uint32 EventMsgView::lumi ( ) const

Definition at line 83 of file EventMessage.cc.

References buf_, edm::streamer::convert32(), and h.

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

83  {
84  EventHeader* h = reinterpret_cast<EventHeader*>(buf_);
85  return convert32(h->lumi_);
86 }
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:29
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ origDataSize()

uint32 EventMsgView::origDataSize ( ) const

Definition at line 88 of file EventMessage.cc.

References buf_, edm::streamer::convert32(), and h.

Referenced by edm::streamer::StreamerInputSource::deserializeEventCommon(), and edm::streamer::dumpEventHeader().

88  {
89  EventHeader* h = reinterpret_cast<EventHeader*>(buf_);
90  return convert32(h->origDataSize_);
91 }
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:29
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ outModId()

uint32 EventMsgView::outModId ( ) const

Definition at line 93 of file EventMessage.cc.

References buf_, edm::streamer::convert32(), and h.

Referenced by edm::streamer::dumpEventHeader().

93  {
94  EventHeader* h = reinterpret_cast<EventHeader*>(buf_);
95  return convert32(h->outModId_);
96 }
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:29
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ protocolVersion()

uint32 EventMsgView::protocolVersion ( ) const

Definition at line 68 of file EventMessage.cc.

References buf_, and h.

Referenced by edm::streamer::dumpEventHeader(), and EventMsgView().

68  {
69  EventHeader* h = reinterpret_cast<EventHeader*>(buf_);
70  return h->protocolVersion_;
71 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ run()

uint32 EventMsgView::run ( ) const

Definition at line 73 of file EventMessage.cc.

References buf_, edm::streamer::convert32(), and h.

Referenced by edm::streamer::StreamerInputSource::deserializeEventCommon(), edm::streamer::dumpEventHeader(), isEventMetaData(), and edm::streamer::StreamerFileReader::skip().

73  {
74  EventHeader* h = reinterpret_cast<EventHeader*>(buf_);
75  return convert32(h->run_);
76 }
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:29
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ size()

uint32 edm::streamer::EventMsgView::size ( void  ) const
inline

◆ startAddress()

uint8* edm::streamer::EventMsgView::startAddress ( ) const
inline

Definition at line 80 of file EventMessage.h.

References buf_.

Referenced by edm::streamer::StreamerOutputFile::writeEventHeader().

80 { return buf_; }

Member Data Documentation

◆ adler32_chksum_

uint32 edm::streamer::EventMsgView::adler32_chksum_
private

Definition at line 111 of file EventMessage.h.

Referenced by adler32_chksum(), and EventMsgView().

◆ buf_

uint8* edm::streamer::EventMsgView::buf_
private

◆ event_len_

uint32 edm::streamer::EventMsgView::event_len_
private

Definition at line 110 of file EventMessage.h.

Referenced by eventLength(), and EventMsgView().

◆ event_start_

uint8* edm::streamer::EventMsgView::event_start_
private

Definition at line 109 of file EventMessage.h.

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

◆ head_

HeaderView edm::streamer::EventMsgView::head_
private

Definition at line 103 of file EventMessage.h.

Referenced by code(), and size().

◆ hlt_bits_count_

uint32 edm::streamer::EventMsgView::hlt_bits_count_
private

Definition at line 106 of file EventMessage.h.

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

◆ hlt_bits_start_

uint8* edm::streamer::EventMsgView::hlt_bits_start_
private

Definition at line 105 of file EventMessage.h.

Referenced by EventMsgView(), and hltTriggerBits().

◆ host_name_len_

uint32 edm::streamer::EventMsgView::host_name_len_
private

Definition at line 113 of file EventMessage.h.

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

◆ host_name_start_

uint8* edm::streamer::EventMsgView::host_name_start_
private

Definition at line 112 of file EventMessage.h.

Referenced by EventMsgView(), and hostName().

◆ l1_bits_count_

uint32 edm::streamer::EventMsgView::l1_bits_count_
private

Definition at line 108 of file EventMessage.h.

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

◆ l1_bits_start_

uint8* edm::streamer::EventMsgView::l1_bits_start_
private

Definition at line 107 of file EventMessage.h.

Referenced by EventMsgView(), and l1TriggerBits().

◆ v2Detected_

bool edm::streamer::EventMsgView::v2Detected_
private

Definition at line 114 of file EventMessage.h.

Referenced by EventMsgView(), and hltTriggerBits().