CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MESet.h
Go to the documentation of this file.
1 #ifndef MESet_H
2 #define MESet_H
3 
4 #include <string>
5 #include <vector>
6 
9 
11 
13 
15 
16 typedef EcalDQMBinningService BinService; // prepare for expansion into more than one binning service
17 
18 namespace ecaldqm
19 {
20  struct MEData {
28  MEData() :
29  pathName(""), otype(BinService::nObjType), btype(BinService::nBinType), kind(MonitorElement::DQM_KIND_INVALID),
30  xaxis(0), yaxis(0), zaxis(0)
31  {}
33  BinService::AxisSpecs const* _xaxis = 0, BinService::AxisSpecs const* _yaxis = 0, BinService::AxisSpecs const* _zaxis = 0) :
34  pathName(_pathName), otype(_otype), btype(_btype), kind(_kind),
35  xaxis(_xaxis ? new BinService::AxisSpecs(*_xaxis) : 0),
36  yaxis(_yaxis ? new BinService::AxisSpecs(*_yaxis) : 0),
37  zaxis(_zaxis ? new BinService::AxisSpecs(*_zaxis) : 0)
38  {}
39  MEData(MEData const& _orig) :
40  pathName(_orig.pathName), otype(_orig.otype), btype(_orig.btype), kind(_orig.kind),
41  xaxis(_orig.xaxis ? new BinService::AxisSpecs(*_orig.xaxis) : 0),
42  yaxis(_orig.yaxis ? new BinService::AxisSpecs(*_orig.yaxis) : 0),
43  zaxis(_orig.zaxis ? new BinService::AxisSpecs(*_orig.zaxis) : 0)
44  {}
46  {
47  delete xaxis;
48  delete yaxis;
49  delete zaxis;
50  }
51 
52  MEData& operator=(MEData const& _rhs)
53  {
54  pathName = _rhs.pathName;
55  otype = _rhs.otype;
56  btype = _rhs.btype;
57  kind = _rhs.kind;
58  xaxis = _rhs.xaxis ? new BinService::AxisSpecs(*_rhs.xaxis) : 0;
59  yaxis = _rhs.yaxis ? new BinService::AxisSpecs(*_rhs.yaxis) : 0;
60  zaxis = _rhs.zaxis ? new BinService::AxisSpecs(*_rhs.zaxis) : 0;
61  return *this;
62  }
63  };
64 
65  class MESet {
66  public :
67  MESet(std::string const&, MEData const&, bool _readOnly = false);
68  virtual ~MESet();
69 
70  virtual void book();
71  virtual bool retrieve() const;
72  virtual void clear() const;
73 
74  // default values are necessary (otherwise fill(DetId) will be interpreted as fill(uint32_t)!!)
75  virtual void fill(DetId const&, double _wx = 1., double _wy = 1., double _w = 1.);
76  virtual void fill(EcalElectronicsId const&, double _wx = 1., double _wy = 1., double _w = 1.);
77  virtual void fill(unsigned, double _wx = 1., double _wy = 1., double _w = 1.);
78  virtual void fill(double, double _wy = 1., double _w = 1.);
79 
80  virtual void setBinContent(DetId const&, double, double _err = 0.);
81  virtual void setBinContent(EcalElectronicsId const&, double, double _err = 0.);
82  virtual void setBinContent(unsigned, double, double _err = 0.);
83 
84  virtual void setBinEntries(DetId const&, double);
85  virtual void setBinEntries(EcalElectronicsId const&, double);
86  virtual void setBinEntries(unsigned, double);
87 
88  virtual double getBinContent(DetId const&, int _bin = 0) const;
89  virtual double getBinContent(EcalElectronicsId const&, int _bin = 0) const;
90  virtual double getBinContent(unsigned, int _bin = 0) const;
91 
92  virtual double getBinError(DetId const&, int _bin = 0) const;
93  virtual double getBinError(EcalElectronicsId const&, int _bin = 0) const;
94  virtual double getBinError(unsigned, int _bin = 0) const;
95 
96  virtual double getBinEntries(DetId const&, int _bin = 0) const;
97  virtual double getBinEntries(EcalElectronicsId const&, int _bin = 0) const;
98  virtual double getBinEntries(unsigned, int _bin = 0) const;
99 
100  virtual void setAxisTitle(std::string const&, int _axis = 1);
101  virtual void setBinLabel(unsigned, int, std::string const&, int _axis = 1);
102 
103  virtual void reset(double _content = 0., double _err = 0., double _entries = 0.);
104  virtual void resetAll(double _content = 0., double _err = 0., double _entries = 0.);
105 
106  std::string const& getDir() const { return dir_; }
107  void setDir(std::string const& _dir) { dir_ = _dir; }
108  std::string const& getName() const { return name_; }
109  void setName(std::string const& _name) { name_ = _name; }
110  void name(std::map<std::string, std::string> const&) const;
113  bool isActive() const { return active_; }
114 
115  virtual MonitorElement const* getME(unsigned _offset) const { return (_offset < mes_.size() ? mes_[_offset] : 0); }
116 
117  protected:
118  virtual void fill_(unsigned, int, double);
119  virtual void fill_(unsigned, double, double, double);
120  virtual void setBinContent_(unsigned, int, double, double);
121  virtual void setBinEntries_(unsigned, int, double);
122  virtual double getBinContent_(unsigned, int) const;
123  virtual double getBinError_(unsigned, int) const;
124  virtual double getBinEntries_(unsigned, int) const;
125 
126  static BinService const* binService_;
128 
129  mutable std::vector<MonitorElement*> mes_;
130 
131  mutable std::string dir_;
133  MEData const* data_;
134 
135  mutable bool active_;
136  bool readOnly_;
137  };
138 
139 }
140 
141 #endif
void setName(std::string const &_name)
Definition: MESet.h:109
BinService::ObjectType otype
Definition: MESet.h:22
bool readOnly_
Definition: MESet.h:136
MEData & operator=(MEData const &_rhs)
Definition: MESet.h:52
virtual void reset(double _content=0., double _err=0., double _entries=0.)
Definition: MESet.cc:87
std::string pathName
Definition: MESet.h:21
virtual void clear() const
Definition: MESet.cc:59
std::string const & getName() const
Definition: MESet.h:108
BinService::AxisSpecs * yaxis
Definition: MESet.h:26
virtual void book()
Definition: MESet.cc:46
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::string const & getDir() const
Definition: MESet.h:106
MonitorElement::Kind kind
Definition: MESet.h:24
virtual MonitorElement const * getME(unsigned _offset) const
Definition: MESet.h:115
BinService::BinningType getBinType() const
Definition: MESet.h:112
virtual ~MESet()
Definition: MESet.cc:41
BinService::AxisSpecs * xaxis
Definition: MESet.h:25
virtual void setBinContent(DetId const &, double, double _err=0.)
Definition: MESet.cc:154
virtual double getBinContent(DetId const &, int _bin=0) const
Definition: MESet.cc:186
std::vector< MonitorElement * > mes_
Definition: MESet.h:129
virtual void setBinEntries(DetId const &, double)
Definition: MESet.cc:170
EcalDQMBinningService BinService
Definition: MESet.h:16
virtual bool retrieve() const
Definition: MESet.cc:53
MEData(MEData const &_orig)
Definition: MESet.h:39
static DQMStore * dqmStore_
Definition: MESet.h:127
std::string dir_
Definition: MESet.h:131
BinService::BinningType btype
Definition: MESet.h:23
virtual void setBinEntries_(unsigned, int, double)
Definition: MESet.cc:313
virtual void setBinContent_(unsigned, int, double, double)
Definition: MESet.cc:294
std::string name_
Definition: MESet.h:132
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:262
virtual void setBinLabel(unsigned, int, std::string const &, int _axis=1)
Definition: MESet.cc:73
void setDir(std::string const &_dir)
Definition: MESet.h:107
Definition: DetId.h:18
MESet(std::string const &, MEData const &, bool _readOnly=false)
Definition: MESet.cc:16
bool isActive() const
Definition: MESet.h:113
virtual double getBinContent_(unsigned, int) const
Definition: MESet.cc:330
virtual double getBinError_(unsigned, int) const
Definition: MESet.cc:346
static BinService const * binService_
Definition: MESet.h:126
BinService::AxisSpecs * zaxis
Definition: MESet.h:27
bool active_
Definition: MESet.h:135
virtual void setAxisTitle(std::string const &, int _axis=1)
Definition: MESet.cc:66
virtual void fill(DetId const &, double _wx=1., double _wy=1., double _w=1.)
Definition: MESet.cc:133
BinService::ObjectType getObjType() const
Definition: MESet.h:111
MEData const * data_
Definition: MESet.h:133
virtual double getBinError(DetId const &, int _bin=0) const
Definition: MESet.cc:204
virtual double getBinEntries_(unsigned, int) const
Definition: MESet.cc:362
MEData(std::string const &_pathName, BinService::ObjectType _otype, BinService::BinningType _btype, MonitorElement::Kind _kind, BinService::AxisSpecs const *_xaxis=0, BinService::AxisSpecs const *_yaxis=0, BinService::AxisSpecs const *_zaxis=0)
Definition: MESet.h:32
virtual void resetAll(double _content=0., double _err=0., double _entries=0.)
Definition: MESet.cc:93
void name(std::map< std::string, std::string > const &) const
Definition: MESet.cc:240
virtual double getBinEntries(DetId const &, int _bin=0) const
Definition: MESet.cc:222