Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
#include "DQM/EcalCommon/interface/MESetDet0D.h"

namespace ecaldqm {
  MESetDet0D::MESetDet0D(std::string const &_fullPath,
                         binning::ObjectType _otype,
                         binning::BinningType _btype,
                         MonitorElement::Kind _kind)
      : MESetEcal(_fullPath, _otype, _btype, _kind, 0, nullptr, nullptr) {
    switch (kind_) {
      case MonitorElement::Kind::REAL:
        break;
      default:
        throw_("Unsupported MonitorElement kind");
    }
  }

  MESetDet0D::MESetDet0D(MESetDet0D const &_orig) : MESetEcal(_orig) {}

  MESetDet0D::~MESetDet0D() {}

  MESet *MESetDet0D::clone(std::string const &_path /* = ""*/) const {
    std::string path(path_);
    if (!_path.empty())
      path_ = _path;
    MESet *copy(new MESetDet0D(*this));
    path_ = path;
    return copy;
  }

  void MESetDet0D::fill(EcalDQMSetupObjects const edso, DetId const &_id, double _value, double, double) {
    if (!active_)
      return;

    unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _id));
    checkME_(iME);

    mes_[iME]->Fill(_value);
  }

  void MESetDet0D::fill(EcalDQMSetupObjects const edso, EcalElectronicsId const &_id, double _value, double, double) {
    if (!active_)
      return;

    unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _id));
    checkME_(iME);

    mes_[iME]->Fill(_value);
  }

  void MESetDet0D::fill(EcalDQMSetupObjects const edso, int _dcctccid, double _value, double, double) {
    if (!active_)
      return;

    unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _dcctccid, btype_));
    checkME_(iME);

    mes_[iME]->Fill(_value);
  }

  double MESetDet0D::getBinContent(EcalDQMSetupObjects const edso, DetId const &_id, int) const {
    if (!active_)
      return 0.;

    unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _id));
    checkME_(iME);

    return mes_[iME]->getFloatValue();
  }

  double MESetDet0D::getBinContent(EcalDQMSetupObjects const edso, EcalElectronicsId const &_id, int) const {
    if (!active_)
      return 0.;

    unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _id));
    checkME_(iME);

    return mes_[iME]->getFloatValue();
  }

  double MESetDet0D::getBinContent(EcalDQMSetupObjects const edso, int _dcctccid, int) const {
    if (!active_)
      return 0.;

    unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _dcctccid, btype_));
    checkME_(iME);

    return mes_[iME]->getFloatValue();
  }

  void MESetDet0D::reset(EcalElectronicsMapping const *electronicsMap, double _value /* = 0.*/, double, double) {
    unsigned nME(mes_.size());
    for (unsigned iME(0); iME < nME; iME++)
      mes_[iME]->Fill(_value);
  }
}  // namespace ecaldqm