The reason for a lower bound in the first place are threshold effects showing up in the data, which make the polya not fit very well. This leads to a bad prediction of the gas gain (NOTE: does not directly matter for the following analysis, since we use the mean of the data anyway), which slows down the fitting significantly. Each fit can take up to 1 s instead of ~(20 ms).
An example for a normal polya:
An example for a bad fit due to a too low cut value:
And an example that shows data that cuts of very early where we really do not want to try to fit the left edge:
Example 2 and 3 here are cases where the left edge would significantly cause a bad fit, due to a sharper than real drop off, because the pixel threshold of the is visible.
We need to dynamically determine the lower bound. Essentially find the maximum of the data and then walk to the left up to maybe once more than 1 consecutive bin (to avoid stat fluctuations mess things up) to be lower than maybe 60% of the max or so.
Finally, also show the actual range of the fit and the extended range that is plotted for the fit line here in the plots. Just draw two geom_line or add a new column before plotting with a label "fit / extended" or something like this.
We use a hardcoded lower bound for the polya fit, which by default is at 1200 e⁻:
https://github.com/Vindaar/TimepixAnalysis/blob/master/Analysis/ingrid/calibration/calib_fitting.nim#L605
The reason for a lower bound in the first place are threshold effects showing up in the data, which make the polya not fit very well. This leads to a bad prediction of the gas gain (NOTE: does not directly matter for the following analysis, since we use the mean of the data anyway), which slows down the fitting significantly. Each fit can take up to 1 s instead of ~(20 ms).
An example for a normal polya:![gas_gain_run_84_chip_3_current_cut_acceptable](https://user-images.githubusercontent.com/7742232/100205786-d7651500-2f05-11eb-8a47-aee28f1df196.png)
An example for a bad fit due to a too low cut value:![gas_gain_run_84_chip_2_current_cut_too_low](https://user-images.githubusercontent.com/7742232/100205858-ef3c9900-2f05-11eb-9880-bf995ac94795.png)
And an example that shows data that cuts of very early where we really do not want to try to fit the left edge:![gas_gain_run_303_chip_5_cut_off_sharply](https://user-images.githubusercontent.com/7742232/100205905-fc598800-2f05-11eb-930e-e9c27c07c59e.png)
Example 2 and 3 here are cases where the left edge would significantly cause a bad fit, due to a sharper than real drop off, because the pixel threshold of the is visible.
We need to dynamically determine the lower bound. Essentially find the maximum of the data and then walk to the left up to maybe once more than 1 consecutive bin (to avoid stat fluctuations mess things up) to be lower than maybe 60% of the max or so.
Finally, also show the actual range of the fit and the extended range that is plotted for the fit line here in the plots. Just draw two
geom_line
or add a new column before plotting with a label "fit / extended" or something like this.