ROI_refinement.h
Go to the documentation of this file.
1 #ifndef WIRECELLSIGPROC_ROIREFINEMENT
2 #define WIRECELLSIGPROC_ROIREFINEMENT
3 
4 #include "SignalROI.h"
5 #include "ROI_formation.h"
6 #include "WireCellUtil/Array.h"
8 #include "WireCellUtil/Logging.h"
9 
10 #include <vector>
11 #include <map>
12 
13 namespace WireCell{
14  namespace SigProc{
15 
16 
17 
19  public:
20  ROI_refinement(Waveform::ChannelMaskMap& cmm,int nwire_u, int nwire_v, int nwire_w, float th_factor = 3.0, float fake_signal_low_th = 500, float fake_signal_high_th = 1000, float fake_signal_low_th_ind_factor=1.0, float fake_signal_high_th_ind_factor=1.0, int pad = 5, int break_roi_loop = 2, float th_peak = 3.0, float sep_peak = 6.0, float low_peak_sep_threshold_pre = 1200, int max_npeaks = 200, float sigma = 2, float th_percent = 0.1);
22 
23  void Clear();
24 
25  // initialize the ROIs
26  void load_data(int plane, const Array::array_xxf& r_data, ROI_formation& roi_form);
27  void refine_data(int plane, ROI_formation& roi_form);
28  void refine_data_debug_mode(int plane, ROI_formation& roi_form, const std::string& cmd);
29 
30  void apply_roi(int plane, Array::array_xxf& r_data);
31 
36 
37  private:
38  int nwire_u;
39  int nwire_v;
40  int nwire_w;
41 
42  float th_factor;
47  int pad;
49  float th_peak;
50  float sep_peak;
52 
53  //peak finding ones
55  float sigma;
56  float th_percent;
57 
58  void unlink(SignalROI *prev_roi, SignalROI *next_roi);
59  void link(SignalROI *prev_roi, SignalROI *next_roi);
60  void CleanUpROIs(int plane);
61  void generate_merge_ROIs(int plane);
62  void CheckROIs(int plane, ROI_formation& roi_form);
63 
64  void CleanUpCollectionROIs();
65  void CleanUpInductionROIs(int plane);
66  void ShrinkROIs(int plane, ROI_formation& roi_form);
67  void ShrinkROI(SignalROI *roi, ROI_formation& roi_form);
68 
69  void BreakROIs(int plane, ROI_formation& roi_form);
70  void BreakROI(SignalROI *roi, float rms);
71  void BreakROI1(SignalROI *roi);
72 
73  void ExtendROIs();
74 
75  void TestROIs();
76 
77  std::map<int,std::vector<std::pair<int,int>>> bad_ch_map;
78 
79 
83 
86 
87 
91 
93  };
94  }
95 }
96 #endif
97 // Local Variables:
98 // mode: c++
99 // c-basic-offset: 2
100 // End:
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:39
void link(SignalROI *prev_roi, SignalROI *next_roi)
std::string string
Definition: nybbler.cc:12
ROI_refinement(Waveform::ChannelMaskMap &cmm, int nwire_u, int nwire_v, int nwire_w, float th_factor=3.0, float fake_signal_low_th=500, float fake_signal_high_th=1000, float fake_signal_low_th_ind_factor=1.0, float fake_signal_high_th_ind_factor=1.0, int pad=5, int break_roi_loop=2, float th_peak=3.0, float sep_peak=6.0, float low_peak_sep_threshold_pre=1200, int max_npeaks=200, float sigma=2, float th_percent=0.1)
void unlink(SignalROI *prev_roi, SignalROI *next_roi)
std::map< std::string, ChannelMasks > ChannelMaskMap
Collect channel masks by some label.
Definition: Waveform.h:59
void BreakROI(SignalROI *roi, float rms)
void ShrinkROIs(int plane, ROI_formation &roi_form)
void load_data(int plane, const Array::array_xxf &r_data, ROI_formation &roi_form)
std::map< SignalROI *, SignalROISelection > SignalROIMap
Definition: SignalROI.h:55
std::vector< SignalROIList > SignalROIChList
Definition: SignalROI.h:54
std::shared_ptr< spdlog::logger > logptr_t
Definition: Logging.h:24
void apply_roi(int plane, Array::array_xxf &r_data)
Definition: Main.h:22
std::map< int, std::vector< std::pair< int, int > > > bad_ch_map
SignalROIChList & get_rois_by_plane(int plane)
list cmd
Definition: getreco.py:22
void refine_data(int plane, ROI_formation &roi_form)
Eigen::ArrayXXf array_xxf
A real, 2D array.
Definition: Array.h:54
void refine_data_debug_mode(int plane, ROI_formation &roi_form, const std::string &cmd)
void CheckROIs(int plane, ROI_formation &roi_form)
void ShrinkROI(SignalROI *roi, ROI_formation &roi_form)
void BreakROIs(int plane, ROI_formation &roi_form)