NoisyAdcSimulator.h
Go to the documentation of this file.
1 // NoisyAdcSimulator.h
2 //
3 // PLasorak
4 // 05/2020
5 //
6 // Implementation of AdcSimulator for an noisy 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 NoisyAdcSimulator_H
17 #define NoisyAdcSimulator_H
18 
20 #include "fhiclcpp/ParameterSet.h"
22 
23 #include "nurandom/RandomUtils/NuRandomService.h"
24 #include "CLHEP/Random/JamesRandom.h"
25 #include "CLHEP/Random/RandBinomial.h"
26 
28 
29 public:
30 
31  // Ctor from params.
32  explicit NoisyAdcSimulator(double vsen, unsigned int nbit, int noise);
33 
34  // Ctor for art tool.
35  explicit NoisyAdcSimulator(fhicl::ParameterSet const& ps);
36 
37  // Evaluate an ADC count.
38  Count count(double vin, Channel chan =0, Tick tick =0) const override;
39 
40 private:
41  int m_noise;
42  double m_vsen;
43  double m_vmax;
45  CLHEP::HepRandomEngine* m_random_engine;
46 
47 
48 };
49 
50 #endif
Count count(double vin, Channel chan=0, Tick tick=0) const override
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
CLHEP::HepRandomEngine * m_random_engine
unsigned short Count
Definition: AdcSimulator.h:24
NoisyAdcSimulator(double vsen, unsigned int nbit, int noise)