cms-gem-daq-project / gem-plotting-tools

Repository for GEM commissioning plotting tools
GNU General Public License v3.0
1 stars 26 forks source link

in calibrateThrDac.py, remove points with low scurveMeanError and restrict fit range #212

Closed AndrewLevin closed 5 years ago

AndrewLevin commented 5 years ago

Add protection against failed Gaussian fits to the scurveMean distribution and restrict the fit range automatically.

Description

The scurve mean and the error on the scurve mean are determined by a Gaussian fit to a histogram (actually a TGraph) of the scurveMean. The Gaussian fit can fail in a way that produces a reasonable scurveMean but an scurveMeanError that is unreasonably small. This can cause the scurveMean vs THR_DAC fit to fail. So, this pull request removes points in which the scurveMeanError is less than 0.1% of the scurveMean error.

The new fit range restriction will not affect the fit, but will affect how the fitted function is plotted. The fit range is determined on a per vfat basis based on which points are included in the fit.

Types of changes

Motivation and Context

This address https://github.com/cms-gem-daq-project/gem-plotting-tools/issues/208 including the comment https://github.com/cms-gem-daq-project/gem-plotting-tools/issues/208#issuecomment-495305202.

How Has This Been Tested?

Yes. As stated in the issue, among the 33 list of scandates files that I tested, there are 7 points that are removed by this algorithm. The scurveMean distributions shown there all indicate that it is reasonable to remove them. And the problematic scurveMean vs thrDac fit is improved in the case that motivated the issue (notice VFAT18):

Before:

58165543-45cd7500-7c88-11e9-8013-2ce581058492

With the new point removal algorithm:

canvScurveMeanVsThrDac_Summary 11

With the new point removal algorithm and the new restriction on the fit range:

canvScurveMeanVsThrDac_Summary

Checklist:

AndrewLevin commented 5 years ago

rebased