ExponentialChannelNoiseService.h
Go to the documentation of this file.
1 // ExponentialChannelNoiseService
2 
3 // David Adams
4 // January 2016
5 //
6 // Implementation of TPC channel noise model with an exponential
7 // shape in frequency.
8 // Same as the nose model 1 in SimWireDUNE35t, e.g. from dunetpc v04_29_01.
9 //
10 // DLA Feb 2016: Change normalization so RMS does not vary with FFT size.
11 // See https://cdcvs.fnal.gov/redmine/issues/11470.
12 //
13 // DLA Aug 2018: Add new option for low frequency cutoff that has constant noise
14 // level below that frequency matched to the height of the exponential.
15 // It is selected with a negative value (-freq) in LowCutoffX (X= U, V, Z).
16 // See https://cdcvs.fnal.gov/redmine/issues/20621.
17 
18 #ifndef ExponentialChannelNoiseService_H
19 #define ExponentialChannelNoiseService_H
20 
22 #include <vector>
23 #include <iostream>
24 
25 namespace detinfo {
26  class DetectorClocksData;
27 }
28 
29 class TH1;
30 namespace CLHEP {
31 class HepRandomEngine;
32 }
33 
35 
36 public:
37 
38  // Ctor.
40 
41  // Ctor.
43 
44  // Dtor.
46 
47  // Add noise to a signal array.
48  int addNoise(detinfo::DetectorClocksData const& clockData,
49  detinfo::DetectorPropertiesData const& detProp,
50  Channel chan, AdcSignalVector& sigs) const;
51 
52  // Print the configuration.
53  std::ostream& print(std::ostream& out =std::cout, std::string prefix ="") const;
54 
55  // Fill a noise vector.
56  // Input vector contents are lost.
57  // The size of the vector is obtained from the FFT service.
58  void generateNoise(detinfo::DetectorClocksData const& clockData,
59  float aNoiseNorm, float aNoiseWidth, float aLowCutoff,
60  AdcSignalVector& noise, TH1* aNoiseHist) const;
61 
62 private:
63 
64  // Fill the noise vectors.
65  void generateNoise(detinfo::DetectorClocksData const& clockData);
66 
67  // Parameters.
68  float fNoiseNormZ; ///< noise scale factor for Z (collection) plane
69  float fNoiseWidthZ; ///< exponential noise width (kHz) for Z (collection) plane
70  float fLowCutoffZ; ///< low frequency filter cutoff (kHz) for Z (collection) plane
71  float fNoiseNormU; ///< noise scale factor for U plane
72  float fNoiseWidthU; ///< exponential noise width (kHz) for U plane
73  float fLowCutoffU; ///< low frequency filter cutoff (kHz) for U plane
74  float fNoiseNormV; ///< noise scale factor for V plane
75  float fNoiseWidthV; ///< exponential noise width (kHz) for V plane
76  float fLowCutoffV; ///< low frequency filter cutoff (kHz) for V plane
77  unsigned int fNoiseArrayPoints; ///< number of points in randomly generated noise array
78  bool fOldNoiseIndex; ///< Use old selection of noise array index
79  float fWhiteNoiseZ; ///< Level (per freq bin) for white noise for Z.
80  float fWhiteNoiseU; ///< Level (per freq bin) for white noise for U.
81  float fWhiteNoiseV; ///< Level (per freq bin) for white noise for V.
82  int fRandomSeed; ///< Seed for random number service. If absent or zero, use SeedSvc.
83  int fLogLevel; ///< Log message level: 0=quiet, 1=init only, 2+=every event
84 
85  // Noise arrays.
86  AdcSignalVectorVector fNoiseZ; ///< noise on each channel for each time for Z (collection) plane
87  AdcSignalVectorVector fNoiseU; ///< noise on each channel for each time for U plane
88  AdcSignalVectorVector fNoiseV; ///< noise on each channel for each time for V plane
89 
90  // Histograms.
91  //TH1* fNoiseHist; ///< distribution of noise counts // unused
92  TH1* fNoiseHistZ; ///< distribution of noise counts for Z
93  TH1* fNoiseHistU; ///< distribution of noise counts for U
94  TH1* fNoiseHistV; ///< distribution of noise counts for V
95  TH1* fNoiseChanHist; ///< distribution of accessed noise samples
96 
97  CLHEP::HepRandomEngine* m_pran;
98 
99 };
100 
102 
103 #endif
float fNoiseWidthV
exponential noise width (kHz) for V plane
std::string string
Definition: nybbler.cc:12
float fNoiseNormV
noise scale factor for V plane
DECLARE_ART_SERVICE_INTERFACE_IMPL(MySharedService, art::test::MyServiceInterface, SHARED) DEFINE_ART_SERVICE_INTERFACE_IMPL(MySharedService
AdcSignalVectorVector fNoiseV
noise on each channel for each time for V plane
float fNoiseNormZ
noise scale factor for Z (collection) plane
float fLowCutoffV
low frequency filter cutoff (kHz) for V plane
float fLowCutoffZ
low frequency filter cutoff (kHz) for Z (collection) plane
float fNoiseWidthZ
exponential noise width (kHz) for Z (collection) plane
float fWhiteNoiseU
Level (per freq bin) for white noise for U.
float fWhiteNoiseV
Level (per freq bin) for white noise for V.
AdcSignalVectorVector fNoiseZ
noise on each channel for each time for Z (collection) plane
TH1 * fNoiseHistU
distribution of noise counts for U
General LArSoft Utilities.
float fLowCutoffU
low frequency filter cutoff (kHz) for U plane
float fNoiseWidthU
exponential noise width (kHz) for U plane
float fWhiteNoiseZ
Level (per freq bin) for white noise for Z.
bool fOldNoiseIndex
Use old selection of noise array index.
TH1 * fNoiseHistV
distribution of noise counts for V
Contains all timing reference information for the detector.
std::vector< AdcSignalVector > AdcSignalVectorVector
Definition: AdcTypes.h:23
int fLogLevel
Log message level: 0=quiet, 1=init only, 2+=every event.
float fNoiseNormU
noise scale factor for U plane
std::vector< AdcSignal > AdcSignalVector
Definition: AdcTypes.h:22
TH1 * fNoiseChanHist
distribution of accessed noise samples
AdcSignalVectorVector fNoiseU
noise on each channel for each time for U plane
TH1 * fNoiseHistZ
distribution of noise counts for Z
int fRandomSeed
Seed for random number service. If absent or zero, use SeedSvc.
unsigned int fNoiseArrayPoints
number of points in randomly generated noise array