CMS 3D CMS Logo

Public Member Functions | Private Attributes

edm::StreamDQMDeserializer Class Reference

#include <StreamDQMDeserializer.h>

List of all members.

Public Member Functions

std::auto_ptr
< DQMEvent::TObjectTable
deserializeDQMEvent (DQMEventMsgView const &dqmEventView)
 StreamDQMDeserializer ()

Private Attributes

std::vector< unsigned char > decompressBuffer_
TBufferFile workTBuffer_

Detailed Description

Definition at line 19 of file StreamDQMDeserializer.h.


Constructor & Destructor Documentation

edm::StreamDQMDeserializer::StreamDQMDeserializer ( )

Default constructor.

Definition at line 24 of file StreamDQMDeserializer.cc.


Member Function Documentation

std::auto_ptr< DQMEvent::TObjectTable > edm::StreamDQMDeserializer::deserializeDQMEvent ( DQMEventMsgView const &  dqmEventView)

Deserializes the specified DQM event message into a map of subfolder names and lists of TObjects that can be turned into monitor elements.

Definition at line 35 of file StreamDQMDeserializer.cc.

References cms::Adler32(), DQMEventMsgView::adler32_chksum(), DQMEventMsgView::code(), DQMEventMsgView::compressionFlag(), decompressBuffer_, Header::DQM_EVENT, DQMEventMsgView::eventAddress(), DQMEventMsgView::eventLength(), DQMEventMsgView::eventNumberAtUpdate(), Exception, FDEBUG, DQMEventMsgView::hostName(), DQMEventMsgView::meCount(), DQMEventMsgView::runNumber(), DQMEventMsgView::size(), AlCaHLTBitMon_QueryRunRegistry::string, DQMEventMsgView::subFolderCount(), DQMEventMsgView::subFolderName(), edm::StreamerInputSource::uncompressBuffer(), and workTBuffer_.

Referenced by stor::DQMTopLevelFolder::addDQMEvent(), and edm::DQMHttpSource::addEventToDQMBackend().

  {
    if (dqmEventView.code() != Header::DQM_EVENT)
      throw cms::Exception("StreamTranslation",
                           "DQM Event deserialization error")
        << "received wrong message type: expected DQM_EVENT ("
        << Header::DQM_EVENT << "), got " << dqmEventView.code() << "\n";
    FDEBUG(9) << "Deserialing DQM event: "
         << dqmEventView.eventNumberAtUpdate() << " "
         << dqmEventView.runNumber() << " "
         << dqmEventView.size() << " "
         << dqmEventView.adler32_chksum() << " "
         << dqmEventView.hostName() << " "
         << dqmEventView.eventLength() << " "
         << dqmEventView.eventAddress()
         << std::endl;


    // create the folder name to TObject map
    std::auto_ptr<DQMEvent::TObjectTable> tablePtr(new DQMEvent::TObjectTable());

    // fetch the number of subfolders
    uint32 subFolderCount = dqmEventView.subFolderCount();

    // handle compressed data, if needed
    unsigned char *bufPtr = dqmEventView.eventAddress();
    unsigned int bufLen = dqmEventView.eventLength();
    unsigned int originalSize = dqmEventView.compressionFlag();

    uint32_t adler32_chksum = cms::Adler32((char*)dqmEventView.eventAddress(), dqmEventView.eventLength());
    if((uint32)adler32_chksum != dqmEventView.adler32_chksum()) {
      throw cms::Exception("StreamTranslation",
                           "DQM Event chksum error")
          << "Error from StreamDQMSerializer: checksum of event data blob failed:" << std::endl
          << "chksum from event = " << adler32_chksum << " from header = "
          << dqmEventView.adler32_chksum() << " host name = "
          << dqmEventView.hostName() << std::endl;
    }

    if (originalSize != 0)
      {
        unsigned int actualSize =
          StreamerInputSource::uncompressBuffer(bufPtr, bufLen,
                                               decompressBuffer_,
                                               originalSize);
        bufPtr = &decompressBuffer_[0];
        bufLen = actualSize;
      }

    // wrap a TBuffer around the DQM event data so that we can read out the
    // monitor elements
    workTBuffer_.Reset();
    workTBuffer_.SetBuffer(bufPtr, bufLen, kFALSE);

    // loop over the subfolders
    for (uint32 fdx = 0; fdx < subFolderCount; fdx++)
      {

        // create the list of monitor elements in the subfolder
        std::vector<TObject *> meList;
        int meCount = dqmEventView.meCount(fdx);
        for (int mdx = 0; mdx < meCount; mdx++)
          {
            TObject *tmpPtr = workTBuffer_.ReadObject(TObject::Class());
            meList.push_back(tmpPtr);
          }

        // store the list of monitor elements in the table
        std::string subFolderName = dqmEventView.subFolderName(fdx);
        (*tablePtr)[subFolderName] = meList;
      }

    return tablePtr;
  }

Member Data Documentation

std::vector<unsigned char> edm::StreamDQMDeserializer::decompressBuffer_ [private]

Definition at line 28 of file StreamDQMDeserializer.h.

Referenced by deserializeDQMEvent().

Definition at line 29 of file StreamDQMDeserializer.h.

Referenced by deserializeDQMEvent().