From b676e5c361698dc4a69b6b21c016a18e05545c34 Mon Sep 17 00:00:00 2001 From: Alessandro Thea Date: Wed, 13 Sep 2023 06:37:38 +0200 Subject: [PATCH 1/2] Adding 50L setup map --- CMakeLists.txt | 1 + config/50L/50LChannelMap_v1.txt | 128 ++++++++++++++++++++++++++++++++ plugins/FiftyLChannelMap.cpp | 84 +++++++++++++++++++++ plugins/VDColdboxChannelMap.cpp | 28 ------- src/PD2HDChannelMapSP.cpp | 16 ++++ 5 files changed, 229 insertions(+), 28 deletions(-) create mode 100644 config/50L/50LChannelMap_v1.txt create mode 100644 plugins/FiftyLChannelMap.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a33f9b..d32281a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ daq_add_plugin( ProtoDUNESP1ChannelMap duneChannelMap LINK_LIBRARIES detchannelm daq_add_plugin( VDColdboxChannelMap duneChannelMap LINK_LIBRARIES detchannelmaps ) daq_add_plugin( PD2HDChannelMap duneChannelMap LINK_LIBRARIES detchannelmaps ) daq_add_plugin( PD2VDBottomTPCChannelMap duneChannelMap LINK_LIBRARIES detchannelmaps ) +daq_add_plugin( FiftyLChannelMap duneChannelMap LINK_LIBRARIES detchannelmaps ) daq_add_plugin( HDColdboxChannelMap duneChannelMap LINK_LIBRARIES detchannelmaps ) ############################################################################## diff --git a/config/50L/50LChannelMap_v1.txt b/config/50L/50LChannelMap_v1.txt new file mode 100644 index 0000000..87813a9 --- /dev/null +++ b/config/50L/50LChannelMap_v1.txt @@ -0,0 +1,128 @@ +36 4 50L 1 0 0 0 2 36 1 0 0 0 +37 4 50L 1 0 0 1 2 37 1 0 1 1 +52 4 50L 1 0 0 2 0 4 1 0 2 2 +38 4 50L 1 0 0 3 2 38 1 0 3 3 +39 4 50L 1 0 0 4 2 39 1 0 4 4 +53 4 50L 1 0 0 5 0 5 1 0 5 5 +40 4 50L 1 0 0 6 2 40 1 0 6 6 +41 4 50L 1 0 0 7 2 41 1 0 7 7 +42 4 50L 1 0 0 8 2 42 1 0 8 8 +43 4 50L 1 0 0 9 2 43 1 0 9 9 +54 4 50L 1 0 0 10 0 6 1 0 10 10 +44 4 50L 1 0 0 11 2 44 1 0 11 11 +45 4 50L 1 0 0 12 2 45 1 0 12 12 +55 4 50L 1 0 0 13 0 7 1 0 13 13 +46 4 50L 1 0 0 14 2 46 1 0 14 14 +47 4 50L 1 0 0 15 2 47 1 0 15 15 +56 4 50L 1 0 0 16 0 8 1 1 0 16 +57 4 50L 1 0 0 17 0 9 1 1 1 17 +58 4 50L 1 0 0 18 0 10 1 1 2 18 +59 4 50L 1 0 0 19 0 11 1 1 3 19 +60 4 50L 1 0 0 20 0 12 1 1 4 20 +61 4 50L 1 0 0 21 0 13 1 1 5 21 +62 4 50L 1 0 0 22 0 14 1 1 6 22 +63 4 50L 1 0 0 23 0 15 1 1 7 23 +64 4 50L 1 0 0 24 0 16 1 1 8 24 +65 4 50L 1 0 0 25 0 17 1 1 9 25 +66 4 50L 1 0 0 26 0 18 1 1 10 26 +67 4 50L 1 0 0 27 0 19 1 1 11 27 +68 4 50L 1 0 0 28 0 20 1 1 12 28 +69 4 50L 1 0 0 29 0 21 1 1 13 29 +70 4 50L 1 0 0 30 0 22 1 1 14 30 +71 4 50L 1 0 0 31 0 23 1 1 15 31 +72 4 50L 1 0 0 32 0 24 1 2 0 32 +73 4 50L 1 0 0 33 0 25 1 2 1 33 +74 4 50L 1 0 0 34 0 26 1 2 2 34 +75 4 50L 1 0 0 35 0 27 1 2 3 35 +76 4 50L 1 0 0 36 0 28 1 2 4 36 +77 4 50L 1 0 0 37 0 29 1 2 5 37 +78 4 50L 1 0 0 38 0 30 1 2 6 38 +79 4 50L 1 0 0 39 0 31 1 2 7 39 +80 4 50L 1 0 0 40 0 32 1 2 8 40 +81 4 50L 1 0 0 41 0 33 1 2 9 41 +82 4 50L 1 0 0 42 0 34 1 2 10 42 +83 4 50L 1 0 0 43 0 35 1 2 11 43 +84 4 50L 1 0 0 44 0 36 1 2 12 44 +85 4 50L 1 0 0 45 0 37 1 2 13 45 +86 4 50L 1 0 0 46 0 38 1 2 14 46 +87 4 50L 1 0 0 47 0 39 1 2 15 47 +24 4 50L 1 0 0 48 2 24 1 3 0 48 +25 4 50L 1 0 0 49 2 25 1 3 1 49 +48 4 50L 1 0 0 50 2 48 1 3 2 50 +26 4 50L 1 0 0 51 2 26 1 3 3 51 +27 4 50L 1 0 0 52 2 27 1 3 4 52 +49 4 50L 1 0 0 53 0 1 1 3 5 53 +28 4 50L 1 0 0 54 2 28 1 3 6 54 +29 4 50L 1 0 0 55 2 29 1 3 7 55 +30 4 50L 1 0 0 56 2 30 1 3 8 56 +31 4 50L 1 0 0 57 2 31 1 3 9 57 +50 4 50L 1 0 0 58 0 2 1 3 10 58 +32 4 50L 1 0 0 59 2 32 1 3 11 59 +33 4 50L 1 0 0 60 2 33 1 3 12 60 +51 4 50L 1 0 0 61 0 3 1 3 13 61 +34 4 50L 1 0 0 62 2 34 1 3 14 62 +35 4 50L 1 0 0 63 2 35 1 3 15 63 +12 4 50L 1 0 0 64 2 12 1 4 0 64 +13 4 50L 1 0 0 65 2 13 1 4 1 65 +124 4 50L 1 0 0 66 1 36 1 4 2 66 +14 4 50L 1 0 0 67 2 14 1 4 3 67 +15 4 50L 1 0 0 68 2 15 1 4 4 68 +125 4 50L 1 0 0 69 1 37 1 4 5 69 +16 4 50L 1 0 0 70 2 16 1 4 6 70 +17 4 50L 1 0 0 71 2 17 1 4 7 71 +18 4 50L 1 0 0 72 2 18 1 4 8 72 +19 4 50L 1 0 0 73 2 19 1 4 9 73 +126 4 50L 1 0 0 74 1 38 1 4 10 74 +20 4 50L 1 0 0 75 2 20 1 4 11 75 +21 4 50L 1 0 0 76 2 21 1 4 12 76 +127 4 50L 1 0 0 77 1 39 1 4 13 77 +22 4 50L 1 0 0 78 2 22 1 4 14 78 +23 4 50L 1 0 0 79 2 23 1 4 15 79 +88 4 50L 1 0 0 80 1 0 1 5 0 80 +89 4 50L 1 0 0 81 1 1 1 5 1 81 +90 4 50L 1 0 0 82 1 2 1 5 2 82 +91 4 50L 1 0 0 83 1 3 1 5 3 83 +92 4 50L 1 0 0 84 1 4 1 5 4 84 +93 4 50L 1 0 0 85 1 5 1 5 5 85 +94 4 50L 1 0 0 86 1 6 1 5 6 86 +95 4 50L 1 0 0 87 1 7 1 5 7 87 +96 4 50L 1 0 0 88 1 8 1 5 8 88 +97 4 50L 1 0 0 89 1 9 1 5 9 89 +98 4 50L 1 0 0 90 1 10 1 5 10 90 +99 4 50L 1 0 0 91 1 11 1 5 11 91 +100 4 50L 1 0 0 92 1 12 1 5 12 92 +101 4 50L 1 0 0 93 1 13 1 5 13 93 +102 4 50L 1 0 0 94 1 14 1 5 14 94 +103 4 50L 1 0 0 95 1 15 1 5 15 95 +104 4 50L 1 0 0 96 1 16 1 6 0 96 +105 4 50L 1 0 0 97 1 17 1 6 1 97 +106 4 50L 1 0 0 98 1 18 1 6 2 98 +107 4 50L 1 0 0 99 1 19 1 6 3 99 +108 4 50L 1 0 0 100 1 20 1 6 4 100 +109 4 50L 1 0 0 101 1 21 1 6 5 101 +110 4 50L 1 0 0 102 1 22 1 6 6 102 +111 4 50L 1 0 0 103 1 23 1 6 7 103 +112 4 50L 1 0 0 104 1 24 1 6 8 104 +113 4 50L 1 0 0 105 1 25 1 6 9 105 +114 4 50L 1 0 0 106 1 26 1 6 10 106 +115 4 50L 1 0 0 107 1 27 1 6 11 107 +116 4 50L 1 0 0 108 1 28 1 6 12 108 +117 4 50L 1 0 0 109 1 29 1 6 13 109 +118 4 50L 1 0 0 110 1 30 1 6 14 110 +119 4 50L 1 0 0 111 1 31 1 6 15 111 +0 4 50L 1 0 0 112 2 0 1 7 0 112 +1 4 50L 1 0 0 113 2 1 1 7 1 113 +120 4 50L 1 0 0 114 1 32 1 7 2 114 +2 4 50L 1 0 0 115 2 2 1 7 3 115 +3 4 50L 1 0 0 116 2 3 1 7 4 116 +121 4 50L 1 0 0 117 1 33 1 7 5 117 +4 4 50L 1 0 0 118 2 4 1 7 6 118 +5 4 50L 1 0 0 119 2 5 1 7 7 119 +6 4 50L 1 0 0 120 2 6 1 7 8 120 +7 4 50L 1 0 0 121 2 7 1 7 9 121 +122 4 50L 1 0 0 122 1 34 1 7 10 122 +8 4 50L 1 0 0 123 2 8 1 7 11 123 +9 4 50L 1 0 0 124 2 9 1 7 12 124 +123 4 50L 1 0 0 125 1 35 1 7 13 125 +10 4 50L 1 0 0 126 2 10 1 7 14 126 +11 4 50L 1 0 0 127 2 11 1 7 15 127 diff --git a/plugins/FiftyLChannelMap.cpp b/plugins/FiftyLChannelMap.cpp new file mode 100644 index 0000000..aef6c2a --- /dev/null +++ b/plugins/FiftyLChannelMap.cpp @@ -0,0 +1,84 @@ +#include "detchannelmaps/TPCChannelMap.hpp" +#include "PD2HDChannelMapSP.h" + +#include "logging/Logging.hpp" // NOLINT + +namespace dunedaq { +namespace detchannelmaps { + +class FiftyLChannelMap : public TPCChannelMap +{ +public: + + explicit FiftyLChannelMap() { + + const char* detchannelmaps_share_cstr = getenv("DETCHANNELMAPS_SHARE"); + if (!detchannelmaps_share_cstr) { + throw std::runtime_error("Environment variable DETCHANNELMAPS_SHARE is not set"); + } + std::string detchannelmaps_share(detchannelmaps_share_cstr); + std::string channel_map_file = detchannelmaps_share + "/config/50L/50LChannelMap_v1.txt"; + m_channel_map.reset(new dune::PD2HDChannelMapSP()); + m_channel_map->ReadMapFromFile(channel_map_file); + TLOG_DEBUG(10) << "FiftyLChannelMap Created"; + } + + FiftyLChannelMap(const FiftyLChannelMap&) = delete; ///< FiftyLChannelMap is not copy-constructible + FiftyLChannelMap& operator=(const FiftyLChannelMap&) = delete; ///< FiftyLChannelMap is not copy-assignable + FiftyLChannelMap(FiftyLChannelMap&&) = delete; ///< FiftyLChannelMap is not move-constructible + FiftyLChannelMap& operator=(FiftyLChannelMap&&) = delete; ///< FiftyLChannelMap is not move-assignable + + + uint + get_offline_channel_from_crate_slot_fiber_chan(uint crate, uint slot, uint link, uint wibframechan) final { + + auto chan_info = m_channel_map->GetChanInfoFromWIBElements( + crate, slot, link, wibframechan + ); + + + if (!chan_info.valid) { + return -1; + } + + return chan_info.offlchan; + + } + + + uint + get_plane_from_offline_channel(uint offchannel) final { + auto chan_info = m_channel_map->GetChanInfoFromOfflChan(offchannel); + + if (!chan_info.valid) { + return 9999; + } + + return chan_info.plane; + }; + + + std::optional + get_crate_slot_fiber_chan_from_offline_channel(uint offchannel) { + auto ci = m_channel_map->GetChanInfoFromOfflChan(offchannel); + + if ( !ci.valid) { + return std::nullopt; + } + return TPCCoords{ci.crate, ci.wib-1, ci.link, ci.wibframechan}; + } + + + +private: + + std::unique_ptr m_channel_map; + + +}; + +DEFINE_DUNE_DET_CHANNEL_MAP(dunedaq::detchannelmaps::FiftyLChannelMap) + + +} // namespace detchannelmaps +} // namespace dunedaq diff --git a/plugins/VDColdboxChannelMap.cpp b/plugins/VDColdboxChannelMap.cpp index c51f743..fb848fd 100644 --- a/plugins/VDColdboxChannelMap.cpp +++ b/plugins/VDColdboxChannelMap.cpp @@ -50,34 +50,6 @@ class VDColdboxChannelMap : public TPCChannelMap return chan_info.plane; }; - // std::optional - // get_crate_slot_fiber_chan_from_offline_channel(uint offchannel) { - // auto ci = m_channel_map->getChanInfoFromOfflChan(offchannel); - - // // return ci.valid ? std::optional{4, ci.wib-1, (ci.wibconnector+1)/2, ci.cebchan} : std::nullopt; - // return std::nullopt; - // } - -// std::optional -// get_crate_slot_fiber_chan_from_offline_channel(uint offchannel) { -// auto ci = m_channel_map->GetChanInfoFromOfflChan(offchannel); -// -// if ( !ci.valid) { -// return std::nullopt; -// } -// // wc = (fiber*2 - 1) + (chan > 127); -// // cechan = chan % 128 -// -// // ((wc+1) % 2) == 0 // -// -// // fibre = 1 -> wc = 1 (0-127),2 (0-127) -// // fibre = 2 -> wc = 3,4 -// -// -// // std::cout << ci.wib << " " << ci.wibconnector << " " << ci.cebchan << std::endl; -// return TPCCoords{4, ci.wib-1, (ci.wibconnector+1)/2, ci.cebchan+128*((ci.wibconnector+1)%2)}; -// } -// std::optional get_crate_slot_fiber_chan_from_offline_channel(uint offchannel) { auto ci = m_channel_map->GetChanInfoFromOfflChan(offchannel); diff --git a/src/PD2HDChannelMapSP.cpp b/src/PD2HDChannelMapSP.cpp index 57df444..7116627 100644 --- a/src/PD2HDChannelMapSP.cpp +++ b/src/PD2HDChannelMapSP.cpp @@ -45,6 +45,22 @@ void dune::PD2HDChannelMapSP::ReadMapFromFile(std::string &fullname) chanInfo.valid = true; + std::cout + << " offlchan " << chanInfo.offlchan + << " crate " << chanInfo.crate + << " APAName" << chanInfo.APAName + << " wib " << chanInfo.wib + << " link " << chanInfo.link + << " femb_on_link" << chanInfo.femb_on_link + << " cebchan " << chanInfo.cebchan + << " plane " << chanInfo.plane + << " chan_in_plan" << chanInfo.chan_in_plane + << " femb " << chanInfo.femb + << " asic " << chanInfo.asic + << " asicchan" << chanInfo.asicchan + << " wibframechan" << chanInfo.wibframechan + << std::endl; + // fill maps. check_offline_channel(chanInfo.offlchan); From 86c9aeb678ef8dc5350ea7ad803b3251964ff189 Mon Sep 17 00:00:00 2001 From: Alessandro Thea Date: Fri, 29 Sep 2023 11:32:05 +0200 Subject: [PATCH 2/2] Cleanup --- src/PD2HDChannelMapSP.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/PD2HDChannelMapSP.cpp b/src/PD2HDChannelMapSP.cpp index 7116627..e64d5b3 100644 --- a/src/PD2HDChannelMapSP.cpp +++ b/src/PD2HDChannelMapSP.cpp @@ -44,23 +44,7 @@ void dune::PD2HDChannelMapSP::ReadMapFromFile(std::string &fullname) >> chanInfo.wibframechan; chanInfo.valid = true; - - std::cout - << " offlchan " << chanInfo.offlchan - << " crate " << chanInfo.crate - << " APAName" << chanInfo.APAName - << " wib " << chanInfo.wib - << " link " << chanInfo.link - << " femb_on_link" << chanInfo.femb_on_link - << " cebchan " << chanInfo.cebchan - << " plane " << chanInfo.plane - << " chan_in_plan" << chanInfo.chan_in_plane - << " femb " << chanInfo.femb - << " asic " << chanInfo.asic - << " asicchan" << chanInfo.asicchan - << " wibframechan" << chanInfo.wibframechan - << std::endl; - + // fill maps. check_offline_channel(chanInfo.offlchan);