CMS 3D CMS Logo

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 72 of file EventMessage.h.

Constructor & Destructor Documentation

◆ EventMsgView()

EventMsgView::EventMsgView ( void *  buf)

Definition at line 4 of file EventMessage.cc.

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

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_.

Member Function Documentation

◆ adler32_chksum()

uint32 EventMsgView::adler32_chksum ( ) const
inline

Definition at line 96 of file EventMessage.h.

96 { return adler32_chksum_; }

References adler32_chksum_.

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

◆ code()

uint32 EventMsgView::code ( ) const
inline

Definition at line 76 of file EventMessage.h.

76 { return head_.code(); }

References HeaderView::code(), and head_.

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

◆ droppedEventsCount()

uint32 EventMsgView::droppedEventsCount ( ) const

Definition at line 96 of file EventMessage.cc.

96  {
98  return convert32(h->droppedEventsCount_);
99  return 0;
100 }

References buf_, and convert32().

Referenced by dumpEventHeader().

◆ event()

uint64 EventMsgView::event ( ) const

Definition at line 76 of file EventMessage.cc.

76  {
78  return convert64(h->event_);
79 }

References buf_, and convert64().

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

◆ eventData()

const uint8* EventMsgView::eventData ( ) const
inline

Definition at line 79 of file EventMessage.h.

79 { return event_start_; }

References event_start_.

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

◆ eventLength()

uint32 EventMsgView::eventLength ( ) const
inline

Definition at line 81 of file EventMessage.h.

81 { return event_len_; }

References event_len_.

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

◆ headerSize()

uint32 EventMsgView::headerSize ( ) const
inline

Definition at line 82 of file EventMessage.h.

82 { return event_start_ - buf_; }

References buf_, and event_start_.

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

◆ hltCount()

uint32 EventMsgView::hltCount ( ) const
inline

Definition at line 94 of file EventMessage.h.

94 { return hlt_bits_count_; }

References hlt_bits_count_.

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

◆ hltTriggerBits()

void EventMsgView::hltTriggerBits ( uint8 put_here) const

Definition at line 110 of file EventMessage.cc.

110  {
111  uint32 hlt_sz = hlt_bits_count_;
112  if (hlt_sz != 0)
113  hlt_sz = 1 + ((hlt_sz - 1) / 4);
114 
115  if (v2Detected_)
116  hlt_sz = 2;
117 
118  std::copy(hlt_bits_start_, hlt_bits_start_ + hlt_sz, put_here);
119 }

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

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

◆ hostName()

std::string EventMsgView::hostName ( ) const

Definition at line 121 of file EventMessage.cc.

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

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

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

◆ hostName_len()

uint32 EventMsgView::hostName_len ( ) const
inline

Definition at line 98 of file EventMessage.h.

98 { return host_name_len_; }

References host_name_len_.

◆ l1Count()

uint32 EventMsgView::l1Count ( ) const
inline

Definition at line 95 of file EventMessage.h.

95 { return l1_bits_count_; }

References l1_bits_count_.

◆ l1TriggerBits()

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

Definition at line 102 of file EventMessage.cc.

102  {
103  put_here.clear();
104  put_here.resize(l1_bits_count_);
105 
107  put_here[i] = (bool)(l1_bits_start_[i / 8] & (1 << ((i & 0x07))));
108 }

References mps_fire::i, l1_bits_count_, and l1_bits_start_.

Referenced by dumpEventHeader().

◆ lumi()

uint32 EventMsgView::lumi ( ) const

Definition at line 81 of file EventMessage.cc.

81  {
83  return convert32(h->lumi_);
84 }

References buf_, and convert32().

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

◆ origDataSize()

uint32 EventMsgView::origDataSize ( ) const

Definition at line 86 of file EventMessage.cc.

86  {
88  return convert32(h->origDataSize_);
89 }

References buf_, and convert32().

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

◆ outModId()

uint32 EventMsgView::outModId ( ) const

Definition at line 91 of file EventMessage.cc.

91  {
93  return convert32(h->outModId_);
94 }

References buf_, and convert32().

Referenced by dumpEventHeader().

◆ protocolVersion()

uint32 EventMsgView::protocolVersion ( ) const

Definition at line 66 of file EventMessage.cc.

66  {
68  return h->protocolVersion_;
69 }

References buf_.

