5 #include "Identifier/Identifier.h" 
    7 #include "GaudiKernel/EventIDRange.h" 
   27     ATH_MSG_ERROR(
"The database is set to be input source (2) but the ReadKey is empty.");
 
   33   return StatusCode::SUCCESS;
 
   43     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.");
 
   44     return StatusCode::SUCCESS;
 
   48   std::unique_ptr<PixelOfflineCalibData> writeCdo(std::make_unique<PixelOfflineCalibData>());
 
   52     return StatusCode::FAILURE;
 
   55     ATH_MSG_WARNING(
"Pixel ITk constants read from text file. Only supported for local developments and debugging!");
 
   57     auto calibData = std::make_unique<PixelOfflineCalibData>();
 
   60     ATH_MSG_INFO(
"Load ITkPixelErrorData constants from text file");
 
   64        unsigned int n_entries = calibData->getClusterErrorData()->load(
fileName);
 
   68     const EventIDBase 
start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0,                       0,                       EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
 
   69     const EventIDBase 
stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
 
   74     if (writeHandle.
record(rangeW, std::move(writeCdo)).isFailure()) {
 
   75       ATH_MSG_FATAL(
"Could not record PixelCalib::ITkPixelOfflineCalibData " << writeHandle.
key() << 
" with EventRange " << rangeW << 
" into Conditions Store");
 
   76       return StatusCode::FAILURE;
 
   78     ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.
key() << 
" with range " << rangeW << 
" into Conditions Store");
 
   90     if (readCdo==
nullptr) {
 
   92       return StatusCode::FAILURE;
 
   97     if (not readHandle.range(rangeW)) {
 
   98        ATH_MSG_FATAL(
"Failed to retrieve validity range for " << readHandle.key());
 
   99        return StatusCode::FAILURE;
 
  104     for(
const auto & attrList : *readCdo){
 
  106       std::ostringstream attrStr;
 
  107       attrList.second.toOutputStream(attrStr);
 
  108       ATH_MSG_DEBUG( 
"ChanNum " << attrList.first << 
" Attribute list " << attrStr.str() );
 
  110       std::string stringData = attrList.second[
"data_array"].data<std::string>();
 
  113       std::vector<std::string> component;
 
  115       while ((
pos = stringData.find(
delimiter)) != std::string::npos) {
 
  117     component.push_back(
buffer);
 
  120       component.push_back(stringData);
 
  123       for (
auto & 
i : component) {
 
  124     std::string checkModule = 
i;
 
  125     std::vector<std::string> moduleString;
 
  128     while ((
pos = checkModule.find(
delimiter)) != std::string::npos) {
 
  130       moduleString.push_back(
buffer);
 
  133     moduleString.push_back(std::move(checkModule));
 
  135     if (moduleString.size()!=2) {
 
  136       ATH_MSG_FATAL(
"String size (moduleString) is not 2. " << moduleString.size() << 
" in " << 
i << 
" channel " <<  attrList.first << 
" read from " << readHandle.fullKey());
 
  137       return StatusCode::FAILURE;
 
  140     std::stringstream checkModuleHash(moduleString[0]);
 
  141     std::vector<std::string> moduleStringHash;
 
  142     while (std::getline(checkModuleHash,
buffer,
'"')) { moduleStringHash.push_back(
buffer); }
 
  144     int waferHash   = 
std::atoi(moduleStringHash[1].c_str());
 
  147     std::stringstream moduleConstants(moduleString[1]);
 
  148     std::vector<double> moduleConstantsVec;
 
  149     while (std::getline(moduleConstants,
buffer,
',')) {  moduleConstantsVec.emplace_back(
std::atof(
buffer.c_str())); }
 
  152         std::array<double, ITk::PixelClusterErrorData::kNParam> param{};
 
  153         std::span<double> param_src(param);
 
  156     if(moduleConstantsVec.size()==4){
 
  163     else if(moduleConstantsVec.size()==7){
 
  167           param[0] = moduleConstantsVec[0]; 
 
  168           for (
unsigned int idx=0; 
idx<moduleConstantsVec.size(); ++
idx) {
 
  169              param[
idx+1] = moduleConstantsVec[
idx];
 
  174     else if(moduleConstantsVec.size()==8){
 
  175            param_src = std::span<double>(moduleConstantsVec.begin(), moduleConstantsVec.end());
 
  177         assert(writeCdo->getClusterErrorData());
 
  178         writeCdo->getClusterErrorData()->setDeltaError(waferID_hash,param_src);
 
  184     if (writeHandle.
record(rangeW, std::move(writeCdo)).isFailure()) {
 
  185       ATH_MSG_FATAL(
"Could not record PixelCalib::ITkPixelOfflineCalibData " << writeHandle.
key() << 
" with EventRange " << rangeW << 
" into Conditions Store");
 
  186       return StatusCode::FAILURE;
 
  188     ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.
key() << 
" with range " << rangeW << 
" into Conditions Store");
 
  192   return StatusCode::SUCCESS;