8#include "Identifier/Identifier.h"
17#include "GeoModelKernel/throwExcept.h"
29 ostr <<
" timeSince " << obj.timeSince <<
" timeUntil " << obj.timeUntil <<
" elink " << obj.elink;
37 return static_cast<unsigned int>(hash)*(idHelper.
gasGapMax()) + (idHelper.
gasGap(chan_id) -1);
40 return static_cast<unsigned int>(hash)*(idHelper.
gasGapMax()) + (idHelper.
gasGap(chan_id) -1);
55 if (array_idx >= dcsMap.size()) dcsMap.resize(array_idx + 1);
57 const unsigned int channel = idHelper.
channel(chnlId)-1;
70 if (array_idx >= dcsMap.size()) dcsMap.resize(array_idx + 1);
71 DcsModule& dcs_mod = dcsMap.at(array_idx);
72 const unsigned int channel = idHelper.
channel(chnlId)-1;
90 if (array_idx >=
data.size())
data.resize(array_idx + 1);
92 x.timeSince = timeSince;
93 x.timeUntil = timeUntil;
95 x.permanentlyDisabled = permanentlyDisabled;
96 data[array_idx][chnlId].insert(
x);
103 if (array_idx >=
data.size())
data.resize(array_idx + 1);
104 data[array_idx].insert(channelId);
112std::vector<Identifier>
114 std::vector<Identifier> chnls;
118 chnls.reserve(dcsMap.size());
120 if(module.channels.empty())
continue;
121 if(side ==
"A" && idHelper.
stationEta(module.layer_id) < 0)
continue;
122 if(side ==
"C" && idHelper.
stationEta(module.layer_id) > 0)
continue;
123 for(
unsigned int chn = 1 ; chn <=
module.channels.size() ; ++chn) {
124 if(!module.channels[chn -1])
continue;
125 chnls.push_back(idHelper.
channelID(module.layer_id, idHelper.
multilayer(module.layer_id), idHelper.
gasGap(module.layer_id), chn ));
131 chnls.reserve(dcsMap.size());
133 if(module.channels.empty())
continue;
134 if(side ==
"A" && idHelper.
stationEta(module.layer_id) < 0)
continue;
135 if(side ==
"C" && idHelper.
stationEta(module.layer_id) > 0)
continue;
136 for(
unsigned int chn = 1 ; chn <=
module.channels.size() ; ++chn) {
137 if(!module.channels[chn -1])
continue;
150 if(!idHelper.
is_mm(channelId))
return nullptr;
154 const unsigned int channel = idHelper.
channel(dcsChannelIdStripHv) -1;
155 if (dcsMap.size() > array_idx && dcsMap.at(array_idx).channels.size() > channel && dcsMap[array_idx].channels[channel])
return dcsMap[array_idx].channels[channel].get();
158 if(!idHelper.
is_mm(channelId))
return nullptr;
162 const unsigned int channel = idHelper.
channel(dcsChannelIdDriftHv) -1;
163 if (dcsMap.size() > array_idx && dcsMap.at(array_idx).channels.size() > channel && dcsMap[array_idx].channels[channel])
return dcsMap[array_idx].channels[channel].get();
166 if(!idHelper.
is_stgc(channelId))
return nullptr;
169 if(std::abs(idHelper.
stationEta(channelId))!= 1) {issTgcQ1OuterHv=
false;}
170 Identifier dcsChannelId = idHelper.
hvID(channelId, !issTgcQ1OuterHv );
173 const unsigned int channel = idHelper.
channel(dcsChannelId) -1;
174 if (dcsMap.size() > array_idx && dcsMap.at(array_idx).channels.size() > channel && dcsMap[array_idx].channels[channel])
return dcsMap[array_idx].channels[channel].get();
183 if(!
isGoodHv(channelId, issTgcQ1OuterHv))
return false;
185 bool permanentlyDisabled{
false};
186 if(!
isGoodTDaq(ctx, channelId, permanentlyDisabled))
return false;
198 return !dcs || dcs->
fsmState == DcsFsmState::ON;
201 bool driftHvIsGood = (!dcsDrift || dcsDrift->
fsmState == DcsFsmState::ON);
204 bool stripHvIsGood = (!dcsStrips || dcsStrips->
fsmState == DcsFsmState::ON);
206 return driftHvIsGood && stripHvIsGood;
214 if(
data.size()<=array_idx ||
data[array_idx].empty())
return true;
215 const std::map<Identifier, std::set<TDaqConstants>>& dataInRoElement =
data[array_idx];
221 mapIdentifier = idHelper.
febID(channelId);
226 mapIdentifier = idHelper.
febID(channelId);
228 mapper.elink_info(std::abs(idHelper.
stationEta(channelId))-1, idHelper.
channel(channelId), elink);
231 auto elm = dataInRoElement.find(mapIdentifier);
232 if(elm == dataInRoElement.end())
return true;
234 uint64_t evtTime = ctx.eventID().time_stamp()*1e9;
235 evtTime += ctx.eventID().time_stamp_ns_offset();
236 x.timeSince = evtTime;
237 x.timeUntil = evtTime;
240 auto disabledLink = elm->second.find(
x);
241 if(disabledLink != elm->second.end()){
242 permanentlyDisabled = disabledLink->permanentlyDisabled;
251 if(
data.size()<=array_idx ||
data[array_idx].empty())
return true;
252 if(
data[array_idx].
find(channelId) !=
data[array_idx].end())
return false;
261 if(!
m_idHelperSvc->isMM(channelId))
THROW_EXCEPTION(
"the check for unconnected channels was called with an identifier that is in MM and not sTGC");
266 if(!detectorReadoutElement) {
274 int channel_number = idHelper.
channel(channelId);
276 if(channel_number <= channelDesign->nMissedBottomStereo || channel_number >= channelDesign->
totalStrips - channelDesign->
nMissedTopStereo) {
280 if(channel_number <= channelDesign->nMissedBottomEta || channel_number >= channelDesign->
totalStrips - channelDesign->
nMissedTopEta) {
char data[hepevt_bytes_allocation_ATLAS]
std::ostream & operator<<(std::ostream &ostr, const NswDcsDbData::TDaqConstants &obj)
This is a "hash" representation of an Identifier.
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
Identifier pcbID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int pcb) const
Identifier multilayerID(const Identifier &channeldID) const
bool isStereo(const Identifier &id) const
Identifier febID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int radius) const
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
int multilayer(const Identifier &id) const
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
const MuonChannelDesign * getDesign(const Identifier &id) const
returns the MuonChannelDesign class for the given identifier
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
int stationEta(const Identifier &id) const
bool is_stgc(const Identifier &id) const
bool isSmall(const Identifier &id) const
bool is_mm(const Identifier &id) const
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
MuonCond::DcsConstants DcsConstants
std::vector< DcsModule > ChannelDcsMap
ChannelDcsMap m_data_hv_stg
void setDataHv(const DcsTechType tech, const Identifier &chnlId, DcsConstants constants)
ChannelDcsMap m_data_hv_mmd
bool isGoodEltx(const Identifier &channelId) const
ChannelEltxMap m_data_eltx_stg
const DcsConstants * getDataForChannelHv(const DcsTechType tech, const Identifier &channelId, bool issTgcQ1OuterHv) const
Retrieves the calibration constant for a particular readout channel.
ChannelDcsMap m_data_hv_mmg
bool isGood(const EventContext &ctx, const Identifier &channelId, bool issTgcQ1OuterHv=false) const
Returns whether the channel is alive, i.e. DCS state on, etc...
ChannelTDaqMap m_data_tdaq_mmg
ChannelTDaqMap m_data_tdaq_stg
NswDcsDbData(const Muon::IMuonIdHelperSvc *idHelperSvc, const MuonGM::MuonDetectorManager *muonGeoMgr)
unsigned int identToModuleIdx(const Identifier &chan_id) const
const Muon::IMuonIdHelperSvc * m_idHelperSvc
ChannelEltxMap m_data_eltx_mmg
std::vector< std::set< Identifier > > ChannelEltxMap
bool isConnectedChannel(const Identifier &channelId) const
bool isGoodHv(const Identifier &channelId, bool issTgcQ1OuterHv=false) const
const MuonGM::MuonDetectorManager * m_muonGeoMgr
std::vector< std::map< Identifier, std::set< TDaqConstants > > > ChannelTDaqMap
std::vector< Identifier > getChannelIdsHv(const DcsTechType tech, const std::string &side) const
void setDataTDaq(const DcsTechType tech, const Identifier &chnlId, uint64_t timeSince, uint64_t timeUntil, unsigned int elink, bool permanentlyDisabled)
bool isGoodTDaq(const EventContext &ctx, const Identifier &channelId, bool &permanentlyDisabled) const
void setDataEltx(const DcsTechType tech, const Identifier &chnlId)
int multilayer(const Identifier &id) const
Identifier hvID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, bool isInnerQ1) const
int channelType(const Identifier &id) const
Identifier febID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType) const
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, int channel) const
std::string find(const std::string &s)
return a remapped string
std::vector< std::unique_ptr< DcsConstants > > channels
#define THROW_EXCEPTION(MESSAGE)