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

#include <DQMEventMsgBuilder.h>

Public Member Functions

uint32 bufferSize () const
 
 DQMEventMsgBuilder (void *buf, uint32 bufSize, uint32 run, uint32 event, edm::Timestamp timeStamp, uint32 lumiSection, uint32 updateNumber, uint32 adler32_chksum, const char *host_name, std::string const &releaseTag, std::string const &topFolderName, DQMEvent::TObjectTable monitorElementsBySubFolder)
 
uint8eventAddress () const
 
uint32 headerSize () const
 
void setCompressionFlag (uint32)
 
void setEventLength (uint32 len)
 
void setFUGuid (uint32)
 
void setFUProcessId (uint32)
 
void setReserved (uint32)
 
uint32 size () const
 
uint8startAddress () const
 

Private Attributes

uint8buf_
 
uint32 bufSize_
 
uint8eventAddr_
 

Detailed Description

This class is used to build and view the DQM Event data that is exchanged between the filter units and the storage manager.

09-Feb-2007 - Initial Implementation DQM Event Message Format:

Definition at line 48 of file DQMEventMsgBuilder.h.

Constructor & Destructor Documentation

DQMEventMsgBuilder::DQMEventMsgBuilder ( void *  buf,
uint32  bufSize,
uint32  run,
uint32  event,
edm::Timestamp  timeStamp,
uint32  lumiSection,
uint32  updateNumber,
uint32  adler_chksum,
const char *  host_name,
std::string const &  releaseTag,
std::string const &  topFolderName,
DQMEvent::TObjectTable  monitorElementsBySubFolder 
)

This class is used to build and view the DQM Event data that is exchanged between the filter units and the storage manager.

09-Feb-2007 - Initial Implementation Constructor.

Definition at line 18 of file DQMEventMsgBuilder.cc.

References buf_, bufSize_, convert(), eventAddr_, DQMEventHeader::eventNumber_, edm::hlt::Exception, DQMEventHeader::headerSize_, DQMEventHeader::lumiSection_, DQMEventHeader::protocolVersion_, DQMEventHeader::runNumber_, setCompressionFlag(), setEventLength(), setFUGuid(), setFUProcessId(), setReserved(), DQMEventHeader::timeStamp_, DQMEventHeader::updateNumber_, and edm::Timestamp::value().

