9 #include "nlohmann/json.hpp"
20 ATH_MSG_FATAL(
"You can't write mdt twin cablings without mdt detectors? ");
21 return StatusCode::FAILURE;
23 return StatusCode::SUCCESS;
30 std::string mlName{
std::format(
"{:}{:d}{:}{:02}M{:d}",
35 idHelper.multilayer(detElId))};
48 Mapping dummyMap{make_array<uint8_t, 24>(-1)};
53 const uint8_t otherTube = dummyBoard.numTubeLayers() == 3 ||
tube != 2 ?
tube +2 : 5;
54 const uint8_t otherPin = dummyBoard.pinNumber(
layer, otherTube);
56 <<
static_cast<int>(thisPin)<<
" <=> tube: "<<
static_cast<int>(
tube + 2)<<
", pin: "
57 <<
static_cast<int>(otherPin));
58 if (dummyMap[thisPin] < dummyMap.size()) {
61 dummyMap[otherPin] = thisPin;
62 dummyMap[thisPin] = otherPin;
65 auto board = std ::make_unique<Muon::HedgehogBoard>(dummyMap, tubeLayers,
id);
66 ATH_MSG_INFO(
"Created new hedgehog board "<<std::endl<<(*board));
69 HedgeHogBoardPtr threeLayBoard{createMap(3,1)}, fourLayBoard{createMap(4,2)};
71 std::vector<const MuonGMR4::MdtReadoutElement*> reEles{
m_detMgr->getAllMdtReadoutElements()};
80 const HedgeHogBoardPtr& pickMe{reEl->numLayers() == 3 ? threeLayBoard : fourLayBoard};
82 std::vector<uint16_t> connectedBoards{};
83 for (
unsigned iTube{1}; iTube<= reEl->numTubesInLay() + (reEl->numTubesInLay() % pickMe->numTubesPerLayer());
84 iTube+=pickMe->numTubesPerLayer()) {
85 ATH_CHECK(twinTubes.addHedgeHogBoard(
id, pickMe, boardCounter++));
86 connectedBoards.push_back(pickMe->boardId());
93 twinPair[
"mountedBoards"] = connectedBoards;
94 payload[
"TwinTubeMapping"].push_back(std::move(twinPair));
97 auto dumpHedgeHog = [&
payload,
this](
const HedgeHogBoardPtr& board) {
98 if (board.use_count() < 2) {
99 ATH_MSG_INFO(
"The board "<<std::endl<<(*board)<<
" has not been used "<<board.use_count());
103 hedge[
"boardId"] = board->boardId();
104 hedge[
"nTubeLayers"] = board->numTubeLayers();
105 hedge[
"hedgeHogPins"] = board->data();
106 if (board->hasHVDelayTime()) {
107 hedge[
"hvDelayTime"] = board->hvDelayTime();
109 payload[
"HedgehogBoards"].push_back(std::move(hedge));
111 dumpHedgeHog(threeLayBoard);
112 dumpHedgeHog(fourLayBoard);
115 if(!outStream.good()){
117 return StatusCode::FAILURE;
122 return StatusCode::SUCCESS;