CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &) override
 
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 ()
 
- 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 const &, 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 ()
 
- 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 recoverStats ()
 
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 void softReset ()
 
virtual ~MESet ()
 

Private Member Functions

template<class Bookable >
void doBook_ (Bookable &)
 
bool shift_ (unsigned)
 

Private Attributes

int currentBin_
 
bool minutely_
 
bool shiftAxis_
 

Additional Inherited Members

- Public Types inherited from ecaldqm::MESet
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 13 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 MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, ecaldqm::MESet::kind_, and ecaldqm::MESet::throw_().

Referenced by clone().

7  :
8  MESetEcal(_fullPath, _otype, _btype, _kind, 1, _xaxis, _yaxis),
9  minutely_(false),
10  shiftAxis_(false),
11  currentBin_(-1)
12  {
13  switch(kind_){
18  break;
19  default:
20  throw_("Unsupported MonitorElement kind");
21  }
22  }
MonitorElement::Kind kind_
Definition: MESet.h:135
void throw_(std::string const &_message) const
Definition: MESet.h:125
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:11
ecaldqm::MESetTrend::MESetTrend ( MESetTrend const &  _orig)

Definition at line 24 of file MESetTrend.cc.

24  :
25  MESetEcal(_orig),
26  minutely_(_orig.minutely_),
27  shiftAxis_(_orig.shiftAxis_),
28  currentBin_(_orig.currentBin_)
29  {
30  }
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:11
ecaldqm::MESetTrend::~MESetTrend ( )
inline

Definition at line 18 of file MESetTrend.h.

18 {}

Member Function Documentation

void ecaldqm::MESetTrend::book ( DQMStore _dqmStore)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 56 of file MESetTrend.cc.

References doBook_().

57  {
58  doBook_(_dqmStore);
59  }
void doBook_(Bookable &)
Definition: MESetTrend.cc:167
void ecaldqm::MESetTrend::book ( DQMStore::IBooker _ibooker)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 62 of file MESetTrend.cc.

References doBook_().

63  {
64  doBook_(_ibooker);
65  }
void doBook_(Bookable &)
Definition: MESetTrend.cc:167
bool ecaldqm::MESetTrend::canShiftAxis ( ) const
inline

Definition at line 43 of file MESetTrend.h.

References shiftAxis_.

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

Reimplemented from ecaldqm::MESetEcal.

Definition at line 46 of file MESetTrend.cc.

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

47  {
49  if(_path != "") path_ = _path;
50  MESet* copy(new MESetTrend(*this));
51  path_ = path;
52  return copy;
53  }
MESetTrend(std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind, binning::AxisSpecs const *=0, binning::AxisSpecs const *=0)
Definition: MESetTrend.cc:7
tuple path
else: Piece not in the list, fine.
std::string path_
Definition: MESet.h:132
template<class Bookable >
void ecaldqm::MESetTrend::doBook_ ( Bookable &  _booker)
private

Definition at line 167 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(), cond::rpcobgas::time, and ecaldqm::MESetEcal::xaxis_.

Referenced by book().