27  :
28  buf_((uint8*)buf),bufSize_(bufSize)
29 {
30  DQMEventHeader* evtHdr;
31  uint8* bufPtr;
32  uint32 len;
33  uint32 protocolVersion = 3;
34 
35  // fill in event header information
36  bufPtr = buf_ + sizeof(DQMEventHeader);
37  if (((uint32) (bufPtr - buf_)) > bufSize_)
38  {
39  throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder")
40  << "Input buffer size is too small for required header "
41  << "information. Size = " << bufSize_
42  << ", necessary size is >= "
43  << ((uint32) (bufPtr - buf_)) << ".\n";
44  }
45 
46  evtHdr = (DQMEventHeader*) buf_;
47  convert(protocolVersion, evtHdr->protocolVersion_);
48  convert(run, evtHdr->runNumber_);
49  convert(event, evtHdr->eventNumber_);
50 
51  convert(timeStamp.value(), evtHdr->timeStamp_);
52 
53  convert(lumiSection, evtHdr->lumiSection_);
54  convert(updateNumber, evtHdr->updateNumber_);
55 
56  // copy the release tag into the message
57  len = releaseTag.length();
58  if (((uint32) (bufPtr + len + sizeof(uint32) - buf_)) > bufSize_)
59  {
60  throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder")
61  << "Input buffer size is too small for required header "
62  << "information. Size = " << bufSize_
63  << ", necessary size is >= "
64  << ((uint32) (bufPtr + len + sizeof(uint32) - buf_)) << ".\n";
65  }
66  convert(len, bufPtr);
67  bufPtr += sizeof(uint32);
68  releaseTag.copy((char*) bufPtr, len);
69  bufPtr += len;
70 
71  // copy the top folder name into the message
72  len = topFolderName.length();
73  if (((uint32) (bufPtr + len + sizeof(uint32) - buf_)) > bufSize_)
74  {
75  throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder")
76  << "Input buffer size is too small for required header "
77  << "information. Size = " << bufSize_
78  << ", necessary size is >= "
79  << ((uint32) (bufPtr + len + sizeof(uint32) - buf_)) << ".\n";
80  }
81  convert(len, bufPtr);
82  bufPtr += sizeof(uint32);
83  topFolderName.copy((char*) bufPtr, len);
84  bufPtr += len;
85 
86  // copy the subfolder count into the message
87  convert(static_cast<uint32>(monitorElementsBySubFolder.size()), bufPtr);
88  bufPtr += sizeof(uint32);
89 
90  // copy the ME count and name for each subfolder into the message
91  DQMEvent::TObjectTable::const_iterator sfIter;
92  for (sfIter = monitorElementsBySubFolder.begin();
93  sfIter != monitorElementsBySubFolder.end(); sfIter++)
94  {
95  std::string subFolderName = sfIter->first;
96  std::vector<TObject *> toList = sfIter->second;
97 
98  convert(static_cast<uint32>(toList.size()), bufPtr);
99  bufPtr += sizeof(uint32);
100 
101  len = subFolderName.length();
102  convert(len, bufPtr);
103  bufPtr += sizeof(uint32);
104  subFolderName.copy((char*) bufPtr, len);
105  bufPtr += len;
106  }
107  // adler32 check sum of data blob
108  convert(adler_chksum, bufPtr);
109  bufPtr += sizeof(uint32);
110 
111  // put host name (Length and then Name) right after check sum
112  uint32 host_name_len = strlen(host_name);
113  assert(host_name_len < 0x00ff);
114  //Put host_name_len
115  *bufPtr++ = host_name_len;
116  //Put host_name
117  memcpy(bufPtr,host_name,host_name_len);
118  bufPtr += host_name_len;
119 
120  // set the header size and the event address, taking into account the
121  // size of the event length field
122  if (((uint32) (bufPtr + sizeof(uint32) - buf_)) > bufSize_)
123  {
124  throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder")
125  << "Input buffer size is too small for required header "
126  << "information. Size = " << bufSize_
127  << ", necessary size is >= "
128  << ((uint32) (bufPtr + sizeof(uint32) - buf_)) << ".\n";
129  }
130  convert(((uint32) (bufPtr - buf_)), evtHdr->headerSize_);
131  bufPtr += sizeof(uint32);
132  eventAddr_ = bufPtr;
133 
134  // set the event length to 0 initially. (The setEventLength method
135  // sets the message code and message size for us. It shouldn't be called
136  // until *after* the event address is set.)
137  setEventLength(0);
138 
139  // initialize the compression flag to zero
141 
142  // initialize the filter unit process ID to zero
143  setFUProcessId(0);
144 
145  // initialize the filter unit GUID to zero
146  setFUGuid(0);
147 
148  // initialize the reserved word to zero
149  setReserved(0);
150 }
char_uint32 lumiSection_
char_uint32 protocolVersion_
char_uint64 timeStamp_
char_uint32 headerSize_
char_uint32 updateNumber_
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
unsigned int uint32
Definition: MsgTools.h:13
char_uint32 eventNumber_
TimeValue_t value() const
Definition: Timestamp.cc:72
void setCompressionFlag(uint32)
void setEventLength(uint32 len)
unsigned char uint8
Definition: MsgTools.h:11
char_uint32 runNumber_

Member Function Documentation

uint32 DQMEventMsgBuilder::bufferSize ( ) const
inline

Definition at line 60 of file DQMEventMsgBuilder.h.

References bufSize_.

60 { return bufSize_; }
uint8* DQMEventMsgBuilder::eventAddress ( ) const
inline

Definition at line 67 of file DQMEventMsgBuilder.h.

References eventAddr_.

Referenced by StreamDQMOutputFile::write().

67 { return eventAddr_; }
uint32 DQMEventMsgBuilder::headerSize ( ) const
inline
void DQMEventMsgBuilder::setCompressionFlag ( uint32  value)

Sets the value of the compression flag in the header.

Definition at line 174 of file DQMEventMsgBuilder.cc.

