Skip to content

Commit

Permalink
Merge pull request #274 from HaiwangYu/icarus-mem
Browse files Browse the repository at this point in the history
tmp solution for ICARUS
  • Loading branch information
brettviren committed Feb 12, 2024
2 parents 805910f + 0503a57 commit 8fd656b
Showing 1 changed file with 45 additions and 17 deletions.
62 changes: 45 additions & 17 deletions sigproc/src/OmnibusSigProc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,7 @@ bool OmnibusSigProc::operator()(const input_pointer& in, output_pointer& out)

// [wgu] save decon result after tight LF
std::vector<double> dummy;
if (m_use_roi_debug_mode and m_use_roi_refinement) {
if (m_use_roi_debug_mode and !m_tight_lf_tag.empty()) {
save_data(*itraces, tight_lf_traces, iplane, perwire_rmses, dummy, "tight_lf");
}

Expand All @@ -1478,7 +1478,9 @@ bool OmnibusSigProc::operator()(const input_pointer& in, output_pointer& out)
// [wgu] save decon result after loose LF
if (m_use_roi_debug_mode) {
decon_2D_looseROI_debug_mode(iplane);
save_data(*itraces, loose_lf_traces, iplane, perwire_rmses, dummy, "loose_lf");
if (!m_loose_lf_tag.empty()) {
save_data(*itraces, loose_lf_traces, iplane, perwire_rmses, dummy, "loose_lf");
}
}

if (m_use_roi_refinement) {
Expand All @@ -1491,16 +1493,24 @@ bool OmnibusSigProc::operator()(const input_pointer& in, output_pointer& out)
// [wgu] collection plane does not need loose LF
// but save something to be consistent
if (m_use_roi_debug_mode and iplane == 2) {
save_data(*itraces, loose_lf_traces, iplane, perwire_rmses, dummy, "loose_lf");
if (!m_loose_lf_tag.empty()) {
save_data(*itraces, loose_lf_traces, iplane, perwire_rmses, dummy, "loose_lf");
}
}

check_data(iplane, "after 2D ROI refine");

// Refine ROIs
if (m_use_roi_refinement) roi_refine.load_data(iplane, m_r_data[iplane], roi_form);
else {
m_c_data[iplane].resize(0, 0); // clear memory
m_r_data[iplane].resize(0, 0); // clear memory
/// TODO: streamline the logics
// special case to dump decon without needs of ROIs
if (m_use_roi_debug_mode and !m_decon_charge_tag.empty()) {
decon_2D_charge(iplane);
save_data(*itraces, decon_charge_traces, iplane, perwire_rmses, thresholds, "decon");
}
m_c_data[iplane].resize(0, 0); // clear memory
m_r_data[iplane].resize(0, 0); // clear memory
}
}

Expand All @@ -1514,7 +1524,7 @@ bool OmnibusSigProc::operator()(const input_pointer& in, output_pointer& out)
roi_refine.CleanUpROIs(iplane);
roi_refine.generate_merge_ROIs(iplane);

if (m_use_roi_debug_mode) {
if (m_use_roi_debug_mode and !m_cleanup_roi_tag.empty()) {
save_roi(*itraces, cleanup_roi_traces, iplane, roi_refine.get_rois_by_plane(iplane));
}

Expand Down Expand Up @@ -1542,10 +1552,10 @@ bool OmnibusSigProc::operator()(const input_pointer& in, output_pointer& out)
roi_refine.CheckROIs(iplane, roi_form);
roi_refine.CleanUpROIs(iplane);
if (m_use_roi_debug_mode) {
if (qx == 0) {
if (qx == 0 and !m_break_roi_loop1_tag.empty()) {
save_roi(*itraces, break_roi_loop1_traces, iplane, roi_refine.get_rois_by_plane(iplane));
}
if (qx == 1) {
if (qx == 1 and !m_break_roi_loop2_tag.empty()) {
save_roi(*itraces, break_roi_loop2_traces, iplane, roi_refine.get_rois_by_plane(iplane));
}
}
Expand All @@ -1556,7 +1566,7 @@ bool OmnibusSigProc::operator()(const input_pointer& in, output_pointer& out)
roi_refine.CheckROIs(iplane, roi_form);
check_data(iplane, "after roi refine check");
roi_refine.CleanUpROIs(iplane);
if (m_use_roi_debug_mode) {
if (m_use_roi_debug_mode and !m_shrink_roi_tag.empty()) {
save_roi(*itraces, shrink_roi_traces, iplane, roi_refine.get_rois_by_plane(iplane));
}

Expand All @@ -1571,7 +1581,7 @@ bool OmnibusSigProc::operator()(const input_pointer& in, output_pointer& out)
roi_refine.ExtendROIs(iplane);
check_data(iplane, "after roi refine extend");

if (m_use_roi_debug_mode) {
if (m_use_roi_debug_mode and !m_extend_roi_tag.empty()) {
save_ext_roi(*itraces, extend_roi_traces, iplane, roi_refine.get_rois_by_plane(iplane));
}

Expand All @@ -1581,7 +1591,7 @@ bool OmnibusSigProc::operator()(const input_pointer& in, output_pointer& out)
roi_refine.apply_roi(iplane, m_r_data[iplane]);
check_data(iplane, "after roi refine apply");
// roi_form.apply_roi(iplane, m_r_data[plane],1);
{
if (!m_gauss_tag.empty()) {
// We only use an intermediate index list here to give
// some clarity to log msg about range added
IFrame::trace_list_t perframe;
Expand All @@ -1591,12 +1601,12 @@ bool OmnibusSigProc::operator()(const input_pointer& in, output_pointer& out)

decon_2D_charge(iplane);
std::vector<double> dummy_thresholds;
if (m_use_roi_debug_mode) {
if (m_use_roi_debug_mode and !m_decon_charge_tag.empty()) {
save_data(*itraces, decon_charge_traces, iplane, perwire_rmses, thresholds, "decon");
}
roi_refine.apply_roi(iplane, m_r_data[iplane]);
// roi_form.apply_roi(iplane, m_r_data[plane],1);
{
if (!m_wiener_tag.empty()) {
// We only use an intermediate index list here to give
// some clarity to log msg about range added
IFrame::trace_list_t perframe;
Expand Down Expand Up @@ -1632,19 +1642,37 @@ bool OmnibusSigProc::operator()(const input_pointer& in, output_pointer& out)
// }

if (m_use_roi_refinement) {
sframe->tag_traces(m_wiener_tag, wiener_traces, thresholds);
sframe->tag_traces(m_gauss_tag, gauss_traces);
if (!m_wiener_tag.empty()) {
sframe->tag_traces(m_wiener_tag, wiener_traces, thresholds);
}
if (!m_gauss_tag.empty()) {
sframe->tag_traces(m_gauss_tag, gauss_traces);
}
}

if (m_use_roi_debug_mode) {
sframe->tag_traces(m_loose_lf_tag, loose_lf_traces);
if (m_use_roi_refinement) {
if (!m_loose_lf_tag.empty()) {
sframe->tag_traces(m_loose_lf_tag, loose_lf_traces);
}
if(!m_decon_charge_tag.empty()) {
sframe->tag_traces(m_decon_charge_tag, decon_charge_traces);
}
if(!m_tight_lf_tag.empty()) {
sframe->tag_traces(m_tight_lf_tag, tight_lf_traces);
}
if (!m_cleanup_roi_tag.empty()) {
sframe->tag_traces(m_cleanup_roi_tag, cleanup_roi_traces);
}
if(!m_break_roi_loop1_tag.empty()) {
sframe->tag_traces(m_break_roi_loop1_tag, break_roi_loop1_traces);
}
if (!m_break_roi_loop2_tag.empty()) {
sframe->tag_traces(m_break_roi_loop2_tag, break_roi_loop2_traces);
}
if (!m_shrink_roi_tag.empty()) {
sframe->tag_traces(m_shrink_roi_tag, shrink_roi_traces);
}
if (!m_extend_roi_tag.empty()) {
sframe->tag_traces(m_extend_roi_tag, extend_roi_traces);
}
}
Expand Down

0 comments on commit 8fd656b

Please sign in to comment.