CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
stor::DQMTopLevelFolder Class Reference

#include <DQMTopLevelFolder.h>

Classes

class  Record
 

Public Member Functions

void addDQMEvent (const DQMEventMsgView &)
 
void addDQMEvent (const I2OChain &dqmEvent)
 
 DQMTopLevelFolder (const DQMKey &, const QueueIDs &, const DQMProcessingParams &, DQMEventMonitorCollection &, const unsigned int expectedUpdates, AlarmHandlerPtr)
 
bool getRecord (Record &)
 
bool isReady (const utils::TimePoint_t &now) const
 
 ~DQMTopLevelFolder ()
 

Private Types

typedef boost::shared_ptr
< DQMFolder
DQMFolderPtr
 
typedef std::map< std::string,
DQMFolderPtr
DQMFoldersMap
 

Private Member Functions

void addEvent (std::auto_ptr< DQMEvent::TObjectTable >)
 
size_t populateTable (DQMEvent::TObjectTable &) const
 

Private Attributes

AlarmHandlerPtr alarmHandler_
 
const QueueIDs dqmConsumers_
 
DQMEventMonitorCollectiondqmEventMonColl_
 
DQMFoldersMap dqmFolders_
 
const DQMKey dqmKey_
 
const DQMProcessingParams dqmParams_
 
const unsigned int expectedUpdates_
 
utils::TimePoint_t lastUpdate_
 
unsigned int mergeCount_
 
unsigned int nUpdates_
 
std::string releaseTag_
 
edm::Timestamp timeStamp_
 
uint32_t updateNumber_
 

Static Private Attributes

static unsigned int sentEvents_
 

Detailed Description

Class holding information for one DQM event

Author:
mommsen
Revision:
1.5
Date:
2011/04/04 16:05:37

Definition at line 36 of file DQMTopLevelFolder.h.

Member Typedef Documentation

typedef boost::shared_ptr<DQMFolder> stor::DQMTopLevelFolder::DQMFolderPtr
private

Definition at line 179 of file DQMTopLevelFolder.h.

typedef std::map<std::string, DQMFolderPtr> stor::DQMTopLevelFolder::DQMFoldersMap
private

Definition at line 180 of file DQMTopLevelFolder.h.

Constructor & Destructor Documentation

stor::DQMTopLevelFolder::DQMTopLevelFolder ( const DQMKey dqmKey,
const QueueIDs dqmConsumers,
const DQMProcessingParams dqmParams,
DQMEventMonitorCollection dqmEventMonColl,
const unsigned int  expectedUpdates,
AlarmHandlerPtr  alarmHandler 
)

Definition at line 26 of file DQMTopLevelFolder.cc.

33  :
34  dqmKey_(dqmKey),
35  dqmConsumers_(dqmConsumers),
36  dqmParams_(dqmParams),
37  dqmEventMonColl_(dqmEventMonColl),
38  expectedUpdates_(expectedUpdates),
39  alarmHandler_(alarmHandler),
40  nUpdates_(0),
41  mergeCount_(0),
42  updateNumber_(0)
43  {
44  gROOT->SetBatch(kTRUE);
46  }
void addSample(const double &value=1)
const unsigned int expectedUpdates_
const DQMProcessingParams dqmParams_
const MonitoredQuantity & getNumberOfTopLevelFoldersMQ() const
DQMEventMonitorCollection & dqmEventMonColl_
AlarmHandlerPtr alarmHandler_
stor::DQMTopLevelFolder::~DQMTopLevelFolder ( )

Definition at line 49 of file DQMTopLevelFolder.cc.

References dqmFolders_.

50  {
51  dqmFolders_.clear();
52  }

Member Function Documentation

void stor::DQMTopLevelFolder::addDQMEvent ( const DQMEventMsgView view)

Adds the DQMEventMsgView, but does not take ownership of the underlying data buffer. Collates the histograms with the existing DQMEventMsgView if there is one.

Definition at line 55 of file DQMTopLevelFolder.cc.

