File indexing completed on 2024-04-06 12:07:18
0001 #include "DQM/EcalMonitorDbModule/interface/LogicIDTranslation.h"
0002
0003 #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
0004
0005 #include "FWCore/Utilities/interface/Exception.h"
0006
0007 namespace ecaldqm {
0008 EcalLogicID ecalID() { return EcalLogicID("ECAL", 1); }
0009
0010 EcalLogicID subdetID(EcalSubdetector _subdet) {
0011 switch (_subdet) {
0012 case EcalBarrel:
0013 return EcalLogicID("EB", 1000000000UL);
0014 case EcalEndcap:
0015 return EcalLogicID("EE", 2000000000UL);
0016 default:
0017 throw cms::Exception("UndefinedLogicID");
0018 }
0019 }
0020
0021 EcalLogicID crystalID(DetId const &_id, EcalElectronicsMapping const *electronicsMap) {
0022 unsigned iDCC(dccId(_id, electronicsMap) - 1);
0023 if (iDCC <= kEEmHigh || iDCC >= kEEpLow) {
0024 EEDetId eeid(_id);
0025 return EcalLogicID("EE_crystal_number",
0026 2010000000UL + 1000000 * (eeid.positiveZ() ? 2 : 0) + 1000 * eeid.ix() + eeid.iy(),
0027 eeid.zside(),
0028 eeid.ix(),
0029 eeid.iy());
0030 } else {
0031 int ism(iDCC <= kEBmHigh ? 19 + iDCC - kEBmLow : 1 + iDCC - kEBpLow);
0032 EBDetId ebid(_id);
0033 return EcalLogicID("EB_crystal_number", 1011000000UL + 10000 * ism + ebid.ic(), ism, ebid.ic());
0034 }
0035 }
0036
0037 EcalLogicID towerID(EcalElectronicsId const &_id) {
0038 unsigned iDCC(_id.dccId() - 1);
0039 if (iDCC <= kEEmHigh || iDCC >= kEEpLow) {
0040 return EcalLogicID(
0041 "EE_readout_tower", 2110000000UL + 100 * (601 + iDCC) + _id.towerId(), 601 + iDCC, _id.towerId());
0042 } else {
0043 int ism(iDCC <= kEBmHigh ? 19 + iDCC - kEBmLow : 1 + iDCC - kEBpLow);
0044 return EcalLogicID("EB_trigger_tower", 1021000000UL + 10000 * ism + _id.towerId(), ism, _id.towerId());
0045 }
0046 }
0047
0048 EcalLogicID memChannelID(EcalPnDiodeDetId const &_id) {
0049
0050
0051 unsigned iDCC(_id.iDCCId() - 1);
0052 int memId((_id.iPnId() - 1) % 5 + ((_id.iPnId() - 1) / 5) * 25 + 1);
0053 if (iDCC <= kEEmHigh || iDCC >= kEEpLow) {
0054 return EcalLogicID("EE_mem_channel", 100 * (601 + iDCC) + memId, 601 + iDCC, memId);
0055 } else {
0056 int ism(iDCC <= kEBmHigh ? 19 + iDCC - kEBmLow : 1 + iDCC - kEBpLow);
0057 return EcalLogicID("EB_mem_channel", 1191000000UL + 10000 * ism + memId, ism, memId);
0058 }
0059 }
0060
0061 EcalLogicID memTowerID(EcalElectronicsId const &_id) {
0062 unsigned iDCC(_id.dccId() - 1);
0063 if (iDCC <= kEEmHigh || iDCC >= kEEpLow) {
0064 return EcalLogicID("EE_mem_TT", 100 * (601 + iDCC) + _id.towerId(), 601 + iDCC, _id.towerId());
0065 } else {
0066 int ism(iDCC <= kEBmHigh ? 19 + iDCC - kEBmLow : 1 + iDCC - kEBpLow);
0067 return EcalLogicID("EB_mem_TT", 1181000000UL + 10000 * ism + _id.towerId(), ism, _id.towerId());
0068 }
0069 }
0070
0071 EcalLogicID lmPNID(EcalPnDiodeDetId const &_id) {
0072 unsigned iDCC(_id.iDCCId() - 1);
0073 int pnid(_id.iPnId());
0074 if (iDCC <= kEEmHigh || iDCC >= kEEpLow) {
0075 return EcalLogicID("EE_LM_PN", 100 * (601 + iDCC) + pnid, 601 + iDCC, pnid);
0076 } else {
0077 int ism(iDCC <= kEBmHigh ? 19 + iDCC - kEBmLow : 1 + iDCC - kEBpLow);
0078 return EcalLogicID("EB_LM_PN", 1131000000UL + 10000 * ism + pnid, ism, pnid);
0079 }
0080 }
0081
0082 DetId toDetId(EcalLogicID const &_id) { return DetId(); }
0083 }