Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use average BaseLine and BaseLineSigma and small changes in peak pos #143

Merged
merged 11 commits into from
Nov 11, 2024

Conversation

JPorron
Copy link
Contributor

@JPorron JPorron commented Nov 6, 2024

JPorron Ok: 61 Powered by Pull Request Badge

We had an issue when detecting peaks in TPC signals. The algorithm identifies as peak a bin which is bigger than its neighbours (it can be smaller or equal than 3 to take into account flat peaks). Then the peaks position and amplitude are found by gauss fitting around this bin. Problems can arise when there is a tendency in the signal, if it is a small bump in a decreasing region, when fitting the results will be bad:

image
Fig 1: A peak was identified in the bin 291. When fitting in this range the peak position is very wrong.

This is corrected by avoiding the gaussFit and using a TripleMaxAverage method. The peak´s amplitude is simply the average of its amplitude and the one of its neighbours.

As for the peak position, the peak´s bin is not simply the peak as we don´t want too close peaks. To avoid those close peaks a peak is not considered if it is within a distance of another one, but again, if let´s say 3 consecutive bins fulfill the peak criteria (in a flat region) only the first one will be considered as peak, introducing a bias to more left peaks.

This is solved by choosing as the actual peak position the bin with the highest amplitude from the peak bin (biased) to the next "distance" bins (lets say 10). The maximum bin in this 10 bins interval is the new peak´s position (and the amplitudes mentioned before are calculated from this bin):

image
image
Fig 2: Imporvement in the peak´s positions and amplitudes.

Finally. Sometimes very small peaks are considered. This is because the peak thershold was calculated from the signal´s baseline, but sometimes small baselines can accept peaks with very low amplitudes. This is averaged by using the BaseLine and BaseLineSigma of all the signals and a threshold of "BaseLineMean + BaseLineSigmaMean * 10" is harcoded.

MAYBE THIS 10 SHOULD BE AN INPUT BUT SEEMS TO BE A VERY REASONABLE VALUE.

@JPorron JPorron mentioned this pull request Nov 7, 2024
@JPorron JPorron requested a review from lobis November 8, 2024 08:54
@lobis lobis enabled auto-merge (squash) November 8, 2024 09:38
@JPorron JPorron disabled auto-merge November 8, 2024 09:56
@lobis lobis enabled auto-merge (squash) November 11, 2024 10:55
@lobis lobis disabled auto-merge November 11, 2024 10:56
@lobis lobis merged commit 2f69a48 into master Nov 11, 2024
91 checks passed
@lobis lobis deleted the jporron-Update-TPCpeaksFinder branch November 11, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants