CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ecaldqm::MESetTrend Class Reference

#include <MESetTrend.h>

Inheritance diagram for ecaldqm::MESetTrend:
ecaldqm::MESetEcal ecaldqm::MESet

Public Member Functions

void book (DQMStore::IBooker &) override
 
bool canShiftAxis () const
 
MESetclone (std::string const &="") const override
 
void fill (DetId const &, double, double=1., double=1.) override
 
void fill (EcalElectronicsId const &, double, double=1., double=1.) override
 
void fill (int, double, double=1., double=1.) override
 
void fill (double, double=1., double=1.) override
 
int findBin (DetId const &, double, double=0.) const override
 
int findBin (EcalElectronicsId const &, double, double=0.) const override
 
int findBin (int, double, double=0.) const override
 
int findBin (double, double=0.) const
 
bool isCumulative () const
 
bool isMinutely () const
 
bool isVariableBinning () const override
 
 MESetTrend (std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind, binning::AxisSpecs const *=0, binning::AxisSpecs const *=0)
 
 MESetTrend (MESetTrend const &)
 
MESetoperator= (MESet const &) override
 
void setCumulative ()
 
void setMinutely ()
 
void setShiftAxis ()
 
 ~MESetTrend () override
 
- Public Member Functions inherited from ecaldqm::MESetEcal
std::vector< std::string > generatePaths () const
 
double getBinContent (DetId const &, int) const override
 
double getBinContent (EcalElectronicsId const &, int) const override
 
double getBinContent (int, int) const override
 
double getBinEntries (DetId const &, int) const override
 
double getBinEntries (EcalElectronicsId const &, int) const override
 
double getBinEntries (int, int) const override
 
double getBinError (DetId const &, int) const override
 
double getBinError (EcalElectronicsId const &, int) const override
 
double getBinError (int, int) const override
 
 MESetEcal (std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind, unsigned, binning::AxisSpecs const *=0, binning::AxisSpecs const *=0, binning::AxisSpecs const *=0)
 
 MESetEcal (MESetEcal const &)
 
bool retrieve (DQMStore::IGetter &, std::string *=0) const override
 
void setBinContent (DetId const &, int, double) override
 
void setBinContent (EcalElectronicsId const &, int, double) override
 
void setBinContent (int, int, double) override
 
void setBinEntries (DetId const &, int, double) override
 
void setBinEntries (EcalElectronicsId const &, int, double) override
 
void setBinEntries (int, int, double) override
 
void setBinError (DetId const &, int, double) override
 
void setBinError (EcalElectronicsId const &, int, double) override
 
void setBinError (int, int, double) override
 
 ~MESetEcal () override
 
- Public Member Functions inherited from ecaldqm::MESet
virtual const_iterator begin () const
 
virtual iterator begin ()
 
virtual const_iterator beginChannel () const
 
virtual iterator beginChannel ()
 
virtual void clear () const
 
virtual const_iterator end () const
 
virtual iterator end ()
 
std::string formPath (PathReplacements const &) const
 
bool getBatchMode () const
 
binning::BinningType getBinType () const
 
MonitorElement::Kind getKind () const
 
bool getLumiFlag () const
 
virtual MonitorElement const * getME (unsigned _iME) const
 
virtual MonitorElementgetME (unsigned _iME)
 
binning::ObjectType getObjType () const
 
virtual std::string const & getPath () const
 
bool isActive () const
 
virtual bool maskMatches (DetId const &, uint32_t, StatusManager const *) const
 
 MESet ()
 
 MESet (std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind)
 
 MESet (MESet const &)
 
virtual void reset (double=0., double=0., double=0.)
 
virtual void resetAll (double=0., double=0., double=0.)
 
virtual void setAxisTitle (std::string const &, int=1)
 
void setBatchMode ()
 
virtual void setBinContent (DetId const &, double)
 
virtual void setBinContent (EcalElectronicsId const &, double)
 
virtual void setBinContent (int, double)
 
virtual void setBinEntries (DetId const &, double)
 
virtual void setBinEntries (EcalElectronicsId const &, double)
 
virtual void setBinEntries (int, double)
 
virtual void setBinError (DetId const &, double)
 
virtual void setBinError (EcalElectronicsId const &, double)
 
virtual void setBinError (int, double)
 
void setLumiFlag ()
 
virtual ~MESet ()
 

Private Member Functions

bool shift_ (unsigned)
 

Private Attributes

int currentBin_
 
