identify tools which need to be generalized to use 'vocabulary' functions, and migrate them
In order to be used by ThOr, code should be written in a generic way, i.e. it should accept any type which defines a set of 'vocabulary' functions. For example:
template <typename T>
void some_function(T const& thing) {
using LHCb::Event::threeMomentum;
auto momentum = threeMomentum(thing);
auto postion = referencePoint(thing);
// do things with momentum and position
}
In case of an interface, it should be defined in two parts: a generic, concrete templated part, which uses the above vocabulary functions to obtain basic quantities, and then protected virtual methods which call the actual implementation.
For example:
class IComputeSomething : extend_interfaces<IAlgTool> {
public:
template <typename T>
auto computeSomething( T const& thing ) const {
using LHCb::threeMomentum;
return actuallyDoSomething( threeMomentum(thing) );
}
protected:
virtual float_v actuallyDoSomething( Vec3<float_v> ) const = 0;
};
with an implementation like:
class computeZ final : public extends<GaudiTool,IComputeSomething> {
float_v actuallyDoSomething( Vec3<float_v> mom ) const override {
return mom.z();
}
};
note that the above is a really bad example, as this task is far too trivial (as in: why would one ever need more than one way of doing this?) to warrant the overhead of an interface, and an implementation as a tool. A more realistic example would be a kinematic fit or something else which would benefit from multiple implementations.