ATLAS Offline Software
TRTHTCondAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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  : ::AthAlgorithm(name,pSvcLocator)
10 {}
12 
14 {
15  // Read key
17 
18  // Register write handle
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 }
TRTHTCondAlg::execute
virtual StatusCode execute() override
Definition: TRTHTCondAlg.cxx:24
TRTHTCondAlg::~TRTHTCondAlg
virtual ~TRTHTCondAlg() override
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
TRTHTCondAlg::m_WriteKey
SG::WriteCondHandleKey< HTcalculator > m_WriteKey
Definition: TRTHTCondAlg.h:27
TRTHTCondAlg::initialize
virtual StatusCode initialize() override
Definition: TRTHTCondAlg.cxx:13
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CondAttrListVec
Definition: CondAttrListVec.h:31
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRTHTCondAlg::m_ReadKey
SG::ReadCondHandleKey< CondAttrListVec > m_ReadKey
Definition: TRTHTCondAlg.h:26
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TRTHTCondAlg::finalize
virtual StatusCode finalize() override
Definition: TRTHTCondAlg.cxx:80
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TRTHTCondAlg.h
TRTHTCondAlg::TRTHTCondAlg
TRTHTCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TRTHTCondAlg.cxx:7
SG::WriteCondHandle
Definition: WriteCondHandle.h:26