CMS 3D CMS Logo

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

#include <DQMFolder.h>

Public Member Functions

void addObjects (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:
mommsen
Revision:
1.2
Date:
2011/03/07 15:31:31

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.

19 {}
DQMFolder::~DQMFolder ( )

Definition at line 21 of file DQMFolder.cc.

References dqmObjects_, NULL, and dbtoconf::object.

22 {
23  for (DQMObjectsMap::const_iterator it = dqmObjects_.begin(),
24  itEnd = dqmObjects_.end(); it != itEnd; ++it)
25  {
26  TObject* object = it->second;
27  if ( object != NULL ) { delete(object); }
28  }
29  dqmObjects_.clear();
30 }
#define NULL
Definition: scimark2.h:8
DQMObjectsMap dqmObjects_
Definition: DQMFolder.h:38
list object
Definition: dbtoconf.py:77

Member Function Documentation

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

Definition at line 32 of file DQMFolder.cc.

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

33 {
34  for (std::vector<TObject*>::const_iterator it = toList.begin(), itEnd = toList.end();
35  it != itEnd; ++it)
36  {
37  TObject* object = *it;
38  if (object)
39  {
40  std::string objectName = getSafeMEName(object);
41 
42  DQMObjectsMap::iterator pos = dqmObjects_.lower_bound(objectName);
43  if ( pos == dqmObjects_.end() || (dqmObjects_.key_comp()(objectName, pos->first)) )
44  {
45  pos = dqmObjects_.insert(pos,
46  DQMFolder::DQMObjectsMap::value_type(objectName, object));
47  }
48  else
49  {
50  TObject* storedObject = pos->second;
51  if ( object->InheritsFrom("TProfile") &&
52  storedObject->InheritsFrom("TProfile") )
53  {
54  TProfile* newProfile = static_cast<TProfile*>(object);
55  TProfile* storedProfile = static_cast<TProfile*>(storedObject);
56  if (newProfile->GetEntries() > 0)
57  {
58  storedProfile->Add(newProfile);
59  }
60  }
61  else if ( object->InheritsFrom("TH1") &&
62  storedObject->InheritsFrom("TH1") )
63  {
64  TH1* newHistogram = static_cast<TH1*>(object);
65  TH1* storedHistogram = static_cast<TH1*>(storedObject);
66  if (newHistogram->GetEntries() > 0)
67  {
68  storedHistogram->Add(newHistogram);
69  }
70  }
71  else
72  {
73  // 15-Jul-2008, KAB - switch to the first instance at the
74  // request of Andreas Meyer...
75 
77  //delete(storedObject);
78  //folder->dqmObjects_[objectName] = object->Clone(object->GetName());
79  }
80  delete(object);
81  }
82  }
83  }
84 }
DQMObjectsMap dqmObjects_
Definition: DQMFolder.h:38
Container::value_type value_type
list object
Definition: dbtoconf.py:77
static std::string getSafeMEName(TObject *object)
Definition: DQMFolder.cc:99
void DQMFolder::fillObjectVector ( std::vector< TObject * > &  vector) const

Definition at line 86 of file DQMFolder.cc.

References dqmObjects_.

87 {
88  for ( DQMObjectsMap::const_iterator it = dqmObjects_.begin(), itEnd = dqmObjects_.end();
89  it != itEnd; ++it )
90  {
91  vector.push_back(it->second);
92  }
93 }
DQMObjectsMap dqmObjects_
Definition: DQMFolder.h:38
std::string DQMFolder::getSafeMEName ( TObject *  object)
staticprivate

Definition at line 99 of file DQMFolder.cc.

References s_rxmeval().

Referenced by addObjects().

100 {
101  std::string rawName = object->GetName();
102  std::string safeName = rawName;
103 
104  lat::RegexpMatch patternMatch;
105  if (dynamic_cast<TObjString *>(object) &&
106  s_rxmeval.match(rawName, 0, 0, &patternMatch)) {
107  safeName = patternMatch.matchString(rawName, 1);
108  }
109 
110  return safeName;
111 }
static const lat::Regexp s_rxmeval("^<(.*)>(i|f|s|t|qr)=(.*)</\\1>$")

Member Data Documentation

DQMObjectsMap stor::DQMFolder::dqmObjects_
private

Definition at line 38 of file DQMFolder.h.

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