ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCondUtils
src
LArHVlineMapAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArHVlineMapAlg.h
"
6
#include "
LArIdentifier/LArOnlineID.h
"
7
#include "
CaloIdentifier/CaloCell_ID.h
"
8
#include "
CaloIdentifier/CaloIdManager.h
"
9
10
LArHVlineMapAlg::LArHVlineMapAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
11
AthCondAlgorithm
(name,pSvcLocator),
12
m_hvmapTool
(
"LArHVMapTool"
,this)
13
{}
14
15
// intialize
16
StatusCode
LArHVlineMapAlg::initialize
()
17
{
18
ATH_CHECK
(
m_mapKey
.initialize());
19
ATH_CHECK
(
m_hvCablingKey
.initialize());
20
ATH_CHECK
(
m_caloDetDescrMgrKey
.initialize());
21
ATH_CHECK
(
detStore
()->retrieve(
m_caloHelper
,
"CaloCell_ID"
) );
22
ATH_CHECK
(
detStore
()->retrieve(
m_hvlineHelper
,
"LArHVLineID"
) );
23
24
const
CaloIdManager
*caloIdMgr;
25
ATH_CHECK
(
detStore
()->retrieve(caloIdMgr));
26
27
return
StatusCode::SUCCESS;
28
}
29
30
StatusCode
LArHVlineMapAlg::execute
(
const
EventContext& ctx )
const
31
{
32
SG::WriteCondHandle<LArHVNMap>
writeHandle{
m_mapKey
,ctx};
33
34
if
(writeHandle.
isValid
()) {
35
ATH_MSG_DEBUG
(
"Found valid write handle"
);
36
return
StatusCode::SUCCESS;
37
}
38
39
SG::ReadCondHandle<CaloDetDescrManager>
caloMgrHandle{
m_caloDetDescrMgrKey
,ctx};
40
const
CaloDetDescrManager
*calodetdescrmgr = *caloMgrHandle;
41
if
(!calodetdescrmgr) {
42
ATH_MSG_ERROR
(
"Why do not have CaloDetDescrManager ? "
<<
m_caloDetDescrMgrKey
.fullKey());
43
return
StatusCode::FAILURE;
44
}
45
46
SG::ReadCondHandle<LArHVIdMapping>
hvCabling (
m_hvCablingKey
, ctx);
47
if
(!hvCabling.
isValid
()) {
48
ATH_MSG_ERROR
(
"Could not get HV mapping !"
);
49
return
StatusCode::FAILURE;
50
}
else
{
51
ATH_MSG_DEBUG
(
"Got HV mapping !"
);
52
}
53
54
writeHandle.
addDependency
(hvCabling);
55
56
unsigned
hmax
=
m_hvlineHelper
->hvlineHashMax();
57
58
std::unique_ptr<LArHVNMap> hvmap=std::make_unique<LArHVNMap>(
hmax
,
m_hvlineHelper
);
59
60
CaloCell_Base_ID ::id_iterator itb =
m_caloHelper
->cell_begin();
61
CaloCell_Base_ID ::id_iterator ite =
m_caloHelper
->cell_end();
62
63
for
(; itb<ite; ++itb) {
64
65
if
(
m_caloHelper
->is_tile(*itb))
continue
;
66
std::vector<HWIdentifier> linevec;
67
m_hvmapTool
->GetHVLines(*itb, calodetdescrmgr, linevec);
68
if
(linevec.size()) {
69
for
(
unsigned
int
i=0; i<linevec.size(); ++i) {
70
unsigned
lhash =
m_hvlineHelper
->hvlineHash(linevec[i]);
71
hvmap->incHVline(lhash);
72
ATH_MSG_VERBOSE
(
"Adding cell: "
<<itb->get_identifier32().get_compact() <<
" to a line: "
<<linevec[i].get_identifier32().get_compact());
73
}
74
}
else
{
75
ATH_MSG_WARNING
(
"Why do not have HVlines for the cell: "
<< itb->get_identifier32().get_compact());
76
}
77
}
78
79
if
(writeHandle.
record
(std::move(hvmap)).isFailure()) {
80
ATH_MSG_ERROR
(
"Could not record LArHVNMap object with "
<< writeHandle.
key
());
81
return
StatusCode::FAILURE;
82
}
83
84
ATH_MSG_INFO
(
"recorded new "
<< writeHandle.
key
());
85
86
return
StatusCode::SUCCESS;
87
88
}
89
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_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloCell_ID.h
CaloIdManager.h
LArHVlineMapAlg.h
LArOnlineID.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCondAlgorithm
Base class for conditions algorithms.
Definition
AthCondAlgorithm.h:22
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition
CaloDetDescrManager.h:469
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition
CaloIdManager.h:45
LArHVlineMapAlg::LArHVlineMapAlg
LArHVlineMapAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArHVlineMapAlg.cxx:10
LArHVlineMapAlg::m_hvmapTool
ToolHandle< ILArHVMapTool > m_hvmapTool
Definition
LArHVlineMapAlg.h:35
LArHVlineMapAlg::m_caloDetDescrMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloDetDescrMgrKey
Definition
LArHVlineMapAlg.h:37
LArHVlineMapAlg::m_mapKey
SG::WriteCondHandleKey< LArHVNMap > m_mapKey
Definition
LArHVlineMapAlg.h:39
LArHVlineMapAlg::m_hvCablingKey
SG::ReadCondHandleKey< LArHVIdMapping > m_hvCablingKey
Definition
LArHVlineMapAlg.h:38
LArHVlineMapAlg::m_caloHelper
const CaloCell_ID * m_caloHelper
Definition
LArHVlineMapAlg.h:41
LArHVlineMapAlg::m_hvlineHelper
const LArHVLineID * m_hvlineHelper
Definition
LArHVlineMapAlg.h:42
LArHVlineMapAlg::initialize
virtual StatusCode initialize() override final
Definition
LArHVlineMapAlg.cxx:16
LArHVlineMapAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
LArHVlineMapAlg.cxx:30
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
SG::WriteCondHandle::isValid
bool isValid() const
Definition
WriteCondHandle.h:252
hmax
double hmax(TH1 *&h)
Definition
listroot.cxx:115
Generated on
for ATLAS Offline Software by
1.17.0