-
Notifications
You must be signed in to change notification settings - Fork 54
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
Reworked TSourceCalibration, updated GH1D and TCalibrationGraphSet #1482
Merged
VinzenzBildstein
merged 36 commits into
GRIFFINCollaboration:main
from
VinzenzBildstein:dev
Jan 2, 2025
Merged
Reworked TSourceCalibration, updated GH1D and TCalibrationGraphSet #1482
VinzenzBildstein
merged 36 commits into
GRIFFINCollaboration:main
from
VinzenzBildstein:dev
Jan 2, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[MegaLinter] Apply linters automatic fixes
[MegaLinter] Apply linters automatic fixes
[MegaLinter] Apply linters automatic fixes
Sofar we've used GCanvas to allow adding new interactive features for drawing histograms (like moving the range with arrow keys). This has the benefit of allowing this for all types of histograms drawn (same keys for ROOT-native 1D histograms and GRSISort specific GH1D histograms). But it also meant we would have to duplicate code to do this whenever another part of the program needed that interactiveness (like it was partially done in TBGSubtraction). I've now added functionality (specifically adding regions to histograms) to the GH1D class directly and made it such that the class connects itself to the pad it is being drawn on to interact with any user actions in that pad. This was mainly done for the TSourceCalibration right now, but it could probably also be used for a revamped TBGSubtraction where the regions are used to set gates and backgrounds.
While updating TSourceCalibration I noticed an issue with removing points from the graph using right-clicks. To try and improve this I added a lot more verbosity (if enabled via TCalibrationGraphSet::VerboseLevel) and instead of having the TCalibrationGraphSet try and determine the position of the interaction, the TCalibrationGraph itself (which is the object the user interacts with) determines the position and sends it to the TCalibrationGraphSet. The TCalibrationGraphSet functions now also emit signals ("RemovePoint(Int_t, Int_t)", and "RemoveResidualPoint(Int_t,Int_t)" which should allow other classes to pick up on this and update themselves (like TSourceCalibration removing indicators that a peak is being used).
Completely changed the layout and progress to simplify using it. Instead of first having only the peaks and a "calibration" of a single source and only seeing the combined data points of all sources (with residuals) after accepting all source fits (and no way of going back), we now see all the found peaks and their fits on the left side, while on the right we see the fit of the combined data points with the residual. The right side also has a second tab showing the FWHM of all fits which might help identifying peaks where the fit isn't good or one that are doublets. It might be better though to move the FWHM graph from the separate tab to the same canvas as the calibration (maybe as a small pad of the same width as the calibration that is below/above the calibratio pad?). Also implemented a lot of the other improvements from GRIFFINCollaboration#1409: - There is now an option to set regions in the histograms to allow using higher overall threshold while still finding smaller peaks (by having separate regions for strong and weak peaks). - If possible we list all .sou files that are found in $GRSISYS/libraries/TAnalysis/SourceData as possible sources instead of just the default Am241, Ba133, Co56, Co60, and Eu152. - Added "Peak ratio" parameter that determines the maximum number of peaks we try to match to the N peaks from the .sou file (limit is parameter*N). This is because TSpectrum has the potential of finding hundreds of peaks (especially if the threshold is set very low), and it takes a very long time to check all possible combinations of those peaks and the energies from the .sou file, during which the program is completely unresponsive. Issues that are not completely solved: - Sometimes(?) not all regions are show after clicking on "Find Peaks" or "Find Peaks Fast". If this happens using the 'u'-key or zooming in and out again shows all regions again. - Removing a point from the graph on the right side does not remove the corresponding fit of the peak on the left side nor does it change the color of the marker for that peak.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Completely changed the layout and progress to simplify using TSourceCalibration
Instead of first having only the peaks and a "calibration" of a single
source and only seeing the combined data points of all sources (with
residuals) after accepting all source fits (and no way of going back),
we now see all the found peaks and their fits on the left side, while on
the right we see the fit of the combined data points with the residual.
The right side also has a second tab showing the FWHM of all fits which
might help identifying peaks where the fit isn't good or one that are
doublets. It might be better though to move the FWHM graph from the
separate tab to the same canvas as the calibration (maybe as a small pad
of the same width as the calibration that is below/above the calibration
pad?).
Also implemented a lot of the other improvements from #1409:
using higher overall threshold while still finding smaller peaks
(by having separate regions for strong and weak peaks).
$GRSISYS/libraries/TAnalysis/SourceData as possible sources instead of
just the default Am241, Ba133, Co56, Co60, and Eu152.
peaks we try to match to the N peaks from the .sou file (limit is
parameter*N). This is because TSpectrum has the potential of finding
hundreds of peaks (especially if the threshold is set very low), and
it takes a very long time to check all possible combinations of those
peaks and the energies from the .sou file, during which the program is
completely unresponsive.
Issues that are not completely solved:
or "Find Peaks Fast". If this happens using the 'u'-key or zooming in
and out again shows all regions again.
corresponding fit of the peak on the left side nor does it change the
color of the marker for that peak.
TCalibrationGraphSet and TCalibrationGraph
While updating TSourceCalibration I noticed an issue with removing
points from the graph using right-clicks. To try and improve this I
added a lot more verbosity (if enabled via
TCalibrationGraphSet::VerboseLevel) and instead of having the
TCalibrationGraphSet try and determine the position of the interaction,
the TCalibrationGraph itself (which is the object the user interacts
with) determines the position and sends it to the TCalibrationGraphSet.
The TCalibrationGraphSet functions now also emit signals
("RemovePoint(Int_t, Int_t)", and "RemoveResidualPoint(Int_t,Int_t)"
which should allow other classes to pick up on this and update
themselves (like TSourceCalibration removing indicators that a peak is
being used).
GH1D
Sofar we've used GCanvas to allow adding new interactive features for
drawing histograms (like moving the range with arrow keys). This has the
benefit of allowing this for all types of histograms drawn (same keys
for ROOT-native 1D histograms and GRSISort specific GH1D histograms).
But it also meant we would have to duplicate code to do this whenever
another part of the program needed that interactiveness (like it was
partially done in TBGSubtraction).
I've now added functionality (specifically adding regions to histograms)
to the GH1D class directly and made it such that the class connects
itself to the pad it is being drawn on to interact with any user actions
in that pad.
This was mainly done for the TSourceCalibration right now, but it could
probably also be used for a revamped TBGSubtraction where the regions
are used to set gates and backgrounds.
Other changes