References buf_, DQMEventHeader::compressionFlag_, and convert().

Referenced by DQMEventMsgBuilder().

175 {
176  DQMEventHeader* evtHdr = (DQMEventHeader*) buf_;
177  convert(value, evtHdr->compressionFlag_);
178 }
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
char_uint32 compressionFlag_
void DQMEventMsgBuilder::setEventLength ( uint32  len)

Sets the length of the event (payload). This method verifies that the buffer in which we are building the message is large enough and updates the size of the message taking into account the new event length.

Definition at line 157 of file DQMEventMsgBuilder.cc.

References buf_, bufSize_, convert(), Header::DQM_EVENT, eventAddr_, edm::hlt::Exception, DQMEventHeader::header_, and headerSize().

Referenced by DQMEventMsgBuilder().

158 {
159  if (((uint32) (eventAddr_ + len - buf_)) > bufSize_)
160  {
161  throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder")
162  << "Event data overflows buffer. Buffer size = " << bufSize_
163  << ", header size = " << this->headerSize()
164  << ", event size = " << len << ".\n";
165  }
166  convert(len, eventAddr_ - sizeof(char_uint32));
167  DQMEventHeader* evtHdr = (DQMEventHeader*) buf_;
168  new (&evtHdr->header_) Header(Header::DQM_EVENT, (eventAddr_ - buf_ + len));
169 }
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
unsigned int uint32
Definition: MsgTools.h:13
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:16
uint32 headerSize() const
void DQMEventMsgBuilder::setFUGuid ( uint32  value)

Sets the value of the filter unit GUID in the header.

Definition at line 192 of file DQMEventMsgBuilder.cc.

References buf_, convert(), and DQMEventHeader::fuGuid_.

Referenced by DQMEventMsgBuilder().

193 {
194  DQMEventHeader* evtHdr = (DQMEventHeader*) buf_;
195  convert(value, evtHdr->fuGuid_);
196 }
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
char_uint32 fuGuid_
void DQMEventMsgBuilder::setFUProcessId ( uint32  value)

Sets the value of the filter unit process ID in the header.

Definition at line 183 of file DQMEventMsgBuilder.cc.

References buf_, convert(), and DQMEventHeader::fuProcessId_.

Referenced by DQMEventMsgBuilder().

184 {
185  DQMEventHeader* evtHdr = (DQMEventHeader*) buf_;
186  convert(value, evtHdr->fuProcessId_);
187 }
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
char_uint32 fuProcessId_
void DQMEventMsgBuilder::setReserved ( uint32  value)

Sets the value of the reserved word in the header.

Definition at line 201 of file DQMEventMsgBuilder.cc.

References buf_, convert(), and DQMEventHeader::reserved_.

Referenced by DQMEventMsgBuilder().

202 {
203  DQMEventHeader* evtHdr = (DQMEventHeader*) buf_;
204  convert(value, evtHdr->reserved_);
205 }
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
char_uint32 reserved_
uint32 DQMEventMsgBuilder::size ( void  ) const

Returns the size of the message.

Definition at line 210 of file DQMEventMsgBuilder.cc.

References buf_, HeaderView::size(), and v.

Referenced by StreamDQMOutputFile::write(), and FUShmDQMOutputService::writeShmDQMData().

211 {
212  HeaderView v(buf_);
213  return v.size();
214 }
mathSSE::Vec4< T > v
uint8* DQMEventMsgBuilder::startAddress ( ) const
inline

Definition at line 61 of file DQMEventMsgBuilder.h.

References buf_.

Referenced by StreamDQMOutputFile::writeDQMEventHeader(), and FUShmDQMOutputService::writeShmDQMData().

61 { return buf_; }

Member Data Documentation

uint8* DQMEventMsgBuilder::buf_
private
uint32 DQMEventMsgBuilder::bufSize_
private

Definition at line 73 of file DQMEventMsgBuilder.h.

Referenced by bufferSize(), DQMEventMsgBuilder(), and setEventLength().

uint8* DQMEventMsgBuilder::eventAddr_
private

Definition at line 74 of file DQMEventMsgBuilder.h.

Referenced by DQMEventMsgBuilder(), eventAddress(), headerSize(), and setEventLength().