All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RawDigitFFTAlg.h
Go to the documentation of this file.
1 #ifndef RAWDIGITFFTALG_H
2 #define RAWDIGITFFTALG_H
3 ////////////////////////////////////////////////////////////////////////
4 //
5 // Class: RawDigitFFTAlg
6 // Module Type: producer
7 // File: RawDigitFFTAlg.h
8 //
9 // This module provides some basic Fast Fourier Transform
10 // algorithms for operating on RawDigit waveforms
11 //
12 // Configuration parameters:
13 //
14 // FillHistograms - Turn on histogram filling for diagnostics
15 // RunFFTInputWires - FFT analyze the input RawDigits if true - diagnostics
16 // RunFFTCorrectedWires - FFT analyze the output RawDigits if true - diagnostics
17 //
18 //
19 // Created by Tracy Usher (usher@slac.stanford.edu) on January 6, 2016
20 //
21 ////////////////////////////////////////////////////////////////////////
22 
24 #include "fhiclcpp/ParameterSet.h"
25 #include "art/Framework/Services/Registry/ServiceHandle.h"
26 #include "art_root_io/TFileService.h"
29 #include "icarus_signal_processing/WaveformTools.h"
30 
31 #include <Eigen/Core>
32 #include <unsupported/Eigen/FFT>
33 
34 #include "TProfile.h"
35 
36 namespace icarus_tool
37 {
38  class IFilter;
39 }
40 
41 namespace caldata
42 {
43 
44 template <class T> class RawDigitFFTAlg
45 {
46 public:
47 
48  // Copnstructors, destructor.
49  RawDigitFFTAlg(fhicl::ParameterSet const & pset);
51 
52  // Provide for reinitialization if necessary
53  void reconfigure(fhicl::ParameterSet const & pset);
54  void initializeHists(detinfo::DetectorClocksData const& clockData,
56  art::ServiceHandle<art::TFileService>&);
57 
58  void getFFTCorrection(std::vector<T>&, double) const;
59 
60  void getFFTCorrection(std::vector<T>&, size_t) const;
61 
62  void filterFFT(detinfo::DetectorClocksData const& clockData,
63  detinfo::DetectorPropertiesData const& detProp,
64  std::vector<short>&, size_t, size_t, float pedestal=0.);
65 
66 private:
67 
68  std::vector<bool> fTransformViewVec; ///< apply FFT transform to this view
69  bool fFillHistograms; ///< if true then will fill diagnostic hists
70  std::string fHistDirName; ///< If writing histograms, the folder name
71  std::vector<size_t> fLoWireByPlane; ///< Low wire for individual wire histograms
72  std::vector<size_t> fHiWireByPlane; ///< Hi wire for individual wire histograms
73 
74  // Try to optimize the filter FFT function with static memory...
75  std::map<size_t,std::vector<std::complex<float>>> fFilterVecMap;
76  std::vector<float> fFFTInputVec;
77  std::vector<std::complex<float>> fFFTOutputVec;
78  std::vector<float> fPowerVec;
79 
80  std::vector<std::vector<TProfile*>> fFFTPowerVec;
81  std::vector<TProfile*> fAveFFTPowerVec;
82  std::vector<TProfile*> fConvFFTPowerVec;
83  std::vector<TProfile*> fFilterFuncVec;
84 
85  icarus_signal_processing::WaveformTools<T> fWaveformTool;
86  std::map<size_t,std::unique_ptr<icarus_tool::IFilter>> fFilterToolMap;
87 
88  std::unique_ptr<Eigen::FFT<float>> fEigenFFT;
89 
90  // Useful services, keep copies for now (we can update during begin run periods)
91 };
92 
93 } // end caldata namespace
94 
95 #endif
Utilities related to art service access.
std::map< size_t, std::vector< std::complex< float > > > fFilterVecMap
std::vector< size_t > fLoWireByPlane
Low wire for individual wire histograms.
std::vector< TProfile * > fAveFFTPowerVec
std::vector< TProfile * > fFilterFuncVec
void filterFFT(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< short > &, size_t, size_t, float pedestal=0.)
icarus_signal_processing::WaveformTools< T > fWaveformTool
std::vector< size_t > fHiWireByPlane
Hi wire for individual wire histograms.
void getFFTCorrection(std::vector< T > &, double) const
std::vector< float > fPowerVec
bool fFillHistograms
if true then will fill diagnostic hists
std::vector< std::complex< float > > fFFTOutputVec
std::vector< std::vector< TProfile * > > fFFTPowerVec
void reconfigure(fhicl::ParameterSet const &pset)
void initializeHists(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, art::ServiceHandle< art::TFileService > &)
Begin job method.
std::unique_ptr< Eigen::FFT< float > > fEigenFFT
std::string fHistDirName
If writing histograms, the folder name.
~RawDigitFFTAlg()
Destructor.
Contains all timing reference information for the detector.
std::vector< bool > fTransformViewVec
apply FFT transform to this view
RawDigitFFTAlg(fhicl::ParameterSet const &pset)
std::vector< TProfile * > fConvFFTPowerVec
std::map< size_t, std::unique_ptr< icarus_tool::IFilter > > fFilterToolMap
process_name can override from command line with o or output caldata
Definition: pid.fcl:40
std::vector< float > fFFTInputVec
auto const detProp