Digitizer.h
Go to the documentation of this file.
1 /** Digitizer converts voltage waveforms to integer ADC ones.
2  *
3  * Resulting waveforms are still in floating-point form and should be
4  * round()'ed and truncated to whatever integer representation is
5  * wanted by some subsequent node.
6  */
7 
8 #ifndef WIRECELL_DIGITIZER
9 #define WIRECELL_DIGITIZER
10 
14 #include "WireCellUtil/Units.h"
15 #include "WireCellUtil/Logging.h"
16 #include <deque>
17 
18 namespace WireCell {
19 
20  namespace Gen {
21 
22  class Digitizer : public IFrameFilter, public IConfigurable {
23  public:
24  Digitizer(const std::string& anode_tn = "AnodePlane",
25  int resolution=12, // bits of resolution
26  double gain = -1.0, // input gain
27  std::vector<double> fullscale = {0.0, 2.0*units::volt},
28  std::vector<double> baselines = {900*units::mV,900*units::mV,200*units::mV});
29  virtual ~Digitizer();
30 
31  virtual void configure(const WireCell::Configuration& config);
33 
34  // Voltage frame goes in, ADC frame comes out.
35  virtual bool operator()(const input_pointer& inframe, output_pointer& outframe);
36 
37 
38  // implementation method. Return a "floating point ADC"
39  // value for the given voltage assumed to have been lifted
40  // to the baseline.
41  double digitize(double voltage);
42 
43  private:
47  double m_gain;
48  std::vector<double> m_fullscale, m_baselines;
51  };
52 
53  }
54 }
55 #endif
virtual bool operator()(const input_pointer &inframe, output_pointer &outframe)
The calling signature:
Definition: Digitizer.cxx:97
std::string m_anode_tn
Definition: Digitizer.h:45
std::string string
Definition: nybbler.cc:12
Digitizer(const std::string &anode_tn="AnodePlane", int resolution=12, double gain=-1.0, std::vector< double > fullscale={0.0, 2.0 *units::volt}, std::vector< double > baselines={900 *units::mV, 900 *units::mV, 200 *units::mV})
Definition: Digitizer.cxx:19
static const double mV
Definition: Units.h:180
double digitize(double voltage)
Definition: Digitizer.cxx:83
std::shared_ptr< const IFrame > input_pointer
Definition: IFunctionNode.h:39
std::vector< double > m_fullscale
Definition: Digitizer.h:48
virtual void configure(const WireCell::Configuration &config)
Accept a configuration.
Definition: Digitizer.cxx:59
static Config * config
Definition: config.cpp:1054
std::shared_ptr< Interface > pointer
Definition: Interface.h:16
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
Definition: Digitizer.cxx:36
std::shared_ptr< const IFrame > output_pointer
Definition: IFunctionNode.h:40
std::string m_frame_tag
Definition: Digitizer.h:49
std::shared_ptr< spdlog::logger > logptr_t
Definition: Logging.h:24
Definition: Main.h:22
Json::Value Configuration
Definition: Configuration.h:50
static const double volt
Definition: Units.h:177
IAnodePlane::pointer m_anode
Definition: Digitizer.h:44
std::vector< double > m_baselines
Definition: Digitizer.h:48
Log::logptr_t log
Definition: Digitizer.h:50