Skip to content

Improve MuonIDHlt1Alg

Arthur Marius Hennequin requested to merge ahennequ_muonid into master

The current CommonMuonStation data structure performs unnecessary partitionning and sorting of the muon hits. Its idea is to partition the hits in a grid of 8*9 regions, and in each region sort the hits by x. This is completly unnecessary because the MuonID algorithm is looping through all regions, and thus testing all hits. Even worse, due to the regular partitionning and the low occupancy of the muon stations, its calling the hits() accessor on a lot of empty regions for nothing. The sorting is also not needed, because its only use is for the find_if to work, but the argument of the find_if is the minimum boundary of the detector, so by definition all hits are passing the test.

The MuonID algorithm also performs a copy of all selected hits so it can loop again on them for uncrossed hits. Copies should be avoided as much as possible, and in this case it can be achieved by merging the two functions that compute the occupancies.

This MR needs a small addition in LHCb's CommonMuonStation.h (implemented in LHCb!2203 (merged)):

CommonMuonHitRange hits() const {
  // return { m_hits.begin(), m_hits.end() }; // Correct (0.2% more muons)
  return { m_index[0], m_index[nRegions()] }; // Backward compatible (same results)
}

At the moment, the algorithm is ignoring some hits that are outside the partitionning grid. Because it is weird to categorize a hit (that is comming from the readout and was decoded) as "outside of the station", I assume this is a bug. If I add those hits, I get 0.2% more muons.

This MR improves the throughput by ~3% (MuonID algorithm goes from ~4% of HLT1 to ~1%).

In a second step, it allows to remove the partitionning and sorting in the setHits() function of CommonMuonStation.h (gaining an additional ~1%)

Edit:

With the "Simplify CommonMuonStation" commit, I removed all the partitionning from the setHits. This has the side effect of changing slightly the outcome of the MuonMatch and MuonID algorithms. The differences can be explained by the fact that it is now testing all the hits, where before some of the hits on the edge of the partition grid were excluded.

For the muonID: the hits outside of the regions on the right and bottom were excluded (but the hits on top and left were tested)

For the muonMatch: the hits outside of the regions on the right and bottom were excluded and the hits on top and left were sometimes excluded, sometimes not depending on the overlap of the region they where attached to and the shape of the foi.

I believe the intended behavior was to tests all hits, @cprouve @masantim @rvazquez @sstahl can you confirm ?

Edited by Arthur Marius Hennequin

Merge request reports