51 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.");
52 return StatusCode::SUCCESS;
57 if (not pixelDetEleHandle.
isValid() or elements==
nullptr) {
59 return StatusCode::FAILURE;
69 std::unique_ptr<PixelChargeCalibCondData> writeCdo(std::make_unique<PixelChargeCalibCondData>(
m_pixelID->wafer_hash_max()));
71 const EventIDBase start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
72 const EventIDBase stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
74 EventIDRange rangeW{start, stop};
78 if (readCdo==
nullptr) {
80 return StatusCode::FAILURE;
83 if (not readHandle.
range(rangeW)) {
85 return StatusCode::FAILURE;
87 ATH_MSG_INFO(
"Size of CondAttrListCollection " << readHandle.
fullKey() <<
" readCdo->size()= " << readCdo->
size());
89 std::unique_ptr<IChargeCalibrationParser> pParser{};
91 for (
const auto & attrList : *readCdo) {
95 if (payload.exists(
"data_array") and not payload[
"data_array"].isNull()) {
97 pParser = std::make_unique<LUTChargeCalibParser>(configData, elements,
m_pixelID);
100 ATH_MSG_FATAL(
"Input file" << fileName <<
" not found! Change the inputSource!");
101 return StatusCode::FAILURE;
103 std::ifstream infile(fileName.c_str());
105 std::string fileContent((std::istreambuf_iterator<char>(infile)), std::istreambuf_iterator<char>());
108 nlohmann::json::parse(fileContent);
109 for (
const auto &[hash,
data] : jsonData.items()) {
110 const unsigned int moduleHash = std::stoul(hash);
117 return StatusCode::FAILURE;
120 if (!b.tot2Charges.empty()) {
121 writeCdo -> setTot2Charges(moduleHash, b.tot2Charges);
124 writeCdo -> setAllFromBundle(moduleHash, b);
140 for (
unsigned int moduleHash{}; moduleHash <
m_pixelID->wafer_hash_max(); moduleHash++) {
146 writeCdo -> setAllFromConfigData(moduleHash, configData, becLayer, numFE);
152 for (
unsigned int moduleHash{}; moduleHash <
m_pixelID->wafer_hash_max(); moduleHash++) {
155 int barrel_ec =
m_pixelID->barrel_ec(wafer_id);
156 int layer =
m_pixelID->layer_disk(wafer_id);
165 writeCdo -> setThresholds(
type, moduleHash, std::vector<Thresholds>(numFE,
defaults));
170 if (writeHandle.
record(rangeW, std::move(writeCdo)).isFailure()) {
171 ATH_MSG_FATAL(
"Could not record PixelChargeCalibCondData " << writeHandle.
key() <<
" with EventRange " << rangeW <<
" into Conditions Store");
172 return StatusCode::FAILURE;
174 ATH_MSG_INFO(
"recorded new CDO " << writeHandle.
key() <<
" with range " << rangeW <<
" into Conditions Store");
176 return StatusCode::SUCCESS;