ATLAS Offline Software
Loading...
Searching...
No Matches
TgcDigitThresholdData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8 AthMessaging{"TgcDigitThresholdData"},
9 m_idHelperSvc{idHelperSvc}{}
10
11bool TgcDigitThresholdData::setThreshold(const Identifier& threshId, const double threshold) {
12 const Identifier layerId = m_idHelperSvc->layerId(threshId);
13 auto insert_itr = m_thresholds.insert(std::make_pair(layerId, threshold));
14 if (!insert_itr.second) {
15 ATH_MSG_ERROR("Failed to threshold "<<threshold<<" for "<<m_idHelperSvc->toString(layerId)
16 <<" as it's been set before to "<<m_thresholds[layerId]);
17 return false;
18 }
19 ATH_MSG_DEBUG("Theshold for channel "<<m_idHelperSvc->toString(layerId)<<" successfully set to "<<threshold);
20 return true;
21}
22double TgcDigitThresholdData::getThreshold(const Identifier& channelId) const {
23 auto itr = m_thresholds.find(m_idHelperSvc->layerId(channelId));
24 if (itr != m_thresholds.end()) return itr->second;
25 constexpr double defaultThresh{999999.};
26 ATH_MSG_WARNING("No threshold has been set for channel "<<m_idHelperSvc->toString(channelId)<<" return "<<defaultThresh);
27 return defaultThresh;
28}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
std::unordered_map< Identifier, double > m_thresholds
bool setThreshold(const Identifier &layerId, const double threshold)
const Muon::IMuonIdHelperSvc * m_idHelperSvc
double getThreshold(const Identifier &channelId) const
TgcDigitThresholdData(const Muon::IMuonIdHelperSvc *idHelperSvc)