CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StreamDQMSerializer.cc
Go to the documentation of this file.
1 
12 
13 #include <cstdlib>
14 
15 namespace edm
16 {
17 
18  const int init_size = 1024*1024;
19 
24  comp_buf_(init_size),
25  curr_event_size_(),
26  curr_space_used_(),
27  rootbuf_(TBuffer::kWrite,init_size),
28  ptr_((unsigned char*)rootbuf_.Buffer()),
29  adler32_chksum_(0)
30  { }
31 
36  bool use_compression,
38  {
39  // initialize the internal TBuffer
40  rootbuf_.Reset();
41  RootDebug tracer(10,10);
42 
43  // loop over each subfolder
44  DQMEvent::TObjectTable::const_iterator sfIter;
45  for (sfIter = toTable.begin(); sfIter != toTable.end(); sfIter++)
46  {
47  std::string folderName = sfIter->first;
48  std::vector<TObject *> toList = sfIter->second;
49 
50  // serialize the ME data
51  uint32 meCount = toList.size();
52  for (int idx = 0; idx < (int) meCount; idx++) {
53  TObject *toPtr = toList[idx];
54  rootbuf_.WriteObject(toPtr);
55  }
56  }
57 
58  // set sizes and pointer(s) appropriately
59  curr_event_size_ = rootbuf_.Length();
61  ptr_ = (unsigned char*) rootbuf_.Buffer();
62 
63  // compress the data, if needed
64  if (use_compression)
65  {
66  unsigned int dest_size =
68  comp_buf_, compression_level);
69  // compression succeeded
70  if (dest_size != 0)
71  {
72  ptr_ = &comp_buf_[0]; // reset to point at compressed area
73  curr_space_used_ = dest_size;
74  }
75  }
76  // calculate the adler32 checksum
78 
79 
80  return curr_space_used_;
81  }
82 }
const char * ptr_
Definition: DataKey.cc:90
const int init_size
static unsigned int compressBuffer(unsigned char *inputBuffer, unsigned int inputSize, std::vector< unsigned char > &outputBuffer, int compressionLevel)
int serializeDQMEvent(DQMEvent::TObjectTable &toTable, bool use_compression, int compression_level)
std::vector< unsigned char > comp_buf_
unsigned int uint32
Definition: MsgTools.h:13
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::map< std::string, std::vector< TObject * > > TObjectTable