Skip to content

Combined Pass1: iterative line finding and time cluster / line seed ntuple branches - #28

Open
michaelmackenzie wants to merge 2 commits into
Mu2e:mainfrom
michaelmackenzie:iterative-lines
Open

michaelmackenzie wants to merge 2 commits into
Mu2e:mainfrom
michaelmackenzie:iterative-lines

Conversation

@michaelmackenzie

@michaelmackenzie michaelmackenzie commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Uses the iterative LineFinder options from Mu2e/Offline#2077 in the combined Pass 1 reconstruction, and adds the matching EventNtuple branches. The tracker-only pass 1 (Tracker/) is unchanged; whether to use these settings there is left to the tracker experts.

Reconstruction (Combined_Pass1.fcl)

  • LineFinder: MaxLines: 3, MaxWireDistPull: 3, SkipFlatLines: true. Up to 3 lines per time cluster, each found after removing the previous lines' hits (e.g. a cosmic and an electron it knocks out). A hit counts only if the line agrees with its position along the wire. Lines parallel to the planes (dz = 0) are skipped because KKLine can't fit them.
  • LineFinder.TimeClusterCollection: SimpleTimeCluster, so all time clusters are searched. CosmicShowerFilter calls a cluster a shower when hits in one panel change layer twice. That rejects nearly every cluster with two tracks, and also single tracks that cross 3 or more straws of a panel (e.g. cosmics nearly parallel to the planes). Most of the newly searched clusters have one line: in the test below, 468 of the 583 clusters the filter rejects give a single line, and 115 give two or more. This is intended: these single-track clusters are now fitted too. The filter still runs, and its clusters are stored.
  • The art output also keeps both time cluster collections and the LineFinder line seeds. The makeSH hits are not kept.

