ATLAS Offline Software
Loading...
Searching...
No Matches
LArFebConfig.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include "GaudiKernel/ISvcLocator.h"
8#include "GaudiKernel/IMessageSvc.h"
9#include "CoralBase/Attribute.h"
10
11const std::string LArFebConfig::s_lower = "lower";
12const std::string LArFebConfig::s_upper = "upper";
13
15 AthMessaging(Gaudi::svcLocator()->service< IMessageSvc >( "MessageSvc" ),"LArFebConfig"),
16 m_onlineID(onlineId)
17
18{ }
19
20
22 const coral::AttributeList* attrList)
23{
24 m_attrPerFeb[febid.get_compact()] = attrList;
25}
26
27
29 short& lower,
30 short& upper) const
31{
32 int channel = 0;
33 const coral::AttributeList* attrList = getAttrList (chid, channel);
34 if (attrList == nullptr) {
35 lower = ERRORCODE;
37 return;
38 }
39 std::string chanstr = std::to_string(channel+1);
40 lower = getThresholdFromAttrList (s_lower, attrList, chanstr);
41 upper = getThresholdFromAttrList (s_upper, attrList, chanstr);
42}
43
44
45const coral::AttributeList*
47 int& channel) const
48{
49 if (m_attrPerFeb.empty()) {
50 ATH_MSG_WARNING("FEB threshold cache is empty");
51 return nullptr;
52 }
53
54 const HWIdentifier fid=m_onlineID->feb_Id(chid);
55 channel = m_onlineID->channel(chid);
56 auto it = m_attrPerFeb.find(fid.get_compact());
57 if (it == m_attrPerFeb.end()) {
58 ATH_MSG_DEBUG("Such FEB was not found !");
59 return nullptr;
60 }
61 return it->second;
62}
63
64
65short
67 const coral::AttributeList* attrList,
68 const std::string& chanstr) const
69{
70 return (short)(*attrList)[MedLow + chanstr].data<int32_t>(); //Will throw and exception if channel does not exist
71}
72
73
74short LArFebConfig::getThreshold(const std::string& MedLow,
75 const HWIdentifier& chid) const
76{
77 int channel = 0;
78 const coral::AttributeList* attrList = getAttrList (chid, channel);
79 if (attrList == nullptr) {
80 return ERRORCODE;
81 }
82 std::string chanstr = std::to_string(channel+1);
83 return getThresholdFromAttrList (MedLow, attrList, chanstr);
84}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
int upper(int c)
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
value_type get_compact() const
Get the compact id.
std::unordered_map< HWIdentifier::value_type, const coral::AttributeList * > m_attrPerFeb
void add(HWIdentifier febid, const coral::AttributeList *attrList)
short getThreshold(const std::string &MedLow, const HWIdentifier &chid) const
void thresholds(const HWIdentifier &chid, short &lower, short &upper) const
const LArOnlineID * m_onlineID
static const std::string s_upper
static const std::string s_lower
const coral::AttributeList * getAttrList(const HWIdentifier &chid, int &channel) const
short getThresholdFromAttrList(const std::string &MedLow, const coral::AttributeList *attrList, const std::string &chanstr) const
LArFebConfig()=delete
=============================================================================