ATLAS Offline Software
Loading...
Searching...
No Matches
NswCalibDbThresholdData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
7
10#include <algorithm>
11#include <iterator>
12
13using namespace Muon::MuonStationIndex;
14// general functions ---------------------------------
16 AthMessaging{"NswCalibDbThresholdData"},
17 m_idHelperSvc{idHelperSvc} {}
18
19
20// setting functions ---------------------------------
21
22// setData
23void NswCalibDbThresholdData::setData(const Identifier& chnlId, const float threshold) {
24
25 auto insert_itr = m_data.insert(std::make_pair(chnlId, threshold));
26 if (!insert_itr.second) {
27 ATH_MSG_WARNING("Threshold data for channel "<<m_idHelperSvc->toString(chnlId)
28 <<" already set to "<<insert_itr.first->second<<". Cannot apply "<<threshold);
29 }
30}
31
32// setZero
36
37
38// retrieval functions -------------------------------
39
40// getChannelIds
41std::vector<Identifier>
42NswCalibDbThresholdData::getChannelIds(std::string_view tech, std::string_view side) const {
43 std::vector<Identifier> keys;
44 keys.reserve(m_data.size());
45 for (const auto& p : m_data) {
46 keys.emplace_back(p.first);
47 }
48
49 if(tech.empty() && side.empty()) {
50 return keys;
51 }
52 std::vector<Identifier> chnls;
53 std::ranges::copy_if(keys, std::back_inserter(chnls), [&](const Identifier& copyMe){
54 const int eta = m_idHelperSvc->stationEta(copyMe);
55 if (!side.empty() && ((eta < 0 && side == "A") || (eta > 0 && side == "C"))){
56 return false;
57 }
58 return tech.empty() || technologyName(m_idHelperSvc->technologyIndex(copyMe)) == tech;
59 });
60 return chnls;
61}
62
63// getThreshold
64std::optional<float> NswCalibDbThresholdData::getThreshold(const Identifier& chnlId) const {
65 ChannelMap::const_iterator chan_itr = m_data.find(chnlId);
67 if(chan_itr != m_data.end()) {
68 return chan_itr->second;
69 }
70 // if channelId doesn't exist in buffer, use 0 channel data ("all channels"), if exists
71 const ThrsldTechType tech = (m_idHelperSvc->issTgc(chnlId))? ThrsldTechType::STGC : ThrsldTechType::MM;
72 return m_zero[toInt(tech)];
73}
74
75
76
Scalar eta() const
pseudorapidity method
#define ATH_MSG_WARNING(x)
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
const Muon::IMuonIdHelperSvc * m_idHelperSvc
MuonCond::CalibTechType ThrsldTechType
void setData(const Identifier &channelId, const float)
void setZero(const ThrsldTechType tech, const float)
std::vector< Identifier > getChannelIds(std::string_view={}, std::string_view={}) const
NswCalibDbThresholdData(const Muon::IMuonIdHelperSvc *idHelperSvc)
std::optional< float > getThreshold(const Identifier &channelId) const
constexpr int toInt(const EnumType enumVal)
const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string