CMS 3D CMS Logo

Public Member Functions | Private Attributes

edm::StreamDQMSerializer Class Reference

#include <StreamDQMSerializer.h>

List of all members.

Public Member Functions

uint32_t adler32_chksum () const
unsigned char * bufferPointer () const
unsigned int currentEventSize () const
unsigned int currentSpaceUsed () const
int serializeDQMEvent (DQMEvent::TObjectTable &toTable, bool use_compression, int compression_level)
 StreamDQMSerializer ()

Private Attributes

uint32_t adler32_chksum_
std::vector< unsigned char > comp_buf_
unsigned int curr_event_size_
unsigned int curr_space_used_
unsigned char * ptr_
TBufferFile rootbuf_

Detailed Description

Definition at line 20 of file StreamDQMSerializer.h.


Constructor & Destructor Documentation

edm::StreamDQMSerializer::StreamDQMSerializer ( )

Default constructor

Definition at line 23 of file StreamDQMSerializer.cc.

                                          :
    comp_buf_(init_size),
    curr_event_size_(),
    curr_space_used_(),
    rootbuf_(TBuffer::kWrite,init_size),
    ptr_((unsigned char*)rootbuf_.Buffer()),
    adler32_chksum_(0)
  { }

Member Function Documentation

uint32_t edm::StreamDQMSerializer::adler32_chksum ( ) const [inline]
unsigned char* edm::StreamDQMSerializer::bufferPointer ( ) const [inline]

Definition at line 34 of file StreamDQMSerializer.h.

References ptr_.

Referenced by stor::DQMTopLevelFolder::getRecord(), and FUShmDQMOutputService::postEndLumi().

{ return ptr_; }
unsigned int edm::StreamDQMSerializer::currentEventSize ( ) const [inline]
unsigned int edm::StreamDQMSerializer::currentSpaceUsed ( ) const [inline]

Definition at line 35 of file StreamDQMSerializer.h.

References curr_space_used_.

Referenced by FUShmDQMOutputService::postEndLumi().

{ return curr_space_used_; }
int edm::StreamDQMSerializer::serializeDQMEvent ( DQMEvent::TObjectTable toTable,
bool  use_compression,
int  compression_level 
)

Serializes the specified table of ROOT TObjects into the internal buffer.

Definition at line 35 of file StreamDQMSerializer.cc.

References cms::Adler32(), adler32_chksum_, comp_buf_, edm::StreamSerializer::compressBuffer(), curr_event_size_, curr_space_used_, ptr_, and rootbuf_.

Referenced by stor::DQMTopLevelFolder::getRecord(), and FUShmDQMOutputService::postEndLumi().

  {
    // initialize the internal TBuffer
    rootbuf_.Reset();
    RootDebug tracer(10,10);

    // loop over each subfolder
    DQMEvent::TObjectTable::const_iterator sfIter;
    for (sfIter = toTable.begin(); sfIter != toTable.end(); sfIter++)
      {
        std::string folderName = sfIter->first;
        std::vector<TObject *> toList = sfIter->second;

        // serialize the ME data
        uint32 meCount = toList.size();
        for (int idx = 0; idx < (int) meCount; idx++) {
          TObject *toPtr = toList[idx];
          rootbuf_.WriteObject(toPtr);
        }
      }

    // set sizes and pointer(s) appropriately
    curr_event_size_ = rootbuf_.Length();
    curr_space_used_ = curr_event_size_;
    ptr_ = (unsigned char*) rootbuf_.Buffer();

    // compress the data, if needed
    if (use_compression)
      {
        unsigned int dest_size =
          StreamSerializer::compressBuffer(ptr_, curr_event_size_,
                                           comp_buf_, compression_level);
        // compression succeeded
        if (dest_size != 0)
          {
            ptr_ = &comp_buf_[0]; // reset to point at compressed area
            curr_space_used_ = dest_size;
          }
      }
    // calculate the adler32 checksum 
    adler32_chksum_ = cms::Adler32((char*)ptr_, curr_space_used_);


    return curr_space_used_;
  }

Member Data Documentation

Definition at line 46 of file StreamDQMSerializer.h.

Referenced by adler32_chksum(), and serializeDQMEvent().

std::vector<unsigned char> edm::StreamDQMSerializer::comp_buf_ [private]

Definition at line 41 of file StreamDQMSerializer.h.

Referenced by serializeDQMEvent().

Definition at line 42 of file StreamDQMSerializer.h.

Referenced by currentEventSize(), and serializeDQMEvent().

Definition at line 43 of file StreamDQMSerializer.h.

Referenced by currentSpaceUsed(), and serializeDQMEvent().

unsigned char* edm::StreamDQMSerializer::ptr_ [private]

Definition at line 45 of file StreamDQMSerializer.h.

Referenced by bufferPointer(), and serializeDQMEvent().

TBufferFile edm::StreamDQMSerializer::rootbuf_ [private]

Definition at line 44 of file StreamDQMSerializer.h.

Referenced by serializeDQMEvent().