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_, alignCSCRings::s, 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::stringstream s;
73  s.str("Subfolder ");
74  s<<idx;
75  std::string subFolderName = s.str();
76  uint32 nameLen = convert32(bufPtr);
77  bufPtr += sizeof(uint32);
78  if (nameLen <= MAX_STRING_SIZE) // prevent something totally crazy // nameLen >= 0, since nameLen is unsigned.
79  {
80  subFolderName.clear();
81  subFolderName.append((char *) bufPtr, nameLen);
82  }
83  bufPtr += nameLen;
84  nameListPtr_->push_back(subFolderName);
86  }
87  adler32_chksum_ = convert32(bufPtr);
88  bufPtr += sizeof(uint32);
89 
90  host_name_len_ = *bufPtr;
91  bufPtr += sizeof(uint8);
92  host_name_start_ = bufPtr;
93  bufPtr += host_name_len_;
94 
95  // determine the event length and address
96  eventLen_ = convert32(bufPtr);
97  bufPtr += sizeof(uint32);
98  eventAddr_ = bufPtr;
99 
100  // check that the event data doesn't extend beyond the reported
101  // size of the message
102  if ((this->headerSize() + this->eventLength()) > this->size())
103  {
104  throw cms::Exception("MessageDecoding", "DQMEventMsgView")
105  << "Inconsistent data sizes. The size of the header ("
106  << this->headerSize() << ") and the data (" << this->eventLength()
107  << ") exceed the size of the message (" << this->size() << ").\n";
108  }
109 }
#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 231 of file DQMEventMessage.cc.

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

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

232 {
234  return convert32(h->compressionFlag_);
235 }
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 204 of file DQMEventMessage.cc.

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

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

205 {
207  return convert32(h->eventNumber_);
208 }
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 eventNumber_
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 249 of file DQMEventMessage.cc.

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

Referenced by dumpDQMEventHeader().

250 {
252  return convert32(h->fuGuid_);
253 }
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 240 of file DQMEventMessage.cc.

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

Referenced by dumpDQMEventHeader().

241 {
243  return convert32(h->fuProcessId_);
244 }
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 fuProcessId_
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
uint32 DQMEventMsgView::headerSize ( ) const

Returns the size of the DQM Event header.

Definition at line 186 of file DQMEventMessage.cc.

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

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

187 {
189  return convert32(h->headerSize_);
190 }
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 213 of file DQMEventMessage.cc.

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

Referenced by dumpDQMEventHeader().

214 {
216  return convert32(h->lumiSection_);
217 }
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 139 of file DQMEventMessage.cc.

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

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

140 {
141  // lookup the index of the specified subfolder
142  std::map<std::string, uint32>::const_iterator subFolderIter;
143  subFolderIter = subFolderIndexTable_.find(subFolderName);
144 
145  // throw an exception if the name was not found
146  if (subFolderIter == subFolderIndexTable_.end())
147  {
148  throw cms::Exception("MessageDecoding", "DQMEventMsgView")
149  << "Unable to find the subfolder index for \""
150  << subFolderName << "\".\n";
151  }
152 
153  // fetch the count by index
154  return this->meCount(subFolderIter->second);
155 }
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 161 of file DQMEventMessage.cc.

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

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

Returns the number of merges

Definition at line 258 of file DQMEventMessage.cc.

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

Referenced by dumpDQMEventHeader().

259 {
261  return convert32(h->mergeCount_);
262 }
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 177 of file DQMEventMessage.cc.

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

Referenced by DQMEventMsgView(), and dumpDQMEventHeader().

178 {
180  return convert32(h->protocolVersion_);
181 }
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 195 of file DQMEventMessage.cc.

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

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

196 {
198  return convert32(h->runNumber_);
199 }
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 123 of file DQMEventMessage.cc.

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

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

124 {
125  // catch attempts to access an invalid entry
126  if (subFolderIndex >= subFolderCount_)
127  {
128  throw cms::Exception("MessageDecoding", "DQMEventMsgView")
129  << "Invalid subfolder index (" << subFolderIndex << ") - "
130  << "the number of subfolders is " << subFolderCount_ << ".\n";
131  }
132 
133  return (*nameListPtr_)[subFolderIndex];
134 }
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 115 of file DQMEventMessage.cc.

References nameListPtr_.

Referenced by dumpDQMEventView().

116 {
117  return nameListPtr_;
118 }
boost::shared_ptr< std::vector< std::string > > nameListPtr_
edm::Timestamp DQMEventMsgView::timeStamp ( ) const

Definition at line 265 of file DQMEventMessage.cc.

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

266 {
268  return edm::Timestamp(convert64(h->timeStamp_));
269 }
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 222 of file DQMEventMessage.cc.

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

Referenced by dumpDQMEventHeader().

223 {
225  return convert32(h->updateNumber_);
226 }
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().