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

#include <DQMEventMessage.h>

Public Member Functions

uint32 adler32_chksum () const
 
uint32 code () const
 
uint32 compressionFlag () const
 
 DQMEventMsgView (void *buf)
 
uint8eventAddress () const
 
uint32 eventLength () const
 
uint32 eventNumberAtUpdate () const
 
uint32 fuGuid () const
 
uint32 fuProcessId () const
 
uint32 headerSize () const
 
std::string hostName () const
 
uint32 hostName_len () const
 
uint32 lumiSection () const
 
uint32 meCount (std::string const &subFolderName) const
 
uint32 meCount (uint32 const subFolderIndex) const
 
uint32 mergeCount () const
 
uint32 protocolVersion () const
 
std::string releaseTag () const
 
uint32 runNumber () const
 
uint32 size () const
 
uint8startAddress () const
 
uint32 subFolderCount () const
 
std::string subFolderName (uint32 const subFolderIndex) const
 
boost::shared_ptr< std::vector
< std::string > > 
subFolderNames () const
 
edm::Timestamp timeStamp () const
 
std::string topFolderName () const
 
uint32 updateNumber () const
 

Private Attributes

uint32 adler32_chksum_
 
uint8buf_
 
uint8eventAddr_
 
uint32 eventLen_
 
std::string folderName_
 
HeaderView head_
 
uint32 host_name_len_
 
uint8host_name_start_
 
std::vector< uint32meCountList_
 
boost::shared_ptr< std::vector
< std::string > > 
nameListPtr_
 
std::string releaseTag_
 
uint32 subFolderCount_
 
std::map< std::string, uint32subFolderIndexTable_
 

Detailed Description

Definition at line 74 of file DQMEventMessage.h.

Constructor & Destructor Documentation

DQMEventMsgView::DQMEventMsgView ( void *  buf)

Constructor.

Definition at line 16 of file DQMEventMessage.cc.

References adler32_chksum_, buf_, code(), convert32(), Header::DQM_EVENT, eventAddr_, eventLen_, eventLength(), edm::hlt::Exception, folderName_, headerSize(), host_name_len_, host_name_start_, customizeTrackingMonitorSeedNumber::idx, MAX_STRING_SIZE, meCount(), meCountList_, nameListPtr_, protocolVersion(), releaseTag_, size(), AlCaHLTBitMon_QueryRunRegistry::string, subFolderCount_, subFolderIndexTable_, and subFolderName().

