Skip to content

FunctorDesc for python configuration

Niklas Stefan Nolte requested to merge NN_functors into master

introduce FunctorDesc to be used as follows:

Gaudi::Property<ThOr::FunctorDesc> m_functor{this,
                                              "myFunctor",
                                              {"code", {"headers","headers2"}},
                                              decode_the_thing};

instead of needing to give functors to two different properties (code and headers).

You can now give a functor like P > 5 directly to a ThOr::FunctorDesc property.

In the options (dumped with -o opts.py) this looks like this:

{'myFunctor' : "('( ::Functors::Track::Momentum{} > 5 )', ['Functors/TrackLike.h'], '( P > 5 )')"}

At the back you can see a "nice interpretation" of the code, so that it stays readable even for long chains of functors.
Another option would be to just print P > 5 in the options, but then we wouldn't be able to run from these options, therefore I chose the (verbose) full representation, which can be parsed as is.
The cpp FunctorDesc will also have access to a "nice" version of the code for debugging purposes.

@olupton

Edited by Marco Cattaneo

Merge request reports

Loading