168  {
169  binning::AxisSpecs xaxis;
170  if(xaxis_) xaxis = *xaxis_;
171  else{
172  xaxis.nbins = 200;
173  xaxis.low = 0.;
174  xaxis.high = 2000.;
175  }
176 
177  if(minutely_){
178  time_t localTime(time(0));
179  struct tm timeBuffer;
180  gmtime_r(&localTime, &timeBuffer); // gmtime() is not thread safe
181  unsigned utcTime(mktime(&timeBuffer));
182 
183  xaxis.low = utcTime;
184  if(xaxis_) xaxis.high = utcTime + xaxis_->high - xaxis_->low;
185  else xaxis.high = xaxis.low + 200 * 60.;
186  }
187 
188  binning::AxisSpecs const* xaxisTemp(xaxis_);
189  xaxis_ = &xaxis;
190 
191  MESetEcal::book(_booker);
192 
193  xaxis_ = xaxisTemp;
194 
195  if(minutely_){
196  for(unsigned iME(0); iME < mes_.size(); ++iME)
197  mes_[iME]->getTH1()->GetXaxis()->SetTimeDisplay(1);
198  setAxisTitle("UTC");
199  }
200  else
201  setAxisTitle("LumiSections");
202  }
virtual void setAxisTitle(std::string const &, int=1)
Definition: MESet.cc:100
void book(DQMStore &) override
Definition: MESetEcal.cc:69
std::vector< MonitorElement * > mes_
Definition: MESet.h:130
binning::AxisSpecs const * xaxis_
Definition: MESetEcal.h:69
void ecaldqm::MESetTrend::fill ( DetId const &  _id,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 68 of file MESetTrend.cc.

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

69  {
70  if(!active_) return;
71 
72  unsigned iME(binning::findPlotIndex(otype_, _id));
73  checkME_(iME);
74 
75  if(shift_(unsigned(_t)))
76  fill_(iME, _t + 0.5, _wy, _w);
77  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:116
bool shift_(unsigned)
Definition: MESetTrend.cc:205
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:278
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:139
binning::ObjectType otype_
Definition: MESet.h:133
void ecaldqm::MESetTrend::fill ( EcalElectronicsId const &  _id,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 80 of file MESetTrend.cc.

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

81  {
82  if(!active_) return;
83 
84  unsigned iME(binning::findPlotIndex(otype_, _id));
85  checkME_(iME);
86 
87  if(shift_(unsigned(_t)))
88  fill_(iME, _t + 0.5, _wy, _w);
89  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:116
bool shift_(unsigned)
Definition: MESetTrend.cc:205
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:278
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:139
binning::ObjectType otype_
Definition: MESet.h:133
void ecaldqm::MESetTrend::fill ( int  _dcctccid,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 92 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_().

93  {
94  if(!active_) return;
95 
96  unsigned iME(binning::findPlotIndex(otype_, _dcctccid, btype_));
97  checkME_(iME);
98 
99  if(shift_(unsigned(_t)))
100  fill_(iME, _t + 0.5, _wy, _w);
101  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:116
bool shift_(unsigned)
Definition: MESetTrend.cc:205
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:278
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:139
binning::ObjectType otype_
Definition: MESet.h:133
binning::BinningType btype_
Definition: MESet.h:134
void ecaldqm::MESetTrend::fill ( double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 104 of file MESetTrend.cc.

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

105  {
106  if(!active_) return;
107  if(mes_.size() != 1)
108  throw_("MESet type incompatible");
109 
110  if(shift_(unsigned(_t)))
111  fill_(0, _t + 0.5, _wy, _w);
112  }
bool shift_(unsigned)
Definition: MESetTrend.cc:205
std::vector< MonitorElement * > mes_
Definition: MESet.h:130
void throw_(std::string const &_message) const
Definition: MESet.h:125
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:278
bool active_
Definition: MESet.h:139
int ecaldqm::MESetTrend::findBin ( DetId const &  _id,
double  _t,
double  _y = 0. 
) const
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 115 of file MESetTrend.cc.

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

116  {
117  if(!active_) return -1;
118 
119  unsigned iME(binning::findPlotIndex(otype_, _id));
120  checkME_(iME);
121 
122  return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
123  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:116
std::vector< MonitorElement * > mes_
Definition: MESet.h:130
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:139
binning::ObjectType otype_
Definition: MESet.h:133
int ecaldqm::MESetTrend::findBin ( EcalElectronicsId const &  _id,
double  _t,
double  _y = 0. 
) const
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 126 of file MESetTrend.cc.

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

127  {
128  if(!active_) return -1;
129 
130  unsigned iME(binning::findPlotIndex(otype_, _id));
131  checkME_(iME);
132 
133  return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
134  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:116
std::vector< MonitorElement * > mes_
Definition: MESet.h:130
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:139
binning::ObjectType otype_
Definition: MESet.h:133
int ecaldqm::MESetTrend::findBin ( int  _dcctccid,
double  _t,
double  _y = 0. 
) const
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 137 of file MESetTrend.cc.

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

138  {
139  if(!active_) return -1;
140 
141  unsigned iME(binning::findPlotIndex(otype_, _dcctccid, btype_));
142  checkME_(iME);
143 
144  return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
145  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:116
std::vector< MonitorElement * > mes_
Definition: MESet.h:130
unsigned findPlotIndex(ObjectType, DetId const &)
bool active_
Definition: MESet.h:139
binning::ObjectType otype_
Definition: MESet.h:133
binning::BinningType btype_
Definition: MESet.h:134
int ecaldqm::MESetTrend::findBin ( double  _t,
double  _y = 0. 
) const

Definition at line 148 of file MESetTrend.cc.

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

149  {
150  if(!active_) return -1;
151  if(mes_.size() != 1)
152  throw_("MESet type incompatible");
153 
154  return mes_[0]->getTH1()->FindBin(_t + 0.5, _y);
155  }
std::vector< MonitorElement * > mes_
Definition: MESet.h:130
void throw_(std::string const &_message) const
Definition: MESet.h:125
bool active_
Definition: MESet.h:139
bool ecaldqm::MESetTrend::isCumulative ( ) const
inline

Definition at line 44 of file MESetTrend.h.

References currentBin_.

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

Definition at line 42 of file MESetTrend.h.

References minutely_.

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

Reimplemented from ecaldqm::MESetEcal.

Definition at line 37 of file MESetTrend.h.

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

Reimplemented from ecaldqm::MESetEcal.

Definition at line 33 of file MESetTrend.cc.

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

34  {
35  MESetTrend const* pRhs(dynamic_cast<MESetTrend const*>(&_rhs));
36  if(pRhs){
37  minutely_ = pRhs->minutely_;
38  shiftAxis_ = pRhs->shiftAxis_;
39  currentBin_ = pRhs->currentBin_;
40  }
41 
42  return MESetEcal::operator=(_rhs);
43  }
MESet & operator=(MESet const &) override
Definition: MESetEcal.cc:39
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 158 of file MESetTrend.cc.

References currentBin_, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, ecaldqm::MESet::kind_, and ecaldqm::MESet::throw_().

Referenced by ecaldqm::createMESet().

159  {
161  throw_("Cumulative flag set for a profile plot");
162  currentBin_ = 1;
163  }
MonitorElement::Kind kind_
Definition: MESet.h:135
void throw_(std::string const &_message) const
Definition: MESet.h:125
void ecaldqm::MESetTrend::setMinutely ( )
inline

Definition at line 39 of file MESetTrend.h.

References minutely_.

Referenced by ecaldqm::createMESet().

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

Definition at line 40 of file MESetTrend.h.

References shiftAxis_.

Referenced by ecaldqm::createMESet().

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

Definition at line 205 of file MESetTrend.cc.

References newFWLiteAna::bin, currentBin_, alignCSCRings::dest, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, ecaldqm::MESet::end(), python.tagInventory::entries, MonitorElement::getBinContent(), MonitorElement::getBinEntries(), MonitorElement::getBinError(), MonitorElement::getNbinsY(), MonitorElement::getTH1(), ecaldqm::MESet::kind_, ecaldqm::MESet::mes_, MonitorElement::Reset(), plotscripts::rms(), MonitorElement::setBinContent(), MonitorElement::setBinEntries(), MonitorElement::setBinError(), MonitorElement::setEntries(), shiftAxis_, mathSSE::sqrt(), dqm_diff::start, and relval_parameters_module::step.

Referenced by fill().

206  {
207  TAxis* tAxis(mes_[0]->getTH1()->GetXaxis());
208  int nbinsX(tAxis->GetNbins());
209  unsigned tLow(tAxis->GetBinLowEdge(1));
210  unsigned tHigh(tAxis->GetBinUpEdge(nbinsX));
211 
212  if(!shiftAxis_) return _t >= tLow && _t < tHigh;
213 
214  int dBin(0);
215  int unitsPerBin((tHigh - tLow) / nbinsX);
216 
217  if(_t >= tLow && _t < tHigh){
218  if(currentBin_ > 0){
219  int thisBin(tAxis->FindBin(_t + 0.5));
220  if(thisBin < currentBin_) return false;
221  else if(thisBin > currentBin_){
222  for(unsigned iME(0); iME < mes_.size(); iME++){
223  MonitorElement* me(mes_[iME]);
224  int nbinsY(me->getTH1()->GetNbinsY());
225  for(int iy(1); iy <= nbinsY; ++iy){
226  int orig(me->getTH1()->GetBin(currentBin_, iy));
227  double currentContent(me->getBinContent(orig));
228  double currentError(me->getBinError(orig));
229  for(int ix(currentBin_); ix <= thisBin; ++ix){
230  int dest(me->getTH1()->GetBin(ix, iy));
231  me->setBinContent(dest, currentContent);
232  me->setBinError(dest, currentError);
233  }
234  }
235  }
236  }
237  }
238 
239  return true;
240  }
241  else if(_t >= tHigh){
242  dBin = (_t - tHigh) / unitsPerBin + 1;
243  if(currentBin_ > 0) currentBin_ = nbinsX;
244  }
245  else if(_t < tLow){
246  if(currentBin_ > 0) return false; // no going back in time in case of cumulative history
247 
248  int maxBin(0);
249 
250  for(unsigned iME(0); iME < mes_.size(); iME++){
251  MonitorElement* me(mes_[iME]);
252 
253  bool filled(false);
254  int iMax(nbinsX + 1);
255  while(--iMax > 0 && !filled){
256  switch(kind_){
258  if(me->getBinContent(iMax) != 0) filled = true;
259  break;
261  if(me->getBinEntries(iMax) != 0) filled = true;
262  break;
264  for(int iy(1); iy <= me->getNbinsY(); iy++){
265  if(me->getBinContent(me->getTH1()->GetBin(iMax, iy)) != 0){
266  filled = true;
267  break;
268  }
269  }
270  break;
272  for(int iy(1); iy <= me->getNbinsY(); iy++){
273  if(me->getBinEntries(me->getTH1()->GetBin(iMax, iy)) != 0){
274  filled = true;
275  break;
276  }
277  }
278  break;
279  default:
280  break;
281  }
282  }
283 
284  if(iMax > maxBin) maxBin = iMax;
285  }
286 
287  if(_t < tLow - (nbinsX - maxBin) * unitsPerBin) return false;
288 
289  dBin = (_t - tLow) / unitsPerBin - 1;
290  }
291 
292  int start(dBin > 0 ? dBin + 1 : nbinsX + dBin);
293  int end(dBin > 0 ? nbinsX + 1 : 0);
294  int step(dBin > 0 ? 1 : -1);
295 
296  tLow += dBin * unitsPerBin;
297  tHigh += dBin * unitsPerBin;
298 
299  for(unsigned iME(0); iME < mes_.size(); iME++){
300  MonitorElement* me(mes_[iME]);
301 
302  me->getTH1()->GetXaxis()->SetLimits(tLow, tHigh);
303 
304  if((end - start) / step < 0){
305  me->Reset();
306  continue;
307  }
308 
309  me->setEntries(0.);
310  double entries(0.);
311 
312  switch(kind_){
314  {
315  int ix(start);
316  for(; ix != end; ix += step){
317  double binContent(me->getBinContent(ix));
318  entries += binContent;
319  me->setBinContent(ix - dBin, binContent);
320  me->setBinError(ix - dBin, me->getBinError(ix));
321  }
322  ix = end - dBin - 1 * step;
323  double lastContent(currentBin_ > 0 ? me->getBinContent(ix) : 0.);
324  double lastError(currentBin_ > 0 ? me->getBinContent(ix) : 0.);
325  for(ix += step; ix != end; ix += step){
326  me->setBinContent(ix, lastContent);
327  me->setBinError(ix, lastError);
328  }
329  }
330  break;
332  {
333  int ix(start);
334  for(; ix != end; ix += step){
335  double binEntries(me->getBinEntries(ix));
336  double binContent(me->getBinContent(ix));
337  entries += binEntries;
338  me->setBinEntries(ix - dBin, binEntries);
339  me->setBinContent(ix - dBin, binContent * binEntries);
340  if(binEntries > 0){
341  double rms(me->getBinError(ix) * std::sqrt(binEntries));
342  double sumw2((rms * rms + binContent * binContent) * binEntries);
343  me->setBinError(ix - dBin, std::sqrt(sumw2));
344  }
345  else
346  me->setBinError(ix - dBin, 0.);
347  }
348  ix = end - dBin;
349  for(; ix != end; ix += step){
350  me->setBinEntries(ix, 0.);
351  me->setBinContent(ix, 0.);
352  me->setBinError(ix, 0.);
353  }
354  }
355  break;
357  {
358  int ix(start);
359  int nbinsY(me->getNbinsY());
360  for(; ix != end; ix += step){
361  for(int iy(1); iy <= nbinsY; iy++){
362  int orig(me->getTH1()->GetBin(ix, iy));
363  int dest(me->getTH1()->GetBin(ix - dBin, iy));
364  double binContent(me->getBinContent(orig));
365  entries += binContent;
366  me->setBinContent(dest, binContent);
367  me->setBinError(dest, me->getBinError(orig));
368 
369  me->setBinContent(orig, 0.);
370  me->setBinError(orig, 0.);
371  }
372  }
373  ix = end - dBin - 1 * step;
374  std::vector<double> lastContent;
375  std::vector<double> lastError;
376  for(int iy(1); iy <= nbinsY; iy++){
377  lastContent.push_back(currentBin_ > 0 ? me->getBinContent(ix, iy) : 0.);
378  lastError.push_back(currentBin_ > 0 ? me->getBinError(ix, iy) : 0.);
379  }
380  for(ix += step; ix != end; ix += step){
381  for(int iy(1); iy <= nbinsY; iy++){
382  int bin(me->getTH1()->GetBin(ix, iy));
383  me->setBinContent(bin, lastContent[iy - 1]);
384  me->setBinError(bin, lastError[iy - 1]);
385  }
386  }
387  }
388  break;
390  {
391  int ix(start);
392  int nbinsY(me->getNbinsY());
393  for(; ix != end; ix += step){
394  for(int iy(1); iy <= nbinsY; iy++){
395  int orig(me->getTH1()->GetBin(ix, iy));
396  int dest(me->getTH1()->GetBin(ix - dBin, iy));
397  double binEntries(me->getBinEntries(orig));
398  double binContent(me->getBinContent(orig));
399  entries += binEntries;
400  me->setBinEntries(dest, binEntries);
401  me->setBinContent(dest, binContent * binEntries);
402  if(binEntries > 0){
403  double rms(me->getBinError(orig) * std::sqrt(binEntries));
404  double sumw2((rms * rms + binContent * binContent) * binEntries);
405  me->setBinError(dest, std::sqrt(sumw2));
406  }
407  else
408  me->setBinError(dest, 0.);
409  }
410  }
411  ix = end - dBin;
412  for(; ix != end; ix += step){
413  for(int iy(1); iy <= nbinsY; iy++){
414  int bin(me->getTH1()->GetBin(ix, iy));
415  me->setBinEntries(bin, 0.);
416  me->setBinContent(bin, 0.);
417  me->setBinError(bin, 0.);
418  }
419  }
420  }
421  break;
422  default:
423  break;
424  }
425 
426  me->setEntries(entries);
427  }
428 
429  return true;
430  }
MonitorElement::Kind kind_
Definition: MESet.h:135
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
std::vector< MonitorElement * > mes_
Definition: MESet.h:130
T sqrt(T t)
Definition: SSEVec.h:48
virtual const_iterator end() const
Definition: MESet.h:287

Member Data Documentation

int ecaldqm::MESetTrend::currentBin_
private

Definition at line 52 of file MESetTrend.h.

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

bool ecaldqm::MESetTrend::minutely_
private

Definition at line 50 of file MESetTrend.h.

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

bool ecaldqm::MESetTrend::shiftAxis_
private

Definition at line 51 of file MESetTrend.h.

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