#include <MESetTrend.h>
Public Member Functions | |
void | book () |
void | fill (DetId const &, double, double _wy=1., double _w=1.) |
void | fill (unsigned, double, double _wy=1., double _w=1.) |
void | fill (double, double _wy=1., double _w=1.) |
double | getBinContent (DetId const &, int _bin=0) const |
double | getBinContent (unsigned, int _bin=0) const |
double | getBinEntries (unsigned, int _bin=0) const |
double | getBinEntries (DetId const &, int _bin=0) const |
double | getBinError (DetId const &, int _bin=0) const |
double | getBinError (unsigned, int _bin=0) const |
bool | getMinutely () const |
time_t | getTimeZero () const |
MESetTrend (std::string const &, MEData const &, bool _readOnly=false) | |
void | setBinContent (unsigned, double, double _err=0.) |
void | setBinContent (DetId const &, double, double _err=0.) |
void | setBinEntries (unsigned, double) |
void | setBinEntries (DetId const &, double) |
void | setMinutely (bool _minutely) |
void | setTimeZero (time_t _t0) |
~MESetTrend () | |
Private Member Functions | |
bool | shift_ (time_t) |
Private Attributes | |
bool | minutely_ |
time_t | t0_ |
time_t | tLow_ |
Definition at line 11 of file MESetTrend.h.
ecaldqm::MESetTrend::MESetTrend | ( | std::string const & | _fullpath, |
MEData const & | _data, | ||
bool | _readOnly = false |
||
) |
Definition at line 7 of file MESetTrend.cc.
References EcalDQMBinningService::AxisSpecs::edges, Exception, and ecaldqm::MEData::xaxis.
: MESetEcal(_fullpath, _data, 1, _readOnly), t0_(0), minutely_(false), tLow_(0) { if(!_data.xaxis || _data.xaxis->edges) throw cms::Exception("InvalidConfiguration") << "MESetTrend"; }
ecaldqm::MESetTrend::~MESetTrend | ( | ) |
Definition at line 17 of file MESetTrend.cc.
{ }
void ecaldqm::MESetTrend::book | ( | ) | [virtual] |
Reimplemented from ecaldqm::MESetEcal.
Definition at line 22 of file MESetTrend.cc.
References ecaldqm::MEData::btype, edm::conversion(), ecaldqm::MESet::data_, EcalDQMBinningService::AxisSpecs::high, ecaldqm::MEData::kind, EcalDQMBinningService::AxisSpecs::low, ecaldqm::MESet::mes_, minutely_, EcalDQMBinningService::AxisSpecs::nbins, ecaldqm::MEData::otype, ecaldqm::MEData::pathName, t0_, groupFilesInBlocks::temp, tLow_, tablePrinter::width, ecaldqm::MEData::xaxis, ecaldqm::MEData::yaxis, and ecaldqm::MEData::zaxis.
{ int conversion(minutely_ ? 60 : 3600); time_t width((data_->xaxis->high - data_->xaxis->low) * conversion); tLow_ = t0_; MEData const* temp(data_); BinService::AxisSpecs xaxis(*temp->xaxis); xaxis.low = tLow_; xaxis.high = tLow_ + width; data_ = new MEData(temp->pathName, temp->otype, temp->btype, temp->kind, &xaxis, temp->yaxis, temp->zaxis); MESetEcal::book(); delete data_; data_ = temp; // if yaxis was variable bin size, xaxis will be booked as variable too for(unsigned iME(0); iME < mes_.size(); iME++){ TAxis* axis(mes_[iME]->getTH1()->GetXaxis()); if(axis->IsVariableBinSize()) axis->Set(data_->xaxis->nbins, data_->xaxis->low, data_->xaxis->high); } }
void ecaldqm::MESetTrend::fill | ( | DetId const & | _id, |
double | _t, | ||
double | _wy = 1. , |
||
double | _w = 1. |
||
) | [virtual] |
Reimplemented from ecaldqm::MESetEcal.
Definition at line 51 of file MESetTrend.cc.
References ecaldqm::MESet::active_, ecaldqm::MESet::binService_, ecaldqm::MESet::data_, ecaldqm::MESet::fill_(), EcalDQMBinningService::findOffset(), evf::evtn::offset(), ecaldqm::MEData::otype, and shift_().
{ if(!active_) return; unsigned offset(binService_->findOffset(data_->otype, _id)); if(shift_(time_t(_t))) MESet::fill_(offset, _t, _wy, _w); }
void ecaldqm::MESetTrend::fill | ( | double | _t, |
double | _wy = 1. , |
||
double | _w = 1. |
||
) | [virtual] |
Reimplemented from ecaldqm::MESetEcal.
Definition at line 73 of file MESetTrend.cc.
References ecaldqm::MESet::active_, ecaldqm::MESet::fill_(), ecaldqm::MESet::mes_, and shift_().
{ if(!active_) return; if(mes_.size() != 1) throw cms::Exception("InvalidCall") << "MESet type incompatible" << std::endl; if(shift_(time_t(_t))) MESet::fill_(0, _t, _wy, _w); }
void ecaldqm::MESetTrend::fill | ( | unsigned | _dcctccid, |
double | _t, | ||
double | _wy = 1. , |
||
double | _w = 1. |
||
) | [virtual] |
Reimplemented from ecaldqm::MESetEcal.
Definition at line 62 of file MESetTrend.cc.
References ecaldqm::MESet::active_, ecaldqm::MESet::binService_, ecaldqm::MEData::btype, ecaldqm::MESet::data_, ecaldqm::MESet::fill_(), EcalDQMBinningService::findOffset(), evf::evtn::offset(), ecaldqm::MEData::otype, and shift_().
{ if(!active_) return; unsigned offset(binService_->findOffset(data_->otype, data_->btype, _dcctccid)); if(shift_(time_t(_t))) MESet::fill_(offset, _t, _wy, _w); }
double ecaldqm::MESetTrend::getBinContent | ( | DetId const & | , |
int | _bin = 0 |
||
) | const [inline, virtual] |
double ecaldqm::MESetTrend::getBinContent | ( | unsigned | , |
int | _bin = 0 |
||
) | const [inline, virtual] |
double ecaldqm::MESetTrend::getBinEntries | ( | DetId const & | , |
int | _bin = 0 |
||
) | const [inline, virtual] |
double ecaldqm::MESetTrend::getBinEntries | ( | unsigned | , |
int | _bin = 0 |
||
) | const [inline, virtual] |
double ecaldqm::MESetTrend::getBinError | ( | DetId const & | , |
int | _bin = 0 |
||
) | const [inline, virtual] |
double ecaldqm::MESetTrend::getBinError | ( | unsigned | , |
int | _bin = 0 |
||
) | const [inline, virtual] |
bool ecaldqm::MESetTrend::getMinutely | ( | ) | const [inline] |
time_t ecaldqm::MESetTrend::getTimeZero | ( | ) | const [inline] |
void ecaldqm::MESetTrend::setBinContent | ( | DetId const & | , |
double | , | ||
double | _err = 0. |
||
) | [inline, virtual] |
void ecaldqm::MESetTrend::setBinContent | ( | unsigned | , |
double | , | ||
double | _err = 0. |
||
) | [inline, virtual] |
void ecaldqm::MESetTrend::setBinEntries | ( | unsigned | , |
double | |||
) | [inline, virtual] |
void ecaldqm::MESetTrend::setBinEntries | ( | DetId const & | , |
double | |||
) | [inline, virtual] |
void ecaldqm::MESetTrend::setMinutely | ( | bool | _minutely | ) | [inline] |
void ecaldqm::MESetTrend::setTimeZero | ( | time_t | _t0 | ) | [inline] |
bool ecaldqm::MESetTrend::shift_ | ( | time_t | _t | ) | [private] |
Definition at line 84 of file MESetTrend.cc.
References edm::conversion(), ecaldqm::MESet::data_, alignCSCRings::dest, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TPROFILE, end, python::tagInventory::entries, MonitorElement::getBinContent(), MonitorElement::getBinEntries(), MonitorElement::getBinError(), MonitorElement::getNbinsY(), MonitorElement::getTH1(), EcalDQMBinningService::AxisSpecs::high, ecaldqm::MEData::kind, EcalDQMBinningService::AxisSpecs::low, ecaldqm::MESet::mes_, minutely_, EcalDQMBinningService::AxisSpecs::nbins, plotscripts::rms(), MonitorElement::setBinContent(), MonitorElement::setBinEntries(), MonitorElement::setBinError(), MonitorElement::setEntries(), mathSSE::sqrt(), errorMatrix2Lands_multiChannel::start, launcher::step, tLow_, tablePrinter::width, and ecaldqm::MEData::xaxis.
Referenced by fill().
{ int conversion(minutely_ ? 60 : 3600); time_t width((data_->xaxis->high - data_->xaxis->low) * conversion); time_t tHigh(tLow_ + width); int nbinsX(data_->xaxis->nbins); MonitorElement::Kind kind(data_->kind); int dtPerBin(width / nbinsX); int dBin(0); if(_t >= tLow_ && _t < tHigh) return true; else if(_t >= tHigh) dBin = (_t - tHigh) / dtPerBin + 1; else if(_t < tLow_){ int maxBin(0); for(unsigned iME(0); iME < mes_.size(); iME++){ MonitorElement* me(mes_[iME]); bool filled(false); int iMax(nbinsX + 1); while(--iMax > 0 && !filled){ switch(kind){ case MonitorElement::DQM_KIND_TH1F: if(me->getBinContent(iMax) != 0) filled = true; break; case MonitorElement::DQM_KIND_TPROFILE: if(me->getBinEntries(iMax) != 0) filled = true; break; case MonitorElement::DQM_KIND_TH2F: for(int iy(1); iy <= me->getNbinsY(); iy++) if(me->getBinContent(iMax, iy) != 0) filled = true; break; default: return false; } } if(iMax > maxBin) maxBin = iMax; } if(_t < tLow_ - (nbinsX - maxBin) * dtPerBin) return false; dBin = (_t - dtPerBin - tLow_) / dtPerBin; } int start(dBin > 0 ? dBin + 1 : nbinsX + dBin); int end(dBin > 0 ? nbinsX + 1 : 0); int step(dBin > 0 ? 1 : -1); tLow_ += dBin * dtPerBin; tHigh += dBin * dtPerBin; for(unsigned iME(0); iME < mes_.size(); iME++){ MonitorElement* me(mes_[iME]); me->setEntries(0.); double entries(0.); for(int ix(start); (dBin > 0 ? (ix < end) : (ix > end)); ix += step){ switch(kind){ case MonitorElement::DQM_KIND_TH1F: entries += me->getBinContent(ix); me->setBinContent(ix - dBin, me->getBinContent(ix)); me->setBinError(ix - dBin, me->getBinError(ix)); me->setBinContent(ix, 0.); me->setBinError(ix, 0.); break; case MonitorElement::DQM_KIND_TPROFILE: entries += me->getBinEntries(ix); me->setBinEntries(ix - dBin, me->getBinEntries(ix)); me->setBinContent(ix - dBin, me->getBinContent(ix) * me->getBinEntries(ix)); if(me->getBinEntries(ix) > 0){ double rms(me->getBinError(ix) * std::sqrt(me->getBinEntries(ix))); double sumw2((rms * rms + me->getBinContent(ix) * me->getBinContent(ix)) * me->getBinEntries(ix)); me->setBinError(ix - dBin, std::sqrt(sumw2)); } me->setBinEntries(ix, 0.); me->setBinContent(ix, 0.); me->setBinError(ix, 0.); break; case MonitorElement::DQM_KIND_TH2F: for(int iy(1); iy <= me->getNbinsY(); iy++){ int orig(me->getTH1()->GetBin(ix, iy)); int dest(me->getTH1()->GetBin(ix - dBin, iy)); entries += me->getBinContent(orig); me->setBinContent(dest, me->getBinContent(orig)); me->setBinError(dest, me->getBinError(orig)); me->setBinContent(orig, 0.); me->setBinError(orig, 0.); } break; default: break; } } me->setEntries(entries); me->getTH1()->GetXaxis()->SetLimits(tLow_, tHigh); } return true; }
bool ecaldqm::MESetTrend::minutely_ [private] |
Definition at line 47 of file MESetTrend.h.
Referenced by book(), getMinutely(), setMinutely(), and shift_().
time_t ecaldqm::MESetTrend::t0_ [private] |
Definition at line 46 of file MESetTrend.h.
Referenced by book(), getTimeZero(), and setTimeZero().
time_t ecaldqm::MESetTrend::tLow_ [private] |
Definition at line 49 of file MESetTrend.h.