File indexing completed on 2024-04-06 12:07:28
0001 #include "DQM/HcalCommon/interface/Container1D.h"
0002
0003 namespace hcaldqm {
0004 using namespace mapper;
0005 using namespace constants;
0006 using namespace quantity;
0007
0008 Container1D::Container1D() : _qx(nullptr), _qy(nullptr) {}
0009
0010 Container1D::Container1D(std::string const &folder, hashfunctions::HashType hashtype, Quantity *qx, Quantity *qy)
0011 : Container(folder, qy->name() + "vs" + qx->name()), _hashmap(hashtype), _qx(qx), _qy(qy) {
0012 _qx->setAxisType(quantity::fXAxis);
0013 _qy->setAxisType(quantity::fYAxis);
0014 }
0015
0016 Container1D::~Container1D() {
0017 if (_qx != nullptr)
0018 delete _qx;
0019 if (_qy != nullptr)
0020 delete _qy;
0021 _qx = nullptr;
0022 _qy = nullptr;
0023 }
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 void Container1D::initialize(std::string const &folder,
0034 hashfunctions::HashType hashtype,
0035 Quantity *qx,
0036 Quantity *qy ,
0037 int debug ) {
0038 Container::initialize(folder, qy->name() + "vs" + qx->name(), debug);
0039 _hashmap.initialize(hashtype);
0040 _qx = qx;
0041 _qy = qy;
0042 _qx->setAxisType(quantity::fXAxis);
0043 _qy->setAxisType(quantity::fYAxis);
0044 }
0045
0046 void Container1D::initialize(std::string const &folder,
0047 std::string const &qname,
0048 hashfunctions::HashType hashtype,
0049 Quantity *qx,
0050 Quantity *qy ,
0051 int debug ) {
0052 Container::initialize(folder, qname, debug);
0053 _hashmap.initialize(hashtype);
0054 _qx = qx;
0055 _qy = qy;
0056 _qx->setAxisType(quantity::fXAxis);
0057 _qy->setAxisType(quantity::fYAxis);
0058 }
0059
0060 void Container1D::reset() {
0061 for (auto const &pair : _mes) {
0062 pair.second->Reset();
0063 }
0064 }
0065
0066 void Container1D::print() {
0067 std::cout << "Container by " << _hashmap.getHashTypeName() << std::endl;
0068 for (auto const &pair : _mes) {
0069 std::cout << std::hex << pair.first << std::dec << std::endl;
0070 }
0071 }
0072
0073 void Container1D::fill(uint32_t hash) {
0074 if (_hashmap.isDHash())
0075 this->fill(HcalDetId(hash));
0076 else if (_hashmap.isEHash())
0077 this->fill(HcalElectronicsId(hash));
0078 else if (_hashmap.isTHash())
0079 this->fill(HcalTrigTowerDetId(hash));
0080 }
0081
0082 void Container1D::fill(uint32_t hash, int x) {
0083 if (_hashmap.isDHash())
0084 this->fill(HcalDetId(hash), x);
0085 else if (_hashmap.isEHash())
0086 this->fill(HcalElectronicsId(hash), x);
0087 else if (_hashmap.isTHash())
0088 this->fill(HcalTrigTowerDetId(hash), x);
0089 }
0090
0091 void Container1D::fill(uint32_t hash, double x) {
0092 if (_hashmap.isDHash())
0093 this->fill(HcalDetId(hash), x);
0094 else if (_hashmap.isEHash())
0095 this->fill(HcalElectronicsId(hash), x);
0096 else if (_hashmap.isTHash())
0097 this->fill(HcalTrigTowerDetId(hash), x);
0098 }
0099
0100 void Container1D::fill(uint32_t hash, int x, double y) {
0101 if (_hashmap.isDHash())
0102 this->fill(HcalDetId(hash), x, y);
0103 else if (_hashmap.isEHash())
0104 this->fill(HcalElectronicsId(hash), x, y);
0105 else if (_hashmap.isTHash())
0106 this->fill(HcalTrigTowerDetId(hash), x, y);
0107 }
0108
0109 void Container1D::fill(uint32_t hash, int x, int y) {
0110 if (_hashmap.isDHash())
0111 this->fill(HcalDetId(hash), x, y);
0112 else if (_hashmap.isEHash())
0113 this->fill(HcalElectronicsId(hash), x, y);
0114 else if (_hashmap.isTHash())
0115 this->fill(HcalTrigTowerDetId(hash), x, y);
0116 }
0117
0118 void Container1D::fill(uint32_t hash, double x, double y) {
0119 if (_hashmap.isDHash())
0120 this->fill(HcalDetId(hash), x, y);
0121 else if (_hashmap.isEHash())
0122 this->fill(HcalElectronicsId(hash), x, y);
0123 else if (_hashmap.isTHash())
0124 this->fill(HcalTrigTowerDetId(hash), x, y);
0125 }
0126
0127
0128 void Container1D::fill(HcalDetId const &did) { _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did)); }
0129 void Container1D::fill(HcalDetId const &did, int x) {
0130 QuantityType qtype = _qx->type();
0131 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0132 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x));
0133 else
0134 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
0135 }
0136 void Container1D::fill(HcalDetId const &did, double x) {
0137 QuantityType qtype = _qx->type();
0138 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0139 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x));
0140 else
0141 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
0142 }
0143 void Container1D::fill(HcalDetId const &did, int x, double y) {
0144 QuantityType qtype = _qx->type();
0145 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0146 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
0147 else
0148 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
0149 }
0150 void Container1D::fill(HcalDetId const &did, int x, int y) {
0151 QuantityType qtype = _qx->type();
0152 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0153 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
0154 else
0155 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
0156 }
0157 void Container1D::fill(HcalDetId const &did, double x, double y) {
0158 QuantityType qtype = _qx->type();
0159 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0160 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
0161 else
0162 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
0163 }
0164
0165 double Container1D::getBinEntries(HcalDetId const &id) {
0166 return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id));
0167 }
0168
0169 double Container1D::getBinEntries(HcalDetId const &id, int x) {
0170 return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x));
0171 }
0172
0173 double Container1D::getBinEntries(HcalDetId const &id, double x) {
0174 return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x));
0175 }
0176
0177 double Container1D::getBinContent(HcalDetId const &tid) {
0178 return _mes[_hashmap.getHash(tid)]->getBinContent(_qx->getBin(tid));
0179 }
0180
0181 double Container1D::getBinContent(HcalDetId const &tid, int x) {
0182 return _mes[_hashmap.getHash(tid)]->getBinContent(_qx->getBin(x));
0183 }
0184
0185 double Container1D::getBinContent(HcalDetId const &tid, double x) {
0186 return _mes[_hashmap.getHash(tid)]->getBinContent(_qx->getBin(x));
0187 }
0188
0189 double Container1D::getMean(HcalDetId const &tid, int axis) {
0190 return _mes[_hashmap.getHash(tid)]->getMean(axis);
0191 }
0192
0193 double Container1D::getRMS(HcalDetId const &id, int axis) {
0194 return _mes[_hashmap.getHash(id)]->getRMS(axis);
0195 }
0196
0197
0198 void Container1D::setBinContent(HcalDetId const &id, int x) {
0199 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0200 }
0201 void Container1D::setBinContent(HcalDetId const &id, double x) {
0202 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0203 }
0204 void Container1D::setBinContent(HcalDetId const &id, int x, int y) {
0205 QuantityType qtype = _qx->type();
0206 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0207 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0208 else
0209 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0210 }
0211 void Container1D::setBinContent(HcalDetId const &id, int x, double y) {
0212 QuantityType qtype = _qx->type();
0213 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0214 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0215 else
0216 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0217 }
0218 void Container1D::setBinContent(HcalDetId const &id, double x, int y) {
0219 QuantityType qtype = _qx->type();
0220 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0221 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0222 else
0223 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0224 }
0225 void Container1D::setBinContent(HcalDetId const &id, double x, double y) {
0226 QuantityType qtype = _qx->type();
0227 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0228 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0229 else
0230 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0231 }
0232
0233
0234 void Container1D::fill(HcalElectronicsId const &did) {
0235 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did));
0236 }
0237 void Container1D::fill(HcalElectronicsId const &did, int x) {
0238 QuantityType qtype = _qx->type();
0239 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0240 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x));
0241 else
0242 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
0243 }
0244 void Container1D::fill(HcalElectronicsId const &did, double x) {
0245 QuantityType qtype = _qx->type();
0246 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0247 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x));
0248 else
0249 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
0250 }
0251 void Container1D::fill(HcalElectronicsId const &did, int x, double y) {
0252 QuantityType qtype = _qx->type();
0253 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0254 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
0255 else
0256 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
0257 }
0258 void Container1D::fill(HcalElectronicsId const &did, int x, int y) {
0259 QuantityType qtype = _qx->type();
0260 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0261 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
0262 else
0263 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
0264 }
0265 void Container1D::fill(HcalElectronicsId const &did, double x, double y) {
0266 QuantityType qtype = _qx->type();
0267 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0268 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
0269 else
0270 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
0271 }
0272
0273 double Container1D::getBinEntries(HcalElectronicsId const &id) {
0274 return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id));
0275 }
0276
0277 double Container1D::getBinEntries(HcalElectronicsId const &id, int x) {
0278 return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x));
0279 }
0280
0281 double Container1D::getBinEntries(HcalElectronicsId const &id, double x) {
0282 return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x));
0283 }
0284
0285 double Container1D::getBinContent(HcalElectronicsId const &tid) {
0286 return _mes[_hashmap.getHash(tid)]->getBinContent(_qx->getBin(tid));
0287 }
0288
0289 double Container1D::getBinContent(HcalElectronicsId const &tid, int x) {
0290 return _mes[_hashmap.getHash(tid)]->getBinContent(_qx->getBin(x));
0291 }
0292
0293 double Container1D::getBinContent(HcalElectronicsId const &tid, double x) {
0294 return _mes[_hashmap.getHash(tid)]->getBinContent(_qx->getBin(x));
0295 }
0296
0297 double Container1D::getMean(HcalElectronicsId const &tid, int axis) {
0298 return _mes[_hashmap.getHash(tid)]->getMean(axis);
0299 }
0300
0301 double Container1D::getRMS(HcalElectronicsId const &id, int axis) {
0302 return _mes[_hashmap.getHash(id)]->getRMS(axis);
0303 }
0304
0305
0306 void Container1D::setBinContent(HcalElectronicsId const &id, int x) {
0307 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0308 }
0309 void Container1D::setBinContent(HcalElectronicsId const &id, double x) {
0310 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0311 }
0312 void Container1D::setBinContent(HcalElectronicsId const &id, int x, int y) {
0313 QuantityType qtype = _qx->type();
0314 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0315 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0316 else
0317 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0318 }
0319 void Container1D::setBinContent(HcalElectronicsId const &id, int x, double y) {
0320 QuantityType qtype = _qx->type();
0321 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0322 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0323 else
0324 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0325 }
0326 void Container1D::setBinContent(HcalElectronicsId const &id, double x, int y) {
0327 QuantityType qtype = _qx->type();
0328 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0329 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0330 else
0331 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0332 }
0333 void Container1D::setBinContent(HcalElectronicsId const &id, double x, double y) {
0334 QuantityType qtype = _qx->type();
0335 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0336 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0337 else
0338 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0339 }
0340
0341
0342 void Container1D::fill(HcalTrigTowerDetId const &did) {
0343 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did));
0344 }
0345 void Container1D::fill(HcalTrigTowerDetId const &did, int x) {
0346 QuantityType qtype = _qx->type();
0347 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0348 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x));
0349 else
0350 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
0351 }
0352 void Container1D::fill(HcalTrigTowerDetId const &did, double x) {
0353 QuantityType qtype = _qx->type();
0354 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0355 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x));
0356 else
0357 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
0358 }
0359 void Container1D::fill(HcalTrigTowerDetId const &did, int x, double y) {
0360 QuantityType qtype = _qx->type();
0361 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0362 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
0363 else
0364 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
0365 }
0366 void Container1D::fill(HcalTrigTowerDetId const &did, int x, int y) {
0367 QuantityType qtype = _qx->type();
0368 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0369 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
0370 else
0371 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
0372 }
0373 void Container1D::fill(HcalTrigTowerDetId const &did, double x, double y) {
0374 QuantityType qtype = _qx->type();
0375 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0376 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
0377 else
0378 _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
0379 }
0380
0381 double Container1D::getBinEntries(HcalTrigTowerDetId const &id) {
0382 return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id));
0383 }
0384
0385 double Container1D::getBinEntries(HcalTrigTowerDetId const &id, int x) {
0386 return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x));
0387 }
0388
0389 double Container1D::getBinEntries(HcalTrigTowerDetId const &id, double x) {
0390 return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x));
0391 }
0392
0393 double Container1D::getBinContent(HcalTrigTowerDetId const &tid) {
0394 return _mes[_hashmap.getHash(tid)]->getBinContent(_qx->getBin(tid));
0395 }
0396
0397 double Container1D::getBinContent(HcalTrigTowerDetId const &tid, int x) {
0398 return _mes[_hashmap.getHash(tid)]->getBinContent(_qx->getBin(x));
0399 }
0400
0401 double Container1D::getBinContent(HcalTrigTowerDetId const &tid, double x) {
0402 return _mes[_hashmap.getHash(tid)]->getBinContent(_qx->getBin(x));
0403 }
0404
0405 double Container1D::getMean(HcalTrigTowerDetId const &tid, int axis) {
0406 return _mes[_hashmap.getHash(tid)]->getMean(axis);
0407 }
0408
0409 double Container1D::getRMS(HcalTrigTowerDetId const &id, int axis) {
0410 return _mes[_hashmap.getHash(id)]->getRMS(axis);
0411 }
0412
0413
0414 void Container1D::setBinContent(HcalTrigTowerDetId const &id, int x) {
0415 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0416 }
0417 void Container1D::setBinContent(HcalTrigTowerDetId const &id, double x) {
0418 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0419 }
0420 void Container1D::setBinContent(HcalTrigTowerDetId const &id, int x, int y) {
0421 QuantityType qtype = _qx->type();
0422 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0423 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0424 else
0425 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0426 }
0427 void Container1D::setBinContent(HcalTrigTowerDetId const &id, int x, double y) {
0428 QuantityType qtype = _qx->type();
0429 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0430 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0431 else
0432 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0433 }
0434 void Container1D::setBinContent(HcalTrigTowerDetId const &id, double x, int y) {
0435 QuantityType qtype = _qx->type();
0436 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0437 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0438 else
0439 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0440 }
0441 void Container1D::setBinContent(HcalTrigTowerDetId const &id, double x, double y) {
0442 QuantityType qtype = _qx->type();
0443 if (qtype == fValueQuantity || qtype == fFlagQuantity)
0444 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), y);
0445 else
0446 _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), x);
0447 }
0448
0449
0450 void Container1D::load(DQMStore::IGetter &ig,
0451 HcalElectronicsMap const *emap,
0452 std::string const &subsystem,
0453 std::string const &aux) {
0454
0455
0456 _logger.debug(_hashmap.getHashTypeName());
0457 std::string path =
0458 subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" + _hashmap.getHashTypeName();
0459 _logger.debug("FULLPATH::" + path);
0460
0461 if (_hashmap.isDHash()) {
0462
0463 std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
0464 for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
0465
0466 if (!it->isHcalDetId())
0467 continue;
0468
0469 HcalDetId did = HcalDetId(it->rawId());
0470 uint32_t hash = _hashmap.getHash(did);
0471 MEMap::iterator mit = _mes.find(hash);
0472
0473
0474 if (mit != _mes.end())
0475 continue;
0476
0477 _logger.debug(_hashmap.getName(did));
0478 _mes.insert(std::make_pair(hash, ig.get(path + "/" + _hashmap.getName(did))));
0479 }
0480 }
0481
0482 else if (_hashmap.isEHash()) {
0483
0484 std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
0485 for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
0486 HcalElectronicsId eid = HcalElectronicsId(it->rawId());
0487 uint32_t hash = _hashmap.getHash(eid);
0488 MEMap::iterator mit = _mes.find(hash);
0489
0490
0491 if (mit != _mes.end())
0492 continue;
0493
0494 _logger.debug(_hashmap.getName(eid));
0495 _mes.insert(std::make_pair(hash, ig.get(path + "/" + _hashmap.getName(eid))));
0496 }
0497 } else if (_hashmap.isTHash()) {
0498
0499 std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
0500 for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
0501 HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
0502 uint32_t hash = _hashmap.getHash(tid);
0503 MEMap::iterator mit = _mes.find(hash);
0504
0505
0506 if (mit != _mes.end())
0507 continue;
0508
0509 _logger.debug(_hashmap.getName(tid));
0510 _mes.insert(std::make_pair(hash, ig.get(path + "/" + _hashmap.getName(tid))));
0511 }
0512 }
0513 }
0514
0515
0516 void Container1D::load(DQMStore::IGetter &ig,
0517 HcalElectronicsMap const *emap,
0518 filter::HashFilter const &filter,
0519 std::string const &subsystem,
0520 std::string const &aux) {
0521
0522
0523 _logger.debug(_hashmap.getHashTypeName());
0524 std::string path =
0525 subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" + _hashmap.getHashTypeName();
0526 _logger.debug("FULLPATH::" + path);
0527
0528 if (_hashmap.isDHash()) {
0529
0530 std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
0531 for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
0532
0533 if (!it->isHcalDetId())
0534 continue;
0535
0536 HcalDetId did = HcalDetId(it->rawId());
0537 uint32_t hash = _hashmap.getHash(did);
0538 MEMap::iterator mit = _mes.find(hash);
0539
0540
0541 if (mit != _mes.end())
0542 continue;
0543
0544 if (filter.filter(did))
0545 continue;
0546
0547 _logger.debug(_hashmap.getName(did));
0548 _mes.insert(std::make_pair(hash, ig.get(path + "/" + _hashmap.getName(did))));
0549 }
0550 }
0551
0552 else if (_hashmap.isEHash()) {
0553
0554 std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
0555 for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
0556 HcalElectronicsId eid = HcalElectronicsId(it->rawId());
0557 uint32_t hash = _hashmap.getHash(eid);
0558 MEMap::iterator mit = _mes.find(hash);
0559
0560
0561 if (mit != _mes.end())
0562 continue;
0563
0564 if (filter.filter(eid))
0565 continue;
0566
0567 _logger.debug(_hashmap.getName(eid));
0568 _mes.insert(std::make_pair(hash, ig.get(path + "/" + _hashmap.getName(eid))));
0569 }
0570 } else if (_hashmap.isTHash()) {
0571
0572 std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
0573 for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
0574 HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
0575 uint32_t hash = _hashmap.getHash(tid);
0576 MEMap::iterator mit = _mes.find(hash);
0577
0578
0579 if (mit != _mes.end())
0580 continue;
0581
0582 if (filter.filter(tid))
0583 continue;
0584
0585 _logger.debug(_hashmap.getName(tid));
0586 _mes.insert(std::make_pair(hash, ig.get(path + "/" + _hashmap.getName(tid))));
0587 }
0588 }
0589 }
0590
0591
0592 void Container1D::book(DQMStore::IBooker &ib,
0593 HcalElectronicsMap const *emap,
0594 std::string subsystem,
0595 std::string aux) {
0596
0597
0598 ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" +
0599 _hashmap.getHashTypeName());
0600 _logger.debug(_hashmap.getHashTypeName());
0601 if (_hashmap.isDHash()) {
0602
0603 std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
0604 for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
0605
0606 if (!it->isHcalDetId())
0607 continue;
0608
0609 HcalDetId did = HcalDetId(it->rawId());
0610 uint32_t hash = _hashmap.getHash(did);
0611 MEMap::iterator mit = _mes.find(hash);
0612 if (mit != _mes.end())
0613 continue;
0614
0615 _logger.debug(_hashmap.getName(did));
0616 _mes.insert(std::make_pair(
0617 hash, ib.book1DD(_hashmap.getName(did), _hashmap.getName(did), _qx->nbins(), _qx->min(), _qx->max())));
0618
0619
0620 customize(_mes[hash]);
0621 }
0622 }
0623
0624 else if (_hashmap.isEHash()) {
0625
0626 std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
0627 for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
0628 HcalElectronicsId eid = HcalElectronicsId(it->rawId());
0629 uint32_t hash = _hashmap.getHash(eid);
0630 MEMap::iterator mit = _mes.find(hash);
0631 if (mit != _mes.end())
0632 continue;
0633
0634 _logger.debug(_hashmap.getName(eid));
0635 _mes.insert(std::make_pair(
0636 hash, ib.book1DD(_hashmap.getName(eid), _hashmap.getName(eid), _qx->nbins(), _qx->min(), _qx->max())));
0637
0638
0639 customize(_mes[hash]);
0640 }
0641 } else if (_hashmap.isTHash()) {
0642
0643 std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
0644 for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
0645 HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
0646 uint32_t hash = _hashmap.getHash(tid);
0647 MEMap::iterator mit = _mes.find(hash);
0648 if (mit != _mes.end())
0649 continue;
0650
0651 _logger.debug(_hashmap.getName(tid));
0652 _mes.insert(std::make_pair(
0653 hash, ib.book1DD(_hashmap.getName(tid), _hashmap.getName(tid), _qx->nbins(), _qx->min(), _qx->max())));
0654
0655 customize(_mes[hash]);
0656 }
0657 }
0658 }
0659
0660
0661 void Container1D::book(DQMStore::IBooker &ib,
0662 HcalElectronicsMap const *emap,
0663 filter::HashFilter const &filter,
0664 std::string subsystem,
0665 std::string aux) {
0666
0667
0668 ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" +
0669 _hashmap.getHashTypeName());
0670 _logger.debug(_hashmap.getHashTypeName());
0671
0672 if (_hashmap.isDHash()) {
0673
0674 std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
0675 for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
0676
0677 if (!it->isHcalDetId())
0678 continue;
0679
0680 HcalDetId did = HcalDetId(it->rawId());
0681 uint32_t hash = _hashmap.getHash(did);
0682 MEMap::iterator mit = _mes.find(hash);
0683 if (mit != _mes.end())
0684 continue;
0685 if (filter.filter(did))
0686 continue;
0687
0688 _logger.debug(_hashmap.getName(did));
0689 _mes.insert(std::make_pair(
0690 hash, ib.book1DD(_hashmap.getName(did), _hashmap.getName(did), _qx->nbins(), _qx->min(), _qx->max())));
0691
0692
0693 customize(_mes[hash]);
0694 }
0695 }
0696
0697 else if (_hashmap.isEHash()) {
0698
0699 std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
0700 for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
0701 HcalElectronicsId eid = HcalElectronicsId(it->rawId());
0702 uint32_t hash = _hashmap.getHash(eid);
0703 MEMap::iterator mit = _mes.find(hash);
0704 if (mit != _mes.end())
0705 continue;
0706 if (filter.filter(eid))
0707 continue;
0708
0709 _logger.debug(_hashmap.getName(eid));
0710 _mes.insert(std::make_pair(
0711 hash, ib.book1DD(_hashmap.getName(eid), _hashmap.getName(eid), _qx->nbins(), _qx->min(), _qx->max())));
0712
0713
0714 customize(_mes[hash]);
0715 }
0716 } else if (_hashmap.isTHash()) {
0717
0718 std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
0719 for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
0720 HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
0721 uint32_t hash = _hashmap.getHash(tid);
0722 MEMap::iterator mit = _mes.find(hash);
0723 if (mit != _mes.end())
0724 continue;
0725 if (filter.filter(tid))
0726 continue;
0727
0728 _logger.debug(_hashmap.getName(tid));
0729 _mes.insert(std::make_pair(
0730 hash, ib.book1DD(_hashmap.getName(tid), _hashmap.getName(tid), _qx->nbins(), _qx->min(), _qx->max())));
0731
0732 customize(_mes[hash]);
0733 }
0734 }
0735 }
0736
0737 void Container1D::customize(MonitorElement *me) {
0738
0739 me->setAxisTitle(_qx->name(), 1);
0740 me->setAxisTitle(_qy->name(), 2);
0741
0742
0743 TH1 *h = me->getTH1();
0744 _qx->setBits(h);
0745 _qy->setBits(h);
0746
0747
0748 std::vector<std::string> xlabels = _qx->getLabels();
0749 for (unsigned int i = 0; i < xlabels.size(); i++) {
0750 me->setBinLabel(i + 1, xlabels[i], 1);
0751 }
0752 }
0753
0754 void Container1D::extendAxisRange(int l) {
0755 if (l < _qx->nbins())
0756 return;
0757
0758
0759 for (auto const &pair : _mes) {
0760 int x = _qx->nbins();
0761 while (l >= x) {
0762 pair.second->getTH1()->LabelsInflate();
0763 x *= 2;
0764 _qx->setMax(x);
0765 }
0766 }
0767 }
0768
0769 void Container1D::showOverflowX(bool showOverflow) { _qx->showOverflow(showOverflow); }
0770
0771 void Container1D::showOverflowY(bool showOverflow) { _qy->showOverflow(showOverflow); }
0772
0773 }