ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArBadChannelTool
src
LArBadChannelDBAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArBadChannelTool/LArBadChannelDBAlg.h
"
6
7
// AttributeList
8
#include "CoralBase/Attribute.h"
9
#include "CoralBase/Blob.h"
10
#include "CoralBase/AttributeListSpecification.h"
11
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
12
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
13
14
#include "
LArBadChannelTool/LArBadChannelDBTools.h
"
15
16
#include "
LArIdentifier/LArOnlineID.h
"
17
18
LArBadChannelDBAlg::LArBadChannelDBAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
19
AthAlgorithm
( name, pSvcLocator),
m_BCKey
(
"LArBadChannel"
),
m_BFKey
(
"LArBadFeb"
),
m_isSC
(false)
20
{
21
declareProperty
(
"BadChanKey"
,
m_BCKey
);
22
declareProperty
(
"MissingFEBKey"
,
m_BFKey
);
23
declareProperty
(
"DBFolder"
,
m_dbFolder
=
"/LAR/BadChannels/BadChannels"
);
24
declareProperty
(
"FEBFolder"
,
m_dbFebFolder
=
"/LAR/BadChannels/MissingFEBs"
);
25
declareProperty
(
"WritingMode"
,
m_mode
=0,
"selects information written to DB: 0 for bad channels, 1 for missing febs"
);
26
declareProperty
(
"SuperCell"
,
m_isSC
);
27
}
28
29
LArBadChannelDBAlg::~LArBadChannelDBAlg
() =
default
;
30
31
32
StatusCode
LArBadChannelDBAlg::initialize
() {
33
34
ATH_MSG_INFO
(
"initialize()"
);
35
36
ATH_CHECK
(
m_BCKey
.initialize(
m_mode
==0) );
37
ATH_CHECK
(
m_BFKey
.initialize(
m_mode
==1) );
38
39
return
StatusCode::SUCCESS;
40
}
41
42
StatusCode
LArBadChannelDBAlg::execute
(
const
EventContext&
/*ctx*/
)
43
{
return
StatusCode::SUCCESS;}
44
45
StatusCode
LArBadChannelDBAlg::finalize
() {
46
const
LArOnlineID
*onlineID=
nullptr
;
47
if
(!
m_isSC
) {
48
ATH_CHECK
(
detStore
()->retrieve(onlineID,
"LArOnlineID"
) );
49
if
(!onlineID) {
50
ATH_MSG_ERROR
(
"Failed to retrieve LArOnlineID"
);
51
return
StatusCode::FAILURE;
52
}
53
}
54
if
(
m_mode
== 0) {
55
SG::ReadCondHandle<LArBadChannelCont>
readHandle{
m_BCKey
};
56
const
LArBadChannelCont
*bcCont {*readHandle};
57
if
( bcCont ==
nullptr
) {
58
ATH_MSG_ERROR
(
"Failed to retrieve BadChanCont with key "
<<
m_BCKey
.key() );
59
return
StatusCode::FAILURE;
60
}
61
ATH_MSG_INFO
(
"Creating AttrListCollection in folder "
<<
m_dbFolder
);
62
LArBadChannelState
bcState;
63
LArBadChannelState::CoolChannelEnum
coolchan;
64
for
(
const
auto
& entry : bcCont->
fullCont
()) {
65
const
HWIdentifier
hid=
HWIdentifier
(entry.first);
66
if
(
m_isSC
) coolchan =
LArBadChannelState::CoolChannelEnum::EMBA
;
67
else
{
68
if
(onlineID->
isEMBchannel
(hid)) {
69
if
(onlineID->
pos_neg
(hid))
70
coolchan =
LArBadChannelState::CoolChannelEnum::EMBC
;
71
else
72
coolchan =
LArBadChannelState::CoolChannelEnum::EMBA
;
73
}
else
if
(onlineID->
isEMECchannel
(hid)) {
74
if
(onlineID->
pos_neg
(hid))
75
coolchan =
LArBadChannelState::CoolChannelEnum::EMECC
;
76
else
77
coolchan =
LArBadChannelState::CoolChannelEnum::EMECA
;
78
}
else
if
(onlineID->
isHECchannel
(hid)) {
79
if
(onlineID->
pos_neg
(hid))
80
coolchan =
LArBadChannelState::CoolChannelEnum::HECC
;
81
else
82
coolchan =
LArBadChannelState::CoolChannelEnum::HECA
;
83
}
else
if
(onlineID->
isFCALchannel
(hid)) {
84
if
(onlineID->
pos_neg
(hid))
85
coolchan =
LArBadChannelState::CoolChannelEnum::FCALC
;
86
else
87
coolchan =
LArBadChannelState::CoolChannelEnum::FCALA
;
88
}
else
{
89
ATH_MSG_WARNING
(
"Wrong bad channel Id"
<< hid );
90
continue
;
91
}
92
}
93
bcState.
add
(
LArBadChannelDBTools::BadChanEntry
(hid,entry.second),coolchan);
94
}
95
96
CondAttrListCollection
* attrListColl =
97
LArBadChannelDBTools::createCoolCollection
(bcState);
98
99
ATH_CHECK
(
detStore
()->record( attrListColl,
m_dbFolder
) );
100
}
101
102
if
(
m_mode
== 1) {
103
ATH_MSG_INFO
(
"Creating AthenaAttributeList in folder "
<<
m_dbFebFolder
);
104
105
SG::ReadCondHandle<LArBadFebCont>
readHandle{
m_BFKey
};
106
const
LArBadFebCont
*bfCont {*readHandle};
107
if
( bfCont ==
nullptr
) {
108
ATH_MSG_ERROR
(
"Failed to retrieve BadFebCont with key "
<<
m_BFKey
.key() );
109
return
StatusCode::FAILURE;
110
}
111
LArBadChannelDBTools::BadFebVec
febs;
112
for
(
const
auto
& entry : bfCont->
fullCont
()) {
113
const
HWIdentifier
hid=
HWIdentifier
(entry.first);
114
febs.emplace_back(
LArBadChannelDBTools::BadFebEntry
(hid,entry.second));
115
}
116
if
(!febs.empty()) {
117
AthenaAttributeList
* attrList =
LArBadChannelDBTools::createFebPayload
( febs);
118
119
ATH_CHECK
(
detStore
()->record( attrList,
m_dbFebFolder
) );
120
}
121
ATH_MSG_INFO
(
"exiting finalize successfully "
<<
m_dbFebFolder
);
122
}
123
124
return
StatusCode::SUCCESS;
125
}
126
127
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
AthenaAttributeList.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
LArBadFebCont
LArBadXCont< LArBadFeb > LArBadFebCont
Definition
LArBadChannelCont.h:115
LArBadChannelCont
LArBadXCont< LArBadChannel > LArBadChannelCont
Definition
LArBadChannelCont.h:108
LArBadChannelDBAlg.h
LArBadChannelDBTools.h
LArOnlineID.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table.
Definition
PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:46
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number.
Definition
CondAttrListCollection.h:51
HWIdentifier
Definition
HWIdentifier.h:13
LArBadChannelDBAlg::m_BCKey
SG::ReadCondHandleKey< LArBadChannelCont > m_BCKey
Definition
LArBadChannelDBAlg.h:29
LArBadChannelDBAlg::m_dbFolder
std::string m_dbFolder
Definition
LArBadChannelDBAlg.h:31
LArBadChannelDBAlg::LArBadChannelDBAlg
LArBadChannelDBAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArBadChannelDBAlg.cxx:18
LArBadChannelDBAlg::m_mode
int m_mode
Definition
LArBadChannelDBAlg.h:33
LArBadChannelDBAlg::m_BFKey
SG::ReadCondHandleKey< LArBadFebCont > m_BFKey
Definition
LArBadChannelDBAlg.h:30
LArBadChannelDBAlg::m_dbFebFolder
std::string m_dbFebFolder
Definition
LArBadChannelDBAlg.h:32
LArBadChannelDBAlg::finalize
StatusCode finalize()
Definition
LArBadChannelDBAlg.cxx:45
LArBadChannelDBAlg::initialize
StatusCode initialize()
Definition
LArBadChannelDBAlg.cxx:32
LArBadChannelDBAlg::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
LArBadChannelDBAlg.cxx:42
LArBadChannelDBAlg::~LArBadChannelDBAlg
~LArBadChannelDBAlg()
LArBadChannelDBAlg::m_isSC
bool m_isSC
Definition
LArBadChannelDBAlg.h:34
LArBadChannelState
Definition
LArBadChannelState.h:15
LArBadChannelState::CoolChannelEnum
CoolChannelEnum
Definition
LArBadChannelState.h:23
LArBadChannelState::HECA
@ HECA
Definition
LArBadChannelState.h:23
LArBadChannelState::FCALA
@ FCALA
Definition
LArBadChannelState.h:23
LArBadChannelState::EMBC
@ EMBC
Definition
LArBadChannelState.h:23
LArBadChannelState::EMBA
@ EMBA
Definition
LArBadChannelState.h:23
LArBadChannelState::FCALC
@ FCALC
Definition
LArBadChannelState.h:23
LArBadChannelState::EMECC
@ EMECC
Definition
LArBadChannelState.h:23
LArBadChannelState::EMECA
@ EMECA
Definition
LArBadChannelState.h:23
LArBadChannelState::HECC
@ HECC
Definition
LArBadChannelState.h:23
LArBadChannelState::add
void add(const BadChanEntry &entry, CoolChannelEnum chan)
Add a bad channel entry to a specified cool channel data.
Definition
LArBadChannelState.cxx:16
LArBadXCont::fullCont
const BadChanVec & fullCont() const
Definition
LArBadChannelCont.h:85
LArOnlineID_Base::isEMBchannel
bool isEMBchannel(const HWIdentifier id) const
Definition
LArOnlineID_Base.cxx:1358
LArOnlineID_Base::pos_neg
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
Definition
LArOnlineID_Base.cxx:1660
LArOnlineID_Base::isFCALchannel
bool isFCALchannel(const HWIdentifier id) const
Definition
LArOnlineID_Base.cxx:1363
LArOnlineID
Definition
LArOnlineID.h:21
LArOnlineID::isHECchannel
bool isHECchannel(const HWIdentifier id) const override final
Definition
LArOnlineID.cxx:533
LArOnlineID::isEMECchannel
bool isEMECchannel(const HWIdentifier id) const override final
Definition
LArOnlineID.cxx:573
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
LArBadChanBlobUtils::BadFebEntry
std::pair< HWIdentifier, LArBadFeb > BadFebEntry
Definition
LArBadChanBlobUtils.h:21
LArBadChanBlobUtils::BadChanEntry
std::pair< HWIdentifier, LArBadChannel > BadChanEntry
Definition
LArBadChanBlobUtils.h:20
LArBadChanBlobUtils::BadFebVec
std::vector< BadFebEntry > BadFebVec
Definition
LArBadChanBlobUtils.h:23
LArBadChannelDBTools::createCoolCollection
CondAttrListCollection * createCoolCollection(const LArBadChannelState &bcState)
Definition
LArBadChannelDBTools.cxx:82
LArBadChannelDBTools::createFebPayload
AthenaAttributeList * createFebPayload(const BadFebVec &data)
Definition
LArBadChannelDBTools.cxx:65
Generated on
for ATLAS Offline Software by
1.17.0