11 #include "nlohmann/json.hpp"
19 return StatusCode::SUCCESS;
25 if (writeHandle.isValid()) {
26 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
27 <<
". In theory this should not be called, but may happen"
28 <<
" if multiple concurrent events are being processed out of order.");
29 return StatusCode::SUCCESS;
36 if (!in_json.good()) {
38 return StatusCode::FAILURE;
44 if (!readHandle.isValid()) {
46 return StatusCode::FAILURE;
48 writeHandle.addDependency(readHandle);
49 for (
const auto& itr : **readHandle) {
56 auto condObj = std::make_unique<TwinTubeMap>(
m_idHelperSvc.get());
60 std::unordered_map<unsigned int, HedgehogBoardPtr> hedgeHogBoards{};
62 for (
const auto& boardMapping :
blob[
"HedgehogBoards"].
items()) {
65 const unsigned boardId = payLoad[
"boardId"];
66 const Mapping
mapping = payLoad[
"hedgeHogPins"];
67 const unsigned tubeLayers = payLoad[
"nTubeLayers"];
68 auto newBoard = std::make_unique<HedgehogBoard>(
mapping, tubeLayers, boardId);
69 if (payLoad.find(
"hvDelayTime") != payLoad.end()) {
70 newBoard->setHVDelayTime(payLoad[
"hvDelayTime"]);
74 ATH_MSG_FATAL(
"There's already a board registered under "<<storeMe->boardId()<<
".");
75 return StatusCode::FAILURE;
77 storeMe = std::move(newBoard);
79 for (
const auto& twinMapping :
blob[
"TwinTubeMapping"].
items()) {
82 const int stIndex = idHelper.stationNameIndex(payLoad[
"station"]);
83 const int eta = payLoad[
"eta"];
84 const int phi = payLoad[
"phi"];
85 const int ml = payLoad[
"ml"];
87 const Identifier detElId{idHelper.channelID(stIndex, eta, phi, ml, 1, 1,
isValid)};
89 ATH_MSG_FATAL(
"Failed to build valid identifier from "<<payLoad);
90 return StatusCode::FAILURE;
92 const std::vector<unsigned int> boardMounting = payLoad[
"mountedBoards"];
93 for (
unsigned int place = 0; place < boardMounting.size(); ++place) {
94 ATH_CHECK(condObj->addHedgeHogBoard(detElId, hedgeHogBoards[boardMounting[place]], place));
97 ATH_CHECK(writeHandle.record(std::move(condObj)));
98 return StatusCode::SUCCESS;