CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MonitorElementCollection Class Reference

#include "DataFormats/Histograms/interface/MonitorElementCollection.h"

Public Member Functions

auto begin () const
 
auto end () const
 
bool mergeProduct (MonitorElementCollection const &product)
 
void push_back (std::unique_ptr< const MonitorElementData > value)
 
void swap (MonitorElementCollection &other)
 

Private Attributes

std::vector< std::unique_ptr< const MonitorElementData > > data_
 

Detailed Description

Description: Product to represent DQM data in LuminosityBlocks and Runs. The MonitorElements are represented by a simple struct that only contains the required fields to represent a ME. The only opration allowed on these objects is merging, which is a important part of the DQM functionality and should be handled by EDM. Once a MonitorElement enters this product, it is immutable. During event processing, the ROOT objects need to be protectd by locks. These locks are not present in this structure: Any potential modification needs to be done as a copy-on-write and create a new MonitorElement. The file IO for these objects should still be handled by the DQMIO classes (DQMRootOutputModule and DQMRootSource), so persistent=false would be ok for this class. However, if we can get EDM IO cheaply, it could be useful to handle corner cases like MEtoEDM more cleanly.

Usage: This product should only be handled by the DQMStore, which provides access to the MEs inside. The DQMStore will wrap the MonitorElementData in real MonitorElements, which allow various operations on the underlying histograms, depending on the current stage of processing: In the RECO step, only filling is allowed, while in HARVESTING, the same data will be wrapped in a MonitorElement that also allows access to the ROOT objects. We only use pointers to MonitorElementData, to allow replacing it with a variable-size templated version later. That could eliminate one level of indirection in accessing histograms.

Definition at line 184 of file MonitorElementCollection.h.

Member Function Documentation

auto MonitorElementCollection::begin ( void  ) const
inline

Definition at line 196 of file MonitorElementCollection.h.

196 { return data_.begin(); }
std::vector< std::unique_ptr< const MonitorElementData > > data_
auto MonitorElementCollection::end ( void  ) const
inline

Definition at line 198 of file MonitorElementCollection.h.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

198 { return data_.end(); }
std::vector< std::unique_ptr< const MonitorElementData > > data_
bool MonitorElementCollection::mergeProduct ( MonitorElementCollection const &  product)
inline

Definition at line 200 of file MonitorElementCollection.h.

200  {
201  // discussion: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuidePerRunAndPerLumiBlockData#Merging_Run_and_Luminosity_Block
202  assert(!"Not implemented yet.");
203  return false;
204  // Things to decide:
205  // - Should we allow merging collections of different sets of MEs? (probably not.) [0]
206  // - Should we assume the MEs to be ordered? (probably yes.)
207  // - How to handle incompatible MEs (different binning)? (fail hard.) [1]
208  // - Can multiple MEs with same (dirname, objname) exist? (probably yes.) [2]
209  // - Shall we modify the (immutable?) ROOT objects? (probably yes.)
210  //
211  // [0] Merging should increase the statistics, but not change the number of
212  // MEs, at least with the current workflows. It might be convenient to
213  // allow it, but for the beginning, it would only mask errors.
214  // [1] The DQM framework should guarantee same booking parameters as long
215  // as we stay within the Scope of the MEs.
216  // [2] To implement e.g. MEs covering blocks of 10LS, we'd store them in a
217  // run product, but have as many MEs with same name but different range as
218  // needed to perserve the wanted granularity. Merging then can merge or
219  // concatenate as possible/needed.
220  // Problem: We need to keep copies in memory until the end of run, even
221  // though we could save them to the output file as soon as it is clear that
222  // the nexe LS will not fall into the same block. Instead, we could drop
223  // them into the next lumi block we see; the semantics would be weird (the
224  // MEs in the lumi block don't actually correspond to the lumi block they
225  // are in) but the DQMIO output should be able to handle that.
226  }
void MonitorElementCollection::push_back ( std::unique_ptr< const MonitorElementData value)
inline

Definition at line 188 of file MonitorElementCollection.h.

References eostools::move(), and relativeConstraints::value.

188  {
189  // enforce ordering
190  assert(data_.empty() || data_[data_.size() - 1] <= value);
191  data_.push_back(std::move(value));
192  }
std::vector< std::unique_ptr< const MonitorElementData > > data_
Definition: value.py:1
def move(src, dest)
Definition: eostools.py:511
void MonitorElementCollection::swap ( MonitorElementCollection other)
inline

Definition at line 194 of file MonitorElementCollection.h.

References data_.

194 { data_.swap(other.data_); }
std::vector< std::unique_ptr< const MonitorElementData > > data_

Member Data Documentation

std::vector<std::unique_ptr<const MonitorElementData> > MonitorElementCollection::data_
private

Definition at line 185 of file MonitorElementCollection.h.

Referenced by swap().