ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArRecUtils
src
LArHVIdMappingAlg.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 "
LArHVIdMappingAlg.h
"
6
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
7
#include "CoralBase/Blob.h"
8
9
#include "
CaloIdentifier/CaloCell_ID.h
"
10
#include "
LArCabling/LArHVIdMappingReader.h
"
11
#include "
LArIdentifier/LArElectrodeID.h
"
12
#include "
LArIdentifier/LArHVLineID.h
"
13
14
#include "
PathResolver/PathResolver.h
"
15
16
#include <fstream>
17
18
StatusCode
LArHVIdMappingAlg::initialize
() {
19
20
ATH_MSG_DEBUG
(
"initializing"
);
21
22
// Read Handles
23
ATH_CHECK
(
m_readKey
.initialize() );
24
ATH_CHECK
(
m_writeKey
.initialize() );
25
26
return
StatusCode::SUCCESS;
27
}
28
29
30
StatusCode
LArHVIdMappingAlg::execute
(
const
EventContext& ctx)
const
{
31
ATH_MSG_DEBUG
(
"executing"
);
32
33
SG::WriteCondHandle<LArHVIdMapping>
writeHandle{
m_writeKey
, ctx};
34
35
if
(writeHandle.
isValid
()) {
36
ATH_MSG_DEBUG
(
"Found valid write handle"
);
37
return
StatusCode::SUCCESS;
38
}
39
40
SG::ReadCondHandle<AthenaAttributeList>
readHandle{
m_readKey
, ctx};
41
const
AthenaAttributeList
* attr{*readHandle};
42
writeHandle.
addDependency
(readHandle);
43
44
if
(!attr) {
45
ATH_MSG_WARNING
(
" Cannot find /LAR/IdentifierOfl/HVLineToElectrodeMap from database, Use ASCII file indeed !!!"
);
46
}
47
48
const
CaloCell_ID
* calocellID =
nullptr
;
49
ATH_CHECK
(
detStore
()->retrieve(calocellID,
"CaloCell_ID"
));
50
51
const
LArHVLineID
* hvlineID =
nullptr
;
52
ATH_CHECK
(
detStore
()->retrieve(hvlineID,
"LArHVLineID"
));
53
54
const
LArElectrodeID
* electrodeID =
nullptr
;
55
ATH_CHECK
(
detStore
()->retrieve(electrodeID,
"LArElectrodeID"
));
56
57
std::unique_ptr<LArHVIdMapping> HVIdMap = std::make_unique<LArHVIdMapping>(calocellID, hvlineID, electrodeID);
58
std::map<HWIdentifier,HWIdentifier> &elecLineMap = HVIdMap->m_electrode_hvline_map;
//basically a shorthand
59
std::map<HWIdentifier,std::vector<HWIdentifier> > &lineElecMap = HVIdMap->m_hvline_electrode_map;
60
61
LArHVIdMappingReader
reader;
62
ATH_CHECK
( reader.read (attr,
63
*hvlineID,
64
*electrodeID,
65
elecLineMap,
66
lineElecMap) );
67
68
69
if
(writeHandle.
record
(std::move(HVIdMap)).isFailure()) {
70
ATH_MSG_ERROR
(
"Could not record LArCalibLineMapping object with "
71
<< writeHandle.
key
()
72
<<
" with EventRange "
<< writeHandle.
getRange
()
73
<<
" into Conditions Store"
);
74
return
StatusCode::FAILURE;
75
}
76
77
ATH_MSG_INFO
(
"recorded new "
<< writeHandle.
key
() <<
" with range "
<< writeHandle.
getRange
() <<
" into Conditions Store"
);
78
79
80
return
StatusCode::SUCCESS;
81
}
82
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
AthenaAttributeList.h
CaloCell_ID.h
LArElectrodeID.h
LArHVIdMappingAlg.h
LArHVIdMappingReader.h
Helper to read HV ID mapping data from a file or conditions.
LArHVLineID.h
PathResolver.h
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
CaloCell_ID
Helper class for offline cell identifiers.
Definition
CaloCell_ID.h:34
LArElectrodeID
Helper for the Liquid Argon Calorimeter cell at the electrode level.
Definition
LArElectrodeID.h:95
LArHVIdMappingAlg::m_writeKey
SG::WriteCondHandleKey< LArHVIdMapping > m_writeKey
Definition
LArHVIdMappingAlg.h:28
LArHVIdMappingAlg::m_readKey
SG::ReadCondHandleKey< AthenaAttributeList > m_readKey
Definition
LArHVIdMappingAlg.h:27
LArHVIdMappingAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
LArHVIdMappingAlg.cxx:30
LArHVIdMappingAlg::initialize
virtual StatusCode initialize() override
Definition
LArHVIdMappingAlg.cxx:18
LArHVIdMappingReader
Helper to read HV ID mapping data from a file or conditions.
Definition
LArHVIdMappingReader.h:33
LArHVLineID
Helper for the Liquid Argon Calorimeter High-Voltage identifiers.
Definition
LArHVLineID.h:43
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
Generated on
for ATLAS Offline Software by
1.17.0