References addEvent(), stor::MonitoredQuantity::addSample(), alarmHandler_, edm::StreamDQMDeserializer::deserializeDQMEvent(), dqmEventMonColl_, stor::AlarmHandler::ERROR, expectedUpdates_, stor::utils::getCurrentTime(), stor::DQMEventMonitorCollection::getDQMEventSizeMQ(), edm::Timestamp::invalidTimestamp(), lastUpdate_, DQMEventMsgView::lumiSection(), max(), DQMEventMsgView::mergeCount(), mergeCount_, min, lumiQueryAPI::msg, nUpdates_, DQMEventMsgView::releaseTag(), releaseTag_, DQMEventMsgView::size(), DQMEventMsgView::timeStamp(), timeStamp_, DQMEventMsgView::topFolderName(), DQMEventMsgView::updateNumber(), and updateNumber_.

56  {
57  if ( releaseTag_.empty() ) releaseTag_ = view.releaseTag();
58  // A restarted EP will start counting at 0 again.
59  // Thus, take the maximum of all updates we get.
62  timeStamp_ = view.timeStamp();
63  else
65  mergeCount_ += std::max(1U, view.mergeCount());
66 
67  edm::StreamDQMDeserializer deserializer;
68  std::auto_ptr<DQMEvent::TObjectTable> toTablePtr =
69  deserializer.deserializeDQMEvent(view);
70 
71  addEvent(toTablePtr);
72 
73  ++nUpdates_;
74 
76  {
77  std::ostringstream msg;
78  msg << "Received " << nUpdates_
79  << " updates for top level folder " << view.topFolderName()
80  << " and lumi section " << view.lumiSection()
81  << " whereas only " << expectedUpdates_
82  << " updates are expected.";
83  XCEPT_DECLARE(exception::DQMEventProcessing,
84  sentinelException, msg.str());
85  alarmHandler_->notifySentinel(AlarmHandler::ERROR, sentinelException);
86  }
87 
89 
91  static_cast<double>(view.size()) / 0x100000
92  );
93  }
TimePoint_t getCurrentTime()
Definition: Utils.h:158
void addSample(const double &value=1)
#define min(a, b)
Definition: mlp_lapack.h:161
uint32 updateNumber() const
std::string topFolderName() const
std::auto_ptr< DQMEvent::TObjectTable > deserializeDQMEvent(DQMEventMsgView const &dqmEventView)
void addEvent(std::auto_ptr< DQMEvent::TObjectTable >)
const unsigned int expectedUpdates_
const T & max(const T &a, const T &b)
utils::TimePoint_t lastUpdate_
const MonitoredQuantity & getDQMEventSizeMQ() const
std::string releaseTag() const
static Timestamp const & invalidTimestamp()
Definition: Timestamp.cc:83
DQMEventMonitorCollection & dqmEventMonColl_
uint32 lumiSection() const
uint32 size() const
AlarmHandlerPtr alarmHandler_
edm::Timestamp timeStamp() const
uint32 mergeCount() const
void stor::DQMTopLevelFolder::addDQMEvent ( const I2OChain dqmEvent)

Adds the DQM event message contained in the I2OChain. It copies the data from the I2OChain in its own buffer space. Collates the histograms with the existing DQMEventMsgView if there is one.

void stor::DQMTopLevelFolder::addEvent ( std::auto_ptr< DQMEvent::TObjectTable toTablePtr)
private

Definition at line 112 of file DQMTopLevelFolder.cc.

References dqmFolders_, and pos.

Referenced by addDQMEvent().

113  {
114  for (
115  DQMEvent::TObjectTable::const_iterator it = toTablePtr->begin(),
116  itEnd = toTablePtr->end();
117  it != itEnd;
118  ++it
119  )
120  {
121  const std::string folderName = it->first;
122 
123  DQMFoldersMap::iterator pos = dqmFolders_.lower_bound(folderName);
124  if ( pos == dqmFolders_.end() || (dqmFolders_.key_comp()(folderName, pos->first)) )
125  {
126  pos = dqmFolders_.insert(pos, DQMFoldersMap::value_type(
127  folderName, DQMFolderPtr( new DQMFolder() )
128  ));
129  }
130  pos->second->addObjects(it->second);
131  }
132  }
Container::value_type value_type
boost::shared_ptr< DQMFolder > DQMFolderPtr
bool stor::DQMTopLevelFolder::getRecord ( DQMTopLevelFolder::Record record)

Populate the record with the currently available data. Return false if no data is available.

Definition at line 135 of file DQMTopLevelFolder.cc.

