Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:10:09

0001 #include "DQM/HcalCommon/interface/ContainerProf1D.h"
0002 
0003 namespace hcaldqm {
0004   using namespace mapper;
0005   using namespace quantity;
0006   using namespace constants;
0007 
0008   ContainerProf1D::ContainerProf1D() {
0009     _qx = nullptr;
0010     _qy = nullptr;
0011   }
0012 
0013   ContainerProf1D::ContainerProf1D(std::string const &folder,
0014                                    hashfunctions::HashType hashtype,
0015                                    Quantity *qx,
0016                                    Quantity *qy)
0017       : Container1D(folder, hashtype, qx, qy) {
0018     _qx->setAxisType(quantity::fXAxis);
0019     _qy->setAxisType(quantity::fYAxis);
0020   }
0021 
0022   /* virtual */ void ContainerProf1D::initialize(
0023       std::string const &folder, hashfunctions::HashType hashtype, Quantity *qx, Quantity *qy, int debug /*=0*/) {
0024     Container1D::initialize(folder, hashtype, qx, qy, debug);
0025     _qx->setAxisType(quantity::fXAxis);
0026     _qy->setAxisType(quantity::fYAxis);
0027   }
0028 
0029   /* virtual */ void ContainerProf1D::initialize(std::string const &folder,
0030                                                  std::string const &qname,
0031                                                  hashfunctions::HashType hashtype,
0032                                                  Quantity *qx,
0033                                                  Quantity *qy,
0034                                                  int debug /*=0*/) {
0035     Container1D::initialize(folder, qname, hashtype, qx, qy, debug);
0036     _qx->setAxisType(quantity::fXAxis);
0037     _qy->setAxisType(quantity::fYAxis);
0038   }
0039 
0040   /* virtual */ void ContainerProf1D::book(DQMStore::IBooker &ib,
0041                                            HcalElectronicsMap const *emap,
0042                                            std::string subsystem,
0043                                            std::string aux) {
0044     //  check Container1D.cc for the format
0045     //
0046     ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" +
0047                         _hashmap.getHashTypeName());
0048     if (_hashmap.isDHash()) {
0049       std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
0050       for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
0051         //  skip trigger towers and calibration
0052         if (!it->isHcalDetId())
0053           continue;
0054 
0055         HcalDetId did = HcalDetId(it->rawId());
0056         uint32_t hash = _hashmap.getHash(did);
0057         MEMap::iterator mit = _mes.find(hash);
0058         if (mit != _mes.end())
0059           continue;
0060 
0061         _logger.debug(_hashmap.getName(did));
0062         _mes.insert(std::make_pair(hash,
0063                                    ib.bookProfile(_hashmap.getName(did),
0064                                                   _hashmap.getName(did),
0065                                                   _qx->nbins(),
0066                                                   _qx->min(),
0067                                                   _qx->max(),
0068                                                   _qy->min(),
0069                                                   _qy->max())));
0070         customize(_mes[hash]);
0071       }
0072     } else if (_hashmap.isEHash()) {
0073       std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
0074       for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
0075         HcalElectronicsId eid = HcalElectronicsId(it->rawId());
0076         uint32_t hash = _hashmap.getHash(eid);
0077         MEMap::iterator mit = _mes.find(hash);
0078         if (mit != _mes.end())
0079           continue;
0080 
0081         _logger.debug(_hashmap.getName(eid));
0082         _mes.insert(std::make_pair(hash,
0083                                    ib.bookProfile(_hashmap.getName(eid),
0084                                                   _hashmap.getName(eid),
0085                                                   _qx->nbins(),
0086                                                   _qx->min(),
0087                                                   _qx->max(),
0088                                                   _qy->min(),
0089                                                   _qy->max())));
0090         customize(_mes[hash]);
0091       }
0092     } else if (_hashmap.isTHash()) {
0093       std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
0094       for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
0095         HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
0096         uint32_t hash = _hashmap.getHash(tid);
0097         MEMap::iterator mit = _mes.find(hash);
0098         if (mit != _mes.end())
0099           continue;
0100 
0101         _logger.debug(_hashmap.getName(tid));
0102         _mes.insert(std::make_pair(hash,
0103                                    ib.bookProfile(_hashmap.getName(tid),
0104                                                   _hashmap.getName(tid),
0105                                                   _qx->nbins(),
0106                                                   _qx->min(),
0107                                                   _qx->max(),
0108                                                   _qy->min(),
0109                                                   _qy->max())));
0110         customize(_mes[hash]);
0111       }
0112     }
0113   }
0114 
0115   /* virtual */ void ContainerProf1D::book(DQMStore::IBooker &ib,
0116                                            HcalElectronicsMap const *emap,
0117                                            filter::HashFilter const &filter,
0118                                            std::string subsystem,
0119                                            std::string aux) {
0120     //  check Container1D.cc for the format
0121     //
0122     ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" +
0123                         _hashmap.getHashTypeName());
0124     if (_hashmap.isDHash()) {
0125       std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
0126       for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
0127         //  skip trigger towers and calibration
0128         if (!it->isHcalDetId())
0129           continue;
0130 
0131         HcalDetId did = HcalDetId(it->rawId());
0132         uint32_t hash = _hashmap.getHash(did);
0133         MEMap::iterator mit = _mes.find(hash);
0134         if (mit != _mes.end())
0135           continue;
0136         if (filter.filter(did))
0137           continue;
0138 
0139         _logger.debug(_hashmap.getName(did));
0140         _mes.insert(std::make_pair(hash,
0141                                    ib.bookProfile(_hashmap.getName(did),
0142                                                   _hashmap.getName(did),
0143                                                   _qx->nbins(),
0144                                                   _qx->min(),
0145                                                   _qx->max(),
0146                                                   _qy->min(),
0147                                                   _qy->max())));
0148         customize(_mes[hash]);
0149       }
0150     } else if (_hashmap.isEHash()) {
0151       std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
0152       for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
0153         HcalElectronicsId eid = HcalElectronicsId(it->rawId());
0154         uint32_t hash = _hashmap.getHash(eid);
0155         MEMap::iterator mit = _mes.find(hash);
0156         if (mit != _mes.end())
0157           continue;
0158         if (filter.filter(eid))
0159           continue;
0160 
0161         _logger.debug(_hashmap.getName(eid));
0162         _mes.insert(std::make_pair(hash,
0163                                    ib.bookProfile(_hashmap.getName(eid),
0164                                                   _hashmap.getName(eid),
0165                                                   _qx->nbins(),
0166                                                   _qx->min(),
0167                                                   _qx->max(),
0168                                                   _qy->min(),
0169                                                   _qy->max())));
0170         customize(_mes[hash]);
0171       }
0172     } else if (_hashmap.isTHash()) {
0173       std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
0174       for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
0175         HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
0176         uint32_t hash = _hashmap.getHash(tid);
0177         MEMap::iterator mit = _mes.find(hash);
0178         if (mit != _mes.end())
0179           continue;
0180         if (filter.filter(tid))
0181           continue;
0182 
0183         _logger.debug(_hashmap.getName(tid));
0184         _mes.insert(std::make_pair(hash,
0185                                    ib.bookProfile(_hashmap.getName(tid),
0186                                                   _hashmap.getName(tid),
0187                                                   _qx->nbins(),
0188                                                   _qx->min(),
0189                                                   _qx->max(),
0190                                                   _qy->min(),
0191                                                   _qy->max())));
0192         customize(_mes[hash]);
0193       }
0194     }
0195   }
0196 }  // namespace hcaldqm