LDMX Software
NoiseGenerator.h
Go to the documentation of this file.
1
7#ifndef TOOLS_NOISEGENERATOR_H
8#define TOOLS_NOISEGENERATOR_H
9
10//----------------//
11// C++ StdLib //
12//----------------//
13#include <time.h>
14
15#include <iostream>
16#include <vector>
17
18//--------------//
19// boost::math //
20//--------------//
21#include <boost/math/distributions/poisson.hpp>
22
23//----------//
24// ROOT //
25//----------//
26#include "Framework/Exception/Exception.h"
27#include "Framework/Logger.h"
28#include "Math/DistFunc.h"
29#include "TRandom3.h"
30
31namespace ldmx {
32
34 public:
36 NoiseGenerator(double noiseValue = 0.0001, bool gauss = true);
37
39 ~NoiseGenerator() = default;
40
42 void seedGenerator(uint64_t seed);
43
45 bool hasSeed() const { return random_.get() != nullptr; }
46
54 std::vector<double> generateNoiseHits(int emptyChannels);
55
57 void setNoiseThreshold(double noiseThreshold) {
58 noise_threshold_ = noiseThreshold;
59 }
60
62 void setNoise(double noise) { noise_ = noise; };
63
65 void setPedestal(double pedestal) { pedestal_ = pedestal; };
66
67 private:
69 std::unique_ptr<TRandom3> random_{nullptr};
70
73
75 double noise_{1};
76
78 double pedestal_{0};
79
82
84 std::unique_ptr<boost::math::poisson_distribution<> > poisson_dist_;
85
86 enableLogging("NoiseGenerator")
87}; // NoiseGenerator
88
89} // namespace ldmx
90
91#endif // TOOLS_NOISEGENERATOR_H
double noise_
Mean noise.
std::unique_ptr< boost::math::poisson_distribution<> > poisson_dist_
pdf for poisson errors
std::vector< double > generateNoiseHits(int emptyChannels)
Generate noise hits_.
NoiseGenerator(double noiseValue=0.0001, bool gauss=true)
Constructor.
double pedestal_
Pedestal or baseline.
std::unique_ptr< TRandom3 > random_
Random number generator.
void setPedestal(double pedestal)
Set the pedestal.
void seedGenerator(uint64_t seed)
Seed the generator.
void setNoiseThreshold(double noiseThreshold)
Set the noise threshold.
double noise_threshold_
The noise threshold.
bool hasSeed() const
Has been seeded?
void setNoise(double noise)
Set the mean noise.
~NoiseGenerator()=default
Destructor.
bool use_gaussian_model_
Gaussian flag.