Butterworth filter

I have time-domain digitizer traces that I would like to run through a low-pass Butterworth filter. Are there any signal processing classes within root that can do this?

EDIT: Seriously people, someone has to have done this before in root! I don’t really want to switch to matlab…

I don’t think ROOT has any signal processing functions. What you can do though is use python to access your ROOT data and then use the scipy/numpy python packages for filtering.


That had been my backup plan. As there seemed to be no solution in root, I ended up using the scipy.signal.butter() method. I am now filled with a profound sadness. If anyone needs help for something similar, hit me up.

OK. I implemented Butterworth filter transfer function as a RooAbsReal class. You can see it here. You could use it by convolving it with your input. There may be not enough documentation now but I will fix this soon. Any suggestion and/or correction would be appreciated.


If you consider using an external DSP library, this one has also Butterworth filters:

Hello @ferhue,

I have managed to build KFR with clang 10. (and the C API library too)
Right know I am facing some additional issue when I try to compile with rootcling.

In file included from input_line_9:5:
In file included from /home/marcomeyer/Software/escalade/src/lib/UMO/include/UMO/TSignal.h:28:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/dft.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/base.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/math.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/comparison.hpp:28:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/constants.hpp:28:
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/types.hpp:404:48: error: reference to 'is_same' is ambiguous
    is_same<T, float> || is_same<T, double> || is_same<T, signed char> || is_same<T, unsigned char> ||
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/../cometa.hpp:181:23: note: candidate found by name lookup is 'cometa::is_same'
constexpr inline bool is_same = std::is_same<T1, T2>::value;
/usr/include/c++/9/type_traits:1285:12: note: candidate found by name lookup is 'std::is_same'
    struct is_same

Any help from ROOT expert would be very welcome too :slight_smile:
I have remove “using namespace std;” I though this was the reason I get this issue.

Hmm maybe try adding cometa:: before every occurrence of is_same in the header.

Hi, thanks for the reply !

I was hoping not to modify KFR, but well…
I think I have fix the issue adding the proper namespace to remove ambiguities.

For those who are passing by this thread.
There is an unmerged branch that is fixing the issues.

In my case GNU C++ was detected first by cmake. This was working at first.
I could compute my FFT forward and backward, but an issue raised when I started to use more advanced methods. For instance, I edited some example programs available in the repository, by combining windows & fft. And these were breaking, due to some seg. faults.
So please, if you want KFR to properly work remember perhaps to use Clang++ compiler. (-DCMAKE_CXX_COMPILER=clang++)

There is no community and the core team is not very active, but all in all this is a good library so far for 1D(only) signal processing.

1 Like