CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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::IBooker &, EcalElectronicsMapping const *) override
 
bool canShiftAxis () const
 
MESetclone (std::string const &="") const override
 
void fill (EcalDQMSetupObjects const, DetId const &, double, double=1., double=1.) override
 
void fill (EcalDQMSetupObjects const, EcalElectronicsId const &, double, double=1., double=1.) override
 
void fill (EcalDQMSetupObjects const, int, double, double=1., double=1.) override
 
void fill (EcalDQMSetupObjects const, double, double=1., double=1.) override
 
int findBin (EcalDQMSetupObjects const, DetId const &, double, double=0.) const override
 
int findBin (EcalDQMSetupObjects const, EcalElectronicsId const &, double, double=0.) const override
 
int findBin (EcalDQMSetupObjects const, int, double, double=0.) const override
 
int findBin (EcalDQMSetupObjects const, 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 *=nullptr, binning::AxisSpecs const *=nullptr)
 
 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 (EcalElectronicsMapping const *) const
 
double getBinContent (EcalDQMSetupObjects const, DetId const &, int) const override
 
double getBinContent (EcalDQMSetupObjects const, EcalElectronicsId const &, int) const override
 
double getBinContent (EcalDQMSetupObjects const, int, int) const override
 
double getBinEntries (EcalDQMSetupObjects const, DetId const &, int) const override
 
double getBinEntries (EcalDQMSetupObjects const, EcalElectronicsId const &, int) const override
 
double getBinEntries (EcalDQMSetupObjects const, int, int) const override
 
double getBinError (EcalDQMSetupObjects const, DetId const &, int) const override
 
double getBinError (EcalDQMSetupObjects const, EcalElectronicsId const &, int) const override
 
double getBinError (EcalDQMSetupObjects const, int, int) const override
 
 MESetEcal (std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind, unsigned, binning::AxisSpecs const *=nullptr, binning::AxisSpecs const *=nullptr, binning::AxisSpecs const *=nullptr)
 
 MESetEcal (MESetEcal const &)
 
bool retrieve (EcalElectronicsMapping const *, DQMStore::IGetter &, std::string *=nullptr) const override
 
void setBinContent (EcalDQMSetupObjects const, DetId const &, int, double) override
 
void setBinContent (EcalDQMSetupObjects const, EcalElectronicsId const &, int, double) override
 
void setBinContent (EcalDQMSetupObjects const, int, int, double) override
 
void setBinEntries (EcalDQMSetupObjects const, DetId const &, int, double) override
 
void setBinEntries (EcalDQMSetupObjects const, EcalElectronicsId const &, int, double) override
 
void setBinEntries (EcalDQMSetupObjects const, int, int, double) override
 
void setBinError (EcalDQMSetupObjects const, DetId const &, int, double) override
 
void setBinError (EcalDQMSetupObjects const, EcalElectronicsId const &, int, double) override
 
void setBinError (EcalDQMSetupObjects const, int, int, double) override
 
 ~MESetEcal () override
 
- Public Member Functions inherited from ecaldqm::MESet
virtual const_iterator begin (EcalElectronicsMapping const *electronicsMap) const
 
virtual iterator begin (EcalElectronicsMapping const *electronicsMap)
 
virtual const_iterator beginChannel (EcalElectronicsMapping const *electronicsMap) const
 
virtual iterator beginChannel (EcalElectronicsMapping const *electronicsMap)
 
virtual void clear () const
 
virtual const_iterator end (EcalElectronicsMapping const *electronicsMap) const
 
virtual iterator end (EcalElectronicsMapping const *electronicsMap)
 
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 *, EcalTrigTowerConstituentsMap const *) const
 
 MESet ()
 
 MESet (std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind)
 
 MESet (MESet const &)
 
virtual void reset (EcalElectronicsMapping const *, 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 (EcalDQMSetupObjects const, DetId const &, double)
 
virtual void setBinContent (EcalDQMSetupObjects const, EcalElectronicsId const &, double)
 
virtual void setBinContent (EcalDQMSetupObjects const, int, double)
 
virtual void setBinEntries (EcalDQMSetupObjects const, DetId const &, double)
 
virtual void setBinEntries (EcalDQMSetupObjects const, EcalElectronicsId const &, double)
 
virtual void setBinEntries (EcalDQMSetupObjects const, int, double)
 
virtual void setBinError (EcalDQMSetupObjects const, DetId const &, double)
 
virtual void setBinError (EcalDQMSetupObjects const, EcalElectronicsId const &, double)
 
virtual void setBinError (EcalDQMSetupObjects const, 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 = nullptr,
binning::AxisSpecs const *  _yaxis = nullptr 
)

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:156
MESetEcal(std::string const &, binning::ObjectType, binning::BinningType, MonitorElement::Kind, unsigned, binning::AxisSpecs const *=nullptr, binning::AxisSpecs const *=nullptr, binning::AxisSpecs const *=nullptr)
Definition: MESetEcal.cc:10
void throw_(std::string const &_message) const
Definition: MESet.h:149
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 *=nullptr, binning::AxisSpecs const *=nullptr, binning::AxisSpecs const *=nullptr)
Definition: MESetEcal.cc:10
ecaldqm::MESetTrend::~MESetTrend ( )
inlineoverride

