Skip to content

Commit

Permalink
better coding
Browse files Browse the repository at this point in the history
  • Loading branch information
Mun Jung Jung committed Mar 5, 2025
1 parent 2b7cdfa commit f4f5bab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pytorch/inc/WireCellPytorch/DNNROIFinding.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace WireCell {
IFrame::trace_summary_t get_summary_e(const IFrame::pointer& inframe, const std::string &tag) const;

// Convert dense array to (dense) traces
ITrace::shared_vector eigen_to_traces(const Array::array_xxf& arr, bool set_negative_to_zero);
ITrace::shared_vector eigen_to_traces(const Array::array_xxf& arr, bool save_negative_charge);

int m_save_count; // count frames saved
};
Expand Down
6 changes: 3 additions & 3 deletions pytorch/src/DNNROIFinding.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ IFrame::trace_summary_t Pytorch::DNNROIFinding::get_summary_e(const IFrame::poin
return summary_e;
}

ITrace::shared_vector Pytorch::DNNROIFinding::eigen_to_traces(const Array::array_xxf& arr, bool set_negative_to_zero)
ITrace::shared_vector Pytorch::DNNROIFinding::eigen_to_traces(const Array::array_xxf& arr, bool save_negative_charge)
{
ITrace::vector traces;
ITrace::ChargeSequence charge(m_ncols, 0.0);
for (size_t irow = 0; irow < m_nrows; ++irow) {
auto wave = arr.row(irow);
for (size_t icol=0; icol<m_ncols; ++icol) {
charge[icol] = wave(icol);
if (set_negative_to_zero) {
if (!save_negative_charge) { // set negative charge to zero
charge[icol] = charge[icol] < 0 ? 0 : charge[icol];
}
}
Expand Down Expand Up @@ -327,7 +327,7 @@ bool Pytorch::DNNROIFinding::operator()(const IFrame::pointer& inframe, IFrame::
#endif

// eigen to frame
auto traces = eigen_to_traces(sp_charge, !m_cfg.save_negative_charge);
auto traces = eigen_to_traces(sp_charge, m_cfg.save_negative_charge);
Aux::SimpleFrame* sframe = new Aux::SimpleFrame(
inframe->ident(), inframe->time(),
traces,
Expand Down

0 comments on commit f4f5bab

Please sign in to comment.