CMS 3D CMS Logo

Public Member Functions | Private Types | Static Private Member Functions | Private Attributes

stor::DQMFolder Class Reference

#include <DQMFolder.h>

List of all members.

Public Member Functions

void addObjects (const std::vector< TObject * > &)
 DQMFolder ()
void fillObjectVector (std::vector< TObject * > &) const
 ~DQMFolder ()

Private Types

typedef std::map< std::string,
TObject * > 
DQMObjectsMap

Static Private Member Functions

static std::string getSafeMEName (TObject *object)

Private Attributes

DQMObjectsMap dqmObjects_

Detailed Description

A single DQM folder holding several histograms

Author:
wmtan
Revision:
1.3
Date:
2013/04/22 16:19:36

Definition at line 25 of file DQMFolder.h.


Member Typedef Documentation

typedef std::map<std::string, TObject*> stor::DQMFolder::DQMObjectsMap [private]

Definition at line 37 of file DQMFolder.h.


Constructor & Destructor Documentation

DQMFolder::DQMFolder ( )

Definition at line 18 of file DQMFolder.cc.

{}
DQMFolder::~DQMFolder ( )

Definition at line 21 of file DQMFolder.cc.

References dqmObjects_, NULL, and dbtoconf::object.

{
  for (DQMObjectsMap::const_iterator it = dqmObjects_.begin(),
         itEnd = dqmObjects_.end(); it != itEnd; ++it)
  {
    TObject* object = it->second;
    if ( object != NULL ) { delete(object); } 
  }
  dqmObjects_.clear();
}

Member Function Documentation

void DQMFolder::addObjects ( const std::vector< TObject * > &  toList)

Definition at line 32 of file DQMFolder.cc.

References dqmObjects_, getSafeMEName(), dbtoconf::object, summarizeEdmComparisonLogfiles::objectName, pos, and AlCaHLTBitMon_QueryRunRegistry::string.

{
  for (std::vector<TObject*>::const_iterator it = toList.begin(), itEnd = toList.end();
       it != itEnd; ++it)
  {
    TObject* object = *it;
    if (object)
    {
      std::string objectName = getSafeMEName(object);
      
      DQMObjectsMap::iterator pos = dqmObjects_.lower_bound(objectName);
      if ( pos == dqmObjects_.end() || (dqmObjects_.key_comp()(objectName, pos->first)) )
      {
        pos = dqmObjects_.insert(pos,
          DQMFolder::DQMObjectsMap::value_type(objectName, object));
      }
      else
      {
        TObject* storedObject = pos->second;
        if ( object->InheritsFrom("TProfile") && 
          storedObject->InheritsFrom("TProfile") )
        {
          TProfile* newProfile    = static_cast<TProfile*>(object);
          TProfile* storedProfile = static_cast<TProfile*>(storedObject);
          if (newProfile->GetEntries() > 0)
          {
            storedProfile->Add(newProfile);
          }
        }
        else if ( object->InheritsFrom("TH1") && 
          storedObject->InheritsFrom("TH1") )
        {
          TH1* newHistogram    = static_cast<TH1*>(object);
          TH1* storedHistogram = static_cast<TH1*>(storedObject);
          if (newHistogram->GetEntries() > 0)
          {
            storedHistogram->Add(newHistogram);
          }
        }
        else
        {
          // 15-Jul-2008, KAB - switch to the first instance at the 
          // request of Andreas Meyer...
          
          //delete(storedObject);
          //folder->dqmObjects_[objectName] = object->Clone(object->GetName());
        }
        delete(object);
      }
    }
  }
}
void DQMFolder::fillObjectVector ( std::vector< TObject * > &  vector) const

Definition at line 86 of file DQMFolder.cc.

References dqmObjects_.

{
  for ( DQMObjectsMap::const_iterator it = dqmObjects_.begin(), itEnd = dqmObjects_.end();
        it != itEnd; ++it )
  {
    vector.push_back(it->second);
  }
}
std::string DQMFolder::getSafeMEName ( TObject *  object) [static, private]

Definition at line 99 of file DQMFolder.cc.

References s_rxmeval(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by addObjects().

{
  std::string rawName = object->GetName();
  std::string safeName = rawName;

  lat::RegexpMatch patternMatch;
  if (dynamic_cast<TObjString *>(object) &&
      s_rxmeval.match(rawName, 0, 0, &patternMatch)) {
    safeName = patternMatch.matchString(rawName, 1);
  }

  return safeName;
}

Member Data Documentation

Definition at line 38 of file DQMFolder.h.

Referenced by addObjects(), fillObjectVector(), and ~DQMFolder().