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  StreamDQMSerializer::Arr::Arr(int sz):ptr_((char*)malloc(sz)) { }
20 
21  const int init_size = 1024*1024;
22 
30  rootbuf_(TBuffer::kWrite,init_size),
31  ptr_((unsigned char*)rootbuf_.Buffer()),
33  { }
34 
39  bool use_compression,
41  {
42  // initialize the internal TBuffer
43  rootbuf_.Reset();
44  RootDebug tracer(10,10);
45 
46  // loop over each subfolder
47  DQMEvent::TObjectTable::const_iterator sfIter;
48  for (sfIter = toTable.begin(); sfIter != toTable.end(); sfIter++)
49  {
50  std::string folderName = sfIter->first;
51  std::vector<TObject *> toList = sfIter->second;
52 
53  // serialize the ME data
54  uint32 meCount = toList.size();
55  for (int idx = 0; idx < (int) meCount; idx++) {
56  TObject *toPtr = toList[idx];
57  rootbuf_.WriteObject(toPtr);
58  }
59  }
60 
61  // set sizes and pointer(s) appropriately
62  curr_event_size_ = rootbuf_.Length();
64  ptr_ = (unsigned char*) rootbuf_.Buffer();
65 
66  // compress the data, if needed
67  if (use_compression)
68  {
69  unsigned int dest_size =
71  comp_buf_, compression_level);
72  // compression succeeded
73  if (dest_size != 0)
74  {
75  ptr_ = &comp_buf_[0]; // reset to point at compressed area
76  curr_space_used_ = dest_size;
77  }
78  }
79  // calculate the adler32 checksum
81 
82 
83  return curr_space_used_;
84  }
85 }
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)
std::map< std::string, std::vector< TObject * > > TObjectTable