ATLAS Offline Software
TileCalibCondAlg.icc
Go to the documentation of this file.
1 //Dear emacs, this is -*- c++ -*-
2 /*
3  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 //#include "TileCalibCondAlg.h"
7 #include "TileCalibBlobObjs/TileCalibUtils.h"
8 
9 #include "StoreGate/ReadCondHandle.h"
10 #include "StoreGate/WriteCondHandle.h"
11 
12 template<class T>
13 TileCalibCondAlg<T>::TileCalibCondAlg(const std::string& name, ISvcLocator* pSvcLocator) :
14  AthAlgorithm(name, pSvcLocator)
15 {
16 
17 }
18 
19 template<class T>
20 TileCalibCondAlg<T>::~TileCalibCondAlg() {
21 }
22 
23 template<class T>
24 StatusCode TileCalibCondAlg<T>::initialize() {
25 
26  ATH_CHECK( m_conditionsProxy.retrieve() );
27  ATH_CHECK( m_calibDataKey.initialize() );
28 
29  return StatusCode::SUCCESS;
30 }
31 
32 template<class T>
33 StatusCode TileCalibCondAlg<T>::execute() {
34 
35  SG::WriteCondHandle<TileCalibData<T> > calibData{m_calibDataKey};
36 
37  if (calibData.isValid()) {
38  ATH_MSG_DEBUG("Found valid TileCalibData: " << calibData.key());
39  return StatusCode::SUCCESS;
40  }
41 
42  // Define validity of the output cond object
43  EventIDRange eventRange;
44  std::unique_ptr<TileCalibData<T>> data = std::make_unique<TileCalibData<T>>();
45 
46  ATH_CHECK( m_conditionsProxy->fillCalibData(*data, eventRange) );
47 
48  if(calibData.record(eventRange, data.release()).isFailure()) {
49  ATH_MSG_ERROR("Could not record TileCalibData object with "
50  << calibData.key()
51  << " with EventRange " << eventRange
52  << " into Conditions Store");
53  return StatusCode::FAILURE;
54  } else {
55 
56  ATH_MSG_VERBOSE("Recorded TileCalibData object with "
57  << calibData.key()
58  << " with EventRange " << eventRange
59  << " into Conditions Store");
60  }
61 
62 
63  return StatusCode::SUCCESS;
64 
65 }
66 
67 template<class T>
68 StatusCode TileCalibCondAlg<T>::finalize() {
69  return StatusCode::SUCCESS;
70 }