References stor::MonitoredQuantity::addSample(), edm::StreamDQMSerializer::adler32_chksum(), edm::StreamDQMSerializer::bufferPointer(), stor::DQMTopLevelFolder::Record::clear(), stor::DQMProcessingParams::compressionLevelDQM_, filterCSVwithJSON::copy, edm::StreamDQMSerializer::currentEventSize(), dqmConsumers_, dqmEventMonColl_, dqmKey_, dqmParams_, stor::DQMTopLevelFolder::Record::getBuffer(), stor::DQMEventMonitorCollection::getNumberOfUpdatesMQ(), stor::DQMEventMonitorCollection::getServedDQMEventSizeMQ(), stor::DQMKey::lumiSection, mergeCount_, nUpdates_, populateTable(), releaseTag_, stor::DQMKey::runNumber, sentEvents_, edm::StreamDQMSerializer::serializeDQMEvent(), LaserTracksInput_cfi::source, asciidump::table, stor::DQMTopLevelFolder::Record::tagForEventConsumers(), timeStamp_, stor::DQMKey::topLevelFolderName, stor::DQMTopLevelFolder::Record::totalDataSize(), updateNumber_, and stor::DQMProcessingParams::useCompressionDQM_.

136  {
137  if ( nUpdates_ == 0 ) return false;
138 
139  record.clear();
140  record.tagForEventConsumers(dqmConsumers_);
141 
142  // Package list of TObjects into a DQMEvent::TObjectTable
144  const size_t folderSize = populateTable(table);
145 
146  edm::StreamDQMSerializer serializer;
147  const size_t sourceSize =
148  serializer.serializeDQMEvent(table,
151 
152  // Add space for header
153  const size_t totalSize =
154  sourceSize
155  + sizeof(DQMEventHeader)
156  + 12*sizeof(uint32_t)
157  + releaseTag_.length()
158  + dqmKey_.topLevelFolderName.length()
159  + folderSize;
160 
161  DQMEventMsgBuilder builder(
162  record.getBuffer(totalSize),
163  totalSize,
165  ++sentEvents_,
166  timeStamp_,
169  (uint32_t)serializer.adler32_chksum(),
170  toolbox::net::getHostName().c_str(),
171  releaseTag_,
173  table
174  );
175  unsigned char* source = serializer.bufferPointer();
176  std::copy(source,source+sourceSize, builder.eventAddress());
177  builder.setEventLength(sourceSize);
179  {
180  // the "compression flag" contains the uncompressed size
181  builder.setCompressionFlag(serializer.currentEventSize());
182  }
183  else
184  {
185  // a size of 0 indicates no compression
186  builder.setCompressionFlag(0);
187  }
188  builder.setMergeCount(mergeCount_);
191  static_cast<double>(record.totalDataSize()) / 0x100000
192  );
193 
194  return true;
195  }
list table
Definition: asciidump.py:386
uint32_t adler32_chksum() const
size_t populateTable(DQMEvent::TObjectTable &) const
JetCorrectorParameters::Record record
Definition: classes.h:11
void addSample(const double &value=1)
static unsigned int sentEvents_
int serializeDQMEvent(DQMEvent::TObjectTable &toTable, bool use_compression, int compression_level)
unsigned int currentEventSize() const
std::string topLevelFolderName
Definition: DQMKey.h:25
const DQMProcessingParams dqmParams_
const MonitoredQuantity & getNumberOfUpdatesMQ() const
unsigned char * bufferPointer() const
uint32_t runNumber
Definition: DQMKey.h:23
DQMEventMonitorCollection & dqmEventMonColl_
const MonitoredQuantity & getServedDQMEventSizeMQ() const
uint32_t lumiSection
Definition: DQMKey.h:24
std::map< std::string, std::vector< TObject * > > TObjectTable
bool stor::DQMTopLevelFolder::isReady ( const utils::TimePoint_t now) const

Returns true if this top level folder is ready to be served. This is either the case if all expected updates have been received or when the last update was more than dqmParams.readyTimeDQM ago.

Definition at line 96 of file DQMTopLevelFolder.cc.

References stor::MonitoredQuantity::addSample(), dqmEventMonColl_, dqmParams_, expectedUpdates_, stor::DQMEventMonitorCollection::getNumberOfCompleteUpdatesMQ(), lastUpdate_, nUpdates_, and stor::DQMProcessingParams::readyTimeDQM_.

