Repository navigation
Track-CRV association data product (TrkCrvMatch) with its MC truth (TrkCrvMatchMC) - #2106
Conversation
|
Hi @RobMina,
which require these tests: build. @Mu2e/fnalbuild-users, @Mu2e/write have access to CI actions on main. ⌛ The following tests have been triggered for e2e5514: build (Build queue - API unavailable) |
|
☀️ The build tests passed at e2e5514.
N.B. These results were obtained from a build of this Pull Request at e2e5514 after being merged into the base branch at b24d416. For more information, please check the job page here. |
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #2106
Reviewed at head e2e55145254dea1f5355876eeff9a04d1b1e057a. First pass.
Decision
- 🟢 approve. The products are complete and correct, and I ran both modules on the 9,314-event off-spill cosmic sample through Production#595's wiring. Every collection has exactly one
TrkCrvMatchperKalSeed, and every truth record lines up with its reco record. OnKKCHmuthe best geometric candidate is the track's own particle in 2,791 of 2,792 tracks. Two things should be fixed, neither blocking: the truth module and the layer probe degrade without saying so (finding 1), and the physics settings live only as C++ defaults, some of them specific to the extracted geometry or copied from another module (finding 2). FNALbuild build 3558 passed every test at this head.
Scope understood
- New products
TrkCrvMatch(one perKalSeed) andTrkCrvMatchMC(one perTrkCrvMatch), theTrkCrvMatchToolhelper inCRVReco, the producersTrkCrvMatcherandTrkCrvMatchMCMaker, prolog tables, and dictionary and build entries. All 17 files are additions; no existing module, product or configuration changes. - Companions, all drafts and not reviewed here: Production#595 schedules the modules in reco and recoMC, EventNtuple#441 writes ntuple branches and can run both modules on existing reco files, and Offline#2107 adds validation histograms.
Findings
-
🟡 [S2] The truth module and the layer probe degrade without saying so.
- Truth module.
TrkCrvMatchMCMaker_module.cc:164-167reads the SimParticles, MCTrajectories, CrvSteps and cluster-MC associations withgetHandle, and each one is skipped silently when absent (:198,:222,:255,:285). Standard reco output does not keep the digi-stage CrvSteps: Production'srecoMC/prolog.fclsetscompressRecoMCs.crvStepsToKeep : [ ], and no Production fcl includesrecoMC/cosmic_epilog.fcl, the only file that keeps them. So the module run on existing reco files, which the description says was tested and which EventNtuple#441 configures, gets no CrvSteps. I ran it alone on my off-spill reco output, with the prolog table as committed. It exited with status 0 and printed no warning. EveryTrkCrvXingMCthen hasedep_,nLayers_anddepPos_equal to zero. Compared with the same module inside the reco job, theCRV_T1summary changes as follows:true:depgoes from 2,866 to 0,fakefrom 119 to 130, anddep-no-geomfrom 28 to 0. The candidate relations are unaffected, because the cluster-MC associations are kept. - Layer probe. Without the pulse collection,
TrkCrvMatcher_module.cc:78-80warns once and continues. Every layer then hasdBar_ = INT8_MAXandpe_ = 0, which is also what "no pulse in the window" looks like. Nothing inTrkCrvXingorTrkCrvMatchrecords that the probe ran without pulses. EventNtuple#441 runs it onSelectReco, which holds the clustered pulses only, so its unclustered-layer columns read as inefficiency. - Suggested fix: use
getValidHandlefor every input the truth module needs, or throw with a message naming the missing collection. Add a flag to the product saying whether the probe had the full pulse collection. While there::297-298compare cluster keys without theProductIDcheck that:323-328apply;:125is an emptycatch, which clang-tidy also reports (bugprone-empty-catch).
- Truth module.
-
🟡 [S2] The physics settings live only as C++ defaults, and some are specific to the extracted geometry or copied from another module.
-
All 22 settings of
TrkCrvMatchTool::Config(TrkCrvMatchTool.hh:33-54) have C++ defaults. The prolog table (CRVReco/fcl/prolog_v12.fcl:393-398) sets only the input tags. Mu2e practice is that physics settings carry no C++ default, so that a job states them. -
DtRefCenter : 75ns has no source. On the Run 1A off-spill sample, the mediandtRefof own-particle time candidates is:fit median dtRef(ns)KKCHmu20.4 (68% between 11.2 and 28.8) KKDe24.5 KKDmu24.7 KKUe35.8 KKUmu36.7 Centring the time ranking on 20 ns turns 5 of the 3,222
KKCHmubest-time choices from Unrelated to SameParticle. The effect is small here because only 16 tracks have more than one time candidate. It would be larger in busy on-spill events. -
The
SigmaVcomment names the sector types "EX, T1, T2, muon taggers". That is the extracted geometry's numbering (crv_counters_extracted_v04.txt:186-196). In the Run 1A geometry, T1 and T2 are both type 1 (crv_counters_run1a_v01.txt:77-78), so both get 7 mm. Incrv_counters_v10.txt, type 1 is CRV-R. -
FiberSignalSpeed(140) andProbePulseDelay(34.5) copyCrvCoincidenceFinder's prolog values (prolog_v12.fcl:383,:385). The 140 there carries "FIXME: The correct value should be 175 mm/ns". If that is fixed, the probe keeps 140. -
Suggested fix: set the values in
prolog_v12.fclwith their sources, and take the fibre speed and delay from the finder's table with@local::. Then make the C++ settings mandatory, and either keySigmaVby sector name or say in the comment which geometry its types refer to.
-
-
⚪ [S3] Small items.
-
There is no
Print/support and nooperator<<for the new products (CrvCoincidenceClusterPrinteris the sibling). -
TrkCrvFitClusterAssns(UsedInFitAssns) has dictionaries and a reader, but nothing produces it, here or in the three companions. If it is for a fit still to come, the comment could say so. -
Two pieces of code are written twice:
- the dominant shield by PE (
TrkCrvMatchTool.cc:77-84,TrkCrvMatchMCMaker_module.cc:182-185); - the KinKalGeom sector to shield map (
TrkCrvMatchTool.cc:43-61,TrkCrvMatchMCMaker_module.cc:114-126).
One helper would serve both.
- the dominant shield by PE (
-
cLight_(TrkCrvMatchTool.hh:106) duplicatesCLHEP::c_light. The mapusedXing(TrkCrvMatchTool.cc:362) is keyed by track and sector, not by crossing.
-
Checked, no action needed
-
🟢 Build.
- A full
muse buildof this head onmainb24d4163, with p110 and Production#595 (56523f10), finished with exit status 0 and no warnings. - A second build with Offline#2084 at
445cd49amerged in also finished with exit status 0; the two branches merge without conflict. - In FNALbuild build 3558, the three clang-tidy errors are in
cetlib/LibraryManager.h. The 110 warnings in the new files are magic numbers and narrowing conversions, apart from the emptycatchabove.
- A full
-
🟢 Data-product paperwork.
classes_def.xmlhas every new type, its vectors, theWrappers,Ptr<CrvCoincidenceCluster>,Ptr<TrkCrvMatch>, and both directions of the newAssns.RecoDataProductscarries no MC information. Every member is initialised where it is declared. I read both products back from the output file with PyROOT. -
🟢 The record order holds. On all 9,314 events, with both off-spill settings, every
TrkCrvMatchcollection has exactly one record perKalSeed, andtrack_.key()equals its index, forKKCHmu,KKDe,KKUe,KKDmuandKKUmu. EveryTrkCrvMatchMChascands_andrecoXingTruth_parallel to its reco record, and every track has MC truth. -
🟢 Matching on
KKCHmu, the off-spill sample through Production#595's wiring:setting tracks with a CRV crossing best geometric candidate own particle best time candidate own particle median χ²/ndof, own geometric validation (field correction on) 4,876 3,005 2,792 2,791 3,207 of 3,222 0.25 production (field correction off) 5,384 2,419 2,057 2,055 3,562 of 3,588 0.67 The truth module's own summary agrees. With the validation setting, the own
CRV_T1cluster is a geometric candidate in 2,766 of 3,183 tracks, and is then always exclusive and best in its sector. On the LoopHelix fits the match is time only, as configured. Between a third and a half of the best time candidates are SameFamily: the cluster belongs to the cosmic muon whose knock-on electron was fitted. That is the label the module is meant to give. -
🟢 Offline#2084. The matcher reads the CRV crossings of
main's extrapolation and does not need #2084. With #2084 at445cd49amerged:- 1 of 4,876 tracks (1430:0:90791) gets crossings of
CRV_T1andCRV_T2at the same point, both in bounds. Its only candidate is unchanged: time only, because the extrapolated crossing is about 1 m from the true one. The truth module counts theCRV_T2crossing as a fake next to the true sector. - With the production setting, on 1430:0:50204, the
CRV_T1cluster stays the best geometric candidate (χ² 0.24), and the extraCRV_T2crossing is labelled the same way. - Over the whole sample, crossings go from 3,022 to 3,054, and best geometric candidates from 2,792 to 2,797, of which 2,796 are the track's own particle.
- 1 of 4,876 tracks (1430:0:90791) gets crossings of
-
🟢 CPU. The
KKCHmumatcher takes 0.06 ms per event and its truth module 0.16 ms, against 17 ms for the whole event.
Validation check
-
Build/tests run: yes.
- Two full
muse builds. - Off-spill reco on 9,314 cosmic events in both settings, each with all five matchers and truth modules in the job. The input was read in place.
- The same with #2084 merged, using the validation setting.
- Single-event diagnostic runs of the two seam events.
- A truth-module-only job on the reco output.
All jobs exited with status 0.
- Two full
-
Config contract check: pass. Both modules use validated FHiCL, and the prolog tables and Production#595's instances validate. Finding 2 covers the defaults.
-
Cross-repo consistency: pass, with finding 1's note on EventNtuple#441.
Residual risk
- Not checked:
- on-spill events with pileup, where the time ranking matters most;
- the extracted
KKLineconfiguration and data, which the description covers.
- On
KKCHmuthe error model looks about twice too large in the validation setting (median χ²/ndof 0.25 for own-particle geometric matches). It was fitted on extractedKKLine, as the description says.
Author follow-ups
- Make the truth module and the layer probe fail or flag when an input is missing (finding 1).
- Move the physics settings into the prolog with sources, and share the fibre speed and delay with
CrvCoincidenceFinder(finding 2). - Optional: the small items in finding 3.
brownd1978
left a comment
There was a problem hiding this comment.
This PR adds important necessary functionality to reconstruction that previously existed only in various private analysis scripts. The basic structure looks complete and correct. My specific comments are mostly about improving code readability (= maintainability) and reducing redundant payload. I may not have caught all instances where those are relevant.
My only architectural question is whether the author considered using Assns to record the associations instead of Ptrs. Assns can have payload, and natively handle M<->N associations, which can be hard to implement via ptrs.
…(relation, removal) constructor.
|
Thanks Dave for the careful review! I think I've addressed all of your comments. Regarding using Assns vs Ptrs, the main reason was to simplify the EventNtuple unpacking, since it already writes per-track branches without any lookup (as is done with KalSeedDtDt and MVAResult). If an Assns view is useful (e.g. FindMany from the cluster side), a small producer can derive it from the records with the candidate as payload. I would add it as a follow-up rather than change the primary product. |
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #2106
Reviewed at head addceca1281ee40c0404f4d86496331cabfce94e. Re-review of e2e5514.
Decision
- 🟡 comment, for one S1 (finding 1). The two new commits answer all of Dave's review and fix both of my S2 findings, and the reconstruction product is right. On my 9,314-event off-spill sample every crossing and probe layer is identical to
e2e55145, and the new reference time and full covariance behave as intended. But the truth module's candidate relations, nowMCRelationships, label the cluster made by the fitted particle's own parent as unrelated whenever that parent was simulated in two stages.addceca1fixes this for the true crossings but not for the candidates, so one record now contradicts itself. FNALbuild has not built this head:mu2e/buildtestsays "This test has not been triggered yet" (checked 21:50 UTC). My own full build passed.
What changed since e2e5514
- Two commits,
f7eca129andaddceca1(15 files, +409 −262). Neither is a rebase; the merge base is stillmainb24d4163. TrkCrvMatchstores the track covariance in the sector plane as a symmetric 2×2SMatrix(cov_), and the χ² uses its correlation. The reference time is the track's entry into the tracker, the earliest ofTT_Front,TT_BackandTT_Outer. Aprobe_field records which pulses the layer probe saw.TrkCrvMatchMCreferences theKalSeedMC. Candidate relations and true-crossing relations areMCRelationships, and the truth module throws on missing inputs unlessRequireCrvSteps : false.- The shared sector geometry moves to
CRVReco/inc/TrkCrvGeom.hh. All physics settings are now inCRVReco/fcl/prolog_v12.fcl, with no C++ defaults. MCRelationshipgains a(relation, removal)constructor.
Findings
- 🟠 [S1] A cluster made by the track particle's parent is labelled unrelated when the parent was simulated in two stages.
-
Evidence: event 1430:0:1608,
KKDetrack 0.- The μ+ is key 0 in stage 0, where it crosses CRV-T1 and makes cluster 0. It continues as key 1 in stage 1, and the fitted electron, key 2, is a
muIonidelta ray of key 1. TrkCrvMatchMCMaker_module.cc:325relates the deposit particle to the track's particle withMCRelationship(key 0, key 2). That compares key 0 with key 2's parent, key 1, and walks ancestors withoriginParticle().parent()(MCRelationship.cc:28-29,:44-49), which never contains key 0. Socands_[0].rel_isnone.- In the same
TrkCrvMatchMCrecord,xings_[0]is key 0's crossing of CRV-T1. Its relation ismother, from the module's stage-awarelineage(:50-53,:265), and itstrueCand_is 0, the very candidate labelled unrelated.
- The μ+ is key 0 in stage 0, where it crosses CRV-T1 and makes cluster 0. It continues as key 1 in stage 1, and the fitted electron, key 2, is a
-
Measured on the whole sample with the validation setting. The best time candidates are the same clusters as at
e2e55145; only their labels change:fit e2e55145this head KKDe29 SameParticle, 30 SameFamily, 5 SamePrimary 29 same, 35 none KKUe29, 30, 1 29 same, 31 none KKDmu24, 16, 4 24 same, 20 none KKUmu27, 17, 1 27 same, 18 none On
KKCHmu, 7 SameFamily candidates become none with the validation setting, and 15 SameFamily plus 2 of 3 SamePrimary with the production setting. -
Impact: on this sample the parent's cluster is the most common label of a LoopHelix fit's best time candidate. A purity or veto study built on
rel_ != none, or onedepRelated_(:337), would count the cosmic muon's own cluster as an accidental coincidence. -
Suggested fix: relate deposits through the same
lineagethataddceca1uses for the crossings. A deposit particle found there, matched by(simStage, key), getsancestorRelation(gen); only the others needMCRelationship. The comment at:48-49describes the problem as counting stage copies as generations. On this sample the relation is lost entirely.
-
Prior findings (from my review at e2e55145)
- 🟢 [was 🟡 S2] The truth module and the layer probe degraded silently. FIXED, verified.
- Run alone on reco output with the prolog defaults, the truth module stops with "no CrvStepCollection … (reco output drops it; set RequireCrvSteps : false to run without deposits)". With
falseit runs with exit status 0. - Every track records which pulses the probe saw (
probe_):probeAllPulseson all 4,876KKCHmutracks of my run. - The cluster-key comparison checks the
ProductID(:285), and the emptycatchis gone.
- Run alone on reco output with the prolog defaults, the truth module stops with "no CrvStepCollection … (reco output drops it; set RequireCrvSteps : false to run without deposits)". With
- 🟢 [was 🟡 S2] The physics settings lived only as C++ defaults. FIXED, verified.
- All are mandatory and set in
prolog_v12.fcl:392-428, with sources. - The fibre speed and pulse delay are
@local::references to the cluster finder;fhicl-dumpgives 140 and 34.5. - The
SigmaVcomment names the extracted geometry's sector types.
- All are mandatory and set in
- ⚪ [S3, partial] Small items. Fixed: the duplicated geometry code,
cLight_, theusedXingname, and theTrkCrvFitClusterAssnscomment. Open: there is noPrint/support and nooperator<<for the two products.
Checked, no action needed
- 🟢 Dave's review is fully answered, including the
Assnsquestion (reply at 21:46 UTC). - 🟢 The new
MCRelationship(relation, removal)constructor adds no data member, so storedMCRelationships and their dictionary are unchanged. No overload becomes ambiguous: every other two-argument call passesSimParticlePtrs orStrawDigiMCs. I checked the 5 such calls in Offline and those inEventNtupleandArtAnalysisonmain. My full build of Offline and Production is clean; I did not build EventNtuple or ArtAnalysis. - 🟢 Reconstruction, this head against
e2e55145, both off-spill settings:- Every
KKCHmucrossing, its position, time and flags, and every probe layer are identical. The track errors shrink by at most 1 mm, from the quadrature term 25 → 24 mm. - I recomputed all 2,058 geometric χ² values of the production job from the stored covariance; they agree to within 1e-7.
- With the tracker-entry reference, the own-particle
dtRefnarrows from 11.2–28.8 ns (16–84%) to 13.2–20.9 ns. The best geometric candidate does not change for any track.
- Every
- 🟢 The true crossings of the track's particle and its ancestors are the same as at
e2e55145; only twotrueCand_indices follow the changed candidate windows. They now carry stage-aware relations: onKKDe, 30 same, 23 mother and 8 umother.
Validation check
- Build/tests run: yes. A full
muse buildwith Production#595a5b655c3and mu2e-trig-config5999ffa2(p110) exited with status 0 and no warnings. I ran off-spill reconstruction on 9,314 cosmic events, in both settings, at this head and ate2e55145; every job exited with status 0. I also ran the truth module alone with deposit diagnostics, and theRequireCrvStepscheck. - Config contract check: pass. EventNtuple#441 sets
ProbeAllPulses : falseandRequireCrvSteps : falsewhere needed. - Cross-repo consistency: pass.
Residual risk
- On this sample the own-particle
dtRefmedians are 16.9 ns forKKCHmuand 21.5, 24.9, 21.7 and 23.8 ns for the four LoopHelix fits. Production#595 centres them on 27, 32, 28, 30 and 26 ns. This affects only the best-time ranking. - Not checked: on-spill events with pileup, and the extracted
KKLineconfiguration.
Author follow-ups
- Give candidate deposits the same stage-aware ancestor relation as the true crossings (finding 1).
- Optional:
Print/support for the two products.
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for addceca: build (Build queue - API unavailable) |
|
☀️ The build tests passed at addceca.
N.B. These results were obtained from a build of this Pull Request at addceca after being merged into the base branch at b24d416. For more information, please check the job page here. |
… (ancestors and siblings simulated in an earlier stage).
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #2106
Reviewed at head f24602b5b6e817b1fb2ac77b6f1f5ab3d0dd9283. Re-review of addceca.
Decision
- 🟡 comment now, approve when green. I would approve this code. The new commit fixes my S1: a candidate cluster made by an ancestor of the track's particle is now labelled by its real relation, also when the ancestor was simulated in an earlier stage, and every candidate now agrees with the true crossing it belongs to. Reconstruction is unchanged. One optional small item is new (finding 1). FNALbuild passed at
addceca1(22:09 UTC) but has not built this head:mu2e/buildtestsays "This test has not been triggered yet" (checked 01:21 UTC). I am triggering it and will approve once the build atf24602b5is green.
What changed since addceca
- One commit,
f24602b5, inCRVResponse/src/TrkCrvMatchMCMaker_module.cconly (+47 −9). Not a rebase. - Each deposit particle and the track's particle get an origin chain: one entry per generation, each the earliest simulation-stage copy of that generation's particle (
:196-211, cached per event).stageAwareRelation(:60-77) compares the two chains, so stage copies count as one particle at every generation. It replacesMCRelationship(deposit, track copy)for the candidates (:352,:363).
Prior findings (from my review at addceca1)
- 🟢 [was 🟠 S1] A cluster made by the track particle's parent was labelled unrelated when the parent was simulated in two stages. FIXED, verified.
-
Event 1430:0:1608,
KKDetrack 0, candidate 0: the deposit of the stage-0 μ+ (key 0) now getsmotherwith removal 1 (deposit diagnostics: "rel 2/1 | track origin chain 2(stage 1) 0(stage 0)"). That matchesxings_[0], the same μ+'s crossing, whosetrueCand_is 0. -
Every candidate labelled SameFamily or SamePrimary at
e2e55145now has a relation, and nothing else moves. Same input, validation setting, all candidates (on these fits each is also the best time candidate):fit e2e55145this head KKDe29 SameParticle, 30 SameFamily, 5 SamePrimary 29 same, 21 mother, 13 umother, 1 sibling KKUe29, 30, 1 29 same, 21 mother, 10 umother KKDmu24, 16, 4 24 same, 9 mother, 11 umother KKUmu27, 17, 1 27 same, 10 mother, 8 umother On
KKCHmuthe 7 SameFamily candidates become 4 mother and 3 umother with the validation setting. With the production setting, 15 SameFamily and 3 SamePrimary become 10 mother and 8 umother. The 12 candidates thate2e55145called unrelated staynonein each setting. -
Candidates and true crossings agree everywhere. For every true crossing that has a candidate, the candidate's relation is at least as close as the crossing's, and its removal counts generations the same way: 59, 59, 40, 44 and 3,224 crossings in the five validation fits and 3,583 in the production
KKCHmu, no exception. Ataddceca1, event 1608 was one of the exceptions. -
Read for edge cases: a null
Ptrand a deposit particle missing from the track's SimParticle collection givenone, as before. The self-parent walk handles any number of stages, and siblings are compared through the earliest copy of their parent. Only two-stage chains occur on this sample, so a third stage is not exercised.
-
- ⚪ [S3, open] There is still no
Print/support and nooperator<<for the two products.
Findings
- ⚪ [S3] The module now walks the track's ancestry two ways.
lineage(:233-242) follows the storedparent()Ptrs up toMaxGenerationsand labels the true crossings. The origin chain (:196-211) maps each step into the track's SimParticle collection, has no generation limit and labels the candidates. They agree on this sample, but an ancestor beyondMaxGenerationswould get a candidate relation and no true crossing. Derivinglineagefrom the track's origin chain would leave one walk. Optional.stageAwareRelationis also whatMCRelationship(SPPtr, SPPtr)itself lacks for its other callers; that belongs in a separate PR.
Validation check
- Build/tests run: yes. Incremental
muse buildof this head (Production#595a5b655c3, mu2e-trig-config5999ffa2, p110): exit status 0, no warnings. Off-spill reconstruction on the same 9,314 cosmic events with both settings, and the truth module alone with deposit diagnostics: all exit status 0. - Reconstruction against
addceca1, both settings: every crossing (3,022 and 2,420), probe layer (12,088 and 9,680), candidate set, best geometric and best time candidate, and true crossing is identical. Only the candidate relations above change. - Config contract check: pass. No fcl change.
- Cross-repo consistency: pass.
Residual risk
- Unchanged: on-spill events with pileup and the extracted
KKLineconfiguration are not checked, and Production#595's time-ranking centres differ from this sample's medians.
Author follow-ups
- Optional: finding 1, and
Print/support for the two products.
|
@FNALbuild run build test |
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for f24602b: build (already triggered: build) (Build queue - API unavailable) |
|
☀️ The build tests passed at f24602b.
N.B. These results were obtained from a build of this Pull Request at f24602b after being merged into the base branch at b24d416. For more information, please check the job page here. |
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #2106
Reviewed at head f24602b5b6e817b1fb2ac77b6f1f5ab3d0dd9283. Follow-up to my comment review at the same head.
Decision
- 🟢 approve. FNALbuild build 3570 has now built this head, merged on
mainb24d4163, and every test passed: the prof build, all eleven validation jobs,rootOverlaps,g4surfaceCheck,trigger,check_cmakeand the whitespace check. The FIXME/TODO count and clang-tidy rows are informational. This is the approval my comment review promised once the build was green. The two small items in that review, the two ancestry walks and the missingPrint/support, still stand and do not block.
Summary
This PR adds a reco data product that associates each KalSeed with the CRV coincidence clusters compatible with it,
and an MC product that labels those associations by SimParticle identity. Analyses today each make their own
track-CRV match (sector existence, nearest cluster in 3D, fixed time windows, ...). This product gives them one
definition, keeps the full candidate list with residuals, errors and flags, and leaves the selection to the analysis.
No existing module, product or configuration changes. The PR adds new products, two new modules, a matching helper
class, prolog entries, and their dictionary and build entries. Companion PRs: Offline validation histograms
(
ValTrkCrvMatch, stacked on this branch), EventNtuple branches with a Python example, and the Production reco wiring.Changes after review
TT_Front,TT_BackorTT_Outer(
EarliestReference). The separate front and mid times are removed from the record; every intersection time is inthe KalSeed.
TrkCrvPlaneCov,error model applied);
sigU()/sigV()are accessors, and the χ² uses the full 2×2.trkCrvSectors()(CRVReco/inc/TrkCrvGeom.hh) returns the KinKalGeom rectangle and its u, v, waxes per sector; the matcher and the truth module share it and the dominant-shield helper.
MCRelationships (closest over the cluster's deposits, compared with everysimulation-stage copy of the track's particle), and the record points at the track's
KalSeedMC.RequireCrvSteps : false(recorded as
hasDeposits_);TrkCrvMatch::probe_records which pulses the layer probe saw.CRVReco/fcl/prolog_v12.fclwith itssource.
DtRefCenteris measured per fit type (below). Fibre speed and pulse delay come fromCrvCoincidenceClusterFinder.KinKal::LineSegmentwith the rectangle'sintersect().What is added
RecoDataProducts/inc/TrkCrvMatch.hhTrkCrvMatch(one per KalSeed, same order),TrkCrvXing(one per CRV KalIntersection),TrkCrvCandidate(one per associated cluster)MCDataProducts/inc/TrkCrvMatchMC.hhTrkCrvMatchMC(one per TrkCrvMatch, same order),TrkCrvXingMC(true sector crossings of the track's particle and its ancestors),TrkCrvCandidateMC(truth relation of each candidate)CRVReco/inc/TrkCrvMatchTool.hh,CRVReco/src/TrkCrvMatchTool.ccCRVReco/src/TrkCrvMatcher_module.ccCRVResponse/src/TrkCrvMatchMCMaker_module.ccCRVReco/inc/TrkCrvPlaneError.hhCRVReco/inc/TrkCrvGeom.hh,CRVReco/src/TrkCrvGeom.cctrkCrvSectors()) and a cluster's dominant shield, shared by both modulesCRVReco/fcl/prolog_v12.fcl,CRVResponse/fcl/prolog_v12.fclTrkCrvMatcherandTrkCrvMatchMCtables, every value with its sourceCRVReco,CRVResponseCMakeLists.txtandsrc/SConscript;classes.h,classes_def.xmlof both product packagesCRVReco)How the match works
For each KalSeed,
TrkCrvMatcher:tRef: the earliest intersection on any ofReferenceSurfaces(defaultTT_Front,TT_Back,TT_Outer), which is the tracker entry for downstream, upstream and cosmic tracks alike;t0if none ispresent.
EarliestReference : falsetakes the first surface of the list present instead. The surface used isstored; on the extracted KKLine sample
TT_Outeris present on 99 % of tracks.KalIntersections): position, direction, time, momentum, and the trackcovariance in the sector plane (u along the bars, v across: the axes of the KinKalGeom sector rectangle). It also
stores the distance to the sector edge, in mm and in track sigmas.
dtRef = tRef − t_clusterinsideDtRefWindow.projected in a straight line onto that plane. The residuals there are
du(along the bars),dv(across) anddtXing. The track error is the crossing's full 6×6 covariance carried over the step. A cluster is kept whenthe residuals are inside
MaxDu,MaxDvandDtXingWindow.sector, is what makes the match robust near sector edges and in the 103 mm wide muon taggers (see validation).
covariance plus the CRV resolution on the diagonal. For single-ended clusters, which have no along-bar
measurement, only the across-bar term enters. Time-only candidates follow, ordered by their distance from
DtRefCenter. The matcher setsbestGeom,bestTime, and abestInSectorflag per cluster sector.nSharecounts the tracks of the collection that hold the cluster as a candidate.bestForClusterflags the cluster's best track.exclusiveassignment runs over the geometric pairs: at most one track per cluster, and onecluster per track per sector.
Windows are loose by design (
DtRefWindow±350 ns,MaxDv500 mm,MaxDu3 m,DtXingWindow±100 ns).KeepAllClustersignores them for commissioning.TimeOffsetis a test knob only: data offsets belong inconditions (
DAQTiming,CRVTime).DoGeometric: falsegives a time-only match for fits that do not extrapolate tothe CRV.
Error model:
SigmaV: 7, 13, 7 and 17 mm for EX, T1, T2 and the muon taggers. These are sector types1-4 of the extracted geometry; other geometries need their own list (the prolog says so).
SigmaU: 300 mm.DtRefCenteronly centres the time ranking; the window does not move. It is the mediandtRefof each track's owncluster in MC truth, per fit type, set per instance:
TrkCrvMatchMCMakergives each candidate the closestMCRelationshipbetween the cluster's deposit particles and thetrack's particle (
same,daughter,mother,sibling, theu*relations, ornone), with the energy from theparticle and from related particles. Multi-stage samples keep one
SimParticlecopy of the track's particle perstage, so each deposit is compared with every copy. The module finds the true crossings of each sector's mid-plane
rectangle from MCTrajectories (gap-inclusive) and CrvSteps, and links reco crossings to true ones. It must run with
the simulation geometry. It requires all its inputs;
RequireCrvSteps : falselets it run on reco output, whichdrops the CrvSteps, and the record says so (
hasDeposits_).Validation
MC: MDC2025bb cosmics (KKLine, extracted v06 geometry), first 50 files, 1,072,232 tracks. This study predates
the review changes; its truth classes map onto the
MCRelationshipones as knock-on family →daughter,mother,siblingand same primary → theu*relations. On file 1 the review build reproduces every geometric associationcount (reco crossings, true and fake, found and missed, own cluster as candidate, exclusive and best).
same primary in 0.4 %, and unrelated in 7 tracks. For comparison, the best time-only candidate is the own particle
in 86.6 % of tracks.
every sector.
fakes). Matching by projection recovers the own cluster in 0.88 of tracks, so analyses should not use
CRV_M*crossings as a selection.
1.1 points in any sector.
scale that depends on fit quality is a possible refinement.
SigmaVper sector type against a flat 40 mm: on the same 50 files, every association count is identical,and one track's best candidate changes truth class (SameFamily to SamePrimary). Only the χ² scale moves: the mean
χ²/ndof of own-cluster candidates goes from about 1.4 to about 3, from tails, while the robust pulls are near 1.
Data: CRT combined run 125472, file 12 (27,142 events, PassN
Combined_Pass1, KPP_reco conditions, v06).The matcher runs in data mode with no MC module and default settings.
8,408 KKLine tracks; 2,078 have CRV crossings, and 1,721 of those have a geometric candidate.
Residuals of the best geometric candidate, first 5,000 events (medians with their errors;
dvis cluster − trackacross the bars):
dtXingdatadtXingMCdvdatadvMCThe time residuals are centred within a few ns with no tuned offset. The T1 offset is also in MC: its clusters are
single-ended, so their time is not corrected for the light propagation. The EX
dvoffset in data is consistentwith the tracker-CRV offset seen in the alignment studies; the matcher measures it and does not absorb it. The
layer probe sees the same direction: in EX and T2, data finds the pulse one bar to one side 1.4-1.9 times as
often as on the other, in all four layers, while MC is symmetric.
CPU: 0.16 ms/event on average for the matcher on the CRT file (median 0.08 ms), against 13 ms/event for the
reco.
I/O: both products are written and read back. The truth module has also run in a separate job on the matcher's
output file.
Several KalSeed collections in one job (OnSpill).
SelectRecoMCwrites oneKalSeedMCAssnsover every KalSeedcollection, so the truth module looks a track up by collection and index.
MDC2025au OnSpill mock-data file (9,905 events, about 7,500-8,100 tracks per collection). Every track of every
collection has MC. The best time candidate is the track's own particle for 1,753-1,960 tracks per collection; the
others are mostly tracks whose particle never reaches the CRV.
recoMC/OnSpill.fclfrom MDC2025au digis schedules the same four matchers and truth modules, andwrites both products (200 events).
No change to existing output: no existing module, product or default configuration changes.
Layer probe (
LayerProbe, default on). For each crossed sector, the track's straight line is followed throughevery layer. The probe records the predicted bar and the best pulse within
ProbeBarWindowbars whose time,corrected for fibre propagation and the electronics delay, falls in
ProbeDtWindow. Per layer it stores the baroffset, time difference, PEs, whether the pulse is in a cluster, and the position along the bar from the two-end time
difference. It reads the full
CrvRecoPulses, which production does not persist, so it runs inside the reco job.The PEs are stored because an unclustered pulse exists nowhere else after reco.
probe_records what the probesaw: off, no pulse collection (predicted bars only, with a warning), clustered pulses only, or all pulses.
usedInFit. The matcher reads an optionalUsedInFitAssns(art::Assns<KalSeed, CrvCoincidenceCluster>, empty bydefault) of the clusters each fit used as constraints, and flags those candidates, whose residuals are biased.
Truth back-pointers. Each TrkCrvMatchMC holds an
art::Ptrto its TrkCrvMatch and to the track's KalSeedMC.Why
Ptrs and not anAssns: most of the payload is per track (crossings, probe, reference time, best indices),one record per KalSeed in KalSeed order follows
KalSeedDtDtandMVAResult, and the many-to-many relation is inthe records (
nShare,bestForCluster,exclusive). AnAssnsview can be derived from them if wanted.Not in this PR (follow-ups)
Print/support for both products.Assnsview derived from the records, ifFindManyfrom the cluster side is wanted.SigmaVkeyed by sector name instead of sector type, for geometries other than the extracted one.DtRefCenteron field-on CE + mix samples (the values here are from cosmics).sample for the cross-track pass.
Questions for reviewers
Ptrs dangle.How to run
One matcher per KalSeed collection, after
SelectReco, from the prolog tables (CRVRecoandCRVResponseprolog.fcl). The truth module needs the simulation geometry and runs aftercompressRecoMCsandCrvCoincidenceClusterMCAssns:LoopHelix fits do not reach the CRV, so their matchers are time only. The Production companion PR schedules these in
the standard reco paths, and the EventNtuple one runs them on existing reco files.
🤖 Generated with Claude Code