Skip to content

Fixing bug with NN in strip pairing - #218

Open
julianmgerber wants to merge 44 commits into
cositools:develop/emfrom
julianmgerber:StripPairingNN
Open

julianmgerber wants to merge 44 commits into
cositools:develop/emfrom
julianmgerber:StripPairingNN

Conversation

@julianmgerber

@julianmgerber julianmgerber commented Sep 24, 2026 •

Copy link
Copy Markdown

When comparing the outputs from the strip pairing with and without the nearest neighbors, I found that there are an additional ~30,000 events that pass through event selections when including NN. It turns out these are events that have no triggered strips but do have NN strips. Since there are NN strips that are output by the "Event->GetNStripHits" command, they don't get the "No strip hits" BD flag.

I edited the strip pairing so that only the triggered strips are actually counted, and events with no triggered strips are flagged as BD. I also updated the unit test references to reflect the changed BD flag.

A separate (but related) issue is that, when including NNs, ~20% of events are lost at the energy calibration stage because the NN happens to fall on a strip that doesn't have a valid energy calibration. The triggered strips are still able to be calibrated, though. I haven't edited the energy cal module because I wanted to check first, but I assume we don't want to be discarding these events just based on the NNs?

zoglauer and others added 30 commits April 26, 2026 22:45
Cherry-picked this commit from PR148 to apply seperately
…arestneighborstriphit" function to MHit class
This reverts commit 9f7b813, reversing
changes made to 2879859.
@julianmgerber
julianmgerber marked this pull request as ready for review September 24, 2026 09:26

@ckierans ckierans left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, Julain! I'm good to merge. But please see my comment about the definition of the IncludingNearestNeighbors boolean and a longer-term fix for that.

MStripHit* SH = Event->GetStripHit(sh);

if (SH->IsNearestNeighbor() == true) {
if ((SH->IsNearestNeighbor() == true) && (IncludingNearestNeighbors == false)) { // if seeing a NN strip for the first time, set to true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This self-definition of "IncludingNearestNeighbors" is giving me pause again. What if there is somewhat garbage data and a NN striphit gets through, but you don't actually want to analyze NN striphits? This would trip you, right?

I get the point about not having the HDF data loader as a prerequisite for this module, so you might not have access to the Get/SetIncludeNearestNeighbors already defined in the MModuleLeaderMeasurementHDF. But what we probably should do is have a Get/SetIncludeNearestNeighbors in every data loaded/reader. That's out of scope with what're your trying to do here, of course. But, if you agree, then let's make an issue and revisit this IncludingNearestNeighbors at a later time.

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 definitely makes sense!

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.

Should there also be an issue for the NNs without energy calibrations?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Alternatively: would it make sense to add some m_IncludeNearestNeighbors to ReadOutAssembly, such that Event already contains that information?
Then whatever loader module created the Event can set that.

@fhagemann

Copy link
Copy Markdown

Why are there so many commits in this PR? 😅

@julianmgerber

julianmgerber commented Sep 24, 2026 •

Copy link
Copy Markdown
Author

Why are there so many commits in this PR? 😅

@fhagemann I'm not sure why it's showing as so many commits... All of the commits except the last 4 are already in the develop/em branch.

@fhagemann

Copy link
Copy Markdown

Ah, your PR #183 got squashed, so all the commits in there were combined into one.
This one still has all original commits.

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.

4 participants