16  :
17  buf_((uint8*)buf),head_(buf)
18 {
19  uint8* bufPtr;
20  uint32 len;
21 
22  // verify that the buffer actually contains a DQM Event message
23  if (this->code() != Header::DQM_EVENT)
24  {
25  throw cms::Exception("MessageDecoding", "DQMEventMsgView")
26  << "Invalid DQM Event message code (" << this->code()
27  << "). Should be " << Header::DQM_EVENT << "\n";
28  }
29 
30  // verify that the message has a protocol that we support
31  if (this->protocolVersion() != 3)
32  {
33  throw cms::Exception("MessageDecoding", "DQMEventMsgView")
34  << "Unsupport protocol version (" << this->protocolVersion() << ").\n";
35  }
36 
37  // set our buffer pointer to just beyond the fixed header data
38  bufPtr = buf_ + sizeof(DQMEventHeader);
39 
40  // determine the release tag
41  len = convert32(bufPtr);
42  bufPtr += sizeof(uint32);
43  if (len <= MAX_STRING_SIZE) // prevent something totally crazy // len >= 0, since len is unsigned.
44  {
45  releaseTag_.append((char *) bufPtr, len);
46  }
47  bufPtr += len;
48 
49  // determine the top-level folder name
50  len = convert32(bufPtr);
51  bufPtr += sizeof(uint32);
52  if (len <= MAX_STRING_SIZE) // prevent something totally crazy // len >= 0, since len is unsigned.
53  {
54  folderName_.append((char *) bufPtr, len);
55  }
56  bufPtr += len;
57 
58  // determine the number of subfolders
59  subFolderCount_ = convert32(bufPtr);
60  bufPtr += sizeof(uint32);
61 
62  // loop over the subfolders to extract relevant quantities
63  nameListPtr_.reset(new std::vector<std::string>());
64  for (int idx = 0; idx < (int) subFolderCount_; idx++)
65  {
66  // number of MEs in subfolder
67  uint32 meCount = convert32(bufPtr);
68  bufPtr += sizeof(uint32);
69  meCountList_.push_back(meCount);
70 
71  // subfolder name
72  std::string subFolderName = "Subfolder " + idx;
73  uint32 nameLen = convert32(bufPtr);
74  bufPtr += sizeof(uint32);
75  if (nameLen <= MAX_STRING_SIZE) // prevent something totally crazy // nameLen >= 0, since nameLen is unsigned.
76  {
77  subFolderName.clear();
78  subFolderName.append((char *) bufPtr, nameLen);
79  }
80  bufPtr += nameLen;
81  nameListPtr_->push_back(subFolderName);
83  }
84  adler32_chksum_ = convert32(bufPtr);
85  bufPtr += sizeof(uint32);
86 
87  host_name_len_ = *bufPtr;
88  bufPtr += sizeof(uint8);
89  host_name_start_ = bufPtr;
90  bufPtr += host_name_len_;
91 
92  // determine the event length and address
93  eventLen_ = convert32(bufPtr);
94  bufPtr += sizeof(uint32);
95  eventAddr_ = bufPtr;
96 
97  // check that the event data doesn't extend beyond the reported
98  // size of the message
99  if ((this->headerSize() + this->eventLength()) > this->size())
100  {
101  throw cms::Exception("MessageDecoding", "DQMEventMsgView")
102  << "Inconsistent data sizes. The size of the header ("
103  << this->headerSize() << ") and the data (" << this->eventLength()
104  << ") exceed the size of the message (" << this->size() << ").\n";
105  }
106 }
#define MAX_STRING_SIZE
uint32 protocolVersion() const
uint8 * host_name_start_
uint32 meCount(std::string const &subFolderName) const
uint32 headerSize() const
std::map< std::string, uint32 > subFolderIndexTable_
uint32 eventLength() const
std::string releaseTag_
std::string subFolderName(uint32 const subFolderIndex) const
boost::shared_ptr< std::vector< std::string > > nameListPtr_
std::string folderName_
unsigned int uint32
Definition: MsgTools.h:13
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::vector< uint32 > meCountList_
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
unsigned char uint8
Definition: MsgTools.h:11
uint32 code() const
uint32 size() const

Member Function Documentation

uint32 DQMEventMsgView::adler32_chksum ( ) const
inline

Definition at line 85 of file DQMEventMessage.h.

References adler32_chksum_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and dumpDQMEventHeader().

85 {return adler32_chksum_;}
uint32 DQMEventMsgView::code ( ) const
inline

Definition at line 79 of file DQMEventMessage.h.

References HeaderView::code(), and head_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), DQMEventMsgView(), and dumpDQMEventHeader().

79 { return head_.code(); }
uint32 code() const
Definition: MsgHeader.h:34
uint32 DQMEventMsgView::compressionFlag ( ) const

Returns the compression flag (uncompressed data size or zero if uncompressed).

Definition at line 228 of file DQMEventMessage.cc.

References buf_, DQMEventHeader::compressionFlag_, convert32(), and h.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and dumpDQMEventHeader().

229 {
231  return convert32(h->compressionFlag_);
232 }
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 compressionFlag_
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
uint8* DQMEventMsgView::eventAddress ( ) const
inline

Definition at line 83 of file DQMEventMessage.h.

References eventAddr_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and StreamDQMOutputFile::write().

83 { return eventAddr_; }
uint32 DQMEventMsgView::eventLength ( ) const
inline

Definition at line 84 of file DQMEventMessage.h.

References eventLen_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), DQMEventMsgView(), and dumpDQMEventHeader().

84 { return eventLen_; }
uint32 DQMEventMsgView::eventNumberAtUpdate ( ) const

Returns the event number associated with the DQM Event.

Definition at line 201 of file DQMEventMessage.cc.

References buf_, convert32(), DQMEventHeader::eventNumber_, and h.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and dumpDQMEventHeader().

202 {
204  return convert32(h->eventNumber_);
205 }
char_uint32 eventNumber_
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
uint32 DQMEventMsgView::fuGuid ( ) const

Returns the GUID of the filter unit that created this update.

Definition at line 246 of file DQMEventMessage.cc.

References buf_, convert32(), DQMEventHeader::fuGuid_, and h.

Referenced by dumpDQMEventHeader().

247 {
249  return convert32(h->fuGuid_);
250 }
char_uint32 fuGuid_
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
uint32 DQMEventMsgView::fuProcessId ( ) const