Definition at line 21 of file MESetTrend.h.

21 {}

Member Function Documentation

void ecaldqm::MESetTrend::book ( DQMStore::IBooker _ibooker,
EcalElectronicsMapping const *  electronicsMap 
)
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(), and ecaldqm::MESetEcal::xaxis_.

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, electronicsMap);
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
void book(DQMStore::IBooker &, EcalElectronicsMapping const *) override
Definition: MESetEcal.cc:70
binning::AxisSpecs const * xaxis_
Definition: MESetEcal.h:74
std::vector< MonitorElement * > mes_
Definition: MESet.h:151
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(), fed_dqm_sourceclient-live_cfg::path, ecaldqm::MESet::path_, and AlCaHLTBitMon_QueryRunRegistry::string.

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 *=nullptr, binning::AxisSpecs const *=nullptr)
Definition: MESetTrend.cc:7
std::string path_
Definition: MESet.h:153
void ecaldqm::MESetTrend::fill ( EcalDQMSetupObjects const  edso,
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::EcalDQMSetupObjects::electronicsMap, ecaldqm::MESet::fill_(), ecaldqm::binning::findPlotIndex(), ecaldqm::MESet::otype_, and shift_().

90  {
91  if (!active_)
92  return;
93 
94  unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _id));
95  checkME_(iME);
96 
97  if (shift_(unsigned(_t)))
98  fill_(iME, _t + 0.5, _wy, _w);
99  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:141
bool shift_(unsigned)
Definition: MESetTrend.cc:186
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:252
unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, DetId const &)
bool active_
Definition: MESet.h:161
binning::ObjectType otype_
Definition: MESet.h:154
void ecaldqm::MESetTrend::fill ( EcalDQMSetupObjects const  edso,
EcalElectronicsId const &  _id,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 101 of file MESetTrend.cc.

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

105  {
106  if (!active_)
107  return;
108 
109  unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _id));
110  checkME_(iME);
111 
112  if (shift_(unsigned(_t)))
113  fill_(iME, _t + 0.5, _wy, _w);
114  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:141
bool shift_(unsigned)
Definition: MESetTrend.cc:186
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:252
unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, DetId const &)
bool active_
Definition: MESet.h:161
binning::ObjectType otype_
Definition: MESet.h:154
void ecaldqm::MESetTrend::fill ( EcalDQMSetupObjects const  edso,
int  _dcctccid,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 116 of file MESetTrend.cc.

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

117  {
118  if (!active_)
119  return;
120 
121  unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _dcctccid, btype_));
122  checkME_(iME);
123 
124  if (shift_(unsigned(_t)))
125  fill_(iME, _t + 0.5, _wy, _w);
126  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:141
bool shift_(unsigned)
Definition: MESetTrend.cc:186
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:252
unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, DetId const &)
bool active_
Definition: MESet.h:161
binning::ObjectType otype_
Definition: MESet.h:154
binning::BinningType btype_
Definition: MESet.h:155
void ecaldqm::MESetTrend::fill ( EcalDQMSetupObjects const  edso,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 128 of file MESetTrend.cc.

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

128  {
129  if (!active_)
130  return;
131  if (mes_.size() != 1)
132  throw_("MESet type incompatible");
133 
134  if (shift_(unsigned(_t)))
135  fill_(0, _t + 0.5, _wy, _w);
136  }
bool shift_(unsigned)
Definition: MESetTrend.cc:186
void throw_(std::string const &_message) const
Definition: MESet.h:149
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:252
bool active_
Definition: MESet.h:161
std::vector< MonitorElement * > mes_
Definition: MESet.h:151
int ecaldqm::MESetTrend::findBin ( EcalDQMSetupObjects const  edso,
DetId const &  _id,
double  _t,
double  _y = 0. 
) const
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 138 of file MESetTrend.cc.

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

138  {
139  if (!active_)
140  return -1;
141 
142  unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _id));
143  checkME_(iME);
144 
145  return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
146  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:141
unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, DetId const &)
bool active_
Definition: MESet.h:161
binning::ObjectType otype_
Definition: MESet.h:154
std::vector< MonitorElement * > mes_
Definition: MESet.h:151
int ecaldqm::MESetTrend::findBin ( EcalDQMSetupObjects const  edso,
EcalElectronicsId const &  _id,
double  _t,
double  _y = 0. 
) const
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 148 of file MESetTrend.cc.

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

