25 return StatusCode::SUCCESS;
30 if (writeHandle.isValid()) {
31 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
32 <<
". In theory this should not be called, but may happen"
33 <<
" if multiple concurrent events are being processed out of order.");
34 return StatusCode::SUCCESS;
38 std::unique_ptr<NswAsBuiltDbData> writeCdo{std::make_unique<NswAsBuiltDbData>()};
42 if (!readHandle.isValid()) {
43 ATH_MSG_ERROR(
"Null pointer to the read MM/ASBUILTPARAMS conditions object");
44 return StatusCode::FAILURE;
46 writeHandle.addDependency(readHandle);
47 ATH_MSG_INFO(
"Size of MM/ASBUILTPARAMS CondAttrListCollection " << readHandle.fullKey()
48 <<
" ->size()= " << readHandle->size());
49 unsigned int nLines{0};
52 const std::string
data{*(
static_cast<const std::string*
>((atr[
"data"]).addressOfData()))};
53 ATH_MSG_DEBUG(__FILE__<<
":"<<__LINE__<<
" data load is " <<
data <<
" FINISHED HERE ");
54 writeCdo->microMegaData = std::make_unique<NswAsBuilt::StripCalculator>();
55 writeCdo->microMegaData->parseJSON(
data);
59 ATH_MSG_FATAL(nLines <<
" data objects were loaded for MM/ASBUILTPARAMS! Expected only one for this validity range!");
60 return StatusCode::FAILURE;
64 ATH_MSG_INFO(
"Load micromega as-built constants from a JSON file");
66 if (!thefile.good()) {
68 return StatusCode::FAILURE;
72 writeCdo->microMegaData = std::make_unique<NswAsBuilt::StripCalculator>();
73 writeCdo->microMegaData->parseJSON(
buffer.str());
78 if (!readHandle.isValid()) {
79 ATH_MSG_ERROR(
"Null pointer to the read STGC/ASBUILTPARAMS conditions object");
80 return StatusCode::FAILURE;
82 writeHandle.addDependency(readHandle);
83 ATH_MSG_INFO(
"Size of STGC/ASBUILTPARAMS CondAttrListCollection " << readHandle.fullKey()
84 <<
" ->size()= " << readHandle->size());
85 unsigned int nLines{0};
88 const std::string
data{*(
static_cast<const std::string*
>((atr[
"data"]).addressOfData()))};
89 ATH_MSG_DEBUG(__FILE__<<
":"<<__LINE__<<
" data load is " <<
data <<
" FINISHED HERE ");
90 writeCdo->sTgcData = std::make_unique<NswAsBuilt::StgcStripCalculator>();
91 writeCdo->sTgcData->parseJSON(
data);
95 ATH_MSG_FATAL(nLines <<
" data objects were loaded for STGC/ASBUILTPARAMS! Expected only one for this validity range!");
96 return StatusCode::FAILURE;
100 ATH_MSG_INFO(
"Load micromega as-built constants from a JSON file");
102 if (!thefile.good()) {
104 return StatusCode::FAILURE;
107 buffer << thefile.rdbuf();
108 writeCdo->sTgcData = std::make_unique<NswAsBuilt::StgcStripCalculator>();
109 writeCdo->sTgcData->parseJSON(
buffer.str());
111 if (!writeCdo->sTgcData && !writeCdo->microMegaData) {
112 ATH_MSG_ERROR(
"No AsBuilt constants were loaded. Please check the algorithm configucration");
113 return StatusCode::FAILURE;
115 ATH_CHECK(writeHandle.record(std::move(writeCdo)));
116 return StatusCode::SUCCESS;