Add helper class to renounce recursively inputs from all tools of an algorithm or tool
In some cases tools which are called through a hierarchy of tools need input data created by one of the parent tools or the parent algorithm. Since there can be different implementations of such tools, which may not need this input data, and due to the more generic nature of the interfaces of the involved tools passing such inputs as arguments is not necessarily a good fit. It is also not always possible to split the top level tool or algorithm into two components: one which only creates the input data, and one which only reads the data. In such cases it would be good to pass the inputs via data handles i.e. the top level tool or algorithm declares a "write" data handle and the tool which is called by the top level tool through some tool hierarchy declares a "read" data handle for the same data. This however will cause (depending on the configuration) at least a warning about "Implicit circular data dependencies". In some cases such warnings are serious (e.g. the input data could be incomplete at the time of the call and this is not desired), in other cases these warnings can be ignored. Only the top level algorithm or tool knows whether a certain data which is create by this component, can be safely used by all (or some) of its child tools.
At the moment The IDataHandleHolder provides the means to renounce data handles, but the implementation (DataHandleHolderBase) would not renounce the corresponding data from its collection of e.g. input data objects if this collection was compiled already. There is also no possibility to renounce inputs from the entire tool hierarchy.
This proposal adds two helper classes
- the ToolVisitor which allows to iterate through a tool hierarchy. This helper can be instrumented.
- the RenounceToolInputsVisitor which renounces certain inputs from a tool.
This requires two modifications to Gaudi interfaces:
- the ToolVisitor has to be friended by the AlgTool to get a modifiable list of tools.
- the IDataHandleHolder has to be extended to allow to renounce inputs by DataObjID, to also renounce the inputs from possible internal input collections as they exist in the DataHandleHolderBase.
An example how the ToolVisitor can be used to renounce all inputs from the tools of an algorithm can be seen in the ToolVisitorTest_test.