ATLAS Offline Software
TileCondAlg.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "TileCalibBlobObjs/TileCalibUtils.h"
6 
7 #include "StoreGate/ReadCondHandle.h"
8 #include "StoreGate/WriteCondHandle.h"
9 
10 #include "TileCondAlg.h"
11 
12 template<class CONDDATA, class CALIBDATA>
13 StatusCode TileCondAlg<CONDDATA, CALIBDATA>::initialize() {
14 
15  ATH_CHECK( m_conditionsProxy.retrieve() );
16  ATH_CHECK( m_condDataKey.initialize() );
17 
18  return StatusCode::SUCCESS;
19 }
20 
21 template<class CONDDATA, class CALIBDATA>
22 StatusCode TileCondAlg<CONDDATA, CALIBDATA>::execute(const EventContext& ctx) const {
23 
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;
28  }
29 
30  // Define validity of the output cond object
31  EventIDRange eventRange;
32  auto calibData = std::make_unique<TileCalibData<CALIBDATA>>();
33 
34  ATH_CHECK( m_conditionsProxy->fillCalibData(*calibData, eventRange) );
35 
36  ATH_CHECK( checkData(*calibData) );
37 
38  auto data = std::make_unique<CONDDATA>(std::move(calibData));
39 
40  if(condData.record(eventRange, std::move(data)).isFailure()) {
41  ATH_MSG_ERROR("Could not record TileCondData object with "
42  << condData.key()
43  << " with EventRange " << eventRange
44  << " into Conditions Store");
45  return StatusCode::FAILURE;
46  } else {
47 
48  ATH_MSG_VERBOSE("Recorded TileCondData object with "
49  << condData.key()
50  << " with EventRange " << eventRange
51  << " into Conditions Store");
52  }
53 
54 
55  return StatusCode::SUCCESS;
56 }