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 ()
 
void fill (DetId const &, double, double _wy=1., double _w=1.)
 
void fill (unsigned, double, double _wy=1., double _w=1.)
 
void fill (double, double _wy=1., double _w=1.)
 
double getBinContent (DetId const &, int _bin=0) const
 
double getBinContent (unsigned, int _bin=0) const
 
double getBinEntries (DetId const &, int _bin=0) const
 
double getBinEntries (unsigned, int _bin=0) const
 
double getBinError (DetId const &, int _bin=0) const
 
double getBinError (unsigned, int _bin=0) const
 
bool getMinutely () const
 
time_t getTimeZero () const
 
 MESetTrend (std::string const &, MEData const &, bool _readOnly=false)
 
void setBinContent (DetId const &, double, double _err=0.)
 
void setBinContent (unsigned, double, double _err=0.)
 
void setBinEntries (DetId const &, double)
 
void setBinEntries (unsigned, double)
 
void setMinutely (bool _minutely)
 
void setTimeZero (time_t _t0)
 
 ~MESetTrend ()
 
- Public Member Functions inherited from ecaldqm::MESetEcal
std::vector< std::string > generateNames () const
 
 MESetEcal (std::string const &, MEData const &, int logicalDimensions_, bool _readOnly=false)
 
void reset (double _content=0., double _err=0., double _entries=0.)
 
bool retrieve () const
 
 ~MESetEcal ()
 
- Public Member Functions inherited from ecaldqm::MESet
virtual void clear () const
 
virtual void fill (EcalElectronicsId const &, double _wx=1., double _wy=1., double _w=1.)
 
virtual double getBinContent (EcalElectronicsId const &, int _bin=0) const
 
virtual double getBinEntries (EcalElectronicsId const &, int _bin=0) const
 
virtual double getBinError (EcalElectronicsId const &, int _bin=0) const
 
BinService::BinningType getBinType () const
 
std::string const & getDir () const
 
virtual MonitorElement const * getME (unsigned _offset) const
 
std::string const & getName () const
 
BinService::ObjectType getObjType () const
 
bool isActive () const
 
 MESet (std::string const &, MEData const &, bool _readOnly=false)
 
void name (std::map< std::string, std::string > const &) const
 
virtual void resetAll (double _content=0., double _err=0., double _entries=0.)
 
virtual void setAxisTitle (std::string const &, int _axis=1)
 
virtual void setBinContent (EcalElectronicsId const &, double, double _err=0.)
 
virtual void setBinEntries (EcalElectronicsId const &, double)
 
virtual void setBinLabel (unsigned, int, std::string const &, int _axis=1)
 
void setDir (std::string const &_dir)
 
void setName (std::string const &_name)
 
virtual ~MESet ()
 

Private Member Functions

bool shift_ (time_t)
 

Private Attributes

bool minutely_
 
time_t t0_
 
time_t tLow_
 

Additional Inherited Members

- Protected Member Functions inherited from ecaldqm::MESetEcal
virtual void fill_ (double)
 
virtual void find_ (uint32_t) const
 
- Protected Member Functions inherited from ecaldqm::MESet
virtual void fill_ (unsigned, int, double)
 
virtual void fill_ (unsigned, double, double, double)
 
virtual double getBinContent_ (unsigned, int) const
 
virtual double getBinEntries_ (unsigned, int) const
 
virtual double getBinError_ (unsigned, int) const
 
virtual void setBinContent_ (unsigned, int, double, double)
 
virtual void setBinEntries_ (unsigned, int, double)
 
- Protected Attributes inherited from ecaldqm::MESetEcal
std::pair< unsigned,
std::vector< int > > 
cache_
 
uint32_t cacheId_
 
const unsigned logicalDimensions_
 
- Protected Attributes inherited from ecaldqm::MESet
bool active_
 
MEData const * data_
 
std::string dir_
 
std::vector< MonitorElement * > mes_
 
std::string name_
 
bool readOnly_
 
- Static Protected Attributes inherited from ecaldqm::MESet
static BinService const * binService_
 
static DQMStoredqmStore_
 

Detailed Description

Definition at line 11 of file MESetTrend.h.

Constructor & Destructor Documentation

ecaldqm::MESetTrend::MESetTrend ( std::string const &  _fullpath,
MEData const &  _data,
bool  _readOnly = false 
)

Definition at line 7 of file MESetTrend.cc.

References EcalDQMBinningService::AxisSpecs::edges, edm::hlt::Exception, and ecaldqm::MEData::xaxis.

