Road Finding

Each BMU hit is turned into 2 IMU_Hit objects, one for each drift hypothesis. The IMU_Hit provides information about the phi of the hit, the drift distance, position in space, and so on--as well as a pointer to its counterpart with the other drift hypothesis. These are collected in an IMU_Hit_Collection. The IMU_Hit_Collection is sorted by side and by layer.

The IMU_Scan object keeps track of a hit in each layer, and proffers this for inspection. If the 4 hits do not satisfy a phi road, it is told to increment, which here means to replace the hit with lowest phi with the next one in that layer, if any. When it runs out of lowest hits, the scanning is done.

The stacks are interleaved. When the phi comes back around to zero the larger angle can be "smaller". Rather than fool with complicated algorithms I defined a myphi which has 0 (and 360) in the support region where we have no chambers, so I do not have to worry about wrap-around logic.