10#include <CoralBase/Blob.h>
21 ATH_MSG_ERROR(
"MuonIdHelperSvc does not have MM, the CTP calibration should not be run!");
22 return StatusCode::FAILURE;
31 ATH_MSG_FATAL(
"Neither an extrenal JSON nor a COOL folder were defined. Please check");
32 return StatusCode::FAILURE;
38 return StatusCode::SUCCESS;
47 <<
" In theory this should not be called, but may happen"
48 <<
" if multiple concurrent events are being processed out of order.");
49 return StatusCode::SUCCESS;
52 std::unique_ptr<Muon::mmCTPClusterCalibData> writeCdo{std::make_unique<Muon::mmCTPClusterCalibData>(
m_idHelperSvc.get())};
57 if (!inStream.good()) {
59 return StatusCode::FAILURE;
69 return StatusCode::FAILURE;
73 itr != readHandle->end(); ++itr) {
74 const coral::AttributeList& atr = itr->second;
75 std::string
data = *(
static_cast<const std::string*
>((atr[
"data"]).addressOfData()));
76 nlohmann::json lines = nlohmann::json::parse(
data);
82 return StatusCode::SUCCESS;
87 for (
auto& corr : lines.items()) {
88 nlohmann::json line = corr.value();
91 if (!line.contains(
"station") || !line.contains(
"phi") || !line.contains(
"eta") || !line.contains(
"multilayer") || !line.contains(
"gasGap")) {
93 return StatusCode::FAILURE;
97 if (!line.contains(
"P1Parameters") || !line[
"P1Parameters"].is_array() || line[
"P1Parameters"].size() != 2) {
98 ATH_MSG_ERROR(
"Get unexpected size of the P1Parameters array");
99 return StatusCode::FAILURE;
103 const std::string stationType = line[
"station"];
104 const int stationPhi = line[
"phi"];
105 const int stationEta = line[
"eta"];
106 const int multiLayer = line[
"multilayer"];
107 const int gasGap = line[
"gasGap"];
110 std::array<double, 2> modelPars;
111 std::copy_n(line[
"P1Parameters"].begin(), 2, modelPars.begin());
116 errorCalibId =
m_idHelperSvc->mmIdHelper().channelID(stationType, stationEta, stationPhi, multiLayer, gasGap, 1 );
124 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
char data[hepevt_bytes_allocation_ATLAS]
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
ChanAttrListMap::const_iterator const_iterator
static EventIDRange infiniteTime()
Produces an EventIDRange that is inifinite in Time and invalid in RunLumi.
Gaudi::Property< std::string > m_readFromJSON
Parse data from COOL.
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyDb
virtual StatusCode execute(const EventContext &ctx) const override final
SG::WriteCondHandleKey< Muon::mmCTPClusterCalibData > m_writeKey
virtual StatusCode initialize() override final
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
StatusCode parseDataFromJSON(const nlohmann::json &lines, Muon::mmCTPClusterCalibData &ctpClusterCondData) const
StatusCode storeConstants(const Identifier &gasGapId, CTPParameters &&newConstants)
void addDependency(const EventIDRange &range)
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const