Skip to content

Fix handling of single private tools, and reverse order of primary component...

Edward Moyse requested to merge emoyse/athena:master-fixes-for-CA into master

Fix handling of single private tools in print methods (we need to support adding both single private tools and lists of them), and (much more importantly) reverse order of primary component determination, to favour private tools over services.

This latter change is because you can get a service from another CA Cfg method, but if you explicitly set a private tool, that must be the intended primary component (since private tools cannot be left dangling).

As an example of where this causes a problem, this worked:

def MuonSegmentMatchingToolCfg(flags):
    result = ComponentAccumulator()
    acc  = MagneticFieldSvcCfg(flags)
    result.merge(acc) 
    ...
    result.setPrivateTools(matching)
    return result

whereas this failed in the client code:

def MuonSegmentMatchingToolCfg(flags):
    result = MagneticFieldSvcCfg(flags) 
    ...
    result.setPrivateTools(matching)
    return result

The reason it failed is in the latter case, the result of getPrimary() for the CA returned by the method is the fieldSvc, NOT the private tool (as expected). In the former, the service doesn't become a primary component since it is merged.

The fix is simple - reverse the determination of the primary component to favour private tools over other primary components (such as services). This should be correct because you would never add private tools and not expect them to be the primary.

Edited by Edward Moyse

Merge request reports