ATLAS Offline Software
Loading...
Searching...
No Matches
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
7TRTHTCondAlg::TRTHTCondAlg(const std::string& name
8 , ISvcLocator* pSvcLocator )
9 : ::AthAlgorithm(name,pSvcLocator)
10{}
12
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
25{
26 ATH_MSG_DEBUG("execute " << name());
27
28 // ____________ Construct Write Cond Handle and check its validity ____________
29
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 ____________
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
81{
82 ATH_MSG_DEBUG("finalize " << name());
83 return StatusCode::SUCCESS;
84}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
bool range(EventIDRange &r)
const std::string & key() const
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
SG::ReadCondHandleKey< CondAttrListVec > m_ReadKey
SG::WriteCondHandleKey< HTcalculator > m_WriteKey
virtual StatusCode initialize() override
virtual ~TRTHTCondAlg() override
TRTHTCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode finalize() override
virtual StatusCode execute() override