Protodune.h
Go to the documentation of this file.
1 /** Inherently protoDUNE-specific functions and classes
2  * Modified from Microboone.h
3  */
4 
5 #ifndef WIRECELLSIGPROC_PROTODUNE
6 #define WIRECELLSIGPROC_PROTODUNE
7 
9 #include "WireCellUtil/Bits.h"
14 
16 
17 
18 namespace WireCell {
19  namespace SigProc {
20  namespace Protodune {
21 
22  bool LinearInterpSticky(WireCell::Waveform::realseq_t& signal, std::vector<std::pair<int,int> >& st_ranges, float stky_sig_like_val, float stky_sig_like_rms);
23  bool FftInterpSticky(WireCell::Waveform::realseq_t& signal, std::vector<std::pair<int,int> >& st_ranges);
24  bool FftShiftSticky(WireCell::Waveform::realseq_t& signal, double toffset, std::vector<std::pair<int,int> >& st_ranges);
25  bool FftScaling(WireCell::Waveform::realseq_t& signal, int nsamples);
26 
27  // hold common config stuff
29  public:
30 
31  ConfigFilterBase(const std::string& anode = "AnodePlane",
32  const std::string& noisedb = "OmniChannelNoiseDB");
33  virtual ~ConfigFilterBase();
34 
35  // IConfigurable configuration interface
36  virtual void configure(const WireCell::Configuration& config);
38 
39  // FIXME: this method needs to die.
41  m_noisedb = ndb;
42  }
43  protected:
47 
48  };
49 
50  /** Microboone/ProtoDUNE style noise subtraction.
51  *
52  * Fixme: in principle, this class could be general purpose
53  * for other detectors. However, it uses the functions above
54  * which hard code microboone-isms. If those
55  * microboone/protodune-specific parameters can be pulled out to a
56  * higher layer then this class can become generic and move
57  * outside of this file.
58  */
59 
60 
62  public:
63 
64  StickyCodeMitig(const std::string& anode_tn = "AnodePlane",
65  const std::string& noisedb = "OmniChannelNoiseDB",
66  float stky_sig_like_val = 15.0,
67  float stky_sig_like_rms = 2.0,
68  int stky_max_len = 5);
69  virtual ~StickyCodeMitig();
70 
71  // IChannelFilter interface
72 
73  /** Filter in place the signal `sig` from given `channel`. */
74  virtual WireCell::Waveform::ChannelMaskMap apply(int channel, signal_t& sig) const;
75 
76  /** Filter in place a group of signals together. */
77  virtual WireCell::Waveform::ChannelMaskMap apply(channel_signals_t& chansig) const;
78 
79  virtual void configure(const WireCell::Configuration& config);
81 
82  private:
83 
87 
88  std::map<int, std::vector<short int> > m_extra_stky; // ch to extra sticky codes
92 
93  };
94 
96  public:
97 
98  OneChannelNoise(const std::string& anode_tn = "AnodePlane",
99  const std::string& noisedb = "OmniChannelNoiseDB");
100  virtual ~OneChannelNoise();
101 
102  // IChannelFilter interface
103 
104  /** Filter in place the signal `sig` from given `channel`. */
105  virtual WireCell::Waveform::ChannelMaskMap apply(int channel, signal_t& sig) const;
106 
107  /** Filter in place a group of signals together. */
108  virtual WireCell::Waveform::ChannelMaskMap apply(channel_signals_t& chansig) const;
109 
112 
113  private:
114  Diagnostics::Partial m_check_partial; // at least need to expose them to configuration
115  std::map<int, int> m_resmp; // ch => orignal smp input
116 
117  };
118 
119  // A relative gain correction based on David Adam's pulse area calibration
121  public:
122 
123  RelGainCalib(const std::string& anode_tn = "AnodePlane",
124  const std::string& noisedb = "OmniChannelNoiseDB",
125  float gain_def = 1.0,
126  float gain_min_cut = 0.8,
127  float gain_max_cut = 1.25);
128  virtual ~RelGainCalib();
129 
130  // IChannelFilter interface
131 
132  /** Filter in place the signal `sig` from given `channel`. */
133  virtual WireCell::Waveform::ChannelMaskMap apply(int channel, signal_t& sig) const;
134 
135  /** Filter in place a group of signals together. */
136  virtual WireCell::Waveform::ChannelMaskMap apply(channel_signals_t& chansig) const;
137 
138  virtual void configure(const WireCell::Configuration& config);
140 
141  private:
142 
146 
147  float m_gain_def;
150 
151  std::vector<float> m_rel_gain; // relative gain map
152 
153  };
154 
155  }
156 
157  }
158 
159 }
160 
161 #endif
162 
163 // Local Variables:
164 // mode: c++
165 // c-basic-offset: 4
166 // End:
Sequence< real_t > realseq_t
Definition: Waveform.h:31
bool FftInterpSticky(WireCell::Waveform::realseq_t &signal, std::vector< std::pair< int, int > > &st_ranges)
Waveform::realseq_t signal_t
std::string string
Definition: nybbler.cc:12
bool FftShiftSticky(WireCell::Waveform::realseq_t &signal, double toffset, std::vector< std::pair< int, int > > &st_ranges)
struct vector vector
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
Definition: Protodune.cxx:611
bool LinearInterpSticky(WireCell::Waveform::realseq_t &signal, std::vector< std::pair< int, int > > &st_ranges, float stky_sig_like_val, float stky_sig_like_rms)
IChannelNoiseDatabase::pointer m_noisedb
Definition: Protodune.h:86
IChannelNoiseDatabase::pointer m_noisedb
Definition: Protodune.h:145
std::map< int, std::vector< short int > > m_extra_stky
Definition: Protodune.h:88
ConfigFilterBase(const std::string &anode="AnodePlane", const std::string &noisedb="OmniChannelNoiseDB")
Definition: Protodune.cxx:599
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
void set_channel_noisedb(WireCell::IChannelNoiseDatabase::pointer ndb)
Definition: Protodune.h:40
Definition: Main.h:22
IChannelNoiseDatabase::pointer m_noisedb
Definition: Protodune.h:46
std::map< int, signal_t > channel_signals_t
virtual void configure(const WireCell::Configuration &config)
Accept a configuration.
Definition: Protodune.cxx:603
Json::Value Configuration
Definition: Configuration.h:50
bool FftScaling(WireCell::Waveform::realseq_t &signal, int nsamples)