17 #include "GaudiKernel/EventIDRange.h" 
   21 #include <nlohmann/json.hpp> 
   48   return StatusCode::SUCCESS;
 
   56     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.");
 
   57     return StatusCode::SUCCESS;
 
   62   if (not pixelDetEleHandle.
isValid() or elements==
nullptr) {
 
   64     return StatusCode::FAILURE;
 
   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};
 
   80   unsigned int channel_warnings=0;
 
   81   unsigned int max_channel_warnings=10;
 
   83   unsigned int max_invalid_channel=0;
 
   87     if (readCdo==
nullptr) {
 
   89       return StatusCode::FAILURE;
 
   92     if (not readHandle.
range(rangeW)) {
 
   94       return StatusCode::FAILURE;
 
   96     ATH_MSG_INFO(
"Size of CondAttrListCollection " << readHandle.
fullKey() << 
" readCdo->size()= " << readCdo->
size());
 
   99     std::unique_ptr<IChargeCalibrationParser> pParser{};
 
  100     for (
const auto & attrList : *readCdo) {
 
  104       if (
payload.exists(
"data_array") and not 
payload[
"data_array"].isNull()) {
 
  105         pParser = std::make_unique<Run3ChargeCalibParser>(configData, elements, 
m_pixelID);
 
  107         for (
const auto &[
hash, 
data] : jsonData.items()) {
 
  108           const unsigned int moduleHash = std::stoul(
hash);
 
  112             return StatusCode::FAILURE;
 
  114           writeCdo -> setAllFromBundle(moduleHash, 
b);
 
  116       } 
else if (
payload.exists(
"data") and not 
payload[
"data"].isNull()) { 
 
  117         pParser = std::make_unique<Run2ChargeCalibParser>(configData, elements, 
m_pixelID);
 
  121            min_invalid_channel = 
std::min(min_invalid_channel,channelNumber);
 
  122            max_invalid_channel = 
std::max(max_invalid_channel,channelNumber);
 
  123            if (channel_warnings++ < max_channel_warnings) {
 
  125                               << (channel_warnings==max_channel_warnings ? 
" Further such warnings will not be reported." : 
""));
 
  129         const unsigned int moduleHash = channelNumber;
 
  130         std::string stringStatus = 
payload[
"data"].data<std::string>();
 
  134           return StatusCode::FAILURE;
 
  136         writeCdo -> setAllFromBundle(moduleHash, 
b);
 
  138         ATH_MSG_ERROR(
"payload[\"data\"] does not exist for ChanNum " << channelNumber);
 
  139         return StatusCode::FAILURE;
 
  144       IdentifierHash wafer_hash = IdentifierHash(moduleHash);
 
  150       const std::vector<Thresholds> allDefaultThresholds(numFE, defaultThreshold);
 
  153       const std::vector<LegacyFitParameters> allDefaultFitParams(numFE, defaultParam);
 
  156       const std::vector<LinearFitParameters> allDefaultLinearParams(numFE, defaultLinParam);
 
  159         writeCdo -> setThresholds(
type, moduleHash, allDefaultThresholds);
 
  160         writeCdo -> setLegacyFitParameters(
type, moduleHash, allDefaultFitParams);
 
  161         writeCdo -> setLinearFitParameters(
type, moduleHash, allDefaultLinearParams);
 
  163       writeCdo -> setTotResolutions(moduleHash, std::vector<Resolutions>(numFE, {0.f, 0.f}));
 
  166   if (channel_warnings>max_channel_warnings) {
 
  167      ATH_MSG_WARNING(
"Encountered " << channel_warnings << 
" invalid channel numbers (range " << min_invalid_channel << 
" .. " 
  174     IdentifierHash wafer_hash = IdentifierHash(moduleHash);
 
  182         writeCdo -> setThresholds(
type, moduleHash, std::vector<Thresholds>(numFE, 
defaults));
 
  187   if (writeHandle.
record(rangeW, std::move(writeCdo)).isFailure()) {
 
  188     ATH_MSG_FATAL(
"Could not record PixelChargeCalibCondData " << writeHandle.
key() << 
" with EventRange " << rangeW << 
" into Conditions Store");
 
  189     return StatusCode::FAILURE;
 
  191   ATH_MSG_INFO(
"recorded new CDO " << writeHandle.
key() << 
" with range " << rangeW << 
" into Conditions Store");
 
  193   return StatusCode::SUCCESS;