bool minutely_
 
bool shiftAxis_
 

Additional Inherited Members

- Public Types inherited from ecaldqm::MESet
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
typedef std::map< std::string, std::string > PathReplacements
 
- Protected Member Functions inherited from ecaldqm::MESet
virtual void checkME_ (unsigned _iME) const
 
virtual void fill_ (unsigned, int, double)
 
virtual void fill_ (unsigned, int, double, double)
 
virtual void fill_ (unsigned, double, double, double)
 
void throw_ (std::string const &_message) const
 
- Protected Attributes inherited from ecaldqm::MESetEcal
unsigned logicalDimensions_
 
binning::AxisSpecs const * xaxis_
 
binning::AxisSpecs const * yaxis_
 
binning::AxisSpecs const * zaxis_
 
- Protected Attributes inherited from ecaldqm::MESet
bool active_
 
bool batchMode_
 
binning::BinningType btype_
 
MonitorElement::Kind kind_
 
bool lumiFlag_
 
std::vector< MonitorElement * > mes_
 
binning::ObjectType otype_
 
std::string path_
 

Detailed Description

Definition at line 12 of file MESetTrend.h.

Constructor & Destructor Documentation

ecaldqm::MESetTrend::MESetTrend ( std::string const &  _fullPath,
binning::ObjectType  _otype,
binning::BinningType  _btype,
MonitorElement::Kind  _kind,
binning::AxisSpecs const *  _xaxis = 0,
binning::AxisSpecs const *  _yaxis = 0 
)

Definition at line 7 of file MESetTrend.cc.

References ecaldqm::MESet::kind_, MonitorElementData::TH1F, MonitorElementData::TH2F, ecaldqm::MESet::throw_(), MonitorElementData::TPROFILE, and MonitorElementData::TPROFILE2D.

Referenced by clone().

13  : MESetEcal(_fullPath, _otype, _btype, _kind, 1, _xaxis, _yaxis),
14  minutely_(false),
15  shiftAxis_(false),
16  currentBin_(-1) {
17  switch (kind_) {
22  break;
23  default:
24  throw_("Unsupported MonitorElement kind");
25  }
26  }
MonitorElement::Kind kind_
Definition: MESet.h:128
void throw_(std::string const &_message) const
Definition: MESet.h:121
MESetEcal(std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind, unsigned, binning::AxisSpecs const *=0, binning::AxisSpecs const *=0, binning::AxisSpecs const *=0)
Definition: MESetEcal.cc:10
ecaldqm::MESetTrend::MESetTrend ( MESetTrend const &  _orig)

Definition at line 28 of file MESetTrend.cc.

29  : MESetEcal(_orig), minutely_(_orig.minutely_), shiftAxis_(_orig.shiftAxis_), currentBin_(_orig.currentBin_) {}
MESetEcal(std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind, unsigned, binning::AxisSpecs const *=0, binning::AxisSpecs const *=0, binning::AxisSpecs const *=0)
Definition: MESetEcal.cc:10
ecaldqm::MESetTrend::~MESetTrend ( )
inlineoverride

Definition at line 21 of file MESetTrend.h.

References book(), clone(), fill(), findBin(), operator=(), and AlCaHLTBitMon_QueryRunRegistry::string.

21 {}

Member Function Documentation

void ecaldqm::MESetTrend::book ( DQMStore::IBooker _ibooker)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 51 of file MESetTrend.cc.

References ecaldqm::MESetEcal::book(), ecaldqm::binning::AxisSpecs::high, ecaldqm::binning::AxisSpecs::low, ecaldqm::MESet::mes_, minutely_, ecaldqm::binning::AxisSpecs::nbins, ecaldqm::MESet::setAxisTitle(), ntuplemaker::time, LaserClient_cfi::xaxis, and ecaldqm::MESetEcal::xaxis_.

Referenced by ~MESetTrend().