7  :
8  MESetEcal(_fullpath, _data, 1, _readOnly),
9  t0_(0),
10  minutely_(false),
11  tLow_(0)
12  {
13  if(!_data.xaxis || _data.xaxis->edges)
14  throw cms::Exception("InvalidConfiguration") << "MESetTrend";
15  }
MESetEcal(std::string const &, MEData const &, int logicalDimensions_, bool _readOnly=false)
Definition: MESetEcal.cc:12
ecaldqm::MESetTrend::~MESetTrend ( )

Definition at line 17 of file MESetTrend.cc.

18  {
19  }

Member Function Documentation

void ecaldqm::MESetTrend::book ( )
virtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 22 of file MESetTrend.cc.

References ecaldqm::MESetEcal::book(), ecaldqm::MEData::btype, edm::conversion(), ecaldqm::MESet::data_, EcalDQMBinningService::AxisSpecs::high, ecaldqm::MEData::kind, EcalDQMBinningService::AxisSpecs::low, ecaldqm::MESet::mes_, minutely_, EcalDQMBinningService::AxisSpecs::nbins, ecaldqm::MEData::otype, ecaldqm::MEData::pathName, t0_, groupFilesInBlocks::temp, tLow_, tablePrinter::width, ecaldqm::MEData::xaxis, ecaldqm::MEData::yaxis, and ecaldqm::MEData::zaxis.

