PandaRoot
PndEmcFadcFilter.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 //-----------------------------------------------------------
14 //
15 // Description:
16 // FADC FIR (finite impulse response) filter
17 // Author Dima Melnychuk
18 // (based on original code by A.Mykulyak)
19 //-----------------------------------------------------------
20 
21 #ifndef PNDEMCFadcFilter_HXX
22 #define PNDEMCFadcFilter_HXX
23 
24 #include <vector>
25 #include "TObject.h"
26 
28 
33 class PndEmcFadcFilter : public TObject {
34 
35  public:
36  enum type { arbitrary = 0, symmetric = 1, antisymmetric = -1 };
37 
39  virtual ~PndEmcFadcFilter();
40 
41  virtual void Filter(const std::vector<Double_t> &in, std::vector<Double_t> &out) const;
42  void SetData(Double_t data[], Int_t i_size, Int_t i_offset);
43  Int_t MinIndex() const;
44  Int_t MaxIndex() const;
45  Int_t Size() const;
46  void Convolute(const PndEmcFadcFilter &filt);
47  void Convolute(const PndEmcFadcFilter &lhs, const PndEmcFadcFilter &rhs);
48  void Clear();
49 
50  // Different filters
51  // void SetupIntegrator(Int_t i_width);
52  void SetupMA(Int_t i_width); // Moving average
53  void SetupMWD(Int_t i_width, Double_t tau); // Moving window deconvolution
54  void SetupMatchedFilter(Int_t i_width, PndEmcAbsPulseshape *pulseshape, Double_t sampleRate); // Matched digital filter
55  void SetupBipolarTrapez(Int_t i_rise, Int_t i_flat, Int_t i_width);
56  // void SetupTriangle(Int_t i_rise);
57  void SetupTrapez(Int_t i_rise, Int_t i_flat);
58  void SetupBipolarTriangle(Int_t i_rise);
59  void SetupDifferentiator(Int_t i_lag = 0, Int_t i_width = 1);
60  void SetupDoubleDifferentiator(Int_t i_npos = 1, Int_t i_nneg = 1, Int_t i_nzero = 0);
61  void SetupPZDifferentiator(Int_t i_lag = 0, Double_t d_fac = 1.);
62  void SetNormalizeFloating(Double_t d_norm = 1.);
63  void SetNormalizeInteger(Int_t i_shift = 0);
64 
65  std::vector<Double_t> GetWeights() const { return fCoeff; }
66 
67  private:
68  std::vector<Double_t> fCoeff;
69  Int_t fOffset;
70  Int_t fType; // arbitrary, symmetric, antisymmetric
71  Bool_t fIntegerize;
72  Double_t fNormFactor;
73  Int_t fShiftCount;
74 
75  ClassDef(PndEmcFadcFilter, 1)
76 };
77 
78 #endif
void SetupPZDifferentiator(Int_t i_lag=0, Double_t d_fac=1.)
void SetupMA(Int_t i_width)
virtual void Filter(const std::vector< Double_t > &in, std::vector< Double_t > &out) const
void SetNormalizeFloating(Double_t d_norm=1.)
void SetupBipolarTriangle(Int_t i_rise)
std::vector< Double_t > GetWeights() const
void SetupBipolarTrapez(Int_t i_rise, Int_t i_flat, Int_t i_width)
FADC FIR (finite impulse response) filter.
void SetupMWD(Int_t i_width, Double_t tau)
void Convolute(const PndEmcFadcFilter &filt)
Int_t Size() const
void SetupMatchedFilter(Int_t i_width, PndEmcAbsPulseshape *pulseshape, Double_t sampleRate)
void SetupDifferentiator(Int_t i_lag=0, Int_t i_width=1)
virtual ~PndEmcFadcFilter()
void SetData(Double_t data[], Int_t i_size, Int_t i_offset)
void SetupDoubleDifferentiator(Int_t i_npos=1, Int_t i_nneg=1, Int_t i_nzero=0)
pulseshape interface
Int_t MinIndex() const
Int_t MaxIndex() const
void SetupTrapez(Int_t i_rise, Int_t i_flat)
void SetNormalizeInteger(Int_t i_shift=0)