CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MESetNonObject.cc
Go to the documentation of this file.
2 
4 
5 namespace ecaldqm
6 {
7  MESetNonObject::MESetNonObject(std::string const& _fullpath, MEData const& _data, bool _readOnly/* = false*/) :
8  MESet(_fullpath, _data, _readOnly)
9  {
10  }
11 
12  void
14  {
16 
17  mes_.clear();
18 
19  MonitorElement* me(0);
20 
24 
25  switch(data_->kind) {
27  me = dqmStore_->bookFloat(name_);
28  break;
29 
31  {
32  if(!xaxis)
33  throw cms::Exception("InvalidCall") << "No xaxis found for MESetNonObject" << std::endl;
34 
35  if(!xaxis->edges)
36  me = dqmStore_->book1D(name_, name_, xaxis->nbins, xaxis->low, xaxis->high);
37  else{
38  float* edges(new float[xaxis->nbins + 1]);
39  for(int i(0); i < xaxis->nbins + 1; i++)
40  edges[i] = xaxis->edges[i];
41  me = dqmStore_->book1D(name_, name_, xaxis->nbins, edges);
42  delete [] edges;
43  }
44  }
45  break;
46 
48  {
49  if(!xaxis)
50  throw cms::Exception("InvalidCall") << "No xaxis found for MESetNonObject" << std::endl;
51 
52  double ylow, yhigh;
53  if(!yaxis){
56  }
57  else{
58  ylow = yaxis->low;
59  yhigh = yaxis->high;
60  }
61  if(xaxis->edges)
62  me = dqmStore_->bookProfile(name_, name_, xaxis->nbins, xaxis->edges, ylow, yhigh, "");
63  else
64  me = dqmStore_->bookProfile(name_, name_, xaxis->nbins, xaxis->low, xaxis->high, ylow, yhigh, "");
65 
66  }
67  break;
68 
70  {
71  if(!xaxis || !yaxis)
72  throw cms::Exception("InvalidCall") << "No x/yaxis found for MESetNonObject" << std::endl;
73 
74  if(!xaxis->edges || !yaxis->edges)
75  me = dqmStore_->book2D(name_, name_, xaxis->nbins, xaxis->low, xaxis->high, yaxis->nbins, yaxis->low, yaxis->high);
76  else{
77  float* xedges(new float[xaxis->nbins + 1]);
78  for(int i(0); i < xaxis->nbins + 1; i++)
79  xedges[i] = xaxis->edges[i];
80  float* yedges(new float[yaxis->nbins + 1]);
81  for(int i(0); i < yaxis->nbins + 1; i++)
82  yedges[i] = yaxis->edges[i];
83  me = dqmStore_->book2D(name_, name_, xaxis->nbins, xedges, yaxis->nbins, yedges);
84  delete [] xedges;
85  delete [] yedges;
86  }
87  }
88  break;
89 
91  {
92  if(!xaxis || !yaxis)
93  throw cms::Exception("InvalidCall") << "No x/yaxis found for MESetNonObject" << std::endl;
94  double high(0.), low(0.);
95  if(zaxis){
96  low = zaxis->low;
97  high = zaxis->high;
98  }
99  else{
102  }
103 
104  me = dqmStore_->bookProfile2D(name_, name_, xaxis->nbins, xaxis->low, xaxis->high, yaxis->nbins, yaxis->low, yaxis->high, low, high, "");
105  }
106  break;
107 
108  default :
109  throw cms::Exception("InvalidCall") << "MESetNonObject of type " << data_->kind << " not implemented" << std::endl;
110  }
111 
112  mes_.push_back(me);
113 
114  active_ = true;
115  }
116 
117  bool
119  {
120  mes_.clear();
121 
122  MonitorElement* me(dqmStore_->get(dir_ + "/" + name_));
123  if(!me) return false;
124 
125  mes_.push_back(me);
126 
127  active_ = true;
128  return true;
129  }
130 
132  {
133  }
134 
135  void
136  MESetNonObject::fill(double _x, double _wy/* = 1.*/, double _w/* = 1.*/)
137  {
138  if(mes_.size() == 0 || !mes_[0]) return;
139 
140  switch(data_->kind) {
142  mes_[0]->Fill(_x);
143  break;
146  mes_[0]->Fill(_x, _wy);
147  break;
150  mes_[0]->Fill(_x, _wy, _w);
151  break;
152  default :
153  break;
154  }
155  }
156 
157 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
BinService::AxisSpecs * yaxis
Definition: MESet.h:26
MonitorElement::Kind kind
Definition: MESet.h:24
void fill(double, double _wy=1., double _w=1.)
dictionary edges
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:809
BinService::AxisSpecs * xaxis
Definition: MESet.h:25
std::vector< MonitorElement * > mes_
Definition: MESet.h:129
static DQMStore * dqmStore_
Definition: MESet.h:127
const T & max(const T &a, const T &b)
MESetNonObject(std::string const &, MEData const &, bool _readOnly=false)
std::string dir_
Definition: MESet.h:131
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1186
std::string name_
Definition: MESet.h:132
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1623
BinService::AxisSpecs * zaxis
Definition: MESet.h:27
bool active_
Definition: MESet.h:135
MEData const * data_
Definition: MESet.h:133
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1330