ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
src
ToolConstantsCondAlg.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
3
*/
10
11
12
#include "
ToolConstantsCondAlg.h
"
13
#include "
AthenaKernel/IOVInfiniteRange.h
"
14
18
StatusCode
ToolConstantsCondAlg::initialize
()
19
{
20
if
(!
m_coolFolderKey
.empty()) {
21
if
(!
m_detStoreKey
.empty()) {
22
ATH_MSG_ERROR
(
"Configuration error: both COOL folder and det store key specified."
);
23
return
StatusCode::FAILURE;
24
}
25
ATH_CHECK
(
m_blobTool
.retrieve() );
26
ATH_CHECK
(
m_coolFolderKey
.initialize() );
27
}
28
else
if
(
m_detStoreKey
.empty()) {
29
ATH_MSG_ERROR
(
"Configuration error: neither COOL folder nor det store key specified."
);
30
return
StatusCode::FAILURE;
31
}
32
33
ATH_CHECK
(
m_toolConstantsKey
.initialize() );
34
35
return
StatusCode::SUCCESS;
36
}
37
38
43
StatusCode
ToolConstantsCondAlg::execute
(
const
EventContext& ctx)
const
44
{
45
SG::WriteCondHandle<CaloRec::ToolConstants>
toolConstants
46
(
m_toolConstantsKey
, ctx);
47
48
auto
tc
= std::make_unique<CaloRec::ToolConstants>();
49
50
if
(!
m_coolFolderKey
.empty()) {
51
SG::ReadCondHandle<CondAttrListCollection>
coolFolder(
m_coolFolderKey
, ctx);
52
53
const
std::string key =
m_toolConstantsKey
.key();
54
55
const
unsigned
chNbr =
m_blobTool
->nameToChannelNumber (key);
56
// Check that this channel actually exits
57
const
std::string& chanName = coolFolder->chanName (chNbr);
58
if
(!chanName.empty() && key!=chanName) {
59
ATH_MSG_ERROR
(
"Channel name does not match! Expected "
<< key <<
" found "
<< chanName );
60
return
StatusCode::FAILURE;
61
}
62
else
{
63
ATH_MSG_DEBUG
(
"Found channel number "
<< chNbr <<
" named "
<< key );
64
}
65
66
const
coral::AttributeList& attrList = coolFolder->attributeList (chNbr);
67
ATH_CHECK
(
m_blobTool
->AttrListToToolConstants (attrList, *
tc
) );
68
69
toolConstants.
addDependency
(coolFolder);
70
}
71
else
if
(!
m_detStoreKey
.empty()) {
72
const
CaloRec::ToolConstants
* tc_in =
nullptr
;
73
ATH_CHECK
(
detStore
()->retrieve (tc_in,
m_detStoreKey
) );
74
*
tc
= *tc_in;
75
76
const
EventIDRange fullRange=
IOVInfiniteRange::infiniteRunLB
();
77
toolConstants.
addDependency
(fullRange);
78
}
79
else
{
80
ATH_MSG_ERROR
(
"Bad configuration."
);
81
return
StatusCode::FAILURE;
82
}
83
84
ATH_CHECK
( toolConstants.
record
(std::move (
tc
)) );
85
return
StatusCode::SUCCESS;
86
}
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_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
IOVInfiniteRange.h
tc
static Double_t tc
Definition
LArPhysWaveHECTool.cxx:38
ToolConstantsCondAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
CaloRec::ToolConstants
Container for the tool constants managed by ToolWithConstants.
Definition
ToolConstants.h:32
IOVInfiniteRange::infiniteRunLB
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
Definition
IOVInfiniteRange.h:39
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
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
ToolConstantsCondAlg::execute
StatusCode execute(const EventContext &ctx) const override
Gaudi execute method.
Definition
ToolConstantsCondAlg.cxx:43
ToolConstantsCondAlg::m_toolConstantsKey
SG::WriteCondHandleKey< CaloRec::ToolConstants > m_toolConstantsKey
Definition
ToolConstantsCondAlg.h:66
ToolConstantsCondAlg::m_blobTool
ToolHandle< Blob2ToolConstants > m_blobTool
Definition
ToolConstantsCondAlg.h:57
ToolConstantsCondAlg::initialize
virtual StatusCode initialize() override
Gaudi initialize method.
Definition
ToolConstantsCondAlg.cxx:18
ToolConstantsCondAlg::m_coolFolderKey
SG::ReadCondHandleKey< CondAttrListCollection > m_coolFolderKey
Definition
ToolConstantsCondAlg.h:60
ToolConstantsCondAlg::m_detStoreKey
StringProperty m_detStoreKey
Definition
ToolConstantsCondAlg.h:63
Generated on
for ATLAS Offline Software by
1.17.0