Skip to content

Trapping correction module and app - #184

Open
sophieehaight wants to merge 65 commits into
cositools:develop/emfrom
sophieehaight:trapping_correction_branch
Open

Trapping correction module and app#184
sophieehaight wants to merge 65 commits into
cositools:develop/emfrom
sophieehaight:trapping_correction_branch

Conversation

@sophieehaight

Copy link
Copy Markdown

Contains a new module for applying depth-based charge trapping correction to individual hit energies along with modules with GUI options and GUI expos. The branch also includes an app for characterizing trapping with Cs-137 data. The trapping correction module requires a csv parameter file as input:
detector_0_trapping_parameters.csv
This file can also be found in resource/dee

@fhagemann

Copy link
Copy Markdown

Can we also remove HasCalibratedTiming() == true from the trapping app and replace by something like HasFastTiming() == true && HasNearestNeighbor() == false (in an effort to completely get rid of HasCalibratedTiming)?

@cositools cositools deleted a comment from codecov-commenter Aug 17, 2026

@fhagemann fhagemann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my feedback from just looking at the code.
I will also try to compile and run both the module and the app to provide more feedback on that as well! :)

Comment thread apps/TrappingCorrectionAm241.cxx
Comment thread apps/TrappingCorrectionCs137.cxx Outdated
Comment thread apps/TrappingCorrectionCs137.cxx Outdated
Comment thread apps/TrappingCorrectionCs137.cxx
Comment thread apps/TrappingCorrectionCs137.cxx
Comment thread src/MModuleTrappingCorrection.cxx Outdated
Comment thread src/MModuleTrappingCorrection.cxx Outdated
Comment thread include/MModuleTrappingCorrection.h Outdated
Comment thread include/MModuleTrappingCorrection.h Outdated
Comment thread include/MModuleTrappingCorrection.h
@fhagemann

Copy link
Copy Markdown

The example file in resource/dee and the results after applying the inverse charge trapping in the DEE looks reasonable:

image image image image image

@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

Comment thread src/MModuleTrappingCorrection.cxx Outdated
Comment thread src/MGUIOptionsLoaderMeasurementsHDF.cxx
@fhagemann fhagemann linked an issue Aug 18, 2026 that may be closed by this pull request

@fhagemann fhagemann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final code-style review, will give it a run to see that it compiles.
But then this should be good to go (tackling reading trapping parameters for multiple detectors in a follow-up PR)

Comment thread src/MModuleTrappingCorrection.cxx Outdated
Comment thread src/MModuleTrappingCorrection.cxx Outdated
Comment thread src/MModuleTrappingCorrection.cxx
Comment thread src/MModuleTrappingCorrection.cxx
Comment on lines +277 to +280
cout << "\n" << m_XmlTag << " --- " << titleLabel << " ---" << endl;
cout << " Centroid (Mu) : " << mu << " keV" << endl;
cout << " Fitted Gaussian FWHM : " << fwhm << " keV" << endl;
cout << " Direct Histogram FWHM: " << directFWHM << " keV" << endl;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this in c_Info?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use this output to evaluate how well the trapping correction is working. If I change the verbosity to info, the comand line becomes overloaded (I believe w info from the depth cal) and nuclearizer crashes. I agree this info doesn't need to be repeated so I can change the verbosity for the following comments but I do need it read out somewhere.

I think we probably need to clean up the outputs for the info verbosity right now because right now it's outputting so much info that I can't receive the info I'm trying to get from the trapping correction.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zoglauer maybe we can introduce the chatty verbosity from megalib also to nuclearizer, and move some of the info messages to chatty?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that could be a good idea!

Comment thread src/MModuleTrappingCorrection.cxx Outdated
Comment thread src/MModuleTrappingCorrection.cxx Outdated

@fhagemann fhagemann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be good from my side. Just gathering here the open TODOs (for follow-up PRs):

  • Allow for a charge trapping parameters file for multiple detectors, at not just one
  • Think about flushing output to c_Info without overloading the output
  • Maybe find an alternative to Interpolate to avoid code duplication (maybe from an existing package or another module --> the depth calibration also used some sort of interpolation algorithm to interpolate the CTD-to-depth spline).

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.

Implement Charge Trapping correction

3 participants