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
8#include "Identifier/Identifier.h"
9
10using namespace Muon::MuonStationIndex;
11// general functions ---------------------------------
13 AthMessaging{"NswCalibDbThresholdData"},
14 m_idHelperSvc{idHelperSvc} {}
15
16
17// setting functions ---------------------------------
18
19// setData
20void NswCalibDbThresholdData::setData(const Identifier& chnlId, const float threshold) {
21
22 auto insert_itr = m_data.insert(std::make_pair(chnlId, threshold));
23 if (!insert_itr.second) {
24 ATH_MSG_WARNING("Threshold data for channel "<<m_idHelperSvc->toString(chnlId)
25 <<" already set to "<<insert_itr.first->second<<". Cannot apply "<<threshold);
26 }
27}
28
29// setZero
33
34
35// retrieval functions -------------------------------
36
37// getChannelIds
38std::vector<Identifier>
39NswCalibDbThresholdData::getChannelIds(const std::string tech, const std::string side) const {
40 std::vector<Identifier> keys;
41 keys.reserve(m_data.size());
42 for (const auto& p : m_data) {
43 keys.emplace_back(p.first);
44 }
45
46 if(tech.empty() && side.empty()) {
47 return keys;
48 }
49 std::vector<Identifier> chnls;
50 std::ranges::copy_if(keys, std::back_inserter(chnls), [&](const Identifier& copyMe){
51 const int eta = m_idHelperSvc->stationEta(copyMe);
52 if (!side.empty() && ((eta < 0 && side == "A") || (eta > 0 && side == "C"))){
53 return false;
54 }
55 return tech.empty() || technologyName(m_idHelperSvc->technologyIndex(copyMe)) == tech;
56 });
57 return chnls;
58}
59
60// getThreshold
61std::optional<float> NswCalibDbThresholdData::getThreshold(const Identifier& chnlId) const {
62 ChannelMap::const_iterator chan_itr = m_data.find(chnlId);
64 if(chan_itr != m_data.end()) {
65 return chan_itr->second;
66 }
67 // if channelId doesn't exist in buffer, use 0 channel data ("all channels"), if exists
68 const ThrsldTechType tech = (m_idHelperSvc->issTgc(chnlId))? ThrsldTechType::STGC : ThrsldTechType::MM;
69 return m_zero[toInt(tech)];
70}
71
72
73
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(const std::string="", const std::string="") 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