45 std::string MuonVersion = geoModel->muonVersionOverride();
46 std::string detectorKey = MuonVersion.empty() ?
AtlasVersion : MuonVersion;
47 std::string detectorNode = MuonVersion.empty() ?
"ATLAS" :
"MuonSpectrometer";
52 IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr(
"HwSwIdMapping", detectorKey, detectorNode);
54 if ((*switchSet).size() == 0) {
56 switchSet = accessSvc->getRecordsetPtr(
"HwSwIdMapping",
"HwSwIdMapping-00");
59 for (
unsigned int irow = 0; irow < (*switchSet).size(); ++irow) {
60 const IRDBRecord* switches = (*switchSet)[irow];
61 std::string hardwareName = switches->
getString(
"HARDNAME");
62 std::string stName = switches->
getString(
"SOFTNAME");
63 int stPhi = switches->
getInt(
"SOFTOCTANT");
64 int stEta = switches->
getInt(
"SOFTIZ");
72 return StatusCode::SUCCESS;
77 return StatusCode::SUCCESS;
80 if (!readHandle.isValid()) {
82 return StatusCode::FAILURE;
84 wh.addDependency(readHandle);
85 return StatusCode::SUCCESS;
99 return StatusCode::SUCCESS;
108 return StatusCode::SUCCESS;
113 if (writeHandle.isValid()) {
114 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
115 <<
" In theory this should not be called, but may happen"
116 <<
" if multiple concurrent events are being processed out of order.");
117 return StatusCode::SUCCESS;
119 std::unique_ptr<MdtCondDbData> writeCdo{std::make_unique<MdtCondDbData>(
m_idHelperSvc->mdtIdHelper())};
136 ATH_CHECK(writeHandle.record(std::move(writeCdo)));
137 ATH_MSG_DEBUG(
"Recorded new " << writeHandle.key() <<
" with range " << writeHandle.getRange() <<
" into Conditions Store");
139 return StatusCode::SUCCESS;
148 return StatusCode::FAILURE;
151 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
153 std::vector<Identifier> cachedDeadMultiLayersId_standby;
155 const unsigned int chanNum = itr.first;
157 const std::string& hv_payload = readCdo->chanName(
chanNum);
160 if (atr.size() == 1) {
161 hv_name = *(
static_cast<const std::string*
>((atr[
"fsm_currentState"]).addressOfData()));
164 auto tokens2 =
tokenize(hv_payload,
"_");
167 int multilayer =
atoi(tokens2[3]);
170 if (ChamberId.is_valid()) {
174 cachedDeadMultiLayersId_standby.push_back(MultiLayerId);
177 if (
tokens[0] ==
"STANDBY") {
178 int multilayer =
atoi(tokens2[3]);
181 if (ChamberId.is_valid()) {
185 cachedDeadMultiLayersId_standby.push_back(MultiLayerId);
194 std::map<Identifier, float> chamberML_V1;
195 std::map<Identifier, float> chamberML_V0;
202 return StatusCode::FAILURE;
205 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle_v0.fullKey() <<
" readCdo->size()= " << readCdo_v0->size());
212 return StatusCode::FAILURE;
215 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle_v1.fullKey() <<
" readCdo->size()= " << readCdo_v1->size());
219 const unsigned int chanNum = itr_v0.first;
221 const std::string& setPointsV0_payload = readCdo_v0->chanName(
chanNum);
222 float setPointsV0_name{0.};
224 if (atr_v0.size() == 1) {
225 setPointsV0_name = *(
static_cast<const float*
>((atr_v0[
"readBackSettings_v0"]).addressOfData()));
227 auto tokens2 =
tokenize(setPointsV0_payload,
"_");
229 int multilayer =
atoi(tokens2[3]);
233 chamberML_V0[MultiLayerId] = setPointsV0_name;
240 const unsigned int chanNum = itr_v1.first;
242 const std::string& setPointsV1_payload = readCdo_v1->chanName(
chanNum);
243 float setPointsV1_name{0.};
245 if (atr_v1.size() == 1) {
246 setPointsV1_name = *(
static_cast<const float*
>((atr_v1[
"readBackSettings_v1"]).addressOfData()));
249 auto tokens2=
tokenize(setPointsV1_payload,
"_");
251 int multilayer =
atoi(tokens2[3]);
255 chamberML_V1[MultiLayerId] = setPointsV1_name;
261 for (
const Identifier& MultilayerId_ch : cachedDeadMultiLayersId_standby) {
262 if (chamberML_V1.find(MultilayerId_ch)->second == chamberML_V0.find(MultilayerId_ch)->second) {
263 ATH_MSG_DEBUG(
"Chamber has correct Voltage V1 = " << chamberML_V1.find(MultilayerId_ch)->second
264 <<
" V0= " << chamberML_V0.find(MultilayerId_ch)->second);
266 ATH_MSG_DEBUG(
"Chamber has wrong correct Voltage V1 = " << chamberML_V1.find(MultilayerId_ch)->second
267 <<
" V0= " << chamberML_V0.find(MultilayerId_ch)->second);
273 return StatusCode::SUCCESS;
282 return StatusCode::FAILURE;
284 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
285 for (
const auto& [
chanNum, atr] : *readCdo) {
286 const std::string& hv_payload = readCdo->chanName(
chanNum);
289 if (!atr.size()) {
continue; }
290 hv_name = *(
static_cast<const std::string*
>((atr[
"fsm_currentState"]).addressOfData()));
293 auto tokens2 =
tokenize(hv_payload,
"_");
301 return StatusCode::SUCCESS;
307 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readCdo.fullKey() <<
" readCdo->size()= " << readCdo->size());
308 for (
const auto& [
chanNum, atr] : **readCdo) {
309 if (!atr.size()) {
continue; }
311 const std::string& hv_payload = readCdo->chanName(
chanNum);
312 const std::string& hv_name_ml1{*(
static_cast<const std::string*
>((atr[
"fsmCurrentState_ML1"]).addressOfData()))};
313 const std::string& hv_name_ml2{*(
static_cast<const std::string*
>((atr[
"fsmCurrentState_ML2"]).addressOfData()))};
314 const float hv_v0_ml1{*(
static_cast<const float*
>((atr[
"v0set_ML1"]).addressOfData()))};
315 const float hv_v1_ml1{*(
static_cast<const float*
>((atr[
"v1set_ML1"]).addressOfData()))};
316 const float hv_v0_ml2{*(
static_cast<const float*
>((atr[
"v0set_ML2"]).addressOfData()))};
317 const float hv_v1_ml2{*(
static_cast<const float*
>((atr[
"v1set_ML2"]).addressOfData()))};
320 if (!chamberId.is_valid())
continue;
322 const float standbyVolt,
323 const float readyVolt,
326 if (
multiLayer > idHelper.numberOfMultilayers(chamberId))
return;
328 constexpr std::array<DcsFsmState, 3> goodStates{DcsFsmState::ON, DcsFsmState::STANDBY,
DcsFsmState::UNKNOWN};
329 if ( (
std::find(goodStates.begin(), goodStates.end(), dcsState) == goodStates.end()) ||
330 (dcsState != DcsFsmState::ON && readyVolt != standbyVolt)) {
333 writeCdo.
setHvState(mlId, dcsState, standbyVolt, readyVolt);
338 return StatusCode::SUCCESS;
347 return StatusCode::FAILURE;
349 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
351 for (
const auto& [
chanNum, atr] : *readCdo) {
352 if (!atr.size()) {
continue; }
353 const std::string& lv_payload = readCdo->chanName(
chanNum);
354 const std::string& lv_name{*
static_cast<const std::string*
>((atr[
"fsmCurrentState_LV"]).addressOfData())};
355 if (lv_payload.empty() || lv_name.empty()){
356 ATH_MSG_WARNING(
"The read data with chanNum "<<
chanNum<<
", lv_payload: "<<lv_payload<<
", hv_name: "<<lv_name
357 <<
". Does not have any fsmCurrentState_LV attribute. "
358 <<
"May be this is related to ATLASRECTS-6920 / ATLASRECTS-6879. Skip it");
370 return StatusCode::SUCCESS;
380 return StatusCode::FAILURE;
382 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
386 const std::string& chamber_dropped{*(
static_cast<const std::string*
>((atr[
"Chambers_disabled"]).addressOfData()))};
389 for (
auto & token :
tokens) {
397 return StatusCode::SUCCESS;
406 return StatusCode::FAILURE;
409 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
413 const std::string&
chamber_name{*(
static_cast<const std::string*
>((atr[
"Chambers_Name"]).addressOfData()))};
414 const std::string& list_mlayer{*(
static_cast<const std::string*
>((atr[
"Dead_multilayer"]).addressOfData()))};
415 const std::string& list_layer{*(
static_cast<const std::string*
>((atr[
"Dead_layer"]).addressOfData()))};
416 const std::string& list_tube{*(
static_cast<const std::string*
>((atr[
"Dead_tube"]).addressOfData()))};
420 auto tokens_mlayer =
tokenize(list_mlayer,
" ");
421 auto tokens_layer =
tokenize(list_layer,
" ");
423 for (
auto & token :
tokens) {
426 int ml =
atoi(token.substr(0, 1));
435 for (
unsigned int i = 0;
i < tokens_mlayer.size();
i++) {
436 if (tokens_mlayer[
i] !=
"0") {
437 int ml =
atoi(tokens_mlayer[
i].substr(0));
444 for (
unsigned int i = 0;
i < tokens_layer.size();
i++) {
445 if (tokens_layer[
i] !=
"0") {
446 int ml =
atoi(tokens_layer[
i].substr(0, 1));
455 return StatusCode::SUCCESS;
464 return StatusCode::FAILURE;
467 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
472 std::string dead_tube = *(
static_cast<const std::string*
>((atr[
"DeadTube_List"]).addressOfData()));
473 std::string
chamber_name = *(
static_cast<const std::string*
>((atr[
"Chamber_Name"]).addressOfData()));
478 for (
auto & token :
tokens) {
479 int ml =
atoi(token.substr(0, 1));
488 return StatusCode::SUCCESS;
497 return StatusCode::FAILURE;
500 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
501 for (
const auto &[
chanNum, atr] : *readCdo) {
505 const std::string& hv_payload = readCdo->chanName(
chanNum);
506 const std::string& hv_name{*(
static_cast<const std::string*
>((atr[
"fsm_currentState"]).addressOfData()))};
510 auto tokens2 =
tokenize(hv_payload,
"_");
518 return StatusCode::SUCCESS;