SiLab-Bonn / pyBAR

Bonn ATLAS Readout in Python - A readout software for FEI4 pixel detectors
BSD 3-Clause "New" or "Revised" License
9 stars 17 forks source link

Binary search algorithms could be slightly improved #86

Closed DavidLP closed 5 years ago

DavidLP commented 6 years ago

There is one special case where we could find a better value: Imagine:

Solution: Do not do / use the last iteration result when all preceding bits are set.

laborleben commented 5 years ago

Don't we have these issues with every scan step? The issue is more likely to appear for the LSB, but also the tuning error is the smallest for the LSB being wrong. I don't see how we can solve this and get significant better results.

A solution would be to increase the number of injections - this is equivalent to increased statistics.

DavidLP commented 5 years ago

Significant better results not, but a cross check that threashol(TDAC) is monotone could inprove the result.

laborleben commented 5 years ago

We store the best result in all tunings. Event if binary search does not give a good result we will overwrite with the optimal result afterwards.

E.g. 10000 -> first step ... 11100 -> this is optimal result, but a little bit too high 11010 -> this in 3nd optimal result, but too low 11011 -> this in 2nd optimal result, but a little too low 11010 -> repeating last scan step with 0 (see above) -> change to 11011 11100 -> replaced 11011 with 11100, because the latter was better