Skip to content

Nearest neighbor handling#98

Open
robin4730 wants to merge 3 commits intocositools:develop/emfrom
robin4730:develop/em
Open

Nearest neighbor handling#98
robin4730 wants to merge 3 commits intocositools:develop/emfrom
robin4730:develop/em

Conversation

@robin4730
Copy link

Add Nearest Neighbor handling to Energy Calibration and TAC

Remove MModuleNearestNeighbor from GUI and execution flow

  • Disables MModuleNearestNeighbor in the main Nuclearizer GUI and removes
    associated actions. Nearest Neighbors will now be processed through the
    standard strip dataflow with module-specific handling, rather than
    relying on this standalone module.
  • Note: Source files are retained for now but should be deleted in a future cleanup.

Add option to include/exclude Nearest Neighbors in HDF Loader

  • Updates MModuleLoaderMeasurementsHDF with a toggle to filter Nearest
    Neighbor hits.
  • Default: Include Nearest Neighbors (true).

Implement configurable energy thresholds for Nearest Neighbors

Updates MModuleEnergyCalibrationUniversal to allow specific cuts on
Nearest Neighbor hits. Users can now select between:

  • No cut
  • A flat lower-bound threshold (user-defined in keV)

Add Nearest Neighbor timing cuts to MModuleTACcut

Extends TAC module to process Nearest Neighbor hits.

  • Implements a specific timing cut: Nearest Neighbors with calibrated timing <= 200ns (like in the python tools)

@zoglauer zoglauer changed the title Develop/em Nearest neighbor handling Feb 10, 2026
@robin4730 robin4730 force-pushed the develop/em branch 2 times, most recently from 640e689 to d9167c2 Compare February 10, 2026 03:15
@ckierans ckierans linked an issue Feb 10, 2026 that may be closed by this pull request

Energy = Fit->Eval(SH->GetADCUnits());

if (Energy < 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there anything left to protect against negative values if we neither do slow nor next neighbor cuts?

Copy link
Author

Choose a reason for hiding this comment

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

No there is nothing left to protect against negative energy. I just didn't think we wanted to automatically remove negative energy values, especially for the nearest neighbors. But if negative energy breaks other modules then I will add the "if Energy < 0, Energy gets set to 0" safeguard back in.

if (SH->IsNearestNeighbor() == true) {
// Get the value user typed in the box (for example 6.0 keV)
// TODO(@RobinAnthonyPetersen): Nearest Neighbor threhsold cut subject to change pending more analysis
if (m_NearestNeighborCutMode == MNearestNeighborCutModes::e_Fixed) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if we have Ignore?

Copy link
Author

Choose a reason for hiding this comment

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

My answer to this changes based on if we can or can't have negative nearest neighbor values

@zoglauer
Copy link
Collaborator

Does is compile for you?

I get:
dyld[97705]: symbol not found in flat namespace '__ZN29MModuleLoaderMeasurementsFITS11m_BatchSizeE'
zsh: abort nuclearizer

@robin4730
Copy link
Author

I can compile and run nuclearizer from this commit without issues. Gemini says that the issue is that m_BatchSize in src/MModuleLoaderMeasurementsFITS.cxx doesn't have memory allocated for it? It says to add:

#ifdef ___CLING___
ClassImp(MModuleLoaderMeasurementsFITS)
#endif

// Initialize the static variable
int MModuleLoaderMeasurementsFITS::m_BatchSize = 1000; // <--- FIX IS HERE: Add this line!

But I didn't change this file at all so not really sure...?

@zoglauer
Copy link
Collaborator

That should not be a static variable...
I'll fix that.

@zoglauer
Copy link
Collaborator

Fixed it in the develop/em branch

@zoglauer
Copy link
Collaborator

Let me know when I can merge it.

@robin4730
Copy link
Author

Hi Andreas, I think this is ready to merge? Or, let me know if there are any other issues to fix.

@zoglauer
Copy link
Collaborator

zoglauer commented Feb 18, 2026

Can you fix the above mentioned conflicts? Or below...

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 Nearest Neighbor Strip Hits

2 participants

Comments