47 auto createMap = [
this](
const uint8_t tubeLayers,
const uint16_t id) {
50 for (uint8_t layer = 1 ; layer<= dummyBoard.
numTubeLayers(); ++layer) {
52 const uint8_t thisPin = dummyBoard.
pinNumber(layer, tube);
53 const uint8_t otherTube = dummyBoard.
numTubeLayers() == 3 || tube != 2 ? tube +2 : 5;
54 const uint8_t otherPin = dummyBoard.
pinNumber(layer, otherTube);
55 ATH_MSG_DEBUG(
"Layer "<<
static_cast<int>(layer)<<
", "<<
static_cast<int>(tube)<<
" -> pin: "
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()};
73 nlohmann::json payload{};
80 const HedgeHogBoardPtr& pickMe{reEl->numLayers() == 3 ? threeLayBoard : fourLayBoard};
81 uint16_t boardCounter{0};
82 std::vector<uint16_t> connectedBoards{};
83 for (
unsigned iTube{1}; iTube<= reEl->numTubesInLay() + (reEl->numTubesInLay() % pickMe->numTubesPerLayer());
84 iTube+=pickMe->numTubesPerLayer()) {
86 connectedBoards.push_back(pickMe->boardId());
88 nlohmann::json twinPair{};
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());
102 nlohmann::json hedge{};
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;
120 outStream<<payload.dump(
m_spacing)<<std::endl;
122 return StatusCode::SUCCESS;