Returns the process ID of the filter unit that created this update.

Definition at line 237 of file DQMEventMessage.cc.

References buf_, convert32(), DQMEventHeader::fuProcessId_, and h.

Referenced by dumpDQMEventHeader().

238 {
240  return convert32(h->fuProcessId_);
241 }
char_uint32 fuProcessId_
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
uint32 DQMEventMsgView::headerSize ( ) const

Returns the size of the DQM Event header.

Definition at line 183 of file DQMEventMessage.cc.

References buf_, convert32(), h, and DQMEventHeader::headerSize_.

Referenced by DQMEventMsgView(), StreamDQMOutputFile::write(), and StreamDQMOutputFile::writeDQMEventHeader().

184 {
186  return convert32(h->headerSize_);
187 }
char_uint32 headerSize_
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
std::string DQMEventMsgView::hostName ( ) const
uint32 DQMEventMsgView::hostName_len ( ) const
inline

Definition at line 87 of file DQMEventMessage.h.

References host_name_len_.

87 {return host_name_len_;}
uint32 DQMEventMsgView::lumiSection ( ) const

Returns the lumi section associated with the DQM Event.

Definition at line 210 of file DQMEventMessage.cc.

References buf_, convert32(), h, and DQMEventHeader::lumiSection_.

Referenced by dumpDQMEventHeader().

211 {
213  return convert32(h->lumiSection_);
214 }
char_uint32 lumiSection_
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
uint32 DQMEventMsgView::meCount ( std::string const &  subFolderName) const

Returns the number of monitor elements in the specified subfolder.

Definition at line 136 of file DQMEventMessage.cc.

References edm::hlt::Exception, and subFolderIndexTable_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), DQMEventMsgView(), and dumpDQMEventView().

137 {
138  // lookup the index of the specified subfolder
139  std::map<std::string, uint32>::const_iterator subFolderIter;
140  subFolderIter = subFolderIndexTable_.find(subFolderName);
141 
142  // throw an exception if the name was not found
143  if (subFolderIter == subFolderIndexTable_.end())
144  {
145  throw cms::Exception("MessageDecoding", "DQMEventMsgView")
146  << "Unable to find the subfolder index for \""
147  << subFolderName << "\".\n";
148  }
149 
150  // fetch the count by index
151  return this->meCount(subFolderIter->second);
152 }
uint32 meCount(std::string const &subFolderName) const
std::map< std::string, uint32 > subFolderIndexTable_
std::string subFolderName(uint32 const subFolderIndex) const
uint32 DQMEventMsgView::meCount ( uint32 const  subFolderIndex) const

Returns the number of monitor elements in the subfolder at the specified index.

Definition at line 158 of file DQMEventMessage.cc.

References edm::hlt::Exception, meCountList_, and subFolderCount_.

159 {
160  // catch attempts to access an invalid entry
161  if (subFolderIndex >= subFolderCount_)
162  {
163  throw cms::Exception("MessageDecoding", "DQMEventMsgView")
164  << "Invalid subfolder index (" << subFolderIndex << ") - "
165  << "the number of subfolders is " << subFolderCount_ << ".\n";
166  }
167 
168  return meCountList_[subFolderIndex];
169 }
std::vector< uint32 > meCountList_
uint32 DQMEventMsgView::mergeCount ( ) const

Returns the number of merges

Definition at line 255 of file DQMEventMessage.cc.

References buf_, convert32(), h, and DQMEventHeader::mergeCount_.

Referenced by dumpDQMEventHeader().

256 {
258  return convert32(h->mergeCount_);
259 }
char_uint32 mergeCount_
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
uint32 DQMEventMsgView::protocolVersion ( ) const

Returns the protocol version of the DQM Event.

Definition at line 174 of file DQMEventMessage.cc.

References buf_, convert32(), h, and DQMEventHeader::protocolVersion_.

Referenced by DQMEventMsgView(), and dumpDQMEventHeader().

175 {
177  return convert32(h->protocolVersion_);
178 }
char_uint32 protocolVersion_
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
std::string DQMEventMsgView::releaseTag ( ) const
inline

Definition at line 102 of file DQMEventMessage.h.

References releaseTag_.

Referenced by dumpDQMEventHeader().

102 { return releaseTag_; }
std::string releaseTag_
uint32 DQMEventMsgView::runNumber ( ) const

Returns the run number associated with the DQM Event.

Definition at line 192 of file DQMEventMessage.cc.

