10 #include "nlohmann/json.hpp"
22 ATH_MSG_FATAL(
"You can't write mdt cablings without mdt detectors? ");
23 return StatusCode::FAILURE;
25 return StatusCode::SUCCESS;
33 Mapping tubeMapping{};
46 if (!outStream.good()) {
48 return StatusCode::FAILURE;
51 outStream<<
" {"<<std::endl;
52 outStream<<
" \"mezzId\": "<<
static_cast<int>(
card.id())<<
","<<std::endl;
53 outStream<<
" \"nTubeLayer\": "<<
static_cast<int>(
card.numTubeLayers())<<
","<<std::endl;
54 outStream<<
" \"tdcToTubeMap\": [";
55 for (
size_t ch = 0 ;
ch <
card.tdcToTubeMap().size(); ++
ch) {
56 outStream<<static_cast<int>(
card.tdcToTubeMap()[
ch]);
57 if (
ch + 1 !=
card.tdcToTubeMap().size()) {
61 outStream<<
"]"<<std::endl;
64 outStream<<
"["<<std::endl;
65 dumpCard(mapping4Layers);
66 outStream<<
","<<std::endl;
67 dumpCard(mapping3Layers);
68 outStream<<
"]"<<std::endl;
71 ATH_MSG_VERBOSE(
"Test mappings "<<std::endl<<mapping4Layers<<std::endl<<mapping3Layers);
73 std::vector<const MuonGMR4::MdtReadoutElement*> reEles{
m_detMgr->getAllMdtReadoutElements()};
76 constexpr std::array<int, 4> subDet{97,98, 99, 100};
77 std::array<int, 4> mrodCounter{make_array<int,4>(0)};
78 std::array<int, 4> csmCounter{make_array<int,4>(0)};
79 constexpr
int mrodMax = 40;
83 const int detIndex = 2*(!reEle->isBarrel()) + (reEle->stationEta() < 0);
84 const int mrod = (++mrodCounter[detIndex]);
86 mrodCounter[detIndex] = 0;
87 (++csmCounter[detIndex]);
95 cablingChannel[
"station"] =
m_idHelperSvc->stationNameString(reEle->identify());
96 cablingChannel[
"eta"] = reEle->stationEta();
97 cablingChannel[
"phi"] = reEle->stationPhi();
98 cablingChannel[
"ml"] = reEle->multilayer();
99 cablingChannel[
"subDet"] = subDet[detIndex];
100 cablingChannel[
"csm"] = csmCounter[detIndex];
101 cablingChannel[
"mrod"] = mrod;
102 cablingChannel[
"tdcId"] = (tdc++);
103 cablingChannel[
"mezzId"] =
static_cast<int>(
card.id());
104 cablingChannel[
"tubeZero"] =
tube;
105 allChannels.push_back(cablingChannel);
109 if (!outStream.good()) {
111 return StatusCode::FAILURE;
113 outStream<<allChannels.dump(2)<<std::endl;
114 return StatusCode::SUCCESS;