51  {
52  binning::AxisSpecs xaxis;
53  if (xaxis_)
54  xaxis = *xaxis_;
55  else {
56  xaxis.nbins = 200;
57  xaxis.low = 0.;
58  xaxis.high = 2000.;
59  }
60 
61  if (minutely_) {
62  time_t localTime(time(nullptr));
63  struct tm timeBuffer;
64  gmtime_r(&localTime, &timeBuffer); // gmtime() is not thread safe
65  unsigned utcTime(mktime(&timeBuffer));
66 
67  xaxis.low = utcTime;
68  if (xaxis_)
69  xaxis.high = utcTime + xaxis_->high - xaxis_->low;
70  else
71  xaxis.high = xaxis.low + 200 * 60.;
72  }
73 
74  binning::AxisSpecs const *xaxisTemp(xaxis_);
75  xaxis_ = &xaxis;
76 
77  MESetEcal::book(_ibooker);
78 
79  xaxis_ = xaxisTemp;
80 
81  if (minutely_) {
82  for (unsigned iME(0); iME < mes_.size(); ++iME)
83  mes_[iME]->getTH1()->GetXaxis()->SetTimeDisplay(1);
84  setAxisTitle("UTC");
85  } else
86  setAxisTitle("LumiSections");
87  }
virtual void setAxisTitle(std::string const &, int=1)
Definition: MESet.cc:89
binning::AxisSpecs const * xaxis_
Definition: MESetEcal.h:74
std::vector< MonitorElement * > mes_
Definition: MESet.h:123
void book(DQMStore::IBooker &) override
Definition: MESetEcal.cc:70
bool ecaldqm::MESetTrend::canShiftAxis ( ) const
inline

Definition at line 45 of file MESetTrend.h.

References shiftAxis_.

45 { return shiftAxis_; }
MESet * ecaldqm::MESetTrend::clone ( std::string const &  _path = "") const
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 42 of file MESetTrend.cc.

References filterCSVwithJSON::copy, MESetTrend(), castor_dqm_sourceclient_file_cfg::path, ecaldqm::MESet::path_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~MESetTrend().