Ntuple (from_mcs-combined.fcl)

  • timeclusters and showerfilteredtimeclusters (no hit branches), and lineseeds with lineseedshits (from the seeds' own hits)
  • Trigger info from the EvB processes (e.g. to identify calo laser events)
  • Geometry geom_common_extracted_v06.txt, the same as the reconstruction (it was geom_cosmic_extracted.txt)

Test
Offline main (807d948f9), with run 125472 subrun 77 (2000 events) through Combined_Pass1.fcl and then from_mcs-combined.fcl. Both exit 0 with no exceptions.

  • 1399 time clusters (793 pass the shower filter), 1533 line seeds, 198 events with more than one seed
  • 873 events with a track (559 on main)
  • trig_* branches filled (calo_laser 72/2000)
  • Pass 1 art output 20.5 MB (13.5 MB on main)

Needs an Offline with #2077 (v13_42_00 or main). geom_common_extracted_v06.txt (#2082) is already needed by main.

🤖 Generated with Claude Code

…tuple branches

Reco (Combined_Pass1.fcl): LineFinder finds up to 3 lines per time cluster
(MaxLines, MaxWireDistPull 3, SkipFlatLines; Offline#2077) on all
SimpleTimeCluster clusters instead of the CosmicShowerFilter output, which
rejects nearly every cluster with two tracks. Keep the makeSH combo hits,
both time cluster collections and the line seeds in the art output.

Ntuple (from_mcs-combined.fcl): fill the time clusters (with hits), the
shower-filtered time clusters and the line seeds (with hits), fill the EvB
trigger info, and use the same geometry as the reconstruction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@oksuzian oksuzian left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Summary — #28

Reviewed at head d25b9d4ecaa504256ed9b7b1428b75908f54b8cd. First pass.

Decision

  • 🟢 approve. Both configurations resolve to exactly the intended changes, and I reproduced the author's test on the same 2000 events with identical counts. The combined pass 1 finds clearly more lines and fits than main. The points below concern how the time-cluster switch is described and what it costs; none of them blocks.

Scope understood

  • Combined_Pass1.fcl: LineFinder gets MaxLines : 3, MaxWireDistPull : 3 and SkipFlatLines : true (Mu2e/Offline#2077), and searches the SimpleTimeCluster clusters instead of the CosmicShowerFilter ones. The art output also keeps the makeSH hits, both time-cluster collections and the line seeds.
  • from_mcs-combined.fcl: adds the timeclusters, showerfilteredtimeclusters and lineseeds branches with their hit branches, fills trigger information from the event-builder processes, and uses the same geometry as the reconstruction.

Findings

  1. 🟡 [S2] Searching SimpleTimeCluster mostly adds single-track clusters, which the description and the comment do not say

    • Evidence: I added a second LineFinder with the same settings, run on the CosmicShowerFilter clusters, to the PR's job on the same 2000 events. I assigned each line seed to the time cluster nearest in time.
      • SimpleTimeCluster makes 1399 clusters and CosmicShowerFilter keeps 793.
      • Of the 154 clusters in which LineFinder finds two or more lines, the filter rejects 115 (75%). This is the case the comment describes.
      • Of the 1193 clusters with exactly one line, the filter rejects 468 (39%). So 468 of the 583 clusters that this PR newly searches have a single line.
      • With the same settings, LineFinder gives 803 seeds on the filtered clusters and 1533 on SimpleTimeCluster.
    • The filter's rule explains this. It calls a cluster a shower as soon as hits in one panel change layer twice (CosmicShowerFilter_module.cc:159-165 at Offline 807d948f). A single track that crosses three or more straws of a panel, as a cosmic running nearly parallel to a plane does, triggers that rule too.
    • The comment says the filter "rejects nearly every cluster with two tracks". That is true, but the bigger effect of the switch is that pass 1 now also fits single-track clusters the filter called showers. The good fits that this adds have fewer active hits: a median of 10, against 13 over all good fits.
    • Suggested fix: if that is intended, say so in the comment at Combined_Pass1.fcl:76-77 and in the description. If not, keep the filter and look at its panel rule for cosmics instead.
  2. ⚪ [S3] The pass-1 art output is four times larger, mostly because of the makeSH hits

    • Evidence: for these 2000 events, out.art grows from 13.5 MB on main to 54.3 MB. product_sizes_dumper attributes 33.8 MB (62% of the file) to ComboHitCollection_makeSH, which only the timeclustershits branch needs. The KalSeeds_KKLine product grows from 7.3 MB to 12.3 MB, because there are more fits. CPU for the job goes from 40 s to 76 s.
    • Suggested fix: keep makeSH only if the time-cluster hit branch is needed routinely. Otherwise drop it and the timeclustershits branch, since lineseedshits already comes from the seeds' own hits.
  3. ⚪ [S3] The combined and the tracker-only pass 1 now find lines differently

    • The four LineFinder settings are in Combined_Pass1.fcl. Tracker/TrkRecoFromDigi.fcl and TrkRecoFromDigiMC.fcl keep CosmicShowerFilter as the input (Tracker/TrkReco_epilog.fcl:21) and one line per cluster. If both should behave the same, the settings belong in TrkReco_epilog.fcl. If the difference is intended, a one-line comment saying so would help.

Checked, no action needed

  • 🟢 Base and merge. The branch is based on PassN main 64bd40f, the merge of #27, and merges cleanly. The geometry it adds to from_mcs-combined.fcl, Offline/Mu2eG4/geom/geom_common_extracted_v06.txt, is the one #27 put in Combined_Pass1.fcl.
  • 🟢 Offline keys. Mu2e/Offline#2077 was merged on 2026-10-29 and is in v13_42_00 and in main 807d948f. There, MaxLines is unsigned, MaxWireDistPull is float and SkipFlatLines is bool (CosmicReco/src/LineFinder_module.cc:74-76). An older Offline rejects the keys at validation.
  • 🟢 Resolved configuration. fhicl-dump of both files at this head against main, with the CI build 807d948f, differs only in the intended lines: the four output commands, the three new LineFinder keys and its TimeClusterCollection, and in the ntuple the trigger settings, the time-cluster and line-seed tables, and the geometry.
  • 🟢 The transverse-step loop is not used. The resolved LineFinder has NTSteps : 0, so the loop I noted on Offline#2077 does not run. MaxLines : 3 calls the search up to three times per cluster, but each call skips that loop.
  • 🟢 Time-cluster hits. SimpleTimeCluster and CosmicShowerFilter both index makeSH (the filter's ComboHitCollection is set to makeSH at Tracker/TrkReco_epilog.fcl:11). So one comboHitTags : [ "makeSH" ] is right for both collections. In the ntuple, the 26,134 timeclustershits entries equal the sum of timeclusters.nhits.
  • 🟢 EventNtuple. The timeclusters and lineseeds tables are in EventNtuple main, and in every tag since v06_12_00 and v06_14_00. Their hit branches (fillHitsFor, comboHitTags) arrived in v06_14_03, so the ntuple job needs that tag or later.
  • 🟢 Trigger information. The input file has 31 event-builder processes (EvB0Calo01, EvB0Trk01-18, EvBCalo02-12 and EvBCrv01). All of them have the same six trigger paths in the same order, so matching on "EvB" gives consistent trig_* branches. trig_calo_laser fires in 72 of 2000 events, as the description says.
  • 🟢 The author's test, rerun. Run 125472, subrun 77, first 2000 events, Offline CI build 807d948f with EventNtuple main d05f8a2. Both stages finish with exit code 0. I get 1399 time clusters, 1533 line seeds, 198 events with more than one seed and 873 events with a track, as in the description.
  • 🟢 Against PassN main on the same events:
    • Seeds go from 769 to 1533, KKLine fits from 574 to 943, events with a fit from 559 to 873, and fits with fit consistency above 0.01 from 279 to 393. 115 events gain a good fit.
    • 10 events lose their only fit, 3 of them a fit with consistency above 0.01, and one more event loses its only good fit. Those 4 good fits had only 2 to 8 active hits. In three, the seed comes back with one hit fewer, which is what the along-wire cut does. Twice that is the same line, which KKLine then does not fit, and once the line shifts slightly and fits with consistency 0. In the fourth, an 8-hit seed is not found at all. One hit removed would put it below the 8-hit minimum, but I did not confirm that this is the cause.
  • 🟢 No production use. No prodtools campaign configuration uses a PassN file, so this affects only hand-run pass-1 processing.

Validation check

  • Ran: fhicl-dump of both changed files at main and at this head; Combined_Pass1.fcl and then from_mcs-combined.fcl on 2000 events, for main and for this head; the second-LineFinder job described in finding 1; and product_sizes_dumper on both outputs.
  • Not run: the tracker-only configurations, other runs or subruns, and any comparison with MC truth.

Author follow-ups

  1. State in the comment and the description that the SimpleTimeCluster switch also admits single-track clusters the shower filter rejects (finding 1).
  2. Optional: decide whether pass 1 needs to keep all makeSH hits (finding 2).
  3. Optional: align the tracker-only configurations, or say why they differ (finding 3).

The makeSH combo hits were ~60% of the pass 1 art output and were only
needed for the timeclustershits branch. Line seeds keep their own hits.
Also note in the comment that searching all SimpleTimeCluster clusters
adds mostly single-track clusters that the shower filter rejects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michaelmackenzie

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Addressed in e90d594:

  1. SimpleTimeCluster switch. This is intended: single-track clusters that the shower filter calls showers (e.g. cosmics nearly parallel to the planes) should be fitted too. The comment in Combined_Pass1.fcl and the description now say that most of the newly searched clusters have one line, and give your numbers (468 of 583).
  2. makeSH hits. Dropped from the pass 1 output, along with the timeclustershits branch (no comboHitTags/fillHitsFor). timeclusters, showerfilteredtimeclusters and lineseeds with lineseedshits are still filled. On the same 2000 events the art output is now 20.5 MB (54.3 MB before, 13.5 MB on main). Clusters, seeds and tracks are unchanged (1399 / 1533 / 873), and both jobs exit 0.
  3. Tracker-only pass 1. The difference is intended. The Tracker/ configurations are for the tracker experts to use and decide on, so this PR leaves them unchanged. The description now says so.

@oksuzian oksuzian left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Summary — #28

Reviewed at head e90d5941d970a930a9c63226fac407e9596387ee. Re-review of d25b9d4.

Decision

  • 🟢 approve. The new commit addresses all three points from my first review. I reran the same 2000 events at this head: the line seeds and fits are identical to the previous head, and the pass-1 output is now 20.5 MB instead of 54.3 MB.

Scope understood

  • One new commit on top of d25b9d4. It stops keeping the makeSH combo hits in the pass-1 output and drops the timeclustershits ntuple branch that needed them. It also expands the comment on the SimpleTimeCluster switch, and the description now covers the single-track clusters and the tracker-only configurations.

Prior findings

  • 🟢 [was 🟡 S2] Searching SimpleTimeCluster mostly adds single-track clusters. FIXED in e90d594, verified. The comment at Combined_Pass1.fcl:75-78 now says that the shower filter also rejects single tracks crossing three or more straws of a panel, and that most of the added clusters have one line. The description says this is intended and gives the counts.
  • 🟢 [was ⚪ S3] The output is four times larger because of the makeSH hits. FIXED in e90d594, verified. The keep line is gone, and timeclusters no longer sets comboHitTags or fillHitsFor (the resolved ntuple config has both empty). On the same 2000 events of run 125472, subrun 77, out.art is 20,502,219 bytes. It was 54,253,680 at d25b9d4 and is 13,461,482 on main.
  • 🟢 [was ⚪ S3] The combined and tracker-only pass 1 find lines differently. Resolved: the description now states that the tracker-only configurations are deliberately left to the tracker experts.

Checked, no action needed

  • 🟢 Resolved configs. fhicl-dump of Combined_Pass1.fcl at this head differs from d25b9d4 only by the removed makeSH keep line. from_mcs-combined.fcl differs only in the two emptied timeclusters keys. Against main, both still differ only in the intended lines.
  • 🟢 Same reconstruction. Both stages exit 0 with no exceptions, on the Offline CI build 807d948f with EventNtuple main d05f8a2. The seed and fit printouts match d25b9d4 exactly: 1533 seeds, 943 KKLine fits, 873 events with a fit and 393 fits with consistency above 0.01.
  • 🟢 Same ntuple content. The ntuple has one branch fewer (timeclustershits). timeclusters (1399), showerfilteredtimeclusters (793), lineseeds (1533), the 20,661 lineseedshits entries and trig_calo_laser (72) are all unchanged.

Merge order

  • #29 deletes from_mcs-combined.fcl, which this PR modifies. A test merge of the two heads conflicts on that file (modify/delete). Combined_Pass1.fcl merges automatically. Whichever PR merges second will need to resolve it.

Validation check

  • Ran: fhicl-dump of both files at this head, and the reconstruction and ntuple jobs on the first 2000 events of raw.mu2e.cosmics.kpp.125472_000077-001.art, compared with the d25b9d4 and main runs from my first review.
  • Not run: the tracker-only configurations, other runs or subruns, and any MC truth comparison.

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.

2 participants