CMS 3D CMS Logo

MonitorElement.cc File Reference

#include "DQMServices/Core/interface/MonitorElement.h"
#include "DQMServices/Core/interface/QTest.h"
#include "TClass.h"
#include "TMath.h"
#include "TList.h"
#include <iostream>
#include <cassert>

Go to the source code of this file.

Defines

#define DQM_ROOT_METHODS   1

Functions

static TH1 * checkRootObject (const std::string &name, TObject *tobj, const char *func, int reqdim)


Define Documentation

#define DQM_ROOT_METHODS   1

Definition at line 1 of file MonitorElement.cc.


Function Documentation

static TH1* checkRootObject ( const std::string &  name,
TObject *  tobj,
const char *  func,
int  reqdim 
) [static]

Definition at line 11 of file MonitorElement.cc.

References Exception, and h.

Referenced by MonitorElement::accessRootObject(), MonitorElement::getRefTH1(), MonitorElement::getRefTH1F(), MonitorElement::getRefTH1S(), MonitorElement::getRefTH2F(), MonitorElement::getRefTH2S(), MonitorElement::getRefTH3F(), MonitorElement::getRefTProfile(), and MonitorElement::getRefTProfile2D().

00012 {
00013   if (! tobj)
00014     throw cms::Exception("MonitorElement")
00015       << "Method '" << func << "' cannot be invoked on monitor element '"
00016       << name << "' because it is not a ROOT object.";
00017 
00018   TH1 *h = dynamic_cast<TH1 *>(tobj);
00019   if (! h)
00020     throw cms::Exception("MonitorElement")
00021       << "Method '" << func << "' cannot be invoked on monitor element '"
00022       << name << "' because it is not a ROOT histogram; it is of type '"
00023       << typeid(*tobj).name() << "'";
00024 
00025   int ndim = h->GetDimension();
00026   if (reqdim < 0 || reqdim > ndim)
00027     throw cms::Exception("MonitorElement")
00028       << "Method '" << func << "' cannot be invoked on monitor element '"
00029       << name << "' because it requires " << reqdim
00030       << " dimensions; this object of type '" << typeid(*h).name()
00031       << "' has " << ndim << " dimensions";
00032 
00033   return h;
00034 }


Generated on Tue Jun 9 17:52:47 2009 for CMSSW by  doxygen 1.5.4