Skip to content

Trapping correction module and app - #184

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

Trapping correction module and app#184
sophieehaight wants to merge 76 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

@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
m_Name = "Trapping Correction"; // - correcting energies for charge trapping (by Sophie);

// Set the XML tag --- has to be unique --- no spaces allowed
m_XmlTag = "TrappingCorrection";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Let's be consistent with XML tag naming here (see #193)

Suggested change
m_XmlTag = "TrappingCorrection";
m_XmlTag = "XmlTagTrappingCorrection";

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'm actually not seeing this convention in the depth or energy calibration modules? It looks like the XML tag is just the name of the module

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 is tackled in #197 once it is merged

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.

Once I change the name of the xml tag, nuclearizer can no longer recognize the module. Is there somewhere else in assembly I need to update the xml tag? I was looking but I couldn't find anything

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 will affect reading in a nuclearizer config file (*.cfg). In those, you might need to update all occurences of TrappingCorrection with XmlTrappingCorrection.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

So either update the .nuclearizer.cfg in your home directory, or the respective .cfg that you load when running nuclearizer.

Comment thread src/MModuleTrappingCorrection.cxx Outdated
Comment thread src/MModuleTrappingCorrection.cxx
Comment thread src/MModuleTrappingCorrection.cxx
Comment thread src/MModuleTrappingCorrection.cxx Outdated
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