Hi all,
I would like to write a generic filter function which can take any number of arguments of the same type. I will explain what I mean using an example. Lets say I want to write a framework which allows the user to test if a trigger was fired. The triggers are saved individually as bools. But maybe the user does not only want to use only a single trigger but wants to check if one of 2 trigger fired. How do I write a function which I can pass to Filter which can take either one or two (or any) number of boolean arguments? Doing this with a simple string would be easy:
Filter("trigger1 || trigger2"), Filter("trigger1")
But how do I do it with a function?
Filter(func, {"trigger1", "trigger2"}), Filter(func, {"trigger1"})
PassAsVec is not working because the number of triggers is not known at compile time but would be provided via a configuration file.
template<typename... Args>
bool func(Args... args)
{
return (... && args);
}
is also not working.
I understand that for such a simple example a simple string would be sufficient but the same function is supposed to test if particles were passing the corresponding trigger thresholds and so one as well. Therefore, I would like to use a function which I can debug and test. (This also means in the end that the function definition will get even more complex since it will not only get a list of bools but also e.g. a vector of floats with the momenta of the particles, but this would be another problem for later.) Is their any possibility to do this?
best
Jonas
ROOT Version: 6.18/04
Platform: Ubuntu 18.04
Compiler: g++ 7.4