REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawFFT.h
1 
18 #ifndef RestCore_TRestRawFFT
19 #define RestCore_TRestRawFFT
20 
21 #include <TArrayD.h>
22 #include <TObject.h>
23 #include <TRestRawSignal.h>
24 
25 #include <iostream>
26 
27 class TRestRawFFT : public TObject {
28  protected:
29  Int_t fNfft;
30 
31  TArrayD fTimeReal; // [fNfft]
32  TArrayD fTimeImg; // [fNfft]
33  TArrayD fFrequencyReal; // [fNfft]
34  TArrayD fFrequencyImg; // [fNfft]
35 
36  public:
37  // Getters
38  Double_t GetFrequencyAmplitudeReal(Int_t n) { return fFrequencyReal.GetArray()[n]; }
39  Double_t GetFrequencyAmplitudeImg(Int_t n) { return fFrequencyImg.GetArray()[n]; }
40 
41  Double_t GetFrequencyNorm2(Int_t n);
42 
43  inline Int_t GetNfft() const { return fNfft; }
44 
45  void GetSignal(TRestRawSignal* sgnl);
46 
47  // Setters
48  void SetNfft(Int_t n);
49 
50  void SetNode(Int_t n, Double_t real, Double_t img = 0) {
51  fFrequencyReal.GetArray()[n] = real;
52  fFrequencyImg.GetArray()[n] = img;
53  }
54 
55  void SetSecondOrderAnalyticalResponse(Double_t f1, Double_t f2, Double_t to);
56  void GaussianSecondOrderResponse(Double_t f1, Double_t f2, Double_t Ao, Double_t sigma);
57 
58  // FFT processing
59  void ForwardSignalFFT(TRestRawSignal* sgnl, Int_t fNStart = 0, Int_t fNEnd = 0);
60  void BackwardFFT();
61 
62  void RenormalizeNode(Int_t n, Double_t factor);
63  void ApplyLowPassFilter(Int_t cutFrequency);
64  // void NoiseReductionFilter( Int_t cutOff );
65  void ButterWorthFilter(Int_t cutOff, Int_t order);
66  void KillFrequencies(Int_t cutOff);
67 
68  void RemoveBaseline();
69 
70  void ProduceDelta(Int_t t_o, Int_t Nfft);
71 
72  void DivideBy(TRestRawFFT* fftInput, Int_t from = 0, Int_t to = 0);
73  void MultiplyBy(TRestRawFFT* fftInput, Int_t from = 0, Int_t to = 0);
74 
75  void ApplyResponse(TRestRawFFT* fftInput, Int_t cutOff);
76 
77  void WriteFrequencyToTextFile(TString filename);
78  void WriteTimeSignalToTextFile(TString filename);
79 
80  // Constructor
81  TRestRawFFT();
82  // Destructor
83  ~TRestRawFFT();
84 
85  ClassDef(TRestRawFFT, 1);
86 };
87 #endif
It defines a Short_t array with a physical parameter that evolves in time using a fixed time bin.