File indexing completed on 2024-04-06 12:02:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "CondTools/DT/plugins/DTHVCheckByAbsoluteValues.h"
0014
0015
0016
0017
0018 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0019 #include "FWCore/PluginManager/interface/ModuleDef.h"
0020 #include "FWCore/ServiceRegistry/interface/ServiceMaker.h"
0021
0022
0023
0024
0025 #include <iostream>
0026
0027 namespace cond {
0028 namespace service {
0029
0030
0031
0032
0033
0034
0035
0036
0037 DTHVCheckByAbsoluteValues::DTHVCheckByAbsoluteValues(const edm::ParameterSet& iConfig, edm::ActivityRegistry& iAR) {
0038 if (instance == nullptr) {
0039 std::cout << "create DTHVCheckByAbsoluteValues" << std::endl;
0040 minHV = new float[4];
0041 maxHV = new float[4];
0042
0043
0044
0045
0046 minHV[0] = 3500.0;
0047 minHV[1] = 3500.0;
0048 minHV[2] = 1700.0;
0049 minHV[3] = 1100.0;
0050 maxHV[0] = 4000.0;
0051 maxHV[1] = 4000.0;
0052 maxHV[2] = 2200.0;
0053 maxHV[3] = 1600.0;
0054 maxCurrent = 30.0;
0055 instance = this;
0056 }
0057 }
0058
0059
0060
0061
0062 DTHVCheckByAbsoluteValues::~DTHVCheckByAbsoluteValues() {}
0063
0064
0065
0066
0067 DTHVAbstractCheck::flag DTHVCheckByAbsoluteValues::checkCurrentStatus(
0068 int rawId,
0069 int type,
0070 float valueA,
0071 float valueC,
0072 float valueS,
0073 const std::map<int, timedMeasurement>& snapshotValues,
0074 const std::map<int, int>& aliasMap,
0075 const std::map<int, int>& layerMap) {
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114 DTWireId chlId(rawId);
0115 int part = chlId.wire() - 10;
0116 DTHVAbstractCheck::flag flag;
0117 flag.a = flag.c = flag.s = 0;
0118 if (type == 1) {
0119 if (valueA < minHV[part])
0120 flag.a = 1;
0121 if (valueA > maxHV[part])
0122 flag.a = 2;
0123 if (valueS < minHV[2])
0124 flag.s = 1;
0125 if (valueS > maxHV[2])
0126 flag.s = 2;
0127 if (valueC < minHV[3])
0128 flag.c = 1;
0129 if (valueC > maxHV[3])
0130 flag.c = 2;
0131 }
0132 if (type == 2) {
0133 float voltA = 0.0;
0134 float voltS = 0.0;
0135 float voltC = 0.0;
0136 DTLayerId lay = chlId.layerId();
0137 int l_p = chlId.wire();
0138 DTWireId chA(lay, l_p);
0139 DTWireId chS(lay, 12);
0140 DTWireId chC(lay, 13);
0141 std::map<int, int>::const_iterator layerIter;
0142 std::map<int, int>::const_iterator layerIend = layerMap.end();
0143 std::map<int, timedMeasurement>::const_iterator snapIter;
0144 std::map<int, timedMeasurement>::const_iterator snapIend = snapshotValues.end();
0145 int chan;
0146 if ((layerIter = layerMap.find(chA.rawId())) != layerIend) {
0147 chan = (layerIter->second * 10) + l_p;
0148 if ((snapIter = snapshotValues.find(chan)) != snapIend) {
0149 voltA = snapIter->second.second;
0150 }
0151 }
0152 if ((layerIter = layerMap.find(chS.rawId())) != layerIend) {
0153 chan = (layerIter->second * 10) + 2;
0154 if ((snapIter = snapshotValues.find(chan)) != snapIend) {
0155 voltS = snapIter->second.second;
0156 }
0157 }
0158 if ((layerIter = layerMap.find(chC.rawId())) != layerIend) {
0159 chan = (layerIter->second * 10) + 3;
0160 if ((snapIter = snapshotValues.find(chan)) != snapIend) {
0161 voltC = snapIter->second.second;
0162 }
0163 }
0164 if ((valueA > maxCurrent) && (voltA >= minHV[part]))
0165 flag.a = 4;
0166 if ((valueS > maxCurrent) && (voltS >= minHV[2]))
0167 flag.s = 4;
0168 if ((valueC > maxCurrent) && (voltC >= minHV[3]))
0169 flag.c = 4;
0170 }
0171 return flag;
0172 }
0173
0174 DEFINE_FWK_SERVICE(DTHVCheckByAbsoluteValues);
0175 }
0176 }