ATLAS Offline Software
Loading...
Searching...
No Matches
MdtCondDbData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include "GeoModelKernel/throwExcept.h"
9#include "Identifier/Identifier.h"
10
12// --- writing identifiers -------
14 m_id_helper(id_helper) {}
15
20
21
22const std::set<Identifier>& MdtCondDbData::getDeadTubesId() const{ return m_cachedDeadTubes; }
23const std::set<Identifier>& MdtCondDbData::getDeadLayersId() const{ return m_cachedDeadLayers; }
24const std::set<Identifier>& MdtCondDbData::getDeadMultilayersId() const{ return m_cachedDeadMultilayers; }
25const std::set<Identifier>& MdtCondDbData::getDeadChambersId() const{ return m_cachedDeadChambers; }
26
27bool MdtCondDbData::isGood(const Identifier & Id) const {
28 return (isGoodChamber(Id) && isGoodMultilayer(Id) && isGoodLayer(Id) && isGoodTube(Id));
29}
30
31bool MdtCondDbData::isGoodTube(const Identifier & Id) const { return !m_cachedDeadTubes.count(Id); }
32bool MdtCondDbData::isGoodLayer(const Identifier & Id) const {
33 if (m_cachedDeadLayers.empty()) return true;
34 const int layer = m_id_helper.tubeLayer(Id);
35 const int multiLayer = m_id_helper.multilayer(Id);
36 return !m_cachedDeadLayers.count(m_id_helper.channelID(Id,multiLayer, layer, 1));
37}
39 return m_cachedDeadLayers.empty() || !m_cachedDeadMultilayers.count(m_id_helper.multilayerID(Id));
40}
42 return m_cachedDeadChambers.empty() || !m_cachedDeadChambers.count(m_id_helper.elementID(Id));
43}
44
45void MdtCondDbData::setHvState(const Identifier& multiLayerID, const DcsFsmState state, const float standByVolt, const float readyVolt) {
46
47 if (m_dcsStates.empty()) m_dcsStates.resize(m_id_helper.detectorElement_hash_max());
48
49 IdentifierHash hash{};
50 m_id_helper.get_detectorElement_hash(multiLayerID, hash);
51 unsigned int hashIdx = static_cast<unsigned int>(hash);
52 if (hashIdx >= m_dcsStates.size()) {
53 return;
54 }
55 DcsConstants& constants = m_dcsStates.at(hashIdx);
56 constants.standbyVolt = standByVolt;
57 constants.readyVolt = readyVolt;
58 constants.fsmState = state;
59}
60const std::vector<DcsConstants>& MdtCondDbData::getAllHvStates() const { return m_dcsStates; }
61const DcsConstants& MdtCondDbData::getHvState(const Identifier& multiLayerID) const {
62 IdentifierHash hash{};
63 m_id_helper.get_detectorElement_hash(multiLayerID, hash);
64 unsigned int hashIdx =static_cast<unsigned int>(hash);
65 if (hashIdx >= m_dcsStates.size()) {
66 THROW_EXCEPTION("MdtCondDbData::getHvState() - Out of bound access "+
67 std::to_string(hashIdx) + " vs. "+std::to_string(m_dcsStates.size()));
68 }
69 return m_dcsStates[hashIdx];
70}
72 return m_dcsStates.size();
73}
74
75
76
MdtCondDbData::DcsConstants DcsConstants
This is a "hash" representation of an Identifier.
void setDeadTube(const Identifier &ident)
The indiviudal tube is dead.
bool isGoodTube(const Identifier &Id) const
Returns whether the particular tube has been markes as bad in the database.
bool isGood(const Identifier &Id) const
Returns if the identifier (tube/multiLayer/chamber) is masked in the conditions database.
const MdtIdHelper & m_id_helper
std::set< Identifier > m_cachedDeadChambers
bool hasDCS() const
const std::vector< DcsConstants > & getAllHvStates() const
const std::set< Identifier > & getDeadMultilayersId() const
void setDeadMultilayer(const Identifier &ident)
All tubes in a multi layer are dead.
bool isGoodLayer(const Identifier &Id) const
Returns whether the corresponding tube layer is marked as bad in the database.
MuonCond::DcsConstants DcsConstants
void setDeadLayer(const Identifier &ident)
All tubes in a drift layer are dead.
std::set< Identifier > m_cachedDeadTubes
void setHvState(const Identifier &multiLayerID, const DcsFsmState state, const float standByVolt, const float readyVolt)
Adds a DCS state to the conditions object multiLayerID -> Identifier of a tube in the multilayer stat...
std::set< Identifier > m_cachedDeadLayers
std::vector< DcsConstants > m_dcsStates
std::set< Identifier > m_cachedDeadMultilayers
const std::set< Identifier > & getDeadTubesId() const
const DcsConstants & getHvState(const Identifier &multiLayerID) const
bool isGoodChamber(const Identifier &Id) const
Returns true if the complete chamber has not dead channels.
const std::set< Identifier > & getDeadChambersId() const
MuonCond::DcsFsmState DcsFsmState
bool isGoodMultilayer(const Identifier &Id) const
MdtCondDbData(const MdtIdHelper &id_helper)
const std::set< Identifier > & getDeadLayersId() const
void setDeadChamber(const Identifier &ident)
All tubes in a chamber are dead.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10