97  {
98  if ( nUpdates_ == 0 ) return false;
99 
100  if ( nUpdates_ == expectedUpdates_ )
101  {
103  return true;
104  }
105 
106  if ( now > lastUpdate_ + dqmParams_.readyTimeDQM_ ) return true;
107 
108  return false;
109  }
void addSample(const double &value=1)
utils::Duration_t readyTimeDQM_
Definition: Configuration.h:63
const unsigned int expectedUpdates_
const DQMProcessingParams dqmParams_
utils::TimePoint_t lastUpdate_
const MonitoredQuantity & getNumberOfCompleteUpdatesMQ() const
DQMEventMonitorCollection & dqmEventMonColl_
size_t stor::DQMTopLevelFolder::populateTable ( DQMEvent::TObjectTable table) const
private

Definition at line 198 of file DQMTopLevelFolder.cc.

References dqmFolders_, and pos.

Referenced by getRecord().

199  {
200  size_t folderSize = 0;
201 
202  for ( DQMFoldersMap::const_iterator it = dqmFolders_.begin(), itEnd = dqmFolders_.end();
203  it != itEnd; ++it )
204  {
205  const std::string folderName = it->first;
206  const DQMFolderPtr folder = it->second;
207 
208  DQMEvent::TObjectTable::iterator pos = table.lower_bound(folderName);
209  if ( pos == table.end() || (table.key_comp()(folderName, pos->first)) )
210  {
211  std::vector<TObject*> newObjectVector;
212  pos = table.insert(pos, DQMEvent::TObjectTable::value_type(folderName, newObjectVector));
213  folderSize += 2*sizeof(uint32_t) + folderName.length();
214  }
215  folder->fillObjectVector(pos->second);
216  }
217  return folderSize;
218  }
list table
Definition: asciidump.py:386
Container::value_type value_type
boost::shared_ptr< DQMFolder > DQMFolderPtr

Member Data Documentation

AlarmHandlerPtr stor::DQMTopLevelFolder::alarmHandler_
private

Definition at line 170 of file DQMTopLevelFolder.h.

Referenced by addDQMEvent().

const QueueIDs stor::DQMTopLevelFolder::dqmConsumers_
private

Definition at line 166 of file DQMTopLevelFolder.h.

Referenced by getRecord().

DQMEventMonitorCollection& stor::DQMTopLevelFolder::dqmEventMonColl_
private

Definition at line 168 of file DQMTopLevelFolder.h.

Referenced by addDQMEvent(), getRecord(), and isReady().

DQMFoldersMap stor::DQMTopLevelFolder::dqmFolders_
private

Definition at line 181 of file DQMTopLevelFolder.h.

Referenced by addEvent(), populateTable(), and ~DQMTopLevelFolder().

const DQMKey stor::DQMTopLevelFolder::dqmKey_
private

Definition at line 165 of file DQMTopLevelFolder.h.

Referenced by getRecord().

const DQMProcessingParams stor::DQMTopLevelFolder::dqmParams_
private

Definition at line 167 of file DQMTopLevelFolder.h.

Referenced by getRecord(), and isReady().

const unsigned int stor::DQMTopLevelFolder::expectedUpdates_
private

Definition at line 169 of file DQMTopLevelFolder.h.

Referenced by addDQMEvent(), and isReady().

utils::TimePoint_t stor::DQMTopLevelFolder::lastUpdate_
private

Definition at line 174 of file DQMTopLevelFolder.h.

Referenced by addDQMEvent(), and isReady().

unsigned int stor::DQMTopLevelFolder::mergeCount_
private

Definition at line 173 of file DQMTopLevelFolder.h.

Referenced by addDQMEvent(), and getRecord().

unsigned int stor::DQMTopLevelFolder::nUpdates_
private

Definition at line 172 of file DQMTopLevelFolder.h.

Referenced by addDQMEvent(), getRecord(), and isReady().

std::string stor::DQMTopLevelFolder::releaseTag_
private

Definition at line 175 of file DQMTopLevelFolder.h.

Referenced by addDQMEvent(), and getRecord().

unsigned int stor::DQMTopLevelFolder::sentEvents_
staticprivate

Definition at line 183 of file DQMTopLevelFolder.h.

Referenced by getRecord().

edm::Timestamp stor::DQMTopLevelFolder::timeStamp_
private

Definition at line 177 of file DQMTopLevelFolder.h.

Referenced by addDQMEvent(), and getRecord().

uint32_t stor::DQMTopLevelFolder::updateNumber_
private

Definition at line 176 of file DQMTopLevelFolder.h.

Referenced by addDQMEvent(), and getRecord().