Skip to content

TrigL2MuonSA: Speed up handling of dead tubes.

[Copy of change made in MuonMDT_CnvTools...]

The search for dead tubes was like this:

for(int layer = 1; layer <= mydetEl->getNLayers(); layer++){ for(int tube = 1; tube <= mydetEl->getNtubesperlayer(); tube++){ bool tubefound = false; for(unsigned int kk=0; kk < cv->getNChildVols(); kk++) { int tubegeo = cv->getIdOfChildVol(kk) % 100; int layergeo = ( cv->getIdOfChildVol(kk) - tubegeo ) / 100; if( tubegeo == tube && layergeo == layer ) { tubefound=true; break; }

However, getNChildVols() and getIdOfChildVol() are both 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 several minutes.

Rewrite using geoGetIds so that we only need to traverse the geo graph once (well, twice actually, since i left in the initial check on getNChildVols)

Merge request reports