13 :
MESetEcal(_fullPath, _otype, _btype, _kind, 1, _xaxis, _yaxis),
24 throw_(
"Unsupported MonitorElement kind");
29 :
MESetEcal(_orig), minutely_(_orig.minutely_), shiftAxis_(_orig.shiftAxis_), currentBin_(_orig.currentBin_) {}
32 MESetTrend const *pRhs(dynamic_cast<MESetTrend const *>(&_rhs));
62 time_t localTime(
time(
nullptr));
64 gmtime_r(&localTime, &timeBuffer);
65 unsigned utcTime(mktime(&timeBuffer));
82 for (
unsigned iME(0); iME <
mes_.size(); ++iME)
83 mes_[iME]->getTH1()->GetXaxis()->SetTimeDisplay(1);
98 fill_(iME, _t + 0.5, _wy, _w);
113 fill_(iME, _t + 0.5, _wy, _w);
125 fill_(iME, _t + 0.5, _wy, _w);
131 if (
mes_.size() != 1)
132 throw_(
"MESet type incompatible");
135 fill_(0, _t + 0.5, _wy, _w);
145 return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
158 return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
168 return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
174 if (
mes_.size() != 1)
175 throw_(
"MESet type incompatible");
177 return mes_[0]->getTH1()->FindBin(_t + 0.5, _y);
182 throw_(
"Cumulative flag set for a profile plot");
187 TAxis *tAxis(
mes_[0]->getTH1()->GetXaxis());
188 int nbinsX(tAxis->GetNbins());
189 unsigned tLow(tAxis->GetBinLowEdge(1));
190 unsigned tHigh(tAxis->GetBinUpEdge(
nbinsX));
193 return _t >= tLow && _t < tHigh;
196 int unitsPerBin((tHigh - tLow) /
nbinsX);
198 if (_t >= tLow && _t < tHigh) {
200 int thisBin(tAxis->FindBin(_t + 0.5));
204 for (
unsigned iME(0); iME <
mes_.size(); iME++) {
206 int nbinsY(
me->getTH1()->GetNbinsY());
207 for (
int iy(1); iy <=
nbinsY; ++iy) {
209 double currentContent(
me->getBinContent(orig));
210 double currentError(
me->getBinError(orig));
212 int dest(
me->getTH1()->GetBin(ix, iy));
213 me->setBinContent(
dest, currentContent);
214 me->setBinError(
dest, currentError);
222 }
else if (_t >= tHigh) {
223 dBin = (_t - tHigh) / unitsPerBin + 1;
226 }
else if (_t < tLow) {
232 for (
unsigned iME(0); iME <
mes_.size(); iME++) {
237 while (--iMax > 0 && !filled) {
240 if (
me->getBinContent(iMax) != 0)
244 if (
me->getBinEntries(iMax) != 0)
248 for (
int iy(1); iy <=
me->getNbinsY(); iy++) {
249 if (
me->getBinContent(
me->getTH1()->GetBin(iMax, iy)) != 0) {
256 for (
int iy(1); iy <=
me->getNbinsY(); iy++) {
257 if (
me->getBinEntries(
me->getTH1()->GetBin(iMax, iy)) != 0) {
275 dBin = (_t - tLow) / unitsPerBin - 1;
280 int step(dBin > 0 ? 1 : -1);
282 tLow += dBin * unitsPerBin;
283 tHigh += dBin * unitsPerBin;
285 for (
unsigned iME(0); iME <
mes_.size(); iME++) {
288 me->getTH1()->GetXaxis()->SetLimits(tLow, tHigh);
301 for (; ix !=
end; ix +=
step) {
302 double binContent(
me->getBinContent(ix));
303 entries += binContent;
304 me->setBinContent(ix - dBin, binContent);
305 me->setBinError(ix - dBin,
me->getBinError(ix));
308 double lastContent(
currentBin_ > 0 ?
me->getBinContent(ix) : 0.);
309 double lastError(
currentBin_ > 0 ?
me->getBinContent(ix) : 0.);
311 me->setBinContent(ix, lastContent);
312 me->setBinError(ix, lastError);
317 for (; ix !=
end; ix +=
step) {
318 double binEntries(
me->getBinEntries(ix));
319 double binContent(
me->getBinContent(ix));
320 entries += binEntries;
321 me->setBinEntries(ix - dBin, binEntries);
322 me->setBinContent(ix - dBin, binContent * binEntries);
323 if (binEntries > 0) {
325 double sumw2((
rms *
rms + binContent * binContent) * binEntries);
328 me->setBinError(ix - dBin, 0.);
331 for (; ix !=
end; ix +=
step) {
332 me->setBinEntries(ix, 0.);
333 me->setBinContent(ix, 0.);
334 me->setBinError(ix, 0.);
340 for (; ix !=
end; ix +=
step) {
341 for (
int iy(1); iy <=
nbinsY; iy++) {
342 int orig(
me->getTH1()->GetBin(ix, iy));
343 int dest(
me->getTH1()->GetBin(ix - dBin, iy));
344 double binContent(
me->getBinContent(orig));
345 entries += binContent;
346 me->setBinContent(
dest, binContent);
347 me->setBinError(
dest,
me->getBinError(orig));
349 me->setBinContent(orig, 0.);
350 me->setBinError(orig, 0.);
354 std::vector<double> lastContent;
355 std::vector<double> lastError;
356 for (
int iy(1); iy <=
nbinsY; iy++) {
357 lastContent.push_back(
currentBin_ > 0 ?
me->getBinContent(ix, iy) : 0.);
358 lastError.push_back(
currentBin_ > 0 ?
me->getBinError(ix, iy) : 0.);
361 for (
int iy(1); iy <=
nbinsY; iy++) {
362 int bin(
me->getTH1()->GetBin(ix, iy));
363 me->setBinContent(
bin, lastContent[iy - 1]);
364 me->setBinError(
bin, lastError[iy - 1]);
371 for (; ix !=
end; ix +=
step) {
372 for (
int iy(1); iy <=
nbinsY; iy++) {
373 int orig(
me->getTH1()->GetBin(ix, iy));
374 int dest(
me->getTH1()->GetBin(ix - dBin, iy));
375 double binEntries(
me->getBinEntries(orig));
376 double binContent(
me->getBinContent(orig));
377 entries += binEntries;
378 me->setBinEntries(
dest, binEntries);
379 me->setBinContent(
dest, binContent * binEntries);
380 if (binEntries > 0) {
382 double sumw2((
rms *
rms + binContent * binContent) * binEntries);
385 me->setBinError(
dest, 0.);
389 for (; ix !=
end; ix +=
step) {
390 for (
int iy(1); iy <=
nbinsY; iy++) {
391 int bin(
me->getTH1()->GetBin(ix, iy));
392 me->setBinEntries(
bin, 0.);
393 me->setBinContent(
bin, 0.);
394 me->setBinError(
bin, 0.);
402 me->setEntries(entries);