Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-09 23:01:17

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