test_simple_channel_noisedb.cxx
Go to the documentation of this file.
1 #include "WireCellUtil/Testing.h"
2 
4 #include "WireCellUtil/Units.h"
5 
6 #include <iostream>
7 
8 using namespace std;
9 using namespace WireCell;
10 using namespace WireCell::SigProc;
11 
12 int main()
13 {
14  const int nsamples = 5432;
15  const double tick = 1.0*units::ms;
16 
17  SimpleChannelNoiseDB cndb(tick, nsamples);
18 
19  Assert(cndb.sample_time() == tick);
20  Assert(cndb.nominal_baseline(0) == 0.0);
21  Assert(cndb.gain_correction(0) == 1.0);
22 
23  auto rcrc0 = cndb.rcrc(0);
24  auto config0 = cndb.config(0);
25  auto noise0 = cndb.noise(0);
26 
27  cerr << rcrc0.size() << endl;
28 
29  Assert(rcrc0.size() == nsamples);
30  Assert(config0.size() == nsamples);
31  Assert(noise0.size() == nsamples);
32 
33  cndb.set_gains_shapings({0,1,2,3});
34 
35  auto config1 = cndb.config(1);
36  cerr << config1.size() << endl;
37  Assert(config1.size() == nsamples);
38 
39  return 0;
40 }
void set_gains_shapings(const std::vector< int > &channels, double from_gain_mVfC=7.8, double to_gain_mVfC=14.0, double from_shaping=1.0 *units::us, double to_shaping=2.0 *units::us)
virtual const filter_t & config(int channel) const
Return the filter to correct any wrongly configured channels.
STL namespace.
const double tick
#define Assert
Definition: Testing.h:7
Definition: Main.h:22
virtual const filter_t & noise(int channel) const
Return the filter to attenuate noise.
static const double ms
Definition: Units.h:100
virtual double sample_time() const
FIXME: how to handle state changes?
virtual const filter_t & rcrc(int channel) const
Return the filter for the RC+RC coupling response function.
QTextStream & endl(QTextStream &s)
virtual double nominal_baseline(int channel) const
Return a nominal baseline correction (additive offset)
virtual double gain_correction(int channel) const