Skip to content

Track Purity DNN for Phase-2 HLT - #251

Merged
github-actions[bot] merged 1 commit into
SegmentLinking:masterfrom
jchismar:track-purity-dnn
Jul 15, 2026
Merged

Track Purity DNN for Phase-2 HLT#251
github-actions[bot] merged 1 commit into
SegmentLinking:masterfrom
jchismar:track-purity-dnn

Conversation

@jchismar

@jchismar jchismar commented Mar 27, 2026

Copy link
Copy Markdown

Implementation of a track purity DNN used for high purity selection for HLT tracks. Initial results were presented by Aashay at the tracking POG meeting on 15 Dec 2025. Since then, the model has been retrained with the latest version of LST, and a separate threshold has been implemented for displaced tracks (|dxy| > 0.5) in order to improve displaced track efficiency. This threshold is set at a target recall of 99.5% calculated on tracks with |dxy| > 0.5. For tracks with |dxy| $\le$ 0.5, the threshold is set at a target recall of 99.5% calculated on all tracks. Additionally, the number of input features has been reduced from 29 to 15 with no loss of performance. The DNN is configured to run in the HLTInitialStepSequence after the hltInitialStepTracks step when the trackTorchClassifier procModifier is used. The procModifier is used due to an existing issue with PyTorch GPU memory usage.

The model file is here: SegmentLinking/RecoTracker-FinalTrackSelectors#1

MTV performance on TT+PU=200 is shown below.
Screenshot 2026-03-31 at 10 48 39 AM
Screenshot 2026-03-31 at 10 50 17 AM

@slava77

slava77 commented Mar 27, 2026

Copy link
Copy Markdown

@ariostas
is the HLT test for CI still a work in progress?

@ariostas

Copy link
Copy Markdown
Member

Yeah, I'll have it done next week

@slava77

slava77 commented Mar 27, 2026

Copy link
Copy Markdown

I added a fork in the LST org https://github.com/SegmentLinking/RecoTracker-FinalTrackSelectors

@jchismar

jchismar commented Apr 6, 2026

Copy link
Copy Markdown
Author

run-ci: [hlt, checks]
procmodifiers: trackTorchClassifier

@ariostas

ariostas commented Apr 6, 2026

Copy link
Copy Markdown
Member

Actually, I never tested procmodifiers, so let me see if they work before I finalize the HLT workflow.

@ariostas

ariostas commented Apr 6, 2026

Copy link
Copy Markdown
Member

run-ci: [hlt, checks]
modifiers: ci_devel
procmodifiers: trackTorchClassifier

@github-actions

github-actions Bot commented Apr 6, 2026

Copy link
Copy Markdown

There was a problem while building and running with HLT workflow. The logs can be found here.

@ariostas

ariostas commented Apr 6, 2026

Copy link
Copy Markdown
Member

I guess it makes sense that it failed since the procmodifier doesn't exist in master. Let me add extra options to have different procmodifiers in the PR and target branch.

@ariostas

ariostas commented Apr 7, 2026

Copy link
Copy Markdown
Member

run-ci: [hlt, checks]
modifiers: ci_devel
procmodifiers: {pr: trackTorchClassifier}

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

The PR was built and ran successfully with HLT setup running on CPU (procModifiers = ). Here are some plots.

HLT General Plots
Efficiency and fake rate vs pT, eta, and phi

The full set of validation and comparison plots can be found here.

@slava77 slava77 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

mostly naming/style or simpler syntax comments.
Also, unclear why a non-Alpaka torch classifier is needed

import FWCore.ParameterSet.Config as cms

# This modifier sets the use of a deep neural network for high purity track selection
trackTorchClassifier = cms.Modifier() No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

newline

firstValid = cms.vuint32(1),
iovIsRunNotTime = cms.bool(True)
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

remove the diff

from Configuration.ProcessModifiers.trackTorchClassifier_cff import trackTorchClassifier
trackTorchClassifier.toModify(hltInitialStepTrackCutClassifier,
src = cms.InputTag("hltInitialStepTrackTorchClassifierOutput")
) No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

newline

