Skip to content

FIX: Issues in the DEE module and its submodule - #290

Open
fhagemann wants to merge 12 commits into
cositools:develop/emfrom
fhagemann:fix/DEE-issues
Open

fhagemann wants to merge 12 commits into
cositools:develop/emfrom
fhagemann:fix/DEE-issues

Conversation

@fhagemann

Copy link
Copy Markdown

Building on top of #247 (waiting for that to be merged first):

Addressing most of the issues opened to react to the ExpectedToFail tests in the new full suite of unit tests.

Opening this as draft for now for people experiencing some events not passing through the DEE, to see if this fixes their issues. One reason might be uninitialized geometries or sub-threshold GR strip hits vetoing the whole event.

@fhagemann fhagemann added the DEE Development related to the detector effects engine label Oct 24, 2026
@fhagemann
fhagemann marked this pull request as draft October 24, 2026 23:07
@fhagemann

Copy link
Copy Markdown
Author

Just rebased this on top of the current develop/em that has the stashed PR #247

@fhagemann
fhagemann marked this pull request as ready for review October 27, 2026 13:22

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.

Changes in this file address issue #276:

  1. A detector without drift splines crashes AnalyzeEvent()
  2. Merged strip hits keep the wrong fast peak time and lose the origins
  3. Minor: Initialize() crashes without a geometry

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.

This file addresses the issue #277:

  1. The simulated relative depth uses the half thickness of the detector
  2. Minor: an event without simulated event crashes

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.

This file addresses issue #278:

  1. TAC calibrations that do not start at strip 0 are applied incorrectly
  2. Negative HV TACs are not clamped to 0
  3. Minor: m_ApplyTimingResolutionCalibration is not initialized in the constructor

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.

This file addresses issue #281:

  1. Saturated strips are lost
  2. Added neighbor strips have no opposite strip ID
  3. A sub-threshold guard ring hit next to a triggered strip is kept
  4. The ADC value is truncated instead of rounded
  5. Minor: m_ApplyResolutionCalibration is not initialized in the constructor

@zoglauer

Copy link
Copy Markdown
Collaborator

As usual Claude finds many more issues than I ever can find:

  1. The TAC lookup is only fixed for LV strips, not HV (MSubModuleDepthReadout.cxx, HV branch, around line 244). The HV side still checks StripID < m_TACCal[DetID][1].size(). Since m_TACCal is an
    unordered_map, that size check doesn't show whether the strip has an entry, and [StripID] then inserts an empty vector. The next step, TACCal[0], reads an empty vector: undefined behavior, likely a
    crash. This happens whenever the HV calibration has gaps, e.g. strip 5 missing. Fix: use the same find(StripID) != end() check as the LV side. The tests don't catch it because TestPartialTACCalibration
    only covers LV. I found this by reading the code and didn't run it.
  2. list::merge on unsorted lists (MSubModuleChargeTransport.cxx, both merge loops). The standard requires both lists to be sorted for merge(), and m_SimulatedOrigins is filled in the order of
    HT->GetOrigins(), so sorting isn't guaranteed. IterLV1->m_SimulatedOrigins.splice(IterLV1->m_SimulatedOrigins.end(), IterLV2->m_SimulatedOrigins) does what's intended and keeps the order.
  3. ADC conversion is now inconsistent and slower (MSubModuleStripReadout.cxx):
    • The added empty neighbor hits still use the old GetX(…, 0, m_MaxADCRange) and truncate with static_cast. Real hits now go through the saturation handling and lround.
    • GetMinimumX(), GetMaximumX() and two Eval() calls now run for every strip hit in every event. Each of the first two is an iterative minimization, and the result only depends on the strip's
      calibration. Computing it once per strip in Initialize() would avoid that cost.
  4. Two test comments are now out of date:
    • UTNSubModuleDepthReadout.cxx:344 says "The HV side does not clamp negative TACs", but it does now. The #if x86 / #else split around that check has the same check in both branches and can be removed.
    • UTNSubModuleStripReadout.cxx:415 mentions the truncating cast, which is now lround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment