Repository navigation
Conversation
Two new config keys, both off by default:
TimeMergeWindow ns; clusters whose median hit times are closer than
this are merged, chained in time order (0/absent = off)
TimeMergeMinTime ns; clusters with an earlier median are never merged
The merge runs just before the cluster maps are put in the CStore, so
every downstream tool sees the merged clusters. Hits of a group are
combined; a hit shared with an earlier cluster of the group (same PMT and
time) is kept once. The merged cluster is keyed by the mean hit time, as
ClusterFinder does. The logic is in ClusterTimeMerge.h, templated on the
hit type, so data (Hits) and MC (MCHits) use the same code. It reads only
hit times and PMT IDs.
Tested on this branch (BeamClusterAnalysisMC, tank 500 / world 700 /
AmBe 1000 events):
- keys absent: output identical to Application (164/164 branches);
- TimeMergeWindow 50 / TimeMergeMinTime 2000, delayed clusters, C++ vs
the Python CF+NMS method on the same hits:
MC pulses (HitStore MCHits): tank 471 -> 435, world 245 -> 226,
AmBe 866 -> 860 clusters; same count in 100 % of triggers;
waveforms (PMTWaveformSim -> PhaseIIADCHitFinder -> HitStore Hits):
same count in 99.6 % (tank) / 100 % (world, AmBe) of triggers.
On MC with per-hit truth (ANNIEsoft/WCSim#27, ToolAnalysis#392) the
Michel/capture clusters that the fixed window split are rejoined (tank
37 -> 0, world 24 -> 0, AmBe 6 -> 0 split particles). No measurable
runtime cost.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge code moves from the header into ClusterTimeMerge.cpp, compiled for Hit and MCHit, following the usual .h/.cpp layout of helper files in UserTools. The function bodies are unchanged, so ClusterFinder merges exactly the same clusters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
ClusterFinder groups hits in a fixed window (
ClusterFindingWindow). Light from one particle that spreads a little longer, e.g. a Michel electron or a neutron capture, can be split into two clusters a few tens of ns apart. This adds an optional step that merges such clusters, controlled by two new keys inClusterFinderConfig(both off by default):Execute, just beforeClusterMap/ClusterMapMC/ClusterMapDetkeyare put in the CStore, so every downstream tool sees the merged clusters and the three maps stay consistent.ClusterTimeMerge.h/.cppin the ClusterFinder folder, compiled forHitandMCHit, so data and both MC pulse models use the same code. It reads only hit times and PMT IDs.HitStore Hits), and the parametric MC pulses (HitStore MCHits).Tests (BeamClusterAnalysisMC on Application; tank 500, world 700, AmBe 1000 events):
TimeMergeWindow 50/TimeMergeMinTime 2000, clusters after 2 µs, C++ against an independent Python implementation on the same hits:Checklist before submitting your PR
newusage, there is a reason the data must be on the heapnewthere is adelete, unless I explicitly know why (e.g. ROOT or a BoostStore takes ownership)Additional Material
Attach any validation or demonstration files here. You may also link to relavant docdb articles.
This presentation has outcomes from some of these changes. However, earlier I had standalone python script but now attempt to have integrated version of it in ToolAnalysis.