151  {
152  if (!active_)
153  return -1;
154 
155  unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _id));
156  checkME_(iME);
157 
158  return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
159  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:141
unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, DetId const &)
bool active_
Definition: MESet.h:161
binning::ObjectType otype_
Definition: MESet.h:154
std::vector< MonitorElement * > mes_
Definition: MESet.h:151
int ecaldqm::MESetTrend::findBin ( EcalDQMSetupObjects const  edso,
int  _dcctccid,
double  _t,
double  _y = 0. 
) const
overridevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 161 of file MESetTrend.cc.

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

161  {
162  if (!active_)
163  return -1;
164 
165  unsigned iME(binning::findPlotIndex(edso.electronicsMap, otype_, _dcctccid, btype_));
166  checkME_(iME);
167 
168  return mes_[iME]->getTH1()->FindBin(_t + 0.5, _y);
169  }
virtual void checkME_(unsigned _iME) const
Definition: MESet.h:141
unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, DetId const &)
bool active_
Definition: MESet.h:161
binning::ObjectType otype_
Definition: MESet.h:154
binning::BinningType btype_
Definition: MESet.h:155
std::vector< MonitorElement * > mes_
Definition: MESet.h:151
int ecaldqm::MESetTrend::findBin ( EcalDQMSetupObjects const  edso,
double  _t,
double  _y = 0. 
) const

Definition at line 171 of file MESetTrend.cc.

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

171  {
172  if (!active_)
173  return -1;
174  if (mes_.size() != 1)
175  throw_("MESet type incompatible");
176 
177  return mes_[0]->getTH1()->FindBin(_t + 0.5, _y);
178  }
void throw_(std::string const &_message) const
Definition: MESet.h:149
bool active_
Definition: MESet.h:161
std::vector< MonitorElement * > mes_
Definition: MESet.h:151
bool ecaldqm::MESetTrend::isCumulative ( ) const
inline

Definition at line 46 of file MESetTrend.h.

References currentBin_.

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_.

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 *=nullptr, binning::AxisSpecs const *=nullptr)
Definition: MESetTrend.cc:7
void ecaldqm::MESetTrend::setCumulative ( )

Definition at line 180 of file MESetTrend.cc.

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

Referenced by ecaldqm::createMESet().

180  {
182  throw_("Cumulative flag set for a profile plot");
183  currentBin_ = 1;
184  }
MonitorElement::Kind kind_
Definition: MESet.h:156
void throw_(std::string const &_message) const
Definition: MESet.h:149
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 shiftAxis_.

Referenced by ecaldqm::createMESet().

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

Definition at line 186 of file MESetTrend.cc.

References newFWLiteAna::bin, currentBin_, alignCSCRings::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_, cms::cuda::allocator::maxBin, hlt_dqm_clientPB-live_cfg::me, ecaldqm::MESet::mes_, 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().

