Skip to content

Add dual implementation in the choice of service name for ONNX in large-R jet DNN calibration tool

This MR adds a dual implementation in the setting of the ONNX service name used in the large-R jet DNN calibration tool.

This is thought to be necessary (even if not recommended) so that the calibration tool can be used within AnalysisBase.

Motivation:

In AnalysisBase setup, the ONNX service of type AthONNX::ONNXRuntimeSvc and name AthONNX::ONNXRuntimeSvc cannot be found by the ServiceHandle instantiator. To remedy this, a solution is to instantiate the service by hand prior to the calibration tool initialisation. It can be done using either the createService(serviceType, serviceName, algSeq) function in python configuration or asg::AsgServiceConfig config (serviceType/serviceName); and config.makeService() in c++ configuration. In both cases it's not possible to instantiate a service with the same name as its type.

But in Athena, the ONNX service has the same name and type so the ServiceHandle is called using

ServiceHandle< AthONNX::IONNXRuntimeSvc > svc("AthONNX::ONNXRuntimeSvc", "AthONNX::ONNXRuntimeSvc");

So a manual instantiation of the ONNX service (with a different serviceName) is not working because of the different service names.

Then, to keep the current working configuration for Athena and AthAnalysis, a solution is to change the serviceName when using AnalysisBase to the one used in the manual instantiation of the ONNX service, using a compiler-level dual implementation. We think that in the current state of the code, this is the easiest way to make the tool work in both Athena and AnalysisBase.

To keep in mind, that this solution would be very temporary as a full re-writing of the JetCalibTools module is planned to start in January. We are also open to possible better solutions.

Tagging @delsart, @cdelitzs

Secondary to this, some method (re-implemented from OnnxRuntimeUtils) are removed from the tool class and the definitions moved to the cxx file, for clarity.

Edited by Guillaume Lucas Albouy

Merge request reports