ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
TRT_ConditionsAlgs
src
TRTHTCondAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TRTHTCondAlg.h
"
6
7
TRTHTCondAlg::TRTHTCondAlg
(
const
std::string& name
8
, ISvcLocator* pSvcLocator )
9
: ::
AthCondAlgorithm
(name,pSvcLocator)
10
{}
11
TRTHTCondAlg::~TRTHTCondAlg
()=
default
;
12
13
StatusCode
TRTHTCondAlg::initialize
()
14
{
15
// Read key
16
ATH_CHECK
(
m_ReadKey
.initialize() );
17
18
// Register write handle
19
ATH_CHECK
(
m_WriteKey
.initialize() );
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
TRTHTCondAlg::execute
(
const
EventContext& ctx)
const
25
{
26
ATH_MSG_DEBUG
(
"execute "
<< name());
27
28
// ____________ Construct Write Cond Handle and check its validity ____________
29
30
SG::WriteCondHandle<HTcalculator>
writeHandle{
m_WriteKey
, ctx};
31
32
// Do we have a valid Write Cond Handle for current time?
33
if
(writeHandle.
isValid
()) {
34
ATH_MSG_DEBUG
(
"CondHandle "
<< writeHandle.
fullKey
() <<
" is already valid."
35
<<
". In theory this should not be called, but may happen"
36
<<
" if multiple concurrent events are being processed out of order."
);
37
38
return
StatusCode::SUCCESS;
39
}
40
41
42
43
// ____________ Construct new Write Cond Object ____________
44
std::unique_ptr<HTcalculator> writeCdo{std::make_unique<HTcalculator>()};
45
46
47
// ____________ Compute the array structures for the HTcalculator object ____________
48
SG::ReadCondHandle<CondAttrListVec>
readHandle{
m_ReadKey
, ctx};
49
const
CondAttrListVec
* channel_values{*readHandle};
50
if
(channel_values==
nullptr
) {
51
ATH_MSG_ERROR
(
" Problem reading TRT/Calib/PID_vector cond object"
);
52
return
StatusCode::FAILURE;
53
}
54
if
(StatusCode::SUCCESS != writeCdo->ReadVectorDB( channel_values )) {
55
ATH_MSG_ERROR
(
"Problem filling HT Calculator."
);
56
return
StatusCode::FAILURE;
57
}
58
59
60
//__________ Assign range of writeCdo to that of the ReadHandle___________
61
EventIDRange rangeW;
62
63
if
(!readHandle.
range
(rangeW)) {
64
ATH_MSG_ERROR
(
"Failed to retrieve validity range for "
<< readHandle.
key
());
65
return
StatusCode::FAILURE;
66
}
67
68
// Record CDO
69
if
(writeHandle.
record
(rangeW,std::move(writeCdo)).isFailure()) {
70
ATH_MSG_ERROR
(
"Could not record HTCalculator "
<< writeHandle.
key
()
71
<<
" with EventRange "
<< rangeW
72
<<
" into Conditions Store"
);
73
return
StatusCode::FAILURE;
74
}
75
76
77
return
StatusCode::SUCCESS;
78
}
79
80
StatusCode
TRTHTCondAlg::finalize
()
81
{
82
ATH_MSG_DEBUG
(
"finalize "
<< name());
83
return
StatusCode::SUCCESS;
84
}
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
TRTHTCondAlg.h
AthCondAlgorithm
Base class for conditions algorithms.
Definition
AthCondAlgorithm.h:22
CondAttrListVec
Definition
CondAttrListVec.h:31
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::range
bool range(EventIDRange &r)
Definition
ReadCondHandle.h:223
SG::ReadCondHandle::key
const std::string & key() const
Definition
ReadCondHandle.h:59
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
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
SG::WriteCondHandle::fullKey
const DataObjID & fullKey() const
Definition
WriteCondHandle.h:45
TRTHTCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
TRTHTCondAlg.cxx:24
TRTHTCondAlg::m_ReadKey
SG::ReadCondHandleKey< CondAttrListVec > m_ReadKey
Definition
TRTHTCondAlg.h:26
TRTHTCondAlg::m_WriteKey
SG::WriteCondHandleKey< HTcalculator > m_WriteKey
Definition
TRTHTCondAlg.h:27
TRTHTCondAlg::initialize
virtual StatusCode initialize() override
Definition
TRTHTCondAlg.cxx:13
TRTHTCondAlg::~TRTHTCondAlg
virtual ~TRTHTCondAlg() override
TRTHTCondAlg::TRTHTCondAlg
TRTHTCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TRTHTCondAlg.cxx:7
TRTHTCondAlg::finalize
virtual StatusCode finalize() override
Definition
TRTHTCondAlg.cxx:80
Generated on
for ATLAS Offline Software by
1.17.0