186  {
187  TAxis *tAxis(mes_[0]->getTH1()->GetXaxis());
188  int nbinsX(tAxis->GetNbins());
189  unsigned tLow(tAxis->GetBinLowEdge(1));
190  unsigned tHigh(tAxis->GetBinUpEdge(nbinsX));
191 
192  if (!shiftAxis_)
193  return _t >= tLow && _t < tHigh;
194 
195  int dBin(0);
196  int unitsPerBin((tHigh - tLow) / nbinsX);
197 
198  if (_t >= tLow && _t < tHigh) {
199  if (currentBin_ > 0) {
200  int thisBin(tAxis->FindBin(_t + 0.5));
201  if (thisBin < currentBin_)
202  return false;
203  else if (thisBin > currentBin_) {
204  for (unsigned iME(0); iME < mes_.size(); iME++) {
205  MonitorElement *me(mes_[iME]);
206  int nbinsY(me->getTH1()->GetNbinsY());
207  for (int iy(1); iy <= nbinsY; ++iy) {
208  int orig(me->getTH1()->GetBin(currentBin_, iy));
209  double currentContent(me->getBinContent(orig));
210  double currentError(me->getBinError(orig));
211  for (int ix(currentBin_); ix <= thisBin; ++ix) {
212  int dest(me->getTH1()->GetBin(ix, iy));
213  me->setBinContent(dest, currentContent);
214  me->setBinError(dest, currentError);
215  }
216  }
217  }
218  }
219  }
220 
221  return true;
222  } else if (_t >= tHigh) {
223  dBin = (_t - tHigh) / unitsPerBin + 1;
224  if (currentBin_ > 0)
225  currentBin_ = nbinsX;
226  } else if (_t < tLow) {
227  if (currentBin_ > 0)
228  return false; // no going back in time in case of cumulative history
229 
230  int maxBin(0);
231 
232  for (unsigned iME(0); iME < mes_.size(); iME++) {
233  MonitorElement *me(mes_[iME]);
234 
235  bool filled(false);
236  int iMax(nbinsX + 1);
237  while (--iMax > 0 && !filled) {
238  switch (kind_) {
240  if (me->getBinContent(iMax) != 0)
241  filled = true;
242  break;
244  if (me->getBinEntries(iMax) != 0)
245  filled = true;
246  break;
248  for (int iy(1); iy <= me->getNbinsY(); iy++) {
249  if (me->getBinContent(me->getTH1()->GetBin(iMax, iy)) != 0) {
250  filled = true;
251  break;
252  }
253  }
254  break;
256  for (int iy(1); iy <= me->getNbinsY(); iy++) {
257  if (me->getBinEntries(me->getTH1()->GetBin(iMax, iy)) != 0) {
258  filled = true;
259  break;
260  }
261  }
262  break;
263  default:
264  break;
265  }
266  }
267 
268  if (iMax > maxBin)
269  maxBin = iMax;
270  }
271 
272  if (_t < tLow - (nbinsX - maxBin) * unitsPerBin)
273  return false;
274 
275  dBin = (_t - tLow) / unitsPerBin - 1;
276  }
277 
278  int start(dBin > 0 ? dBin + 1 : nbinsX + dBin);
279  int end(dBin > 0 ? nbinsX + 1 : 0);
280  int step(dBin > 0 ? 1 : -1);
281 
282  tLow += dBin * unitsPerBin;
283  tHigh += dBin * unitsPerBin;
284 
285  for (unsigned iME(0); iME < mes_.size(); iME++) {
286  MonitorElement *me(mes_[iME]);
287 
288  me->getTH1()->GetXaxis()->SetLimits(tLow, tHigh);
289 
290  if ((end - start) / step < 0) {
291  me->Reset();
292  continue;
293  }
294 
295  me->setEntries(0.);
296  double entries(0.);
297 
298  switch (kind_) {
300  int ix(start);
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));
306  }
307  ix = end - dBin - 1 * step;
308  double lastContent(currentBin_ > 0 ? me->getBinContent(ix) : 0.);
309  double lastError(currentBin_ > 0 ? me->getBinContent(ix) : 0.);
310  for (ix += step; ix != end; ix += step) {
311  me->setBinContent(ix, lastContent);
312  me->setBinError(ix, lastError);
313  }
314  } break;
316  int ix(start);
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) {
324  double rms(me->getBinError(ix) * std::sqrt(binEntries));
325  double sumw2((rms * rms + binContent * binContent) * binEntries);
326  me->setBinError(ix - dBin, std::sqrt(sumw2));
327  } else
328  me->setBinError(ix - dBin, 0.);
329  }
330  ix = end - dBin;
331  for (; ix != end; ix += step) {
332  me->setBinEntries(ix, 0.);
333  me->setBinContent(ix, 0.);
334  me->setBinError(ix, 0.);
335  }
336  } break;
338  int ix(start);
339  int nbinsY(me->getNbinsY());
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));
348 
349  me->setBinContent(orig, 0.);
350  me->setBinError(orig, 0.);
351  }
352  }
353  ix = end - dBin - 1 * step;
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.);
359  }
360  for (ix += step; ix != end; ix += step) {
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]);
365  }
366  }
367  } break;
369  int ix(start);
370  int nbinsY(me->getNbinsY());
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) {
381  double rms(me->getBinError(orig) * std::sqrt(binEntries));
382  double sumw2((rms * rms + binContent * binContent) * binEntries);
383  me->setBinError(dest, std::sqrt(sumw2));
384  } else
385  me->setBinError(dest, 0.);
386  }
387  }
388  ix = end - dBin;
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.);
395  }
396  }
397  } break;
398  default:
399  break;
400  }
401 
402  me->setEntries(entries);
403  }
404 
405  return true;
406  }
MonitorElement::Kind kind_
Definition: MESet.h:156
constexpr unsigned int maxBin
T sqrt(T t)
Definition: SSEVec.h:19
step
Definition: StallMonitor.cc:94
virtual const_iterator end(EcalElectronicsMapping const *electronicsMap) const
Definition: MESet.h:354
std::vector< MonitorElement * > mes_
Definition: MESet.h:151

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_().