6#include "Identifier/Identifier.h"
7#include "GaudiKernel/EventIDRange.h"
21 ATH_MSG_ERROR(
"The database is set to be input source (2) but the ReadKey is empty.");
27 return StatusCode::SUCCESS;
35 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.
fullKey() <<
" is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order.");
36 return StatusCode::SUCCESS;
40 std::unique_ptr<PixelCalib::PixelOfflineCalibData> writeCdo(std::make_unique<PixelCalib::PixelOfflineCalibData>());
44 return StatusCode::FAILURE;
49 auto calibData = std::make_unique<PixelCalib::PixelOfflineCalibData>();
56 ATH_MSG_INFO(
"Load PixelErrorData constants from text file");
58 if (file_name1.empty()) {
ATH_MSG_WARNING(
"Input file " << file_name1 <<
" not found! Default (hardwired) values to be used!"); }
59 else { pced->
Load(file_name1); }
61 ATH_MSG_INFO(
"Load PixelClusterOnTrackErrorData constants from text file");
63 if (file_name2.empty()) {
ATH_MSG_WARNING(
"Input file " << file_name2 <<
" not found! Default (hardwired) values to be used!"); }
64 else { pcoted->
Load(file_name2); }
66 ATH_MSG_INFO(
"Load PixelChargeInterpolationData constants from text file");
68 if (file_name3.empty()) {
ATH_MSG_WARNING(
"Input file " << file_name3 <<
" not found! Default (hardwired) values to be used!"); }
69 else { pcip->
Load(file_name3); }
73 std::vector<float>
constants = calibData->GetConstants();
77 const EventIDBase start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
78 const EventIDBase stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
79 const EventIDRange rangeW{start, stop};
84 ATH_MSG_DEBUG(
"Found constants with new-style Identifier key");
88 if (writeHandle.
record(rangeW, std::move(writeCdo)).isFailure()) {
89 ATH_MSG_FATAL(
"Could not record PixelCalib::PixelOfflineCalibData " << writeHandle.
key() <<
" with EventRange " << rangeW <<
" into Conditions Store");
90 return StatusCode::FAILURE;
92 ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.
key() <<
" with range " << rangeW <<
" into Conditions Store");
103 if (readCdo==
nullptr) {
105 return StatusCode::FAILURE;
109 if (not readHandle.
range(rangeW)) {
110 ATH_MSG_FATAL(
"Failed to retrieve validity range for " << readHandle.
key());
111 return StatusCode::FAILURE;
122 ATH_MSG_DEBUG(
"Found constants with new-style Identifier key");
129 std::vector<float> const2;
130 const2.reserve(readCdo->
size());
132for (
int i=0; i<readCdo->
size(); i++) { const2.push_back(readCdo->
get(key.set_literal(i+1),i)); }
134 if (!const2.empty()) {
135 ATH_MSG_DEBUG(
"Found constants with old-style Identifier key");
136 writeCdo->SetConstants(const2);
140 return StatusCode::FAILURE;
143 if (writeHandle.
record(rangeW, std::move(writeCdo)).isFailure()) {
144 ATH_MSG_FATAL(
"Could not record PixelCalib::PixelOfflineCalibData " << writeHandle.
key() <<
" with EventRange " << rangeW <<
" into Conditions Store");
145 return StatusCode::FAILURE;
147 ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.
key() <<
" with range " << rangeW <<
" into Conditions Store");
150 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Base class for conditions algorithms.
DetCondCFloat is a class to hold sets of Identifiers and arrays of floats for detector element specif...
float get(const Identifier &ident, int k) const
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
void Load(const std::string &filename)
void Load(const std::string &file)
void Load(const std::string &file)
SG::WriteCondHandleKey< PixelCalib::PixelOfflineCalibData > m_writeKey
SG::ReadCondHandleKey< DetCondCFloat > m_readKey
Gaudi::Property< std::string > m_textFileName1
PixelOfflineCalibCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< std::string > m_textFileName3
Gaudi::Property< int > m_inputSource
Gaudi::Property< std::string > m_textFileName2
Gaudi::Property< int > m_dump
virtual StatusCode execute(const EventContext &ctx) const override final
virtual StatusCode initialize() override final
bool range(EventIDRange &r)
const std::string & key() const
const DataObjID & fullKey() const
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const