References buf_, convert32(), h, and DQMEventHeader::runNumber_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and dumpDQMEventHeader().

193 {
195  return convert32(h->runNumber_);
196 }
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
char_uint32 runNumber_
uint32 DQMEventMsgView::size ( void  ) const
inline
uint8* DQMEventMsgView::startAddress ( ) const
inline

Definition at line 82 of file DQMEventMessage.h.

References buf_.

Referenced by StreamDQMOutputFile::writeDQMEventHeader().

82 { return buf_; }
uint32 DQMEventMsgView::subFolderCount ( ) const
inline

Definition at line 105 of file DQMEventMessage.h.

References subFolderCount_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent().

105 { return subFolderCount_; }
std::string DQMEventMsgView::subFolderName ( uint32 const  subFolderIndex) const

Returns the name of the subfolder at the specified index.

Definition at line 120 of file DQMEventMessage.cc.

References edm::hlt::Exception, nameListPtr_, and subFolderCount_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and DQMEventMsgView().

121 {
122  // catch attempts to access an invalid entry
123  if (subFolderIndex >= subFolderCount_)
124  {
125  throw cms::Exception("MessageDecoding", "DQMEventMsgView")
126  << "Invalid subfolder index (" << subFolderIndex << ") - "
127  << "the number of subfolders is " << subFolderCount_ << ".\n";
128  }
129 
130  return (*nameListPtr_)[subFolderIndex];
131 }
boost::shared_ptr< std::vector< std::string > > nameListPtr_
boost::shared_ptr< std::vector< std::string > > DQMEventMsgView::subFolderNames ( ) const

Returns a shared pointer to the list of subfolder names.

Definition at line 112 of file DQMEventMessage.cc.

References nameListPtr_.

Referenced by dumpDQMEventView().

113 {
114  return nameListPtr_;
115 }
boost::shared_ptr< std::vector< std::string > > nameListPtr_
edm::Timestamp DQMEventMsgView::timeStamp ( ) const

Definition at line 262 of file DQMEventMessage.cc.

References buf_, convert64(), h, and DQMEventHeader::timeStamp_.

263 {
265  return edm::Timestamp(convert64(h->timeStamp_));
266 }
uint64 convert64(char_uint64 v)
Definition: MsgTools.h:21
char_uint64 timeStamp_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::string DQMEventMsgView::topFolderName ( ) const
inline

Definition at line 103 of file DQMEventMessage.h.

References folderName_.

Referenced by dumpDQMEventHeader().

103 { return folderName_; }
std::string folderName_
uint32 DQMEventMsgView::updateNumber ( ) const

Returns the update number of the DQM Event.

Definition at line 219 of file DQMEventMessage.cc.

References buf_, convert32(), h, and DQMEventHeader::updateNumber_.

Referenced by dumpDQMEventHeader().

220 {
222  return convert32(h->updateNumber_);
223 }
char_uint32 updateNumber_
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

Member Data Documentation

uint32 DQMEventMsgView::adler32_chksum_
private

Definition at line 119 of file DQMEventMessage.h.

Referenced by adler32_chksum(), and DQMEventMsgView().

uint8* DQMEventMsgView::buf_
private
uint8* DQMEventMsgView::eventAddr_
private

Definition at line 117 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and eventAddress().

uint32 DQMEventMsgView::eventLen_
private

Definition at line 118 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and eventLength().

std::string DQMEventMsgView::folderName_
private

Definition at line 116 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and topFolderName().

HeaderView DQMEventMsgView::head_
private

Definition at line 114 of file DQMEventMessage.h.

Referenced by code(), and size().

uint32 DQMEventMsgView::host_name_len_
private

Definition at line 121 of file DQMEventMessage.h.

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

uint8* DQMEventMsgView::host_name_start_
private

Definition at line 120 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and hostName().

std::vector<uint32> DQMEventMsgView::meCountList_
private

Definition at line 125 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and meCount().

boost::shared_ptr< std::vector<std::string> > DQMEventMsgView::nameListPtr_
private

Definition at line 124 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), subFolderName(), and subFolderNames().

std::string DQMEventMsgView::releaseTag_
private

Definition at line 115 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and releaseTag().

uint32 DQMEventMsgView::subFolderCount_
private

Definition at line 122 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), meCount(), subFolderCount(), and subFolderName().

std::map<std::string, uint32> DQMEventMsgView::subFolderIndexTable_
private

Definition at line 123 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and meCount().