All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SBNDNoiseServiceFromHist.h
Go to the documentation of this file.
1 // SBNDNoiseServiceFromHist.h
2 // Andrew Scarff (University of Sheffield)
3 // Aug 2019
4 
5 // Based upon SPhaseChannelNoiseService.h created by Jingbo Wang (UC Davis) for ProtoDUNE.9
6 
7 // Implementation of a general TPC channel noise model with:
8 // (1) white noise
9 // (2) Inherent Gaussian noise in frequency
10 // (3) MicroBooNE noise in frequency
11 // (4) Coherent noise (exponential + Gaussian) in frequency
12 // (Note a: phase at each frequency bin is randamized at the moment. Will be updated soon
13 // Note b: Currently, consecutive offline channels (configurable) are grouped together and
14 // the same coherent noise waveform is assigned to channels within the same group. )
15 //
16 // The default parameters are obtained from the ProtoDUNE-SP data (run 4096)
17 // fcl file: sbndcode/DetectorSim/Services/SBND_detsim_data_driven_noise.fcl
18 //
19 
20 #ifndef SBNDNoiseServiceFromHist_H
21 #define SBNDNoiseServiceFromHist_H
22 
24 
25 #include "art/Framework/Services/Registry/ServiceHandle.h"
26 #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
27 #include "art_root_io/TFileService.h"
31 #include "nurandom/RandomUtils/NuRandomService.h"
33 
34 #include "CLHEP/Random/JamesRandom.h"
35 #include "CLHEP/Random/RandFlat.h"
36 
37 #include "TH1F.h"
38 #include "TRandom3.h"
39 #include "TF1.h"
40 #include "TMath.h"
41 
42 #include <vector>
43 #include <iostream>
44 #include <sstream>
45 
46 class TH1;
47 namespace CLHEP {
48 class HepRandomEngine;
49 }
50 
52 
53 public:
54 
55  // Ctor.
56  SBNDNoiseServiceFromHist(fhicl::ParameterSet const& pset);
57 
58  // Ctor.
59  SBNDNoiseServiceFromHist(fhicl::ParameterSet const& pset, art::ActivityRegistry&);
60 
61  // Dtor.
63 
64  // Add noise to a signal array.
65  int addNoise(Channel chan, AdcSignalVector& sigs) const;
66 
67  // Print the configuration.
68  std::ostream& print(std::ostream& out =std::cout, std::string prefix ="") const;
69 
70 private:
71 
72  // General parameters
73  unsigned int fNoiseArrayPoints; ///< number of points in randomly generated noise array
74  int fRandomSeed; ///< Seed for random number service. If absent or zero, use SeedSvc.
75  int fLogLevel; ///< Log message level: 0=quiet, 1=init only, 2+=every event
76 
77  CLHEP::HepRandomEngine* m_pran;
78 
79 
80 };
81 
82 DECLARE_ART_SERVICE_INTERFACE_IMPL(SBNDNoiseServiceFromHist, ChannelNoiseService, LEGACY)
83 
84 #endif
SBNDNoiseServiceFromHist(fhicl::ParameterSet const &pset)
CLHEP::HepRandomEngine * m_pran
int addNoise(Channel chan, AdcSignalVector &sigs) const
int fRandomSeed
Seed for random number service. If absent or zero, use SeedSvc.
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
Service to provide microboone-specific signal shaping for simulation (convolution) and reconstruction...
int fLogLevel
Log message level: 0=quiet, 1=init only, 2+=every event.
std::vector< AdcSignal > AdcSignalVector
unsigned int fNoiseArrayPoints
number of points in randomly generated noise array
art framework interface to geometry description
BEGIN_PROLOG could also be cout