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);
97 fill_(iME, _t + 0.5, _wy, _w);
108 fill_(iME, _t + 0.5, _wy, _w);
119 fill_(iME, _t + 0.5, _wy, _w);
125 if (
mes_.size() != 1)
126 throw_(
"MESet type incompatible");
129 fill_(0, _t + 0.5, _wy, _w);
139 return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
149 return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
159 return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
165 if (
mes_.size() != 1)
166 throw_(
"MESet type incompatible");
168 return mes_[0]->getTH1()->FindBin(_t + 0.5, _y);
173 throw_(
"Cumulative flag set for a profile plot");
178 TAxis *tAxis(
mes_[0]->getTH1()->GetXaxis());
179 int nbinsX(tAxis->GetNbins());
180 unsigned tLow(tAxis->GetBinLowEdge(1));
181 unsigned tHigh(tAxis->GetBinUpEdge(
nbinsX));
184 return _t >= tLow && _t < tHigh;
187 int unitsPerBin((tHigh - tLow) /
nbinsX);
189 if (_t >= tLow && _t < tHigh) {
191 int thisBin(tAxis->FindBin(_t + 0.5));
195 for (
unsigned iME(0); iME <
mes_.size(); iME++) {
197 int nbinsY(
me->getTH1()->GetNbinsY());
198 for (
int iy(1); iy <=
nbinsY; ++iy) {
200 double currentContent(
me->getBinContent(orig));
201 double currentError(
me->getBinError(orig));
203 int dest(
me->getTH1()->GetBin(ix, iy));
204 me->setBinContent(
dest, currentContent);
205 me->setBinError(
dest, currentError);
213 }
else if (_t >= tHigh) {
214 dBin = (_t - tHigh) / unitsPerBin + 1;
217 }
else if (_t < tLow) {
223 for (
unsigned iME(0); iME <
mes_.size(); iME++) {
228 while (--iMax > 0 && !filled) {
231 if (
me->getBinContent(iMax) != 0)
235 if (
me->getBinEntries(iMax) != 0)
239 for (
int iy(1); iy <=
me->getNbinsY(); iy++) {
240 if (
me->getBinContent(
me->getTH1()->GetBin(iMax, iy)) != 0) {
247 for (
int iy(1); iy <=
me->getNbinsY(); iy++) {
248 if (
me->getBinEntries(
me->getTH1()->GetBin(iMax, iy)) != 0) {
266 dBin = (_t - tLow) / unitsPerBin - 1;
271 int step(dBin > 0 ? 1 : -1);
273 tLow += dBin * unitsPerBin;
274 tHigh += dBin * unitsPerBin;
276 for (
unsigned iME(0); iME <
mes_.size(); iME++) {
279 me->getTH1()->GetXaxis()->SetLimits(tLow, tHigh);
292 for (; ix !=
end; ix +=
step) {
293 double binContent(
me->getBinContent(ix));
294 entries += binContent;
295 me->setBinContent(ix - dBin, binContent);
296 me->setBinError(ix - dBin,
me->getBinError(ix));
299 double lastContent(
currentBin_ > 0 ?
me->getBinContent(ix) : 0.);
300 double lastError(
currentBin_ > 0 ?
me->getBinContent(ix) : 0.);
302 me->setBinContent(ix, lastContent);
303 me->setBinError(ix, lastError);
308 for (; ix !=
end; ix +=
step) {
309 double binEntries(
me->getBinEntries(ix));
310 double binContent(
me->getBinContent(ix));
311 entries += binEntries;
312 me->setBinEntries(ix - dBin, binEntries);
313 me->setBinContent(ix - dBin, binContent * binEntries);
314 if (binEntries > 0) {
316 double sumw2((
rms *
rms + binContent * binContent) * binEntries);
319 me->setBinError(ix - dBin, 0.);
322 for (; ix !=
end; ix +=
step) {
323 me->setBinEntries(ix, 0.);
324 me->setBinContent(ix, 0.);
325 me->setBinError(ix, 0.);
331 for (; ix !=
end; ix +=
step) {
332 for (
int iy(1); iy <=
nbinsY; iy++) {
333 int orig(
me->getTH1()->GetBin(ix, iy));
334 int dest(
me->getTH1()->GetBin(ix - dBin, iy));
335 double binContent(
me->getBinContent(orig));
336 entries += binContent;
337 me->setBinContent(
dest, binContent);
338 me->setBinError(
dest,
me->getBinError(orig));
340 me->setBinContent(orig, 0.);
341 me->setBinError(orig, 0.);
345 std::vector<double> lastContent;
346 std::vector<double> lastError;
347 for (
int iy(1); iy <=
nbinsY; iy++) {
348 lastContent.push_back(
currentBin_ > 0 ?
me->getBinContent(ix, iy) : 0.);
349 lastError.push_back(
currentBin_ > 0 ?
me->getBinError(ix, iy) : 0.);
352 for (
int iy(1); iy <=
nbinsY; iy++) {
353 int bin(
me->getTH1()->GetBin(ix, iy));
354 me->setBinContent(
bin, lastContent[iy - 1]);
355 me->setBinError(
bin, lastError[iy - 1]);
362 for (; ix !=
end; ix +=
step) {
363 for (
int iy(1); iy <=
nbinsY; iy++) {
364 int orig(
me->getTH1()->GetBin(ix, iy));
365 int dest(
me->getTH1()->GetBin(ix - dBin, iy));
366 double binEntries(
me->getBinEntries(orig));
367 double binContent(
me->getBinContent(orig));
368 entries += binEntries;
369 me->setBinEntries(
dest, binEntries);
370 me->setBinContent(
dest, binContent * binEntries);
371 if (binEntries > 0) {
373 double sumw2((
rms *
rms + binContent * binContent) * binEntries);
376 me->setBinError(
dest, 0.);
380 for (; ix !=
end; ix +=
step) {
381 for (
int iy(1); iy <=
nbinsY; iy++) {
382 int bin(
me->getTH1()->GetBin(ix, iy));
383 me->setBinEntries(
bin, 0.);
384 me->setBinContent(
bin, 0.);
385 me->setBinError(
bin, 0.);
393 me->setEntries(entries);