Implementing NN into Strip Pairing - #183
Conversation
CHG: Speed optimizations
Cherry-picked this commit from PR148 to apply seperately
…arestneighborstriphit" function to MHit class
|
@julianmgerber I woud definitely like to have a flag for NN hits ambiguously attached to two different hits ! |
@fieldrog Just added the new flag, IsAmbiguousNearestNeighbor to MStripHit! |
| <<m_ReadOutElement->GetDetectorID()<<" " | ||
| <<((m_ReadOutElement->IsLowVoltageStrip() == true) ? "l" : "h")<<" " | ||
| <<m_ReadOutElement->GetStripID()<<" " | ||
| <<m_HasTriggered<<" " |
There was a problem hiding this comment.
Just wondering: is m_HasTriggered correlated with the strip being a NN?
Maybe this here might be redundant then, as we can "reconstruct" NN from SH that did not trigger.
There was a problem hiding this comment.
Andreas has removed the m_HasTriggered flag in PR #171 .
There was a problem hiding this comment.
m_HasTriggered seems to not have been removed in #171.
There was a problem hiding this comment.
From what I can tell, m_HasTriggered isn't actually assigned anywhere. Like in the .dat file output, all the strip hits (triggered or otherwise) just have 0 for the HasTriggered parameter.
There was a problem hiding this comment.
Is this when you read data from HDF5?
Maybe, the HDF5 reader module does not assign values to m_HasTriggered? (but should?)
There was a problem hiding this comment.
Yes, looks like the HDF5 reader never assigns a m_HasTriggered value:
nuclearizer/src/MModuleLoaderMeasurementsHDF.cxx
Lines 711 to 726 in 18e1de5
There was a problem hiding this comment.
Okay, I spoke with confidence when I didn't actually check the PR #171 code! Sorry about that.
I'm pretty sure we agreed we didn't need the HasTriggered boolean because it is completely redundant with (but opposite to) the IsNearestNeighbor flag. As far as I can tell, no one is using this flag anywhere so I'd vote for removing it entirely to avoid confusion going forward.
There was a problem hiding this comment.
But that doesn't need to happen in this PR, to be clear.
There was a problem hiding this comment.
I agree (both removing HasTriggered and that it doesn't have to happen in this PR).
|
@julianmgerber Can you resolve the conflicts with the changes in MStripHit and then I'll review? |
ckierans
left a comment
There was a problem hiding this comment.
Looks good, Julian. I think we need to be a bit more careful about being clear when the StripHit list is only triggered strips or also includes NN strip hits as well. Perhaps this can just be better comments, but we might consider changing some of the names to include "TriggeredStripHits" so there's no confusion.
|
|
||
| //! Divide an event's strip hits by detector and LV/HV side | ||
| vector<vector<vector<MStripHit*>>> CollectStripHits(MReadOutAssembly* Event); | ||
| tuple<vector<vector<vector<MStripHit*>>>, bool> CollectStripHits(MReadOutAssembly* Event); |
There was a problem hiding this comment.
Are these now only triggered strip hits? Maybe make that clear in the comment?
There was a problem hiding this comment.
Yes, I see below these are only the triggered strip hits. You should update the comment to reflect this change.
"//! Divide an event's triggered strip hits by detector and LV/HV side"
| //! Ownership stays elsewhere | ||
| MStripHit* GetStripHit(unsigned int i); | ||
| //! Return nearest neighbor strip hit i or nullptr if i is out of bounds | ||
| MStripHit* GetNearestNeighborStripHit(unsigned int i); |
There was a problem hiding this comment.
I'm wondering about any potential confusion/overlap with NN strip hits listed here vs in the StripHit list that then have the IsNearestNeightbor flag. Do we expect NN strip hits to also be listed in the standard GetStripHit list or is that now exclusively for triggered strips? If so, let's make that clear.
| } | ||
| } | ||
| else { | ||
| IncludingNearestNeighbors = true; |
There was a problem hiding this comment.
It took me a moment to understand what you're trying to do with this boolean. Maybe add a comment for this else statement: "If nearest neighbor strips are found in the event, set flag to properly account for them when strip pairing"
We have the boolean Get/SetIncludeNearestNeighbors in the MModuleLeaderMeasurementHDF module, which theoretically should be the same as this boolean here, except you're deriving it from the data, and not the GUI. I'm wondering if it will be less confusing (an potentially less prone to mistakes) to instead use that user-defined variable.
| // Strip hits: | ||
|
|
||
| //! Return the number of strip hits | ||
| unsigned int GetNStripHits() const { return m_StripHits.size(); } |
There was a problem hiding this comment.
Is this now only triggered strip hits? Or both triggered and untriggered?
| bool AssignedDetector = false; | ||
| int DetectorID; // Define detector ID where hit took place | ||
| for (unsigned int sh = 0; sh < Event->GetHit(h)->GetNStripHits(); sh++) { | ||
| // Collect all the strip hits in a hit and split them by side |
There was a problem hiding this comment.
I assume that whenever this function is called, the Hit only has triggered strips assigned to it. So this GetNStripHits will only return the number of triggered strip hits. Make that clear in the comment?
Once you assign Nearest Neighbor strip hits to the event, do you expect GetNStripHits to count all associated strip hits, or only triggered strips?
| <<m_ReadOutElement->GetDetectorID()<<" " | ||
| <<((m_ReadOutElement->IsLowVoltageStrip() == true) ? "l" : "h")<<" " | ||
| <<m_ReadOutElement->GetStripID()<<" " | ||
| <<m_HasTriggered<<" " |
There was a problem hiding this comment.
Okay, I spoke with confidence when I didn't actually check the PR #171 code! Sorry about that.
I'm pretty sure we agreed we didn't need the HasTriggered boolean because it is completely redundant with (but opposite to) the IsNearestNeighbor flag. As far as I can tell, no one is using this flag anywhere so I'd vote for removing it entirely to avoid confusion going forward.
| <<m_ReadOutElement->GetDetectorID()<<" " | ||
| <<((m_ReadOutElement->IsLowVoltageStrip() == true) ? "l" : "h")<<" " | ||
| <<m_ReadOutElement->GetStripID()<<" " | ||
| <<m_HasTriggered<<" " |
There was a problem hiding this comment.
But that doesn't need to happen in this PR, to be clear.
Previously, there was nothing about NN in the strip pairing, so if someone tried the strip pairing with NN included then it'd try to group NN + triggered strips together and add in all the energy on the NN strips. Perhaps eventually we'll want to add in some of the NN energy, but for now I thought it made sense to keep them separate.
Changes:
Questions:
- Update 7/28: Reading out NN strip hits to .dat file as "NN" rather than "SH"
- Update 7/28: New IsAmbiguousNearestNeighbor flag added to MStripHit class to flag NNs that are linked to multiple hits