CMS 3D CMS Logo

Public Member Functions

ecaldqm::MESetNonObject Class Reference

#include <MESetNonObject.h>

Inheritance diagram for ecaldqm::MESetNonObject:
ecaldqm::MESet

List of all members.

Public Member Functions

void book ()
void fill (double, double _wy=1., double _w=1.)
 MESetNonObject (std::string const &, MEData const &, bool _readOnly=false)
bool retrieve () const
 ~MESetNonObject ()

Detailed Description

Definition at line 8 of file MESetNonObject.h.


Constructor & Destructor Documentation

ecaldqm::MESetNonObject::MESetNonObject ( std::string const &  _fullpath,
MEData const &  _data,
bool  _readOnly = false 
)

Definition at line 7 of file MESetNonObject.cc.

                                                                                                 :
    MESet(_fullpath, _data, _readOnly)
  {
  }
ecaldqm::MESetNonObject::~MESetNonObject ( )

Definition at line 131 of file MESetNonObject.cc.

  {
  }

Member Function Documentation

void ecaldqm::MESetNonObject::book ( ) [virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 13 of file MESetNonObject.cc.

References ecaldqm::MESet::active_, DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookFloat(), DQMStore::bookProfile(), DQMStore::bookProfile2D(), ecaldqm::MESet::data_, ecaldqm::MESet::dir_, MonitorElement::DQM_KIND_REAL, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, ecaldqm::MESet::dqmStore_, EcalDQMBinningService::AxisSpecs::edges, prof2calltree::edges, Exception, EcalDQMBinningService::AxisSpecs::high, i, ecaldqm::MEData::kind, EcalDQMBinningService::AxisSpecs::low, max(), ecaldqm::MESet::mes_, ecaldqm::MESet::name_, EcalDQMBinningService::AxisSpecs::nbins, DQMStore::setCurrentFolder(), ecaldqm::MEData::xaxis, ecaldqm::MEData::yaxis, and ecaldqm::MEData::zaxis.

  {
    dqmStore_->setCurrentFolder(dir_);

    mes_.clear();

    MonitorElement* me(0);

    BinService::AxisSpecs* xaxis(data_->xaxis);
    BinService::AxisSpecs* yaxis(data_->yaxis);
    BinService::AxisSpecs* zaxis(data_->zaxis);

    switch(data_->kind) {
    case MonitorElement::DQM_KIND_REAL :
      me = dqmStore_->bookFloat(name_);
      break;

    case MonitorElement::DQM_KIND_TH1F :
      {
        if(!xaxis)
          throw cms::Exception("InvalidCall") << "No xaxis found for MESetNonObject" << std::endl;

        if(!xaxis->edges)
          me = dqmStore_->book1D(name_, name_, xaxis->nbins, xaxis->low, xaxis->high);
        else{
          float* edges(new float[xaxis->nbins + 1]);
          for(int i(0); i < xaxis->nbins + 1; i++)
            edges[i] = xaxis->edges[i];
          me = dqmStore_->book1D(name_, name_, xaxis->nbins, edges);
          delete [] edges;
        }
      }
      break;

    case MonitorElement::DQM_KIND_TPROFILE :
      {
        if(!xaxis)
          throw cms::Exception("InvalidCall") << "No xaxis found for MESetNonObject" << std::endl;

        double ylow, yhigh;
        if(!yaxis){
          ylow = -std::numeric_limits<double>::max();
          yhigh = std::numeric_limits<double>::max();
        }
        else{
          ylow = yaxis->low;
          yhigh = yaxis->high;
        }
        if(xaxis->edges)
          me = dqmStore_->bookProfile(name_, name_, xaxis->nbins, xaxis->edges, ylow, yhigh, "");
        else
          me = dqmStore_->bookProfile(name_, name_, xaxis->nbins, xaxis->low, xaxis->high, ylow, yhigh, "");

      }
      break;

    case MonitorElement::DQM_KIND_TH2F :
      {
        if(!xaxis || !yaxis)
          throw cms::Exception("InvalidCall") << "No x/yaxis found for MESetNonObject" << std::endl;

        if(!xaxis->edges || !yaxis->edges)
          me = dqmStore_->book2D(name_, name_, xaxis->nbins, xaxis->low, xaxis->high, yaxis->nbins, yaxis->low, yaxis->high);
        else{
          float* xedges(new float[xaxis->nbins + 1]);
          for(int i(0); i < xaxis->nbins + 1; i++)
            xedges[i] = xaxis->edges[i];
          float* yedges(new float[yaxis->nbins + 1]);
          for(int i(0); i < yaxis->nbins + 1; i++)
            yedges[i] = yaxis->edges[i];
          me = dqmStore_->book2D(name_, name_, xaxis->nbins, xedges, yaxis->nbins, yedges);
          delete [] xedges;
          delete [] yedges;
        }
      }
      break;

    case MonitorElement::DQM_KIND_TPROFILE2D :
      {
        if(!xaxis || !yaxis)
          throw cms::Exception("InvalidCall") << "No x/yaxis found for MESetNonObject" << std::endl;
        double high(0.), low(0.);
        if(zaxis){
          low = zaxis->low;
          high = zaxis->high;
        }
        else{
          low = -std::numeric_limits<double>::max();
          high = std::numeric_limits<double>::max();
        }

        me = dqmStore_->bookProfile2D(name_, name_, xaxis->nbins, xaxis->low, xaxis->high, yaxis->nbins, yaxis->low, yaxis->high, low, high, "");
      }
      break;

    default :
      throw cms::Exception("InvalidCall") << "MESetNonObject of type " << data_->kind << " not implemented" << std::endl;
    }

    mes_.push_back(me);

    active_ = true;
  }
void ecaldqm::MESetNonObject::fill ( double  _x,
double  _wy = 1.,
double  _w = 1. 
) [virtual]
bool ecaldqm::MESetNonObject::retrieve ( ) const [virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 118 of file MESetNonObject.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::dir_, ecaldqm::MESet::dqmStore_, DQMStore::get(), ecaldqm::MESet::mes_, and ecaldqm::MESet::name_.

  {
    mes_.clear();

    MonitorElement* me(dqmStore_->get(dir_ + "/" + name_));
    if(!me) return false;

    mes_.push_back(me);

    active_ = true;
    return true;
  }