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
edm::StreamDQMDeserializer Class Reference

#include <StreamDQMDeserializer.h>

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.

24  :
26  workTBuffer_(TBuffer::kRead, init_size)
27  { }
const int init_size
std::vector< unsigned char > decompressBuffer_

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(), edm::hlt::Exception, FDEBUG, DQMEventMsgView::hostName(), DQMEventMsgView::meCount(), DQMEventMsgView::runNumber(), DQMEventMsgView::size(), DQMEventMsgView::subFolderCount(), DQMEventMsgView::subFolderName(), edm::StreamerInputSource::uncompressBuffer(), and workTBuffer_.

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

36  {
37  if (dqmEventView.code() != Header::DQM_EVENT)
38  throw cms::Exception("StreamTranslation",
39  "DQM Event deserialization error")
40  << "received wrong message type: expected DQM_EVENT ("
41  << Header::DQM_EVENT << "), got " << dqmEventView.code() << "\n";
42  FDEBUG(9) << "Deserialing DQM event: "
43  << dqmEventView.eventNumberAtUpdate() << " "
44  << dqmEventView.runNumber() << " "
45  << dqmEventView.size() << " "
46  << dqmEventView.adler32_chksum() << " "
47  << dqmEventView.hostName() << " "
48  << dqmEventView.eventLength() << " "
49  << dqmEventView.eventAddress()
50  << std::endl;
51 
52 
53  // create the folder name to TObject map
54  std::auto_ptr<DQMEvent::TObjectTable> tablePtr(new DQMEvent::TObjectTable());
55 
56  // fetch the number of subfolders
57  uint32 subFolderCount = dqmEventView.subFolderCount();
58 
59  // handle compressed data, if needed
60  unsigned char *bufPtr = dqmEventView.eventAddress();
61  unsigned int bufLen = dqmEventView.eventLength();
62  unsigned int originalSize = dqmEventView.compressionFlag();
63 
64  uint32_t adler32_chksum = cms::Adler32((char*)dqmEventView.eventAddress(), dqmEventView.eventLength());
65  if((uint32)adler32_chksum != dqmEventView.adler32_chksum()) {
66  throw cms::Exception("StreamTranslation",
67  "DQM Event chksum error")
68  << "Error from StreamDQMSerializer: checksum of event data blob failed:" << std::endl
69  << "chksum from event = " << adler32_chksum << " from header = "
70  << dqmEventView.adler32_chksum() << " host name = "
71  << dqmEventView.hostName() << std::endl;
72  }
73 
74  if (originalSize != 0)
75  {
76  unsigned int actualSize =
79  originalSize);
80  bufPtr = &decompressBuffer_[0];
81  bufLen = actualSize;
82  }
83 
84  // wrap a TBuffer around the DQM event data so that we can read out the
85  // monitor elements
86  workTBuffer_.Reset();
87  workTBuffer_.SetBuffer(bufPtr, bufLen, kFALSE);
88 
89  // loop over the subfolders
90  for (uint32 fdx = 0; fdx < subFolderCount; fdx++)
91  {
92 
93  // create the list of monitor elements in the subfolder
94  std::vector<TObject *> meList;
95  int meCount = dqmEventView.meCount(fdx);
96  for (int mdx = 0; mdx < meCount; mdx++)
97  {
98  TObject *tmpPtr = workTBuffer_.ReadObject(TObject::Class());
99  meList.push_back(tmpPtr);
100  }
101 
102  // store the list of monitor elements in the table
103  std::string subFolderName = dqmEventView.subFolderName(fdx);
104  (*tablePtr)[subFolderName] = meList;
105  }
106 
107  return tablePtr;
108  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::vector< unsigned char > decompressBuffer_
unsigned int uint32
Definition: MsgTools.h:13
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
std::map< std::string, std::vector< TObject * > > TObjectTable
static unsigned int uncompressBuffer(unsigned char *inputBuffer, unsigned int inputSize, std::vector< unsigned char > &outputBuffer, unsigned int expectedFullSize)

Member Data Documentation

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

Definition at line 28 of file StreamDQMDeserializer.h.

Referenced by deserializeDQMEvent().

TBufferFile edm::StreamDQMDeserializer::workTBuffer_
private

Definition at line 29 of file StreamDQMDeserializer.h.

Referenced by deserializeDQMEvent().