File indexing completed on 2024-04-06 12:02:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "CondTools/DT/interface/DTHVHandler.h"
0014
0015
0016
0017
0018 #include "CondFormats/DTObjects/interface/DTHVStatus.h"
0019 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0020 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0021 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 DTHVHandler::DTHVHandler() : objectPtr(nullptr) {}
0037
0038
0039
0040
0041
0042
0043
0044
0045 DTHVHandler::DTHVHandler(const DTHVStatus* dbObject) : objectPtr(dbObject) {}
0046
0047
0048
0049
0050 DTHVHandler::~DTHVHandler() {}
0051
0052
0053
0054
0055 int DTHVHandler::get(const DTWireId& id, int& flagA, int& flagC, int& flagS) const {
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 flagA = flagC = flagS = 0;
0070 if (objectPtr == nullptr)
0071 return 999;
0072 int iCell = id.wire();
0073 int fCell;
0074 int lCell;
0075 int fCheck = objectPtr->get(
0076 id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), 0, fCell, lCell, flagA, flagC, flagS);
0077 if ((fCheck == 0) && (fCell <= iCell) && (lCell >= iCell))
0078 return 0;
0079 fCheck = objectPtr->get(
0080 id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), 1, fCell, lCell, flagA, flagC, flagS);
0081 if ((fCheck == 0) && (fCell <= iCell) && (lCell >= iCell))
0082 return 0;
0083 flagA = flagC = flagS = 0;
0084 return 1;
0085 }
0086
0087 int DTHVHandler::offChannelsNumber() const {
0088 int offNum = 0;
0089 DTHVStatus::const_iterator iter = objectPtr->begin();
0090 DTHVStatus::const_iterator iend = objectPtr->end();
0091 while (iter != iend) {
0092 const std::pair<DTHVStatusId, DTHVStatusData>& entry = *iter++;
0093 DTHVStatusId hvId = entry.first;
0094 DTHVStatusData data = entry.second;
0095 if (data.flagA || data.flagC || data.flagS)
0096 offNum += (1 + data.lCell - data.fCell);
0097 }
0098 return offNum;
0099 }
0100
0101 int DTHVHandler::offChannelsNumber(const DTChamberId& id) const {
0102 int offNum = 0;
0103 DTHVStatus::const_iterator iter = objectPtr->begin();
0104 DTHVStatus::const_iterator iend = objectPtr->end();
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119 while (iter != iend) {
0120 const std::pair<DTHVStatusId, DTHVStatusData>& entry = *iter++;
0121 DTHVStatusId hvId = entry.first;
0122 DTHVStatusData data = entry.second;
0123 if ((hvId.wheelId == id.wheel()) && (hvId.stationId == id.station()) && (hvId.sectorId == id.sector()) &&
0124 (data.flagA || data.flagC || data.flagS))
0125 offNum += (1 + data.lCell - data.fCell);
0126 }
0127 return offNum;
0128
0129 }
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167