CMS 3D CMS Logo

StatusManager.cc
Go to the documentation of this file.
2 
4 
6 
8 
13 
14 #include "TObjArray.h"
15 #include "TPRegexp.h"
16 #include "TString.h"
17 
18 namespace ecaldqm {
19 
20  StatusManager::StatusManager() : dictionary_(), status_() {
21  dictionary_["CH_ID_ERROR"] = 0x1 << EcalDQMStatusHelper::CH_ID_ERROR;
22  dictionary_["CH_GAIN_ZERO_ERROR"] = 0x1 << EcalDQMStatusHelper::CH_GAIN_ZERO_ERROR;
23  dictionary_["CH_GAIN_SWITCH_ERROR"] = 0x1 << EcalDQMStatusHelper::CH_GAIN_SWITCH_ERROR;
24  dictionary_["TT_ID_ERROR"] = 0x1 << EcalDQMStatusHelper::TT_ID_ERROR;
25  dictionary_["TT_SIZE_ERROR"] = 0x1 << EcalDQMStatusHelper::TT_SIZE_ERROR;
26 
27  dictionary_["PEDESTAL_LOW_GAIN_MEAN_ERROR"] = 0x1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR;
28  dictionary_["PEDESTAL_MIDDLE_GAIN_MEAN_ERROR"] = 0x1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR;
29  dictionary_["PEDESTAL_HIGH_GAIN_MEAN_ERROR"] = 0x1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR;
30  dictionary_["PEDESTAL_LOW_GAIN_RMS_ERROR"] = 0x1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR;
31  dictionary_["PEDESTAL_MIDDLE_GAIN_RMS_ERROR"] = 0x1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR;
32  dictionary_["PEDESTAL_HIGH_GAIN_RMS_ERROR"] = 0x1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR;
33 
34  dictionary_["PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR"] = 0x1
36  dictionary_["PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR"] = 0x1
38 
39  dictionary_["TESTPULSE_LOW_GAIN_MEAN_ERROR"] = 0x1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_MEAN_ERROR;
40  dictionary_["TESTPULSE_MIDDLE_GAIN_MEAN_ERROR"] = 0x1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_MEAN_ERROR;
41  dictionary_["TESTPULSE_HIGH_GAIN_MEAN_ERROR"] = 0x1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_MEAN_ERROR;
42  dictionary_["TESTPULSE_LOW_GAIN_RMS_ERROR"] = 0x1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_RMS_ERROR;
43  dictionary_["TESTPULSE_MIDDLE_GAIN_RMS_ERROR"] = 0x1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_RMS_ERROR;
44  dictionary_["TESTPULSE_HIGH_GAIN_RMS_ERROR"] = 0x1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_RMS_ERROR;
45 
46  dictionary_["LASER_MEAN_ERROR"] = 0x1 << EcalDQMStatusHelper::LASER_MEAN_ERROR;
47  dictionary_["LASER_RMS_ERROR"] = 0x1 << EcalDQMStatusHelper::LASER_RMS_ERROR;
48  dictionary_["LASER_TIMING_MEAN_ERROR"] = 0x1 << EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR;
49  dictionary_["LASER_TIMING_RMS_ERROR"] = 0x1 << EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR;
50 
51  dictionary_["LED_MEAN_ERROR"] = 0x1 << EcalDQMStatusHelper::LED_MEAN_ERROR;
52  dictionary_["LED_RMS_ERROR"] = 0x1 << EcalDQMStatusHelper::LED_RMS_ERROR;
53  dictionary_["LED_TIMING_MEAN_ERROR"] = 0x1 << EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR;
54  dictionary_["LED_TIMING_RMS_ERROR"] = 0x1 << EcalDQMStatusHelper::LED_TIMING_RMS_ERROR;
55 
56  dictionary_["STATUS_FLAG_ERROR"] = 0x1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR;
57 
58  dictionary_["PHYSICS_BAD_CHANNEL_WARNING"] = 0x1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING;
59  dictionary_["PHYSICS_BAD_CHANNEL_ERROR"] = 0x1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_ERROR;
60 
61  dictionary_["disabled_channel"] =
71 
72  dictionary_["dead_channel"] =
92 
101 
108 
109  dictionary_["laser_problem"] =
112 
113  dictionary_["led_problem"] =
116 
122  }
123 
124  void StatusManager::readFromStream(std::istream &_input) {
125  TPRegexp linePat(
126  "^[ ]*(Crystal|TT|PN)[ ]+(EB[0-9+-]*|EE[0-9+-]*|[0-9]+)[ "
127  "]+([0-9]+)[ ]([a-zA-Z_]+)");
128 
130  while (true) {
131  std::getline(_input, line);
132  if (!_input.good())
133  break;
134 
135  if (!linePat.MatchB(line))
136  continue;
137 
138  TObjArray *matches(linePat.MatchS(line));
139  TString channelType(matches->At(1)->GetName());
140  TString module(matches->At(2)->GetName());
141  unsigned channel(TString(matches->At(3)->GetName()).Atoi());
142  TString statusName(matches->At(4)->GetName());
143  delete matches;
144 
145  std::map<std::string, uint32_t>::const_iterator dItr(dictionary_.find(statusName.Data()));
146  if (dItr == dictionary_.end())
147  continue;
148  uint32_t statusVal(dItr->second);
149 
150  if (channelType == "Crystal") {
151  // module: Subdetector name, channel: dense ID
152  // Store using EBDetId and EEDetId as keys (following
153  // EcalDQMChannelStatus)
154 
155  if (module == "EB") {
156  if (!EBDetId::validDenseIndex(channel))
157  continue;
158  status_.insert(std::pair<uint32_t, uint32_t>(EBDetId::unhashIndex(channel).rawId(), statusVal));
159  } else if (module == "EE") {
160  if (!EEDetId::validDenseIndex(channel))
161  continue;
162  status_.insert(std::pair<uint32_t, uint32_t>(EEDetId::unhashIndex(channel).rawId(), statusVal));
163  }
164  } else if (channelType == "TT") {
165  // module: Supermodule name, channel: RU ID (electronics ID tower)
166  // Store using EcalTrigTowerDetId and EcalScDetId as keys (following
167  // EcalDQMTowerStatus)
168 
169  if (module.Contains("EB")) {
170  /* TODO CHECK THIS */
171 
172  int iEta((channel - 1) / 4 + 1);
173  int zside(0);
174  int iPhi(0);
175  if (module(3) == '-') {
176  zside = -1;
177  iPhi = (channel - 1) % 4 + 1;
178  } else {
179  zside = 1;
180  iPhi = (68 - channel) % 4 + 1;
181  }
182 
183  status_.insert(
184  std::pair<uint32_t, uint32_t>(EcalTrigTowerDetId(zside, EcalBarrel, iEta, iPhi).rawId(), statusVal));
185  } else if (module.Contains("EE")) {
186  std::vector<EcalScDetId> scIds(getElectronicsMap()->getEcalScDetId(dccId(module.Data()), channel, false));
187  for (unsigned iS(0); iS != scIds.size(); ++iS)
188  status_.insert(std::pair<uint32_t, uint32_t>(scIds[iS].rawId(), statusVal));
189  }
190  } else if (channelType == "PN") {
191  // module: DCC ID, channel: iPN
192  // Store using EcalPnDiodeDetId as keys
193  unsigned iDCC(module.Atoi() - 1);
194  int subdet(iDCC <= kEEmHigh || iDCC >= kEEpLow ? EcalEndcap : EcalBarrel);
195  status_.insert(std::pair<uint32_t, uint32_t>(EcalPnDiodeDetId(subdet, iDCC + 1, channel).rawId(), statusVal));
196  }
197  }
198  }
199 
200  void StatusManager::readFromObj(EcalDQMChannelStatus const &_channelStatus, EcalDQMTowerStatus const &_towerStatus) {
201  EcalDQMChannelStatus::Items const &barrelChStatus(_channelStatus.barrelItems());
202  for (unsigned iC(0); iC != EBDetId::kSizeForDenseIndexing; ++iC)
203  status_.insert(
204  std::pair<uint32_t, uint32_t>(EBDetId::unhashIndex(iC).rawId(), barrelChStatus[iC].getStatusCode()));
205 
206  EcalDQMChannelStatus::Items const &endcapChStatus(_channelStatus.endcapItems());
207  for (unsigned iC(0); iC != EEDetId::kSizeForDenseIndexing; ++iC)
208  status_.insert(
209  std::pair<uint32_t, uint32_t>(EEDetId::unhashIndex(iC).rawId(), endcapChStatus[iC].getStatusCode()));
210 
211  EcalDQMTowerStatus::Items const &barrelTowStatus(_towerStatus.barrelItems());
212  for (unsigned iC(0); iC != EcalTrigTowerDetId::kEBTotalTowers; ++iC)
213  status_.insert(std::pair<uint32_t, uint32_t>(EcalTrigTowerDetId::detIdFromDenseIndex(iC).rawId(),
214  barrelTowStatus[iC].getStatusCode()));
215 
216  EcalDQMTowerStatus::Items const &endcapTowStatus(_towerStatus.endcapItems());
217  for (unsigned iC(0); iC != EcalScDetId::kSizeForDenseIndexing; ++iC)
218  status_.insert(
219  std::pair<uint32_t, uint32_t>(EcalScDetId::unhashIndex(iC).rawId(), endcapTowStatus[iC].getStatusCode()));
220  }
221 
222  void StatusManager::writeToStream(std::ostream &_output) const {}
223 
224  void StatusManager::writeToObj(EcalDQMChannelStatus &_channelStatus, EcalDQMTowerStatus &_towerStatus) const {
225  for (unsigned iC(0); iC != EBDetId::kSizeForDenseIndexing; ++iC) {
226  uint32_t key(EBDetId::unhashIndex(iC).rawId());
227  _channelStatus.setValue(key, EcalDQMStatusCode(getStatus(key)));
228  }
229 
230  for (unsigned iC(0); iC != EEDetId::kSizeForDenseIndexing; ++iC) {
231  uint32_t key(EEDetId::unhashIndex(iC).rawId());
232  _channelStatus.setValue(key, EcalDQMStatusCode(getStatus(key)));
233  }
234 
235  for (unsigned iC(0); iC != EcalTrigTowerDetId::kEBTotalTowers; ++iC) {
237  _towerStatus.setValue(key, EcalDQMStatusCode(getStatus(key)));
238  }
239 
240  for (unsigned iC(0); iC != EcalScDetId::kSizeForDenseIndexing; ++iC) {
241  uint32_t key(EcalScDetId::unhashIndex(iC));
242  _towerStatus.setValue(key, EcalDQMStatusCode(getStatus(key)));
243  }
244  }
245 
246  uint32_t StatusManager::getStatus(uint32_t _key) const {
247  std::map<uint32_t, uint32_t>::const_iterator itr(status_.find(_key));
248  if (itr == status_.end())
249  return 0;
250  return itr->second;
251  }
252 
253 } // namespace ecaldqm
EcalDQMStatusHelper::LED_RMS_ERROR
static const int LED_RMS_ERROR
Definition: EcalDQMStatusHelper.h:40
EcalDQMStatusHelper::LED_MEAN_ERROR
static const int LED_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:39
ecaldqm
Definition: DQWorker.h:24
EcalCondObjectContainer::endcapItems
const Items & endcapItems() const
Definition: EcalCondObjectContainer.h:32
EcalDQMStatusHelper::LASER_MEAN_ERROR
static const int LASER_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:34
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_RMS_ERROR
static const int TESTPULSE_LOW_GAIN_RMS_ERROR
Definition: EcalDQMStatusHelper.h:30
EEDetId::unhashIndex
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
EBDetId.h
EEDetId.h
EBDetId::unhashIndex
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
EcalScDetId::unhashIndex
static EcalScDetId unhashIndex(int hi)
Definition: EcalScDetId.h:117
EcalDQMStatusCode
Definition: EcalDQMStatusCode.h:9
EcalDQMStatusHelper::STATUS_FLAG_ERROR
static const int STATUS_FLAG_ERROR
Definition: EcalDQMStatusHelper.h:44
EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR
static const int LED_TIMING_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:41
EcalPnDiodeDetId
Definition: EcalPnDiodeDetId.h:22
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR
static const int LASER_TIMING_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:36
EcalCondObjectContainer< EcalDQMStatusCode >
ecaldqm::StatusManager::readFromStream
void readFromStream(std::istream &)
Definition: StatusManager.cc:124
EcalBarrel
Definition: EcalSubdetector.h:10
EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_MEAN_ERROR
static const int TESTPULSE_HIGH_GAIN_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:29
ecaldqm::StatusManager::StatusManager
StatusManager()
Definition: StatusManager.cc:20
EcalDQMStatusHelper.h
EcalCondTowerObjectContainer< EcalDQMStatusCode >
ecaldqm::StatusManager::readFromObj
void readFromObj(EcalDQMChannelStatus const &, EcalDQMTowerStatus const &)
Definition: StatusManager.cc:200
EEDetId::validDenseIndex
static bool validDenseIndex(uint32_t din)
Definition: EEDetId.h:213
StatusManager.h
EEDetId::kSizeForDenseIndexing
Definition: EEDetId.h:329
Exception.h
EcalCondTowerObjectContainer< EcalDQMStatusCode >::Items
std::vector< Item > Items
Definition: EcalCondTowerObjectContainer.h:18
EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR
static const int LASER_TIMING_RMS_ERROR
Definition: EcalDQMStatusHelper.h:37
EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_RMS_ERROR
static const int TESTPULSE_MIDDLE_GAIN_RMS_ERROR
Definition: EcalDQMStatusHelper.h:31
EcalDQMStatusHelper::TT_SIZE_ERROR
static const int TT_SIZE_ERROR
Definition: EcalDQMStatusHelper.h:15
EcalCondObjectContainer::barrelItems
const Items & barrelItems() const
Definition: EcalCondObjectContainer.h:30
EcalDQMStatusHelper::CH_ID_ERROR
static const int CH_ID_ERROR
Definition: EcalDQMStatusHelper.h:11
EcalTrigTowerDetId.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR
static const int PEDESTAL_LOW_GAIN_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:17
EcalDQMStatusHelper::TT_ID_ERROR
static const int TT_ID_ERROR
Definition: EcalDQMStatusHelper.h:14
EcalEndcap
Definition: EcalSubdetector.h:10
EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_MEAN_ERROR
static const int TESTPULSE_MIDDLE_GAIN_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:28
EcalCondObjectContainer::setValue
void setValue(const uint32_t id, const Item &item)
Definition: EcalCondObjectContainer.h:78
EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR
static const int PEDESTAL_HIGH_GAIN_RMS_ERROR
Definition: EcalDQMStatusHelper.h:22
EcalDQMStatusHelper::CH_GAIN_ZERO_ERROR
static const int CH_GAIN_ZERO_ERROR
Definition: EcalDQMStatusHelper.h:12
EBDetId::validDenseIndex
static bool validDenseIndex(uint32_t din)
Definition: EBDetId.h:105
ecaldqm::StatusManager::writeToStream
void writeToStream(std::ostream &) const
Definition: StatusManager.cc:222
EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_MEAN_ERROR
static const int TESTPULSE_LOW_GAIN_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:27
EcalDQMStatusHelper::LED_TIMING_RMS_ERROR
static const int LED_TIMING_RMS_ERROR
Definition: EcalDQMStatusHelper.h:42
EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR
static const int PEDESTAL_MIDDLE_GAIN_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:18
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
module
Definition: vlib.h:198
ecaldqm::StatusManager::writeToObj
void writeToObj(EcalDQMChannelStatus &, EcalDQMTowerStatus &) const
Definition: StatusManager.cc:224
EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR
static const int PEDESTAL_HIGH_GAIN_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:19
EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR
static const int PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:24
EcalTrigTowerDetId::kEBTotalTowers
Definition: EcalTrigTowerDetId.h:116
EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING
static const int PHYSICS_BAD_CHANNEL_WARNING
Definition: EcalDQMStatusHelper.h:46
ecaldqm::StatusManager::getStatus
uint32_t getStatus(uint32_t) const
Definition: StatusManager.cc:246
ecaldqm::StatusManager::dictionary_
std::map< std::string, uint32_t > dictionary_
Definition: StatusManager.h:27
EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
static const int PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
Definition: EcalDQMStatusHelper.h:25
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR
static const int PEDESTAL_LOW_GAIN_RMS_ERROR
Definition: EcalDQMStatusHelper.h:20
EcalDQMStatusHelper::CH_GAIN_SWITCH_ERROR
static const int CH_GAIN_SWITCH_ERROR
Definition: EcalDQMStatusHelper.h:13
EcalCondObjectContainer< EcalDQMStatusCode >::Items
std::vector< Item > Items
Definition: EcalCondObjectContainer.h:18
EcalScDetId.h
ecaldqm::kEEpLow
Definition: EcalDQMCommonUtils.h:83
ecaldqm::StatusManager::status_
std::map< uint32_t, uint32_t > status_
Definition: StatusManager.h:28
EBDetId::kSizeForDenseIndexing
Definition: EBDetId.h:155
EcalTrigTowerDetId::detIdFromDenseIndex
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
Definition: EcalTrigTowerDetId.cc:104
patCandidatesForDimuonsSequences_cff.matches
matches
Definition: patCandidatesForDimuonsSequences_cff.py:131
EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_RMS_ERROR
static const int TESTPULSE_HIGH_GAIN_RMS_ERROR
Definition: EcalDQMStatusHelper.h:32
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
EcalCondTowerObjectContainer::setValue
void setValue(const uint32_t id, const Item &item)
Definition: EcalCondTowerObjectContainer.h:69
EcalScDetId::kSizeForDenseIndexing
Definition: EcalScDetId.h:188
ecaldqm::getElectronicsMap
const EcalElectronicsMapping * getElectronicsMap()
Definition: EcalDQMCommonUtils.cc:438
EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_ERROR
static const int PHYSICS_BAD_CHANNEL_ERROR
Definition: EcalDQMStatusHelper.h:47
EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR
static const int PEDESTAL_MIDDLE_GAIN_RMS_ERROR
Definition: EcalDQMStatusHelper.h:21
mps_splice.line
line
Definition: mps_splice.py:76
crabWrapper.key
key
Definition: crabWrapper.py:19
EcalDQMStatusHelper::LASER_RMS_ERROR
static const int LASER_RMS_ERROR
Definition: EcalDQMStatusHelper.h:35
EcalCondTowerObjectContainer::barrelItems
const Items & barrelItems() const
Definition: EcalCondTowerObjectContainer.h:30
EcalDQMCommonUtils.h
EcalCondTowerObjectContainer::endcapItems
const Items & endcapItems() const
Definition: EcalCondTowerObjectContainer.h:32
ecaldqm::dccId
unsigned dccId(DetId const &)
Definition: EcalDQMCommonUtils.cc:16