ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArRecConditions
src
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
5
#include "
LArRecConditions/LArFebConfig.h
"
6
#include "
LArIdentifier/LArOnlineID.h
"
7
#include "GaudiKernel/ISvcLocator.h"
8
#include "GaudiKernel/IMessageSvc.h"
9
#include "CoralBase/Attribute.h"
10
11
const
std::string
LArFebConfig::s_lower
=
"lower"
;
12
const
std::string
LArFebConfig::s_upper
=
"upper"
;
13
14
LArFebConfig::LArFebConfig
(
const
LArOnlineID
* onlineId) :
15
AthMessaging
(
Gaudi
::svcLocator()->service< IMessageSvc >(
"MessageSvc"
),
"LArFebConfig"
),
16
m_onlineID
(onlineId)
17
18
{ }
19
20
21
void
LArFebConfig::add
(
HWIdentifier
febid,
22
const
coral::AttributeList* attrList)
23
{
24
m_attrPerFeb
[febid.
get_compact
()] = attrList;
25
}
26
27
28
void
LArFebConfig::thresholds
(
const
HWIdentifier
& chid,
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
;
36
upper
=
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
45
const
coral::AttributeList*
46
LArFebConfig::getAttrList
(
const
HWIdentifier
& chid,
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
65
short
66
LArFebConfig::getThresholdFromAttrList
(
const
std::string& MedLow,
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
74
short
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
}
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
upper
int upper(int c)
Definition
LArBadChannelParser.cxx:49
LArFebConfig.h
LArOnlineID.h
AthMessaging::AthMessaging
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Definition
AthMessaging.cxx:13
HWIdentifier
Definition
HWIdentifier.h:13
Identifier::get_compact
value_type get_compact() const
Get the compact id.
LArFebConfig::m_attrPerFeb
std::unordered_map< HWIdentifier::value_type, const coral::AttributeList * > m_attrPerFeb
Definition
LArFebConfig.h:32
LArFebConfig::add
void add(HWIdentifier febid, const coral::AttributeList *attrList)
Definition
LArFebConfig.cxx:21
LArFebConfig::getThreshold
short getThreshold(const std::string &MedLow, const HWIdentifier &chid) const
Definition
LArFebConfig.cxx:74
LArFebConfig::thresholds
void thresholds(const HWIdentifier &chid, short &lower, short &upper) const
Definition
LArFebConfig.cxx:28
LArFebConfig::m_onlineID
const LArOnlineID * m_onlineID
Definition
LArFebConfig.h:30
LArFebConfig::s_upper
static const std::string s_upper
Definition
LArFebConfig.h:43
LArFebConfig::s_lower
static const std::string s_lower
Definition
LArFebConfig.h:42
LArFebConfig::getAttrList
const coral::AttributeList * getAttrList(const HWIdentifier &chid, int &channel) const
Definition
LArFebConfig.cxx:46
LArFebConfig::getThresholdFromAttrList
short getThresholdFromAttrList(const std::string &MedLow, const coral::AttributeList *attrList, const std::string &chanstr) const
Definition
LArFebConfig.cxx:66
LArFebConfig::ERRORCODE
@ ERRORCODE
Definition
LArFebConfig.h:45
LArFebConfig::LArFebConfig
LArFebConfig()=delete
LArOnlineID
Definition
LArOnlineID.h:21
Gaudi
=============================================================================
Definition
CaloGPUClusterAndCellDataMonitorOptions.h:273
Generated on
for ATLAS Offline Software by
1.17.0