Referenced by dumpEventHeader(), and EventMsgView().

◆ run()

uint32 EventMsgView::run ( ) const

Definition at line 71 of file EventMessage.cc.

71  {
73  return convert32(h->run_);
74 }

References buf_, and convert32().

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

◆ size()

uint32 EventMsgView::size ( void  ) const
inline

◆ startAddress()

uint8* EventMsgView::startAddress ( ) const
inline

Definition at line 80 of file EventMessage.h.

80 { return buf_; }

References buf_.

Referenced by StreamerOutputFile::writeEventHeader().

Member Data Documentation

◆ adler32_chksum_

uint32 EventMsgView::adler32_chksum_
private

Definition at line 110 of file EventMessage.h.

Referenced by adler32_chksum(), and EventMsgView().

◆ buf_

uint8* EventMsgView::buf_
private

◆ event_len_

uint32 EventMsgView::event_len_
private

Definition at line 109 of file EventMessage.h.

Referenced by eventLength(), and EventMsgView().

◆ event_start_

uint8* EventMsgView::event_start_
private

Definition at line 108 of file EventMessage.h.

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

◆ head_

HeaderView EventMsgView::head_
private

Definition at line 102 of file EventMessage.h.

Referenced by code(), and size().

◆ hlt_bits_count_

uint32 EventMsgView::hlt_bits_count_
private

Definition at line 105 of file EventMessage.h.

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

◆ hlt_bits_start_

uint8* EventMsgView::hlt_bits_start_
private

Definition at line 104 of file EventMessage.h.

Referenced by EventMsgView(), and hltTriggerBits().

◆ host_name_len_

uint32 EventMsgView::host_name_len_
private

Definition at line 112 of file EventMessage.h.

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

◆ host_name_start_

uint8* EventMsgView::host_name_start_
private

Definition at line 111 of file EventMessage.h.

Referenced by EventMsgView(), and hostName().

◆ l1_bits_count_

uint32 EventMsgView::l1_bits_count_
private

Definition at line 107 of file EventMessage.h.

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

◆ l1_bits_start_

uint8* EventMsgView::l1_bits_start_
private

Definition at line 106 of file EventMessage.h.

Referenced by EventMsgView(), and l1TriggerBits().

◆ v2Detected_

bool EventMsgView::v2Detected_
private

Definition at line 113 of file EventMessage.h.

Referenced by EventMsgView(), and hltTriggerBits().

mps_fire.i
i
Definition: mps_fire.py:355
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
uint8
unsigned char uint8
Definition: MsgTools.h:11
EventMsgView::l1_bits_count_
uint32 l1_bits_count_
Definition: EventMessage.h:107
EventMsgView::adler32_chksum_
uint32 adler32_chksum_
Definition: EventMessage.h:110
EventMsgView::v2Detected_
bool v2Detected_
Definition: EventMessage.h:113
EventHeader
Definition: EventHeader.h:18
char_uint32
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:16
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
EventMsgView::buf_
uint8 * buf_
Definition: EventMessage.h:101
uint32
unsigned int uint32
Definition: MsgTools.h:13
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
EventMsgView::protocolVersion
uint32 protocolVersion() const
Definition: EventMessage.cc:66
convert32
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:28
h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EventMsgView::l1_bits_start_
uint8 * l1_bits_start_
Definition: EventMessage.h:106
EventMsgView::host_name_len_
uint32 host_name_len_
Definition: EventMessage.h:112
HeaderView::code
uint32 code() const
Definition: MsgHeader.h:43
convert64
uint64 convert64(char_uint64 v)
Definition: MsgTools.h:20
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
HeaderView::size
uint32 size() const
Definition: MsgHeader.h:44
EventMsgView::event_start_
uint8 * event_start_
Definition: EventMessage.h:108
EventMsgView::hlt_bits_count_
uint32 hlt_bits_count_
Definition: EventMessage.h:105
Exception
Definition: hltDiff.cc:246
EventMsgView::head_
HeaderView head_
Definition: EventMessage.h:102
EventMsgView::host_name_start_
uint8 * host_name_start_
Definition: EventMessage.h:111
EventMsgView::event_len_
uint32 event_len_
Definition: EventMessage.h:109
EventMsgView::hlt_bits_start_
uint8 * hlt_bits_start_
Definition: EventMessage.h:104