Skip to content

Phase 2: split TMS_Event's detector-sim pipeline into TMS_DetectorSimulation and TMS_SignalProcessing - #300

Open
SFBayLaser wants to merge 2 commits into
phase2-detsim-fixesfrom
phase2-detsim-class-split
Open

Phase 2: split TMS_Event's detector-sim pipeline into TMS_DetectorSimulation and TMS_SignalProcessing#300
SFBayLaser wants to merge 2 commits into
phase2-detsim-fixesfrom
phase2-detsim-class-split

Conversation

@SFBayLaser

Copy link
Copy Markdown
Member

Third step of the real-data restructuring proposal (see #298 for Phase 1, #299 for the Phase 2 prep fixes this builds on; also discussed in #nd_muon_spectrometer_code). This is the actual class split Phase 2 aims for. Heads-up issue: #293.

Change: moved TMS_Event's 7 private detector-response methods into two new classes -- TMS_DetectorSimulation (sim-only: optical model, dark count, timing, deadtime, readout noise) and TMS_SignalProcessing (real-or-simulated: hit merging, pedestal subtraction). TMS_Event::ApplyReconstructionEffects() is now pure orchestration, calling into both classes in the same order as before -- this is the seam a future real-data entry point can join at, by calling only TMS_SignalProcessing on digitized hits.

Pure mechanical move, no algorithm changes.

Verification: build clean, zero new warnings. Full-spill run compared field-for-field against the pre-split baseline: log output, nSlices/totHits/nTracks per spill, and RecoHitBar/TrueHitBar distributions are all bit-identical (only non-deterministic wall-clock timing and raw heap pointer addresses in the log differ).

Closes #293.

SFBayLaser and others added 2 commits August 13, 2026 11:47
…nd TMS_SignalProcessing

Phase 2 class split from the real-data restructuring proposal, now that the
double-merge workaround is gone and ApplyReconstructionEffects() is a single
linear call chain. Moves the 7 private Simulate*()/MergeCoincidentHits()
methods out of TMS_Event into two new singleton classes, matching the
existing TMS_TrackFinder/TMS_ReadoutTreeWriter/TMS_Readout_Manager Meyers-
singleton convention (private ctor, deleted copy/assign, GetInstance()):

- TMS_DetectorSimulation: SimulateOpticalModel, SimulateDarkCount,
  SimulateTimingModel, SimulateDeadtime, SimulateReadoutNoise -- sim-only
  steps that only make sense when simulating a response from truth.
- TMS_SignalProcessing: MergeCoincidentHits, SimulatePedestalSubtraction --
  real-or-simulated steps a real DAQ readout would also need. This is the
  seam a future real-data entry point can join at, by calling only these
  two methods on digitized hits and skipping TMS_DetectorSimulation.

Pure mechanical move: every method body, call order, and RNG draw sequence
is unchanged. TMS_Event::ApplyReconstructionEffects() now just orchestrates
calls into both singletons in the exact same order as before -- kept as
individual calls rather than one Run() per class, because
SimulateReadoutNoise() must run after MergeCoincidentHits() (noise is drawn
once per final merged channel-readout, not per raw sub-hit), so the two
classes' methods are necessarily interleaved rather than each being one
contiguous block.

TMS_Event gained two small public members to support the move without a
bigger encapsulation break: GetHitsRawRef() (a reference-returning sibling
of the existing by-value GetHitsRaw()/SetHitsRaw(), avoiding a full hit-
vector copy on every relocated method call) and AddDeadtimeChannelRecord()
(SimulateDeadtime() used to push directly into three private TMS_Event
member vectors; now it calls this new appender instead). generator stays
private, passed by reference into the two methods that need RNG draws.
GetUniqIDForDeadtime()'s one-line body is inlined into the relocated
SimulateDeadtime() rather than kept as a shared helper, since nothing else
used it.

No behavior change intended -- output should be bit-identical to before
this commit, unlike the earlier merge-collapse work which had an accepted
RNG-stream side effect.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…file build

Same gap as TMS_Geom.o: this class split added two new .cpp files
that the hand-maintained TMS_OBJ list doesn't know about, so GitHub
CI's plain `make` path would fail to link them in.
@SFBayLaser
SFBayLaser force-pushed the phase2-detsim-fixes branch from 96fcd21 to dc8e09d Compare August 13, 2026 18:47
@SFBayLaser
SFBayLaser force-pushed the phase2-detsim-class-split branch from 9dc3827 to f0b5a58 Compare August 13, 2026 18:47
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.

1 participant