17 static const unsigned maxTableSize(100);
20 MESet(_fullPath, _otype, _btype, _kind),
28 throw_(
"Unsupported MonitorElement kind");
39 throw_(
"MESetChannel configured with wrong binning type");
43 MESetChannel::MESetChannel(MESetChannel
const& _orig) :
45 meTable_(_orig.meTable_)
49 MESetChannel::~MESetChannel()
54 MESetChannel::operator=(MESet
const& _rhs)
56 MESetChannel
const* pRhs(dynamic_cast<MESetChannel const*>(&_rhs));
57 if(pRhs) meTable_ = pRhs->meTable_;
65 if(_path !=
"")
path_ = _path;
66 MESet*
copy(
new MESetChannel(*
this));
72 MESetChannel::book(DQMStore::IBooker&)
79 MESetChannel::retrieve(DQMStore::IGetter&,
std::string*)
const
91 dqmStore_->rmdir(
path_.substr(0,
path_.find_last_of(
'/')));
100 unsigned iME(preparePlot_(getIndex_(_id)));
101 if(iME ==
unsigned(-1))
return;
104 mes_[iME]->Fill(0.5, _w);
112 unsigned iME(preparePlot_(getIndex_(_id)));
113 if(iME ==
unsigned(-1))
return;
116 mes_[iME]->Fill(0.5, _w);
120 MESetChannel::setBinContent(
DetId const& _id,
double _content)
124 unsigned iME(preparePlot_(getIndex_(_id)));
125 if(iME ==
unsigned(-1))
return;
128 mes_[iME]->setBinContent(1,
_content);
136 unsigned iME(preparePlot_(getIndex_(_id)));
137 if(iME ==
unsigned(-1))
return;
140 mes_[iME]->setBinContent(1,
_content);
144 MESetChannel::setBinError(
DetId const& _id,
double _error)
148 unsigned iME(preparePlot_(getIndex_(_id)));
149 if(iME ==
unsigned(-1))
return;
152 mes_[iME]->setBinError(1, _error);
160 unsigned iME(preparePlot_(getIndex_(_id)));
161 if(iME ==
unsigned(-1))
return;
164 mes_[iME]->setBinError(1, _error);
168 MESetChannel::setBinEntries(
DetId const& _id,
double _entries)
172 unsigned iME(preparePlot_(getIndex_(_id)));
173 if(iME ==
unsigned(-1))
return;
176 mes_[iME]->setBinEntries(1, _entries);
184 unsigned iME(preparePlot_(getIndex_(_id)));
185 if(iME ==
unsigned(-1))
return;
188 mes_[iME]->setBinEntries(1, _entries);
192 MESetChannel::getBinContent(
DetId const& _id,
int)
const
194 if(!active_)
return 0.;
196 unsigned iME(findPlot_(getIndex_(_id)));
197 if(iME ==
unsigned(-1))
return 0.;
200 return mes_[iME]->getBinContent(1);
206 if(!active_)
return 0.;
208 unsigned iME(findPlot_(getIndex_(_id)));
209 if(iME ==
unsigned(-1))
return 0.;
212 return mes_[iME]->getBinContent(1);
216 MESetChannel::getBinError(
DetId const& _id,
int)
const
218 if(!active_)
return 0.;
220 unsigned iME(findPlot_(getIndex_(_id)));
221 if(iME ==
unsigned(-1))
return 0.;
224 return mes_[iME]->getBinError(1);
230 if(!active_)
return 0.;
232 unsigned iME(findPlot_(getIndex_(_id)));
233 if(iME ==
unsigned(-1))
return 0.;
236 return mes_[iME]->getBinError(1);
240 MESetChannel::getBinEntries(
DetId const& _id,
int)
const
242 if(!active_)
return 0.;
244 unsigned iME(findPlot_(getIndex_(_id)));
245 if(iME ==
unsigned(-1))
return 0.;
248 return mes_[iME]->getBinEntries(1);
254 if(!active_)
return 0.;
256 unsigned iME(findPlot_(getIndex_(_id)));
257 if(iME ==
unsigned(-1))
return 0.;
260 return mes_[iME]->getBinEntries(1);
268 if(
_content == 0. && _entries == 0.){
271 dqmStore_->rmdir(
path_);
275 unsigned nME(mes_.size());
276 for(
unsigned iME(0); iME < nME; iME++){
277 mes_[iME]->setBinContent(1,
_content);
278 mes_[iME]->setBinError(1, _err);
280 mes_[iME]->setBinEntries(1, _entries);
285 MESetChannel::checkDirectory()
const
289 vector<MonitorElement*> storeMEs(dqmStore_->getContents(
path_));
291 unsigned nME(storeMEs.size());
292 for(
unsigned iME(0); iME < nME; iME++){
294 if(
find(mes_.begin(), mes_.end(),
me) != mes_.end())
continue;
299 meTable_[
id] = mes_.size() - 1;
305 MESetChannel::preparePlot_(uint32_t _rawId)
const
307 if(_rawId == 0)
return -1;
309 std::map<uint32_t, unsigned>::iterator tableItr(meTable_.find(_rawId));
310 if(tableItr == meTable_.end()){
311 if(meTable_.size() == maxTableSize){
318 dqmStore_->setCurrentFolder(
path_);
322 me = dqmStore_->book1D(
name,
name, 1, 0., 1.);
326 dqmStore_->setCurrentFolder(
pwd);
330 tableItr = meTable_.insert(std::pair<uint32_t, unsigned>(_rawId, mes_.size() - 1)).first;
333 if(tableItr == meTable_.end()){
338 return tableItr->second;
342 MESetChannel::findPlot_(uint32_t _rawId)
const
344 if(_rawId == 0)
return -1;
346 std::map<uint32_t, unsigned>::const_iterator tableItr(meTable_.find(_rawId));
348 if(tableItr == meTable_.end())
return -1;
350 return tableItr->second;
354 MESetChannel::getIndex_(
DetId const& _id)
const
363 return EcalElectronicsId(pnid.iDCCId(), pnid.iPnId() < 6 ? 69 : 70, 1, (pnid.iPnId() - 1) % 5 + 1).
rawId();