Microboone.h
Go to the documentation of this file.
1 /** Inherently MicroBooNE-specific functions and classes
2  */
3 
4 #ifndef WIRECELLSIGPROC_MICROBOONE
5 #define WIRECELLSIGPROC_MICROBOONE
6 
8 #include "WireCellUtil/Bits.h"
13 
15 
16 
17 namespace WireCell {
18  namespace SigProc {
19  namespace Microboone {
20 
21 
22 
23 
24  bool Chirp_raise_baseline(WireCell::Waveform::realseq_t& sig, int bin1, int bin2);
28 
30  bool NoisyFilterAlg(WireCell::Waveform::realseq_t& spec, float min_rms, float max_rms);
31 
32  std::vector< std::vector<int> > SignalProtection(WireCell::Waveform::realseq_t& sig, const WireCell::Waveform::compseq_t& respec, int res_offset, int pad_f, int pad_b, float upper_decon_limit = 0.02, float decon_lf_cutoff = 0.08, float upper_adc_limit = 15, float protection_factor = 5.0, float min_adc_limit = 50);
33  bool Subtract_WScaling(WireCell::IChannelFilter::channel_signals_t& chansig, const WireCell::Waveform::realseq_t& medians, const WireCell::Waveform::compseq_t& respec, int res_offset, std::vector< std::vector<int> >& rois, float upper_decon_limit1=0.08, float roi_min_max_ratio=0.8);
34 
35 
36  // hold common config stuff
38  public:
39 
40  ConfigFilterBase(const std::string& anode = "AnodePlane",
41  const std::string& noisedb = "OmniChannelNoiseDB");
42  virtual ~ConfigFilterBase();
43 
44  /// IConfigurable configuration interface
45  virtual void configure(const WireCell::Configuration& config);
47 
48  // FIXME: this method needs to die.
50  m_noisedb = ndb;
51  }
52  protected:
56  };
57 
58  /** Microboone style coherent noise subtraction.
59  *
60  * Fixme: in principle, this class could be general purpose
61  * for other detectors. However, it uses the functions above
62  * which hard code microboone-isms. If those
63  * microboone-specific parameters can be pulled out to a
64  * higher layer then this class can become generic and move
65  * outside of this file.
66  */
68  public:
69 
70  CoherentNoiseSub(const std::string& anode = "AnodePlane",
71  const std::string& noisedb = "OmniChannelNoiseDB");
72  virtual ~CoherentNoiseSub();
73 
74  //// IChannelFilter interface
75 
76  /** Filter in place the signal `sig` from given `channel`. */
77  virtual WireCell::Waveform::ChannelMaskMap apply(int channel, signal_t& sig) const;
78 
79  /** Filter in place a group of signals together. */
80  virtual WireCell::Waveform::ChannelMaskMap apply(channel_signals_t& chansig) const;
81 
82 
83  private:
84  };
85 
86 
87  /** Microboone style single channel noise subtraction.
88  *
89  * Fixme: in principle, this class could be general purpose
90  * for other detectors. However, it uses the functions above
91  * which hard code microboone-isms. If those
92  * microboone-specific parameters can be pulled out to a
93  * higher layer then this class can become generic and move
94  * outside of this file.
95  */
96 
98  public:
99 
100  OneChannelNoise(const std::string& anode_tn = "AnodePlane",
101  const std::string& noisedb = "OmniChannelNoiseDB");
102  virtual ~OneChannelNoise();
103 
104  //// IChannelFilter interface
105 
106  /** Filter in place the signal `sig` from given `channel`. */
107  virtual WireCell::Waveform::ChannelMaskMap apply(int channel, signal_t& sig) const;
108 
109  /** Filter in place a group of signals together. */
110  virtual WireCell::Waveform::ChannelMaskMap apply(channel_signals_t& chansig) const;
111 
112 
113  private:
114 
115  Diagnostics::Chirp m_check_chirp; // fixme, these should be done via service interfaces
116  Diagnostics::Partial m_check_partial; // at least need to expose them to configuration
117 
118  };
119 
120 
122  public:
123  OneChannelStatus(const std::string anode_tn = "AnodePlane",
124  double threshold = 3.5, int window =5, int nbins = 250, double cut = 14);
125  virtual ~OneChannelStatus();
126 
127  /** Filter in place the signal `sig` from given `channel`. */
128  virtual WireCell::Waveform::ChannelMaskMap apply(int channel, signal_t& sig) const;
129 
130  /** Filter in place a group of signals together. */
131  virtual WireCell::Waveform::ChannelMaskMap apply(channel_signals_t& chansig) const;
132 
133  virtual void configure(const WireCell::Configuration& config);
135 
136  bool ID_lf_noisy(signal_t& sig) const;
137 
138  private:
141  double m_threshold;
142  int m_window;
143  int m_nbins;
144  double m_cut;
145  };
146 
147 
149  public:
150  ADCBitShift(int nbits = 12, int exam_nticks = 500, double threshold_sigma = 7.5,
151  double threshold_fix = 0.8);
152  virtual ~ADCBitShift();
153 
154  /** Filter in place the signal `sig` from given `channel`. */
155  virtual WireCell::Waveform::ChannelMaskMap apply(int channel, signal_t& sig) const;
156 
157  /** Filter in place a group of signals together. */
158  virtual WireCell::Waveform::ChannelMaskMap apply(channel_signals_t& chansig) const;
159 
160  virtual void configure(const WireCell::Configuration& config);
162 
163  private:
164  // Number of bits 12
165  int m_nbits;
166  // How many ADC: 500
168  // Threshold for ADC Bit shift: 7.5 sigma
170  // Threshold for correction: 80%
172  };
173 
174  }
175 
176  }
177 
178 }
179 
180 #endif
181 
182 // Local Variables:
183 // mode: c++
184 // c-basic-offset: 4
185 // End:
std::vector< std::vector< int > > SignalProtection(WireCell::Waveform::realseq_t &sig, const WireCell::Waveform::compseq_t &respec, int res_offset, int pad_f, int pad_b, float upper_decon_limit=0.02, float decon_lf_cutoff=0.08, float upper_adc_limit=15, float protection_factor=5.0, float min_adc_limit=50)
Definition: Microboone.cxx:232
bool SignalFilter(WireCell::Waveform::realseq_t &sig)
Definition: Microboone.cxx:648
Sequence< real_t > realseq_t
Definition: Waveform.h:31
ConfigFilterBase(const std::string &anode="AnodePlane", const std::string &noisedb="OmniChannelNoiseDB")
Definition: Microboone.cxx:849
Waveform::realseq_t signal_t
bool Subtract_WScaling(WireCell::IChannelFilter::channel_signals_t &chansig, const WireCell::Waveform::realseq_t &medians, const WireCell::Waveform::compseq_t &respec, int res_offset, std::vector< std::vector< int > > &rois, float upper_decon_limit1=0.08, float roi_min_max_ratio=0.8)
Definition: Microboone.cxx:55
std::string string
Definition: nybbler.cc:12
struct vector vector
void set_channel_noisedb(WireCell::IChannelNoiseDatabase::pointer ndb)
Definition: Microboone.h:49
bool Chirp_raise_baseline(WireCell::Waveform::realseq_t &sig, int bin1, int bin2)
Definition: Microboone.cxx:615
std::map< std::string, ChannelMasks > ChannelMaskMap
Collect channel masks by some label.
Definition: Waveform.h:59
static Config * config
Definition: config.cpp:1054
std::shared_ptr< Interface > pointer
Definition: Interface.h:16
virtual void configure(const WireCell::Configuration &config)
IConfigurable configuration interface.
Definition: Microboone.cxx:853
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
Definition: Microboone.cxx:861
bool NoisyFilterAlg(WireCell::Waveform::realseq_t &spec, float min_rms, float max_rms)
Definition: Microboone.cxx:542
bool RawAdapativeBaselineAlg(WireCell::Waveform::realseq_t &sig)
Definition: Microboone.cxx:693
bool RemoveFilterFlags(WireCell::Waveform::realseq_t &sig)
Definition: Microboone.cxx:821
Definition: Main.h:22
std::map< int, signal_t > channel_signals_t
Json::Value Configuration
Definition: Configuration.h:50
IChannelNoiseDatabase::pointer m_noisedb
Definition: Microboone.h:55
Sequence< complex_t > compseq_t
A complex-valued sequence, eg for discrete spectrum powers.
Definition: Waveform.h:34
float CalcRMSWithFlags(const WireCell::Waveform::realseq_t &sig)
Definition: Microboone.cxx:625