23  {
24  int conversion(minutely_ ? 60 : 3600);
25  time_t width((data_->xaxis->high - data_->xaxis->low) * conversion);
26 
27  tLow_ = t0_;
28 
29  MEData const* temp(data_);
30  BinService::AxisSpecs xaxis(*temp->xaxis);
31  xaxis.low = tLow_;
32  xaxis.high = tLow_ + width;
33 
34  data_ = new MEData(temp->pathName, temp->otype, temp->btype, temp->kind, &xaxis, temp->yaxis, temp->zaxis);
35 
37 
38  delete data_;
39  data_ = temp;
40 
41  // if yaxis was variable bin size, xaxis will be booked as variable too
42 
43  for(unsigned iME(0); iME < mes_.size(); iME++){
44  TAxis* axis(mes_[iME]->getTH1()->GetXaxis());
45  if(axis->IsVariableBinSize())
46  axis->Set(data_->xaxis->nbins, data_->xaxis->low, data_->xaxis->high);
47  }
48  }
BinService::AxisSpecs * xaxis
Definition: MESet.h:25
std::vector< MonitorElement * > mes_
Definition: MESet.h:129
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
MEData const * data_
Definition: MESet.h:133
void ecaldqm::MESetTrend::fill ( DetId const &  _id,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
virtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 51 of file MESetTrend.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::binService_, ecaldqm::MESet::data_, ecaldqm::MESet::fill_(), EcalDQMBinningService::findOffset(), evf::evtn::offset(), ecaldqm::MEData::otype, and shift_().

52  {
53  if(!active_) return;
54 
55  unsigned offset(binService_->findOffset(data_->otype, _id));
56 
57  if(shift_(time_t(_t)))
58  MESet::fill_(offset, _t, _wy, _w);
59  }
BinService::ObjectType otype
Definition: MESet.h:22
unsigned findOffset(ObjectType, const DetId &) const
unsigned int offset(bool)
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:262
static BinService const * binService_
Definition: MESet.h:126
bool active_
Definition: MESet.h:135
MEData const * data_
Definition: MESet.h:133
bool shift_(time_t)
Definition: MESetTrend.cc:84
void ecaldqm::MESetTrend::fill ( unsigned  _dcctccid,
double  _t,
double  _wy = 1.,
double  _w = 1. 
)
virtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 62 of file MESetTrend.cc.

References ecaldqm::MESet::active_, ecaldqm::MESet::binService_, ecaldqm::MEData::btype, ecaldqm::MESet::data_, ecaldqm::MESet::fill_(), EcalDQMBinningService::findOffset(), evf::evtn::offset(), ecaldqm::MEData::otype, and shift_().

63  {
64  if(!active_) return;
65 
66  unsigned offset(binService_->findOffset(data_->otype, data_->btype, _dcctccid));
67 
68  if(shift_(time_t(_t)))
69  MESet::fill_(offset, _t, _wy, _w);
70  }
BinService::ObjectType otype
Definition: MESet.h:22
unsigned findOffset(ObjectType, const DetId &) const
BinService::BinningType btype
Definition: MESet.h:23
unsigned int offset(bool)
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:262
static BinService const * binService_
Definition: MESet.h:126
bool active_
Definition: MESet.h:135
MEData const * data_
Definition: MESet.h:133
bool shift_(time_t)
Definition: MESetTrend.cc:84
void ecaldqm::MESetTrend::fill ( double  _t,
double  _wy = 1.,
double  _w = 1. 
)
virtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 73 of file MESetTrend.cc.

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

74  {
75  if(!active_) return;
76  if(mes_.size() != 1)
77  throw cms::Exception("InvalidCall") << "MESet type incompatible" << std::endl;
78 
79  if(shift_(time_t(_t)))
80  MESet::fill_(0, _t, _wy, _w);
81  }
std::vector< MonitorElement * > mes_
Definition: MESet.h:129
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:262
bool active_
Definition: MESet.h:135
bool shift_(time_t)
Definition: MESetTrend.cc:84
double ecaldqm::MESetTrend::getBinContent ( DetId const &  ,
int  _bin = 0 
) const
inlinevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 29 of file MESetTrend.h.

29 { return 0.; }
double ecaldqm::MESetTrend::getBinContent ( unsigned  ,
int  _bin = 0 
) const
inlinevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 30 of file MESetTrend.h.

30 { return 0.; }
double ecaldqm::MESetTrend::getBinEntries ( DetId const &  ,
int  _bin = 0 
) const
inlinevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 35 of file MESetTrend.h.

35 { return 0.; }
double ecaldqm::MESetTrend::getBinEntries ( unsigned  ,
int  _bin = 0 
) const
inlinevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 36 of file MESetTrend.h.

36 { return 0.; }
double ecaldqm::MESetTrend::getBinError ( DetId const &  ,
int  _bin = 0 
) const
inlinevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 32 of file MESetTrend.h.

32 { return 0.; }
double ecaldqm::MESetTrend::getBinError ( unsigned  ,
int  _bin = 0 
) const
inlinevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 33 of file MESetTrend.h.

33 { return 0.; }
bool ecaldqm::MESetTrend::getMinutely ( ) const
inline

Definition at line 41 of file MESetTrend.h.

References minutely_.

41 { return minutely_; }
time_t ecaldqm::MESetTrend::getTimeZero ( ) const
inline

Definition at line 39 of file MESetTrend.h.

References t0_.

39 { return t0_; }
void ecaldqm::MESetTrend::setBinContent ( DetId const &  ,
double  ,
double  _err = 0. 
)
inlinevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 23 of file MESetTrend.h.

23 {}
void ecaldqm::MESetTrend::setBinContent ( unsigned  ,
double  ,
double  _err = 0. 
)
inlinevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 24 of file MESetTrend.h.

24 {}
void ecaldqm::MESetTrend::setBinEntries ( DetId const &  ,
double   
)
inlinevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 26 of file MESetTrend.h.

26 {}
void ecaldqm::MESetTrend::setBinEntries ( unsigned  ,
double   
)
inlinevirtual

Reimplemented from ecaldqm::MESetEcal.

Definition at line 27 of file MESetTrend.h.

27 {}
void ecaldqm::MESetTrend::setMinutely ( bool  _minutely)
inline

Definition at line 40 of file MESetTrend.h.

References minutely_.

40 { minutely_ = _minutely; }
void ecaldqm::MESetTrend::setTimeZero ( time_t  _t0)
inline

Definition at line 38 of file MESetTrend.h.

References t0_.

38 { t0_ = _t0; }
bool ecaldqm::MESetTrend::shift_ ( time_t  _t)
private

Definition at line 84 of file MESetTrend.cc.

References edm::conversion(), ecaldqm::MESet::data_, alignCSCRings::dest, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TPROFILE, end, python.tagInventory::entries, MonitorElement::getBinContent(), MonitorElement::getBinEntries(), MonitorElement::getBinError(), MonitorElement::getNbinsY(), MonitorElement::getTH1(), EcalDQMBinningService::AxisSpecs::high, ecaldqm::MEData::kind, EcalDQMBinningService::AxisSpecs::low, ecaldqm::MESet::mes_, minutely_, EcalDQMBinningService::AxisSpecs::nbins, plotscripts::rms(), MonitorElement::setBinContent(), MonitorElement::setBinEntries(), MonitorElement::setBinError(), MonitorElement::setEntries(), mathSSE::sqrt(), errorMatrix2Lands_multiChannel::start, launcher::step, tLow_, tablePrinter::width, and ecaldqm::MEData::xaxis.

Referenced by fill().

85  {
86  int conversion(minutely_ ? 60 : 3600);
87  time_t width((data_->xaxis->high - data_->xaxis->low) * conversion);
88 
89  time_t tHigh(tLow_ + width);
90  int nbinsX(data_->xaxis->nbins);
92 
93  int dtPerBin(width / nbinsX);
94  int dBin(0);
95 
96  if(_t >= tLow_ && _t < tHigh)
97  return true;
98  else if(_t >= tHigh)
99  dBin = (_t - tHigh) / dtPerBin + 1;
100  else if(_t < tLow_){
101  int maxBin(0);
102 
103  for(unsigned iME(0); iME < mes_.size(); iME++){
104  MonitorElement* me(mes_[iME]);
105 
106  bool filled(false);
107  int iMax(nbinsX + 1);
108  while(--iMax > 0 && !filled){
109  switch(kind){
111  if(me->getBinContent(iMax) != 0) filled = true;
112  break;
114  if(me->getBinEntries(iMax) != 0) filled = true;
115  break;
117  for(int iy(1); iy <= me->getNbinsY(); iy++)
118  if(me->getBinContent(iMax, iy) != 0) filled = true;
119  break;
120  default:
121  return false;
122  }
123  }
124 
125  if(iMax > maxBin) maxBin = iMax;
126  }
127 
128  if(_t < tLow_ - (nbinsX - maxBin) * dtPerBin) return false;
129 
130  dBin = (_t - dtPerBin - tLow_) / dtPerBin;
131  }
132 
133  int start(dBin > 0 ? dBin + 1 : nbinsX + dBin);
134  int end(dBin > 0 ? nbinsX + 1 : 0);
135  int step(dBin > 0 ? 1 : -1);
136 
137  tLow_ += dBin * dtPerBin;
138  tHigh += dBin * dtPerBin;
139 
140  for(unsigned iME(0); iME < mes_.size(); iME++){
141  MonitorElement* me(mes_[iME]);
142 
143  me->setEntries(0.);
144 
145  double entries(0.);
146 
147  for(int ix(start); (dBin > 0 ? (ix < end) : (ix > end)); ix += step){
148  switch(kind){
150  entries += me->getBinContent(ix);
151  me->setBinContent(ix - dBin, me->getBinContent(ix));
152  me->setBinError(ix - dBin, me->getBinError(ix));
153  me->setBinContent(ix, 0.);
154  me->setBinError(ix, 0.);
155  break;
157  entries += me->getBinEntries(ix);
158  me->setBinEntries(ix - dBin, me->getBinEntries(ix));
159  me->setBinContent(ix - dBin, me->getBinContent(ix) * me->getBinEntries(ix));
160  if(me->getBinEntries(ix) > 0){
161  double rms(me->getBinError(ix) * std::sqrt(me->getBinEntries(ix)));
162  double sumw2((rms * rms + me->getBinContent(ix) * me->getBinContent(ix)) * me->getBinEntries(ix));
163  me->setBinError(ix - dBin, std::sqrt(sumw2));
164  }
165  me->setBinEntries(ix, 0.);
166  me->setBinContent(ix, 0.);
167  me->setBinError(ix, 0.);
168  break;
170  for(int iy(1); iy <= me->getNbinsY(); iy++){
171  int orig(me->getTH1()->GetBin(ix, iy));
172  int dest(me->getTH1()->GetBin(ix - dBin, iy));
173  entries += me->getBinContent(orig);
174  me->setBinContent(dest, me->getBinContent(orig));
175  me->setBinError(dest, me->getBinError(orig));
176  me->setBinContent(orig, 0.);
177  me->setBinError(orig, 0.);
178  }
179  break;
180  default:
181  break;
182  }
183  }
184 
185  me->setEntries(entries);
186  me->getTH1()->GetXaxis()->SetLimits(tLow_, tHigh);
187  }
188 
189  return true;
190  }
list step
Definition: launcher.py:15
MonitorElement::Kind kind
Definition: MESet.h:24
BinService::AxisSpecs * xaxis
Definition: MESet.h:25
std::vector< MonitorElement * > mes_
Definition: MESet.h:129
T sqrt(T t)
Definition: SSEVec.h:46
#define end
Definition: vmac.h:38
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
MEData const * data_
Definition: MESet.h:133

Member Data Documentation

bool ecaldqm::MESetTrend::minutely_
private

Definition at line 47 of file MESetTrend.h.

Referenced by book(), getMinutely(), setMinutely(), and shift_().

time_t ecaldqm::MESetTrend::t0_
private

Definition at line 46 of file MESetTrend.h.

Referenced by book(), getTimeZero(), and setTimeZero().

time_t ecaldqm::MESetTrend::tLow_
private

Definition at line 49 of file MESetTrend.h.

Referenced by book(), and shift_().