From 5f84d4d92fc136c9f84e5c151b3b40b1df63e6ff Mon Sep 17 00:00:00 2001 From: Wenqiang Gu Date: Wed, 7 Aug 2024 09:19:31 -0500 Subject: [PATCH 1/2] get field response with function --- sigproc/src/OmnibusSigProc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sigproc/src/OmnibusSigProc.cxx b/sigproc/src/OmnibusSigProc.cxx index f11959b6..123615c1 100644 --- a/sigproc/src/OmnibusSigProc.cxx +++ b/sigproc/src/OmnibusSigProc.cxx @@ -790,7 +790,7 @@ void OmnibusSigProc::init_overall_response(IFrame::pointer frame) // Convert each average FR to a 2D array for (int iplane = 0; iplane < 3; ++iplane) { - auto arr = Response::as_array(fravg.planes[iplane], fine_nwires, fine_nticks); + auto arr = Response::as_array(*(fravg.plane(iplane)), fine_nwires, fine_nticks); int nrows = 0; From f778c70be4346351fc8fd4ef809ec195478d2525 Mon Sep 17 00:00:00 2001 From: Wenqiang Gu Date: Thu, 8 Aug 2024 15:10:14 -0500 Subject: [PATCH 2/2] add a configurable protection --- sigproc/inc/WireCellSigProc/OmnibusSigProc.h | 4 ++++ sigproc/src/OmnibusSigProc.cxx | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sigproc/inc/WireCellSigProc/OmnibusSigProc.h b/sigproc/inc/WireCellSigProc/OmnibusSigProc.h index 6280a8a9..9166d405 100644 --- a/sigproc/inc/WireCellSigProc/OmnibusSigProc.h +++ b/sigproc/inc/WireCellSigProc/OmnibusSigProc.h @@ -233,6 +233,10 @@ namespace WireCell { // samples. bool m_sparse{false}; + // If true, load plane response with an ident number, see: + // https://github.com/WireCell/wire-cell-toolkit/issues/322 + bool m_load_fr_with_plane_ident{false}; + size_t m_count{0}; int m_verbose{0}; diff --git a/sigproc/src/OmnibusSigProc.cxx b/sigproc/src/OmnibusSigProc.cxx index 123615c1..c94f695e 100644 --- a/sigproc/src/OmnibusSigProc.cxx +++ b/sigproc/src/OmnibusSigProc.cxx @@ -54,6 +54,7 @@ std::string WireCell::SigProc::OmnibusSigProc::OspChan::str() const void OmnibusSigProc::configure(const WireCell::Configuration& config) { m_sparse = get(config, "sparse", false); + m_load_fr_with_plane_ident = get(config, "load_fr_with_plane_ident", false); m_fine_time_offset = get(config, "ftoffset", m_fine_time_offset); m_coarse_time_offset = get(config, "ctoffset", m_coarse_time_offset); @@ -297,6 +298,7 @@ WireCell::Configuration OmnibusSigProc::default_configuration() const cfg["isWarped"] = m_isWrapped; // default false cfg["sparse"] = false; + cfg["load_fr_with_plane_ident"] = false; return cfg; } @@ -790,7 +792,15 @@ void OmnibusSigProc::init_overall_response(IFrame::pointer frame) // Convert each average FR to a 2D array for (int iplane = 0; iplane < 3; ++iplane) { - auto arr = Response::as_array(*(fravg.plane(iplane)), fine_nwires, fine_nticks); + Array::array_xxf arr; + if (m_load_fr_with_plane_ident) { + // Load correct field response for the swapped V&W planes in PDHD APA1. See: + // https://github.com/WireCell/wire-cell-toolkit/issues/322 + arr = Response::as_array(*(fravg.plane(iplane)), fine_nwires, fine_nticks); + } + else { + arr = Response::as_array(fravg.planes[iplane], fine_nwires, fine_nticks); + } int nrows = 0;