ATLAS Offline Software
Loading...
Searching...
No Matches
NswCalibDbThresholdData Class Reference

Conditions data to model a channel dependent energy deposit threshold such that the electronics returns a signal. More...

#include <NswCalibDbThresholdData.h>

Inheritance diagram for NswCalibDbThresholdData:
Collaboration diagram for NswCalibDbThresholdData:

Public Types

using ThrsldTechType = MuonCond::CalibTechType

Public Member Functions

 NswCalibDbThresholdData (const Muon::IMuonIdHelperSvc *idHelperSvc)
virtual ~NswCalibDbThresholdData ()=default
void setData (const Identifier &channelId, const float)
void setZero (const ThrsldTechType tech, const float)
std::vector< IdentifiergetChannelIds (const std::string="", const std::string="") const
std::optional< float > getThreshold (const Identifier &channelId) const
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Private Types

using ChannelMap = std::unordered_map<Identifier, float>
using ZeroMap

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

ChannelMap m_data {}
ZeroMap m_zero {}
const Muon::IMuonIdHelperSvcm_idHelperSvc {}
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Conditions data to model a channel dependent energy deposit threshold such that the electronics returns a signal.

The object is only used by the digitization tools of the NSW

Definition at line 23 of file NswCalibDbThresholdData.h.

Member Typedef Documentation

◆ ChannelMap

using NswCalibDbThresholdData::ChannelMap = std::unordered_map<Identifier, float>
private

Definition at line 45 of file NswCalibDbThresholdData.h.

◆ ThrsldTechType

◆ ZeroMap

Initial value:
std::array<std::optional<float>,
Muon::MuonStationIndex::toInt(ThrsldTechType::nTypes)>
constexpr int toInt(const EnumType enumVal)

Definition at line 46 of file NswCalibDbThresholdData.h.

Constructor & Destructor Documentation

◆ NswCalibDbThresholdData()

NswCalibDbThresholdData::NswCalibDbThresholdData ( const Muon::IMuonIdHelperSvc * idHelperSvc)

Definition at line 12 of file NswCalibDbThresholdData.cxx.

12 :
13 AthMessaging{"NswCalibDbThresholdData"},
14 m_idHelperSvc{idHelperSvc} {}
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
const Muon::IMuonIdHelperSvc * m_idHelperSvc

◆ ~NswCalibDbThresholdData()

virtual NswCalibDbThresholdData::~NswCalibDbThresholdData ( )
virtualdefault

Member Function Documentation

◆ getChannelIds()

std::vector< Identifier > NswCalibDbThresholdData::getChannelIds ( const std::string tech = "",
const std::string side = "" ) const

Definition at line 39 of file NswCalibDbThresholdData.cxx.

39 {
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}
Scalar eta() const
pseudorapidity method
const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string

◆ getThreshold()

std::optional< float > NswCalibDbThresholdData::getThreshold ( const Identifier & channelId) const

For the moment require that there is only one channel per identifier

Definition at line 61 of file NswCalibDbThresholdData.cxx.

61 {
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}
MuonCond::CalibTechType ThrsldTechType

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 182 of file AthMessaging.h.

183{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 // If user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ setData()

void NswCalibDbThresholdData::setData ( const Identifier & channelId,
const float threshold )

Definition at line 20 of file NswCalibDbThresholdData.cxx.

20 {
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}
#define ATH_MSG_WARNING(x)

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ setZero()

void NswCalibDbThresholdData::setZero ( const ThrsldTechType tech,
const float threshold )

Definition at line 30 of file NswCalibDbThresholdData.cxx.

30 {
31 m_zero[toInt(tech)] = threshold;
32}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_data

ChannelMap NswCalibDbThresholdData::m_data {}
private

Definition at line 48 of file NswCalibDbThresholdData.h.

48{};

◆ m_idHelperSvc

const Muon::IMuonIdHelperSvc* NswCalibDbThresholdData::m_idHelperSvc {}
private

Definition at line 52 of file NswCalibDbThresholdData.h.

52{};

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_zero

ZeroMap NswCalibDbThresholdData::m_zero {}
private

Definition at line 49 of file NswCalibDbThresholdData.h.

49{};

The documentation for this class was generated from the following files: