IdealAdcSimulator.h
Go to the documentation of this file.
1 // IdealAdcSimulator.h
2 //
3 // David Adams
4 // April 2017
5 //
6 // Implementation of AdcSimulator for an ideal ADC with linear response.
7 //
8 // The ADC is characterized by its sensitivity Vsen (aka step size or LSB)
9 // and # bits Nbit.
10 // The sensitivity is the voltage difference between adjacent ADC bins.
11 // The voltage range is Vmax = Vsen*(2^Nbit-1) and the count is
12 // 0 for Vin < 0.5*Vsen
13 // 2^Nbit-1 for Vin >= Vmax - 0.5*Vsen
14 // int(Vin/Vsen + 0.5) otherwise
15 
16 #ifndef IdealAdcSimulator_H
17 #define IdealAdcSimulator_H
18 
20 #include "fhiclcpp/ParameterSet.h"
22 
24 
25 public:
26 
27  // Ctor from params.
28  explicit IdealAdcSimulator(double vsen, unsigned int nbit =12);
29 
30  // Ctor for art tool.
31  explicit IdealAdcSimulator(fhicl::ParameterSet const& ps);
32 
33  // Evaluate an ADC count.
34  Count count(double vin, Channel chan =0, Tick tick =0) const override;
35 
36 private:
37 
38  double m_vsen;
39  double m_vmax;
41 
42 };
43 
44 
45 #endif
Count count(double vin, Channel chan=0, Tick tick=0) const override
IdealAdcSimulator(double vsen, unsigned int nbit=12)
unsigned int Tick
Definition: AdcSimulator.h:25
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:75
static constexpr double ps
Definition: Units.h:99
unsigned int Channel
Definition: AdcSimulator.h:23
unsigned short Count
Definition: AdcSimulator.h:24