Hello, everyone!
I have a problem while using the Filter() function in rdataframe.
I want to use a vector in Filter() to compare. It can not work:
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
But there is no problem without vector, such as Filter_hit().
I put Filter() in a separate user-defined function because I want to call this function multiple times later.
Here are the .cpp file and data file: coincidence_2F_test.cpp (1.3 KB) 20221011_4_fixed.root (117.8 KB)
thank you for the reproducer. In general in case of a segfault my recommendation would be to:
compile the program with debug symbols (either by adding the appropriate #include and a main function and compiling it as g++ -o program program.cpp $(root-config --libs --cflags) or by running it as root.exe program.cpp+g (note the .exe and the +g – this will also require adding some #includes)
run the program under a debugger, which will tell you exactly what the state of the program was at the point of the crash, which usually shows what the problem is (e.g. gdb ./program or gdb --args root.exe -l -b -q program.cpp+g)
Running it as gdb ./coincidence_2F_test.cpp I can reproduce the segfault (as you see from the message at the top of the following figure) and printing a couple of variable contents shows that the problem is that you are accessing the 6th element of a vector with size 0 (see the bottom of the figure):