2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 #include "TileCalibBlobObjs/TileCalibUtils.h"
7 #include "StoreGate/ReadCondHandle.h"
8 #include "StoreGate/WriteCondHandle.h"
10 #include "TileCondAlg.h"
12 template<class CONDDATA, class CALIBDATA>
13 StatusCode TileCondAlg<CONDDATA, CALIBDATA>::initialize() {
15 ATH_CHECK( m_conditionsProxy.retrieve() );
16 ATH_CHECK( m_condDataKey.initialize() );
18 return StatusCode::SUCCESS;
21 template<class CONDDATA, class CALIBDATA>
22 StatusCode TileCondAlg<CONDDATA, CALIBDATA>::execute(const EventContext& ctx) const {
24 SG::WriteCondHandle<CONDDATA> condData{m_condDataKey, ctx};
25 if (condData.isValid()) {
26 ATH_MSG_DEBUG("Found valid TileCondData: " << condData.key());
27 return StatusCode::SUCCESS;
30 // Define validity of the output cond object
31 EventIDRange eventRange;
32 auto calibData = std::make_unique<TileCalibData<CALIBDATA>>();
34 ATH_CHECK( m_conditionsProxy->fillCalibData(*calibData, eventRange) );
36 ATH_CHECK( checkData(*calibData) );
38 auto data = std::make_unique<CONDDATA>(std::move(calibData));
40 if(condData.record(eventRange, std::move(data)).isFailure()) {
41 ATH_MSG_ERROR("Could not record TileCondData object with "
43 << " with EventRange " << eventRange
44 << " into Conditions Store");
45 return StatusCode::FAILURE;
48 ATH_MSG_VERBOSE("Recorded TileCondData object with "
50 << " with EventRange " << eventRange
51 << " into Conditions Store");
55 return StatusCode::SUCCESS;