CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MESetDet1D.cc
Go to the documentation of this file.
2 
4 
6 
7 namespace ecaldqm
8 {
9 
10  MESetDet1D::MESetDet1D(std::string const& _fullpath, MEData const& _data, bool _readOnly/* = false*/) :
11  MESetEcal(_fullpath, _data, 1, _readOnly)
12  {
13  }
14 
16  {
17  }
18 
19  void
20  MESetDet1D::fill(DetId const& _id, double _wy/* = 1.*/, double _w/* = 1.*/, double)
21  {
22  find_(_id);
23 
24  fill_(_wy, _w);
25  }
26 
27  void
28  MESetDet1D::fill(unsigned _dcctccid, double _wy/* = 1.*/, double _w/* = 1.*/, double)
29  {
30  find_(_dcctccid);
31 
32  fill_(_wy, _w);
33  }
34 
35  double
36  MESetDet1D::getBinContent(DetId const& _id, int _bin/* = 0*/) const
37  {
38  find_(_id);
39 
40  if(cache_.second.size() == 0) return 0.;
41 
42  int bin(cache_.second[0]);
43 
45  int nbinsX(mes_[cache_.first]->getTH1()->GetNbinsX());
46  bin += (_bin - 1) * nbinsX;
47  }
48 
49  return getBinContent_(cache_.first, bin);
50  }
51 
52  double
53  MESetDet1D::getBinContent(unsigned _dcctccid, int _bin/* = 0*/) const
54  {
55  find_(_dcctccid);
56 
57  if(cache_.second.size() == 0) return 0.;
58 
59  int bin(cache_.second[0]);
60 
62  int nbinsX(mes_[cache_.first]->getTH1()->GetNbinsX());
63  bin += (_bin - 1) * nbinsX;
64  }
65 
66  return getBinContent_(cache_.first, bin);
67  }
68 
69  double
70  MESetDet1D::getBinError(DetId const& _id, int _bin/* = 0*/) const
71  {
72  find_(_id);
73 
74  if(cache_.second.size() == 0) return 0.;
75 
76  int bin(cache_.second[0]);
77 
79  int nbinsX(mes_[cache_.first]->getTH1()->GetNbinsX());
80  bin += (_bin - 1) * nbinsX;
81  }
82 
83  return getBinError_(cache_.first, bin);
84  }
85 
86  double
87  MESetDet1D::getBinError(unsigned _dcctccid, int _bin/* = 0*/) const
88  {
89  find_(_dcctccid);
90 
91  if(cache_.second.size() == 0) return 0.;
92 
93  int bin(cache_.second[0]);
94 
96  int nbinsX(mes_[cache_.first]->getTH1()->GetNbinsX());
97  bin += (_bin - 1) * nbinsX;
98  }
99 
100  return getBinError_(cache_.first, bin);
101  }
102 
103  double
104  MESetDet1D::getBinEntries(DetId const& _id, int _bin/* = 0*/) const
105  {
106  find_(_id);
107 
108  if(cache_.second.size() == 0) return 0.;
109 
110  int bin(cache_.second[0]);
111 
113  int nbinsX(mes_[cache_.first]->getTH1()->GetNbinsX());
114  bin += (_bin - 1) * nbinsX;
115  }
116 
117  return getBinEntries_(cache_.first, bin);
118  }
119 
120  double
121  MESetDet1D::getBinEntries(unsigned _dcctccid, int _bin/* = 0*/) const
122  {
123  find_(_dcctccid);
124 
125  if(cache_.second.size() == 0) return 0.;
126 
127  int bin(cache_.second[0]);
128 
130  int nbinsX(mes_[cache_.first]->getTH1()->GetNbinsX());
131  bin += (_bin - 1) * nbinsX;
132  }
133 
134  return getBinEntries_(cache_.first, bin);
135  }
136 
137  void
138  MESetDet1D::find_(uint32_t _id) const
139  {
140  if(_id == cacheId_) return;
141 
143  DetId id(_id);
144  if(id.det() == DetId::Ecal)
146  else
148  }
149  else{
150  DetId id(_id);
151  if(id.det() == DetId::Ecal)
153  else
154  cache_ = binService_->findBins(data_->otype, data_->btype, unsigned(_id));
155  }
156 
157  if(cache_.first >= mes_.size() || !mes_[cache_.first])
158  throw cms::Exception("InvalidCall") << "ME array index overflow" << std::endl;
159 
160  // some TTs are apparently empty..!
161 // if(cache_.second.size() == 0)
162 // throw cms::Exception("InvalidCall") << "No bins to get content from" << std::endl;
163 
164  cacheId_ = _id;
165  }
166 
167  void
168  MESetDet1D::fill_(double _wy, double _w)
169  {
171  std::vector<int> bins(cache_.second);
172  TH1* h(mes_[cache_.first]->getTH1());
173  int iy(h->GetYaxis()->FindBin(_wy));
174  int nbinsX(h->GetNbinsX());
175  for(unsigned iBin(0); iBin < bins.size(); iBin++)
176  bins[iBin] += (iy - 1) * nbinsX;
177 
178  for(unsigned iBin(0); iBin < bins.size(); iBin++)
179  MESet::fill_(cache_.first, bins[iBin], _w);
180  }
181  else
182  MESetEcal::fill_(_wy);
183  }
184 
185 }
186 
BinService::ObjectType otype
Definition: MESet.h:22
uint32_t cacheId_
Definition: MESetEcal.h:47
double getBinContent(DetId const &, int _bin=0) const
Definition: MESetDet1D.cc:36
void fill(DetId const &, double _wy=1., double _w=1., double _unused=0.)
Definition: MESetDet1D.cc:20
MonitorElement::Kind kind
Definition: MESet.h:24
virtual void fill_(double)
Definition: MESetEcal.cc:491
std::vector< MonitorElement * > mes_
Definition: MESet.h:129
void fill_(double, double)
Definition: MESetDet1D.cc:168
BinService::BinningType btype
Definition: MESet.h:23
std::pair< unsigned, std::vector< int > > findBinsNoMap(ObjectType, BinningType, const DetId &) const
std::pair< unsigned, std::vector< int > > cache_
Definition: MESetEcal.h:48
virtual void fill_(unsigned, int, double)
Definition: MESet.cc:262
Definition: DetId.h:18
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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
std::pair< unsigned, std::vector< int > > findBins(ObjectType, BinningType, const DetId &) const
MEData const * data_
Definition: MESet.h:133
double getBinError(DetId const &, int _bin=0) const
Definition: MESetDet1D.cc:70
virtual double getBinEntries_(unsigned, int) const
Definition: MESet.cc:362
double getBinEntries(DetId const &, int _bin=0) const
Definition: MESetDet1D.cc:104
MESetDet1D(std::string const &, MEData const &, bool _readOnly=false)
Definition: MESetDet1D.cc:10
void find_(uint32_t) const
Definition: MESetDet1D.cc:138