ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArRecUtils
src
LArRoIMapCondAlg.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
3
*/
10
11
12
#include "
LArRoIMapCondAlg.h
"
13
#include "
LArIdentifier/LArOnlineID.h
"
14
#include "
CaloIdentifier/CaloLVL1_ID.h
"
15
#include "
CaloIdentifier/LArEM_ID.h
"
16
#include "
CaloTTDetDescr/CaloTTDescriptor.h
"
17
#include "
CaloTTDetDescr/CaloTTDescrManager.h
"
18
#include "
StoreGate/ReadCondHandle.h
"
19
#include "
StoreGate/WriteCondHandle.h
"
20
#include <fstream>
21
#include <vector>
22
23
27
StatusCode
LArRoIMapCondAlg::initialize
()
28
{
29
ATH_CHECK
(
detStore
()->retrieve(
m_onlineID
) );
30
ATH_CHECK
(
detStore
()->retrieve(
m_TT_ID
) );
31
ATH_CHECK
(
detStore
()->retrieve(
m_em_id
) );
32
ATH_CHECK
(
detStore
()->retrieve(
m_hec_id
) );
33
ATH_CHECK
(
detStore
()->retrieve(
m_fcal_id
) );
34
35
ATH_CHECK
(
m_ttSvc
.retrieve() );
36
37
ATH_CHECK
(
m_onOffIdKey
.initialize() );
38
ATH_CHECK
(
m_febRodKey
.initialize() );
39
ATH_CHECK
(
m_LArRoIMapKey
.initialize() );
40
41
return
StatusCode::SUCCESS;
42
}
43
44
48
StatusCode
LArRoIMapCondAlg::execute
(
const
EventContext& ctx)
const
49
{
50
SG::WriteCondHandle<LArRoIMap>
writeHandle (
m_LArRoIMapKey
, ctx);
51
if
(writeHandle.
isValid
()) {
52
return
StatusCode::SUCCESS;
53
}
54
auto
larRoIMap = std::make_unique<LArRoIMap> (100);
55
56
SG::ReadCondHandle<LArOnOffIdMapping>
onOffId (
m_onOffIdKey
, ctx);
57
SG::ReadCondHandle<LArFebRodMapping>
febRod (
m_febRodKey
, ctx);
58
59
for
(
const
Identifier
&
id
:
m_em_id
->channel_ids()) {
60
ATH_CHECK
(
addEntry
(*larRoIMap, **onOffId, **febRod,
id
) );
61
}
62
63
for
(
const
Identifier
&
id
:
m_hec_id
->channel_ids()) {
64
ATH_CHECK
(
addEntry
(*larRoIMap, **onOffId, **febRod,
id
) );
65
}
66
67
for
(
const
Identifier
&
id
:
m_fcal_id
->channel_ids()) {
68
ATH_CHECK
(
addEntry
(*larRoIMap, **onOffId, **febRod,
id
) );
69
}
70
71
writeHandle.
addDependency
(onOffId);
72
writeHandle.
addDependency
(febRod);
73
ATH_CHECK
( writeHandle.
record
(std::move (larRoIMap)) );
74
ATH_MSG_INFO
(
"recorded new "
<< writeHandle.
key
() <<
" with range "
<< writeHandle.
getRange
() <<
" into Conditions Store"
);
75
return
StatusCode::SUCCESS;
76
}
77
78
79
StatusCode
LArRoIMapCondAlg::addEntry
(
LArRoIMap
& m,
80
const
LArOnOffIdMapping
& onOffId,
81
const
LArFebRodMapping
& febRod,
82
const
Identifier
&
id
)
const
83
{
84
HWIdentifier
sigId = onOffId.
createSignalChannelID
(
id
);
85
Identifier
rId =
m_ttSvc
->whichTTID (
id
);
86
IdentifierHash
hashid;
87
IdContext
layer_context =
m_TT_ID
->layer_context();
88
if
(
m_TT_ID
->get_hash (rId, hashid, &layer_context) != 0) {
89
ATH_MSG_ERROR
(
"Failed to get TT hash"
);
90
return
StatusCode::FAILURE;
91
}
92
HWIdentifier
febId =
m_onlineID
->feb_Id(sigId);
93
const
HWIdentifier
& robId = febRod.
getReadoutModuleID
(febId);
94
m.addEntry (
id
, sigId, robId, hashid);
95
return
StatusCode::SUCCESS;
96
}
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
CaloLVL1_ID.h
CaloTTDescrManager.h
CaloTTDescriptor.h
LArEM_ID.h
LArOnlineID.h
LArRoIMapCondAlg.h
Conditions algorithm producing LArRoIMap.
ReadCondHandle.h
WriteCondHandle.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
HWIdentifier
Definition
HWIdentifier.h:13
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition
IdContext.h:26
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
LArFebRodMapping
Definition
LArFebRodMapping.h:17
LArFebRodMapping::getReadoutModuleID
HWIdentifier getReadoutModuleID(const HWIdentifier &id) const
Definition
LArFebRodMapping.cxx:15
LArOnOffIdMapping
Definition
LArOnOffIdMapping.h:20
LArOnOffIdMapping::createSignalChannelID
HWIdentifier createSignalChannelID(const Identifier &id) const
create a HWIdentifier from an Identifier (not inline)
Definition
LArOnOffIdMapping.h:126
LArRoIMapCondAlg::m_onlineID
const LArOnlineID * m_onlineID
Definition
LArRoIMapCondAlg.h:62
LArRoIMapCondAlg::m_hec_id
const LArHEC_ID * m_hec_id
Definition
LArRoIMapCondAlg.h:64
LArRoIMapCondAlg::m_LArRoIMapKey
SG::WriteCondHandleKey< LArRoIMap > m_LArRoIMapKey
Definition
LArRoIMapCondAlg.h:75
LArRoIMapCondAlg::m_onOffIdKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffIdKey
Definition
LArRoIMapCondAlg.h:71
LArRoIMapCondAlg::m_ttSvc
ToolHandle< CaloTriggerTowerService > m_ttSvc
Definition
LArRoIMapCondAlg.h:68
LArRoIMapCondAlg::m_TT_ID
const CaloLVL1_ID * m_TT_ID
Definition
LArRoIMapCondAlg.h:61
LArRoIMapCondAlg::addEntry
StatusCode addEntry(LArRoIMap &m, const LArOnOffIdMapping &onOffId, const LArFebRodMapping &febRod, const Identifier &id) const
Definition
LArRoIMapCondAlg.cxx:79
LArRoIMapCondAlg::m_fcal_id
const LArFCAL_ID * m_fcal_id
Definition
LArRoIMapCondAlg.h:65
LArRoIMapCondAlg::m_febRodKey
SG::ReadCondHandleKey< LArFebRodMapping > m_febRodKey
Definition
LArRoIMapCondAlg.h:73
LArRoIMapCondAlg::m_em_id
const LArEM_ID * m_em_id
Definition
LArRoIMapCondAlg.h:63
LArRoIMapCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi execute method.
Definition
LArRoIMapCondAlg.cxx:48
LArRoIMapCondAlg::initialize
virtual StatusCode initialize() override
Gaudi initialize method.
Definition
LArRoIMapCondAlg.cxx:27
LArRoIMap
Mapping between calorimeter trigger id to offline/online Identifier.
Definition
LArRoIMap.h:31
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
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::getRange
const EventIDRange & getRange() const
Definition
WriteCondHandle.h:93
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
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0