42  {
44  if (!_path.empty())
45  path_ = _path;
46  MESet *copy(new MESetTrend(*this));
47  path_ = path;
48  return copy;
49  }
MESetTrend(std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind, binning::AxisSpecs const *=0, binning::AxisSpecs const *=0)
Definition: MESetTrend.cc:7
std::string path_
Definition: MESet.h:125
void ecaldqm::MESetTrend::fill ( DetId const &  _id,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 89 of file MESetTrend.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::checkME_(), ecaldqm::MESet::fill_(), ecaldqm::binning::findPlotIndex(), ecaldqm::MESet::otype_, and shift_().

Referenced by ~MESetTrend().

89  {
90  if (!active_)
91  return;
92 
93  unsigned iME(binning::findPlotIndex(otype_, _id));
94  checkME_(iME);
95 
96  if (shift_(unsigned(_t)))
97  fill_(iME, _t + 0.5, _wy, _w);
98  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:113
bool shift_(unsigned)
Definition: MESetTrend.cc:177
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:246
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:133
binning::ObjectType otype_
Definition: MESet.h:126
void ecaldqm::MESetTrend::fill ( EcalElectronicsId const &  _id,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 100 of file MESetTrend.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::checkME_(), ecaldqm::MESet::fill_(), ecaldqm::binning::findPlotIndex(), ecaldqm::MESet::otype_, and shift_().

100  {
101  if (!active_)
102  return;
103 
104  unsigned iME(binning::findPlotIndex(otype_, _id));
105  checkME_(iME);
106 
107  if (shift_(unsigned(_t)))
108  fill_(iME, _t + 0.5, _wy, _w);
109  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:113
bool shift_(unsigned)
Definition: MESetTrend.cc:177
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:246
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:133
binning::ObjectType otype_
Definition: MESet.h:126
void ecaldqm::MESetTrend::fill ( int  _dcctccid,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 111 of file MESetTrend.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::btype_, ecaldqm::MESet::checkME_(), ecaldqm::MESet::fill_(), ecaldqm::binning::findPlotIndex(), ecaldqm::MESet::otype_, and shift_().

111  {
112  if (!active_)
113  return;
114 
115  unsigned iME(binning::findPlotIndex(otype_, _dcctccid, btype_));
116  checkME_(iME);
117 
118  if (shift_(unsigned(_t)))
119  fill_(iME, _t + 0.5, _wy, _w);
120  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:113
bool shift_(unsigned)
Definition: MESetTrend.cc:177
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:246
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:133
binning::ObjectType otype_
Definition: MESet.h:126
binning::BinningType btype_
Definition: MESet.h:127
void ecaldqm::MESetTrend::fill ( double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 122 of file MESetTrend.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::fill_(), ecaldqm::MESet::mes_, shift_(), and ecaldqm::MESet::throw_().

122  {
123  if (!active_)
124  return;
125  if (mes_.size() != 1)
126  throw_("MESet type incompatible");
127 
128  if (shift_(unsigned(_t)))
129  fill_(0, _t + 0.5, _wy, _w);
130  }
bool shift_(unsigned)
Definition: MESetTrend.cc:177
void throw_(std::string const &_message) const
Definition: MESet.h:121
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:246
bool active_
Definition: MESet.h:133
std::vector< MonitorElement * > mes_
Definition: MESet.h:123
int ecaldqm::MESetTrend::findBin ( DetId const &  _id,
double  _t,
double  _y = 0. 
) const
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 132 of file MESetTrend.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::checkME_(), ecaldqm::binning::findPlotIndex(), ecaldqm::MESet::mes_, and ecaldqm::MESet::otype_.

Referenced by ~MESetTrend().

132  {
133  if (!active_)
134  return -1;
135 
136  unsigned iME(binning::findPlotIndex(otype_, _id));
137  checkME_(iME);
138 
139  return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
140  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:113
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:133
binning::ObjectType otype_
Definition: MESet.h:126
std::vector< MonitorElement * > mes_
Definition: MESet.h:123
int ecaldqm::MESetTrend::findBin ( EcalElectronicsId const &  _id,
double  _t,
double  _y = 0. 
) const
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 142 of file MESetTrend.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::checkME_(), ecaldqm::binning::findPlotIndex(), ecaldqm::MESet::mes_, and ecaldqm::MESet::otype_.

142  {
143  if (!active_)
144  return -1;
145 
146  unsigned iME(binning::findPlotIndex(otype_, _id));
147  checkME_(iME);
148 
149  return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
150  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:113
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:133
binning::ObjectType otype_
Definition: MESet.h:126
std::vector< MonitorElement * > mes_
Definition: MESet.h:123
int ecaldqm::MESetTrend::findBin ( int  _dcctccid,
double  _t,
double  _y = 0. 
) const
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 152 of file MESetTrend.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::btype_, ecaldqm::MESet::checkME_(), ecaldqm::binning::findPlotIndex(), ecaldqm::MESet::mes_, and ecaldqm::MESet::otype_.

152  {
153  if (!active_)
154  return -1;
155 
156  unsigned iME(binning::findPlotIndex(otype_, _dcctccid, btype_));
157  checkME_(iME);
158 
159  return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
160  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:113
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:133
binning::ObjectType otype_
Definition: MESet.h:126
binning::BinningType btype_
Definition: MESet.h:127
std::vector< MonitorElement * > mes_
Definition: MESet.h:123
int ecaldqm::MESetTrend::findBin ( double  _t,
double  _y = 0. 
) const

Definition at line 162 of file MESetTrend.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::mes_, and ecaldqm::MESet::throw_().

162  {
163  if (!active_)
164  return -1;
165  if (mes_.size() != 1)
166  throw_("MESet type incompatible");
167 
168  return mes_[0]->getTH1()->FindBin(_t + 0.5, _y);
169  }
void throw_(std::string const &_message) const
Definition: MESet.h:121
bool active_
Definition: MESet.h:133
std::vector< MonitorElement * > mes_
Definition: MESet.h:123
bool ecaldqm::MESetTrend::isCumulative ( ) const
inline

Definition at line 46 of file MESetTrend.h.

References currentBin_, and shift_().

46 { return currentBin_ > 0; }
bool ecaldqm::MESetTrend::isMinutely ( ) const
inline

Definition at line 44 of file MESetTrend.h.

References minutely_.

44 { return minutely_; }
bool ecaldqm::MESetTrend::isVariableBinning ( ) const
inlineoverridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 39 of file MESetTrend.h.

39 { return true; }
MESet & ecaldqm::MESetTrend::operator= ( MESet const &  _rhs)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 31 of file MESetTrend.cc.

References currentBin_, minutely_, ecaldqm::MESetEcal::operator=(), and shiftAxis_.

Referenced by ~MESetTrend().

31  {
32  MESetTrend const *pRhs(dynamic_cast<MESetTrend const *>(&_rhs));
33  if (pRhs) {
34  minutely_ = pRhs->minutely_;
35  shiftAxis_ = pRhs->shiftAxis_;
36  currentBin_ = pRhs->currentBin_;
37  }
38 
39  return MESetEcal::operator=(_rhs);
40  }
MESet & operator=(MESet const &) override
Definition: MESetEcal.cc:40
MESetTrend(std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind, binning::AxisSpecs const *=0, binning::AxisSpecs const *=0)
Definition: MESetTrend.cc:7
void ecaldqm::MESetTrend::setCumulative ( )

Definition at line 171 of file MESetTrend.cc.

References currentBin_, ecaldqm::MESet::kind_, ecaldqm::MESet::throw_(), MonitorElementData::TPROFILE, and MonitorElementData::TPROFILE2D.

Referenced by ecaldqm::createMESet(), and setShiftAxis().

171  {
173  throw_("Cumulative flag set for a profile plot");
174  currentBin_ = 1;
175  }
MonitorElement::Kind kind_
Definition: MESet.h:128
void throw_(std::string const &_message) const
Definition: MESet.h:121
void ecaldqm::MESetTrend::setMinutely ( )
inline

Definition at line 41 of file MESetTrend.h.

References minutely_.

Referenced by ecaldqm::createMESet().

41 { minutely_ = true; }
void ecaldqm::MESetTrend::setShiftAxis ( )
inline

Definition at line 42 of file MESetTrend.h.

References setCumulative(), and shiftAxis_.

Referenced by ecaldqm::createMESet().

42 { shiftAxis_ = true; }
bool ecaldqm::MESetTrend::shift_ ( unsigned  _t)
private

Definition at line 177 of file MESetTrend.cc.

References newFWLiteAna::bin, currentBin_, mps_fire::dest, ecaldqm::MESet::end(), dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getBinEntries(), dqm::impl::MonitorElement::getBinError(), dqm::impl::MonitorElement::getNbinsY(), dqm::legacy::MonitorElement::getTH1(), ecaldqm::MESet::kind_, hlt_dqm_clientPB-live_cfg::me, ecaldqm::MESet::mes_, hlt_dqm_clientPB-live_cfg::nbinsX, hlt_dqm_clientPB-live_cfg::nbinsY, dqm::impl::MonitorElement::Reset(), SiStripPI::rms, dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinEntries(), dqm::impl::MonitorElement::setBinError(), dqm::impl::MonitorElement::setEntries(), shiftAxis_, mathSSE::sqrt(), command_line::start, MonitorElementData::TH1F, MonitorElementData::TH2F, MonitorElementData::TPROFILE, and MonitorElementData::TPROFILE2D.

Referenced by fill(), and isCumulative().

177  {
178  TAxis *tAxis(mes_[0]->getTH1()->GetXaxis());
179  int nbinsX(tAxis->GetNbins());
180  unsigned tLow(tAxis->GetBinLowEdge(1));
181  unsigned tHigh(tAxis->GetBinUpEdge(nbinsX));
182 
183  if (!shiftAxis_)
184  return _t >= tLow && _t < tHigh;
185 
186  int dBin(0);
187  int unitsPerBin((tHigh - tLow) / nbinsX);
188 
189  if (_t >= tLow && _t < tHigh) {
190  if (currentBin_ > 0) {
191  int thisBin(tAxis->FindBin(_t + 0.5));
192  if (thisBin < currentBin_)
193  return false;
194  else if (thisBin > currentBin_) {
195  for (unsigned iME(0); iME < mes_.size(); iME++) {
196  MonitorElement *me(mes_[iME]);
197  int nbinsY(me->getTH1()->GetNbinsY());
198  for (int iy(1); iy <= nbinsY; ++iy) {
199  int orig(me->getTH1()->GetBin(currentBin_, iy));
200  double currentContent(me->getBinContent(orig));
201  double currentError(me->getBinError(orig));
202  for (int ix(currentBin_); ix <= thisBin; ++ix) {
203  int dest(me->getTH1()->GetBin(ix, iy));
204  me->setBinContent(dest, currentContent);
205  me->setBinError(dest, currentError);
206  }
207  }
208  }
209  }
210  }
211 
212  return true;
213  } else if (_t >= tHigh) {
214  dBin = (_t - tHigh) / unitsPerBin + 1;
215  if (currentBin_ > 0)
217  } else if (_t < tLow) {
218  if (currentBin_ > 0)
219  return false; // no going back in time in case of cumulative history
220 
221  int maxBin(0);
222 
223  for (unsigned iME(0); iME < mes_.size(); iME++) {
224  MonitorElement *me(mes_[iME]);
225 
226  bool filled(false);
227  int iMax(nbinsX + 1);
228  while (--iMax > 0 && !filled) {
229  switch (kind_) {
231  if (me->getBinContent(iMax) != 0)
232  filled = true;
233  break;
235  if (me->getBinEntries(iMax) != 0)
236  filled = true;
237  break;
239  for (int iy(1); iy <= me->getNbinsY(); iy++) {
240  if (me->getBinContent(me->getTH1()->GetBin(iMax, iy)) != 0) {
241  filled = true;
242  break;
243  }
244  }
245  break;
247  for (int iy(1); iy <= me->getNbinsY(); iy++) {
248  if (me->getBinEntries(me->getTH1()->GetBin(iMax, iy)) != 0) {
249  filled = true;
250  break;
251  }
252  }
253  break;
254  default:
255  break;
256  }
257  }
258 
259  if (iMax > maxBin)
260  maxBin = iMax;
261  }
262 
263  if (_t < tLow - (nbinsX - maxBin) * unitsPerBin)
264  return false;
265 
266  dBin = (_t - tLow) / unitsPerBin - 1;
267  }
268 
269  int start(dBin > 0 ? dBin + 1 : nbinsX + dBin);
270  int end(dBin > 0 ? nbinsX + 1 : 0);
271  int step(dBin > 0 ? 1 : -1);
272 
273  tLow += dBin * unitsPerBin;
274  tHigh += dBin * unitsPerBin;
275 
276  for (unsigned iME(0); iME < mes_.size(); iME++) {
277  MonitorElement *me(mes_[iME]);
278 
279  me->getTH1()->GetXaxis()->SetLimits(tLow, tHigh);
280 
281  if ((end - start) / step < 0) {
282  me->Reset();
283  continue;
284  }
285 
286  me->setEntries(0.);
287  double entries(0.);
288 
289  switch (kind_) {
291  int ix(start);
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));
297  }
298  ix = end - dBin - 1 * step;
299  double lastContent(currentBin_ > 0 ? me->getBinContent(ix) : 0.);
300  double lastError(currentBin_ > 0 ? me->getBinContent(ix) : 0.);
301  for (ix += step; ix != end; ix += step) {
302  me->setBinContent(ix, lastContent);
303  me->setBinError(ix, lastError);
304  }
305  } break;
307  int ix(start);
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) {
315  double rms(me->getBinError(ix) * std::sqrt(binEntries));
316  double sumw2((rms * rms + binContent * binContent) * binEntries);
317  me->setBinError(ix - dBin, std::sqrt(sumw2));
318  } else
319  me->setBinError(ix - dBin, 0.);
320  }
321  ix = end - dBin;
322  for (; ix != end; ix += step) {
323  me->setBinEntries(ix, 0.);
324  me->setBinContent(ix, 0.);
325  me->setBinError(ix, 0.);
326  }
327  } break;
329  int ix(start);
330  int nbinsY(me->getNbinsY());
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));
339 
340  me->setBinContent(orig, 0.);
341  me->setBinError(orig, 0.);
342  }
343  }
344  ix = end - dBin - 1 * step;
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.);
350  }
351  for (ix += step; ix != end; ix += step) {
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]);
356  }
357  }
358  } break;
360  int ix(start);
361  int nbinsY(me->getNbinsY());
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) {
372  double rms(me->getBinError(orig) * std::sqrt(binEntries));
373  double sumw2((rms * rms + binContent * binContent) * binEntries);
374  me->setBinError(dest, std::sqrt(sumw2));
375  } else
376  me->setBinError(dest, 0.);
377  }
378  }
379  ix = end - dBin;
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.);
386  }
387  }
388  } break;
389  default:
390  break;
391  }
392 
393  me->setEntries(entries);
394  }
395 
396  return true;
397  }
Definition: start.py:1
MonitorElement::Kind kind_
Definition: MESet.h:128
T sqrt(T t)
Definition: SSEVec.h:19
virtual const_iterator end() const
Definition: MESet.h:321
step
Definition: StallMonitor.cc:94
std::vector< MonitorElement * > mes_
Definition: MESet.h:123

Member Data Documentation

int ecaldqm::MESetTrend::currentBin_
private

Definition at line 53 of file MESetTrend.h.

Referenced by isCumulative(), operator=(), setCumulative(), and shift_().

bool ecaldqm::MESetTrend::minutely_
private

Definition at line 51 of file MESetTrend.h.

Referenced by book(), isMinutely(), operator=(), and setMinutely().

bool ecaldqm::MESetTrend::shiftAxis_
private

Definition at line 52 of file MESetTrend.h.

Referenced by canShiftAxis(), operator=(), setShiftAxis(), and shift_().