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

Reworked TSourceCalibration, updated GH1D and TCalibrationGraphSet #1482

Merged
merged 36 commits into from
Jan 2, 2025

Conversation

VinzenzBildstein
Copy link
Member

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:

  • 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.

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

  • Moved functionality from GCanvas to GRootCommands to avoid code duplication.
  • TRedirect has been updated to allow the redirection of stderr only.
  • Some linter fixes.

VinzenzBildstein and others added 30 commits September 23, 2024 14:03
[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.
@VinzenzBildstein VinzenzBildstein merged commit e05bdda into GRIFFINCollaboration:main Jan 2, 2025
6 checks passed
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.

1 participant