ATLAS Offline Software
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 
11 bool 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 }
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 }
TgcDigitThresholdData::m_thresholds
std::unordered_map< Identifier, double > m_thresholds
Definition: TgcDigitThresholdData.h:31
TgcDigitThresholdData.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Muon::IMuonIdHelperSvc::layerId
virtual Identifier layerId(const Identifier &id) const =0
create a layer ID, returns tube id for the MDTs
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
TgcDigitThresholdData::setThreshold
bool setThreshold(const Identifier &layerId, const double threshold)
Definition: TgcDigitThresholdData.cxx:11
TgcDigitThresholdData::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: TgcDigitThresholdData.h:30
threshold
Definition: chainparser.cxx:74
TgcDigitThresholdData::TgcDigitThresholdData
TgcDigitThresholdData(const Muon::IMuonIdHelperSvc *idHelperSvc)
Definition: TgcDigitThresholdData.cxx:7
Muon::IMuonIdHelperSvc::toString
virtual std::string toString(const Identifier &id) const =0
print all fields to string
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TgcDigitThresholdData::getThreshold
double getThreshold(const Identifier &channelId) const
Definition: TgcDigitThresholdData.cxx:22
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:26
Identifier
Definition: IdentifierFieldParser.cxx:14