Skip to content

MuonReadoutGeometry: Speed up using getGeoIds

In MdtReadoutElement, we had in a few places an operation like:

        for(unsigned int kk=0; kk < cv->getNChildVols(); kk++) {
           tubenbr = cv->getIdOfChildVol(kk) % 100;
           layernbr = ( cv->getIdOfChildVol(kk) - tubenbr ) / 100;

However, getIdOfChildVol() is an O(N) operations, requiring a walk of the geo graph. Further, geomodel will maintain the transform while it does so, resulting in many calls to Eigen. And Eigen is much, much, much slower in debug builds than in optimized builds.

The upshot is that in debug builds, this code was taking many minutes.

Rewrite using geoGetIds so that we only need to traverse the geo graph once.

Merge request reports