Skip to content

CRV inference #358

Open
sam-grant wants to merge 4 commits intoMu2e:mainfrom
sam-grant:sgrant/crv-cosmic
Open

CRV inference #358
sam-grant wants to merge 4 commits intoMu2e:mainfrom
sam-grant:sgrant/crv-cosmic

Conversation

@sam-grant
Copy link
Copy Markdown
Contributor

@sam-grant sam-grant commented Mar 23, 2026

Summary

  • Add optional crvcosmic. branch to EventNtuple, storing CRV cosmic veto BDT scores
  • Structure is TxC (track x cluster), with each array aligned with the elements of trk. branch
    • Each track has a vector of MVAResultInfo scores, one per CRV coincidence cluster
    • Tracks with no CRV match get an empty vector, preserving alignment
  • Controlled by CrvInferenceTag fcl parameter
    • No branch is created when absent (backwards compatible)
  • Added from_mcs-mockdata_crvInf.fcl for ntupling with CrvInference enabled

Example output

One event with 4 track hypotheses and 2 CRV clusters:

[pyprint] [INFO] -------------------------------------------------------------------------------------
[pyprint] [INFO] trk.trk.pdg: [11, -11, 13, -13]
[pyprint] [INFO] trkfit.trksegs.mom.fCoordinates.fX: [[11.9, -88.8, 63.3, -140, 13.6], [...], ..., [-11.8, 89.3, -61.7, 136, -14.6]]
[pyprint] [INFO] trkfit.trksegs.mom.fCoordinates.fY: [[118, -80.1, -99.5, 90.2, 128], [-118, ...], ..., [-118, 78, 101, -94, -127]]
[pyprint] [INFO] trkfit.trksegs.mom.fCoordinates.fZ: [[129, 129, 129, 56.4, 119], [-129, ...], ..., [-129, -128, -130, -56.9, -119]]
[pyprint] [INFO] trkfit.trksegs.pos.fCoordinates.fX: [[677, 24.8, -40.7, 385, 661], [677, ..., 661], ..., [677, 34.9, -45, 394, 661]]
[pyprint] [INFO] trkfit.trksegs.pos.fCoordinates.fY: [[-87.4, 234, -268, 214, -87.5], [...], ..., [-87.4, 233, -262, 204, -93.8]]
[pyprint] [INFO] trkfit.trksegs.pos.fCoordinates.fZ: [[10.1, -1.63e+03, 1.64e+03, -5.97e+03, -2.59e+03], ..., [10.1, ..., -2.58e+03]]
[pyprint] [INFO] trkfit.trksegs.time: [[1.24e+03, 1.23e+03, 1.25e+03, 1.21e+03, 1.23e+03], ..., [1.24e+03, ...]]
[pyprint] [INFO] trkfit.trksegs.dmom: [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
[pyprint] [INFO] trkfit.trksegs.momerr: [[0.464, 0.467, 0.459, 0.467, 0.467], ..., [0.537, 0.541, ..., 0.541, 0.541]]
[pyprint] [INFO] trkfit.trksegs.inbounds: [[True, True, True, True, True], [...], ..., [True, True, True, True, True]]
[pyprint] [INFO] trkfit.trksegs.gap: [[False, False, False, False, False], ..., [False, False, ..., False, False]]
[pyprint] [INFO] trkfit.trksegs.sid: [[1, 0, 2, 96, 95], [1, 0, 2, 96, 95], [1, 0, ..., 95], [1, 0, 2, 96, 95]]
[pyprint] [INFO] trkfit.trksegs.sindex: [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
[pyprint] [INFO] crv.crvcoincs.PEs: [1.74e+03, 1.11e+03]
[pyprint] [INFO] mva.crvcosmic.valid: [[True, True], [True, True], [True, True], [True, True]]
[pyprint] [INFO] mva.crvcosmic.result: [[0.999, 0.97], [0.999, 0.97], [0.999, 0.97], [0.999, 0.97]]
[pyprint] [INFO] -------------------------------------------------------------------------------------

trk.pdg: [11, -11, 13, -13]
crvcoincs.PEs: [1.74e+03, 1.11e+03]
crvcosmic.valid: [[True, True], [True, True], [True, True], [True, True]]
crvcosmic.result: [[0.999, 0.97], [0.999, 0.97], [0.999, 0.97], [0.999, 0.97]]
  • High score (~1.0): the coincidence is cosmic-like and the track is nearby in time/space
  • Low score (~0.0): the coincidence is pileup/noise-like and/or the track is far from the coincidence

Plots from test EventNtuple files, showing separation of classes.

h1o_selection

Details

The CrvInference producer module (in ArtAnalysis/CrvInference) pairs every KalSeed with every CrvCoincidenceCluster and computes an XGBoost BDT score indicating the probability that the coincidence is from a genuine cosmic. EventNtupleMaker reads the resulting art::Assns<KalSeed, CrvCoincidenceCluster, MVAResult> and stores the scores in a crvcosmic. branch with fields result (the BDT score) and valid.

The branch uses fhicl::OptionalAtom so existing fcl configurations are unaffected. To enable, add the input tag physics.analyzers.EventNtuple.CrvInferenceTag : "CrvInference".

@sam-grant sam-grant marked this pull request as ready for review March 23, 2026 02:39
Copy link
Copy Markdown
Collaborator

@AndrewEdmonds11 AndrewEdmonds11 left a comment

Choose a reason for hiding this comment

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

This looks great, Sam! I think you can go ahead and turn it on by default in the mockdata fcl files. Thanks

@sam-grant
Copy link
Copy Markdown
Contributor Author

This looks great, Sam! I think you can go ahead and turn it on by default in the mockdata fcl files. Thanks

Thanks. Before we turn it on by default, it has a dependency on ArtAnalysis which needs to be merged PR-2. I guess this also means ArtAnalysis needs to be included in the EventNtuple musing, if it hasn't been already?

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