hltPhase2LegacyTracking.toModify(hltInitialStepTrackCutClassifier,
mva = dict(passThroughForAll=False, passThroughForDisplaced=False)
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why is this here? looks duplicate of 10 lines above


from Configuration.ProcessModifiers.trackTorchClassifier_cff import trackTorchClassifier
trackTorchClassifier.toModify(hltInitialStepTrackCutClassifier,
src = cms.InputTag("hltInitialStepTrackTorchClassifierOutput")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
src = cms.InputTag("hltInitialStepTrackTorchClassifierOutput")
src = "hltInitialStepTrackTorchClassifierOutput"

is a safer syntax

Comment on lines +24 to +25
features_token_(consumes(iConfig.getParameter<edm::InputTag>("features"))),
scores_token_{produces()},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

may add Input/Put modifiers in the names for clarity


#include "DataFormats/SoATemplate/interface/SoALayout.h"

GENERATE_SOA_LAYOUT(TrackFeaturesSoALayout,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
GENERATE_SOA_LAYOUT(TrackFeaturesSoALayout,
GENERATE_SOA_LAYOUT(TrackTorchClassifierFeaturesSoALayout,

unless the idea is that this is going to be universal

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why is this file/TrackTorchClassifier needed if the Alpaka variant is present?


// This module consumes the HOST copy of the Alpaka device scores
// The framework automatically creates host copies of device PortableCollections
class TrackTorchClassifierAlpakaOutput : public edm::stream::EDProducer<> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
class TrackTorchClassifierAlpakaOutput : public edm::stream::EDProducer<> {
class TrackTorchClassifierFromSoA : public edm::stream::EDProducer<> {

FromSoA is a more common name modifier for modules reading a SoA and making a "legacy"/non-alpaka collection

Comment on lines +38 to +39
: tracks_token_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("src"))),
scores_token_(consumes<PortableHostCollection<TrackScoresSoA>>(iConfig.getParameter<edm::InputTag>("scores"))),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
: tracks_token_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("src"))),
scores_token_(consumes<PortableHostCollection<TrackScoresSoA>>(iConfig.getParameter<edm::InputTag>("scores"))),
: tracks_token_(consumes(iConfig.getParameter<edm::InputTag>("src"))),
scores_token_(consumes(iConfig.getParameter<edm::InputTag>("scores"))),

IIRC types are not needed in the consumes call, it's already detectable from the type of the token.
Check other files

@jchismar

jchismar commented May 1, 2026

Copy link
Copy Markdown
Author

run-ci: [hlt, checks]
modifiers: ci_devel
procmodifiers: {pr: trackTorchClassifier}

@jchismar

jchismar commented May 1, 2026

Copy link
Copy Markdown
Author

run-ci: hlt
procmodifiers: {pr: trackTorchClassifier}

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

The PR was built and ran successfully with HLT setup running on CPU (procModifiers = ). Here are some plots.

HLT General Plots
Efficiency and fake rate vs pT, eta, and phi

The full set of validation and comparison plots can be found here.

@slava77 slava77 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR looks almost good to go to CMSSW.
The step to do before doing it is to take out the model file from the commits in this PR and submit it in https://github.com/cms-data/RecoTracker-FinalTrackSelectors

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this file should be removed from the CMSSW PR.
The file will be passed via a PR to https://github.com/cms-data/RecoTracker-FinalTrackSelectors
please remove it from the commit history as well.

@jchismar
jchismar force-pushed the track-purity-dnn branch 2 times, most recently from d812d8f to 15d938f Compare May 27, 2026 09:58
@slava77

slava77 commented May 27, 2026

Copy link
Copy Markdown

@jchismar jchismar force-pushed the track-purity-dnn branch from d812d8f to 15d938f 2 hours ago

It looks like the model file is gone.
It would still be nice to squash the commits to get rid of the quite significant file renaming and reshuffling made in a follow up to the code review.

@jchismar
jchismar force-pushed the track-purity-dnn branch from 15d938f to 62883d2 Compare May 27, 2026 13:07
@jchismar

Copy link
Copy Markdown
Author

@jchismar jchismar force-pushed the track-purity-dnn branch from d812d8f to 15d938f 2 hours ago

It looks like the model file is gone. It would still be nice to squash the commits to get rid of the quite significant file renaming and reshuffling made in a follow up to the code review.

Just squashed to 2 commits, let me know if you'd prefer a single commit or if this looks fine.

@slava77

slava77 commented May 27, 2026

Copy link
Copy Markdown

It looks like the model file is gone. It would still be nice to squash the commits to get rid of the quite significant file renaming and reshuffling made in a follow up to the code review.

Just squashed to 2 commits, let me know if you'd prefer a single commit or if this looks fine.

currently the second commit (62883d2) still about a half redoing/renaming the code from the previous commit.
So, better squash back to one.
Do you have a reason to keep the first one separate?

@slava77

slava77 commented May 27, 2026

Copy link
Copy Markdown

(in case needed; a diff of the May 1st version wrt the two last two commit variant; git isn't making it easy to find or see anymore: https://github.com/SegmentLinking/cmssw/compare/a229b532955f0693977515bf883ac674c3d4b77f..62883d201c58b60d03f1576d54b67d8925e1e002

@jchismar
jchismar force-pushed the track-purity-dnn branch from 62883d2 to 4986d26 Compare May 28, 2026 09:34
@slava77

slava77 commented Jun 2, 2026

Copy link
Copy Markdown

@jchismar

in CMSSW bot results the hltInitialStepTrackTorchClassifier takes 288.3 ms on the CPU backend.
I suggest to reproduce this locally; start with a single thread and then check/repeat on multi-threaded (x8, x32 ... ) to see if it's scaling up. Compared to the NGT DNN we have CPU-GPU transfers; I'm not sure if some of them are blocking.

Once the bad scaling is confirmed, the CPU time trace from a profiler would also be useful. e.g. with nsys profile --sample=cpu --demangle --output=filename cmsRun config.py

@slava77

slava77 commented Jun 25, 2026

Copy link
Copy Markdown

run-ci: all

@slava77

slava77 commented Jun 25, 2026

Copy link
Copy Markdown

[the last call to run - ci: all ]

mainly to check/confirm that CI is broken

@github-actions

Copy link
Copy Markdown

There was a problem while building and running in standalone mode. The logs can be found here.

@github-actions

Copy link
Copy Markdown

There was a problem while building and running with CMSSW. The logs can be found here.

Co-authored-by: Jade Chismar <jchismar@ucsd.edu>
@jchismar
jchismar force-pushed the track-purity-dnn branch from 1c6ef29 to 22195b2 Compare July 9, 2026 17:59
@github-actions
github-actions Bot merged commit 8b60706 into SegmentLinking:master Jul 15, 2026
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.

4 participants