cmssw icon indicating copy to clipboard operation
cmssw copied to clipboard

Feature: Simplified and improved Pixel Seed Creation

Open chrishanw opened this issue 1 month ago • 42 comments

PR description:

This PR adds two new producers with the goal of speeding up the PixelSeed generation for the EGamma reconstruction.

Extensive analysis of the ElectronNHitSeedProducer, which is the first producer consuming the TrajectorySeeds which are the product of the SeedCreatorFromRegionConsecutiveHitsEDProducer during the EGamma reconstruction showed that the ElectronNHitSeedProducer only really needs the hit collection in the seeds, but not fitted information or a proper TrajectoryStateOnSurface. However, the SeedCreatorFromRegionConsecutiveHitsEDProducer fits all seed candidates, thus potentially wasting a lot of compute resources on seeds that will discarded in the next step without ever checking the fitted information (the state).

The two producers introduced in this PR:

  1. Produce simplified TrajectorySeed objects by just taking the collection of hits in the SeedingHitSets and creating a dummy PTrajectoryStateOnDet to have valid information in the state. This is done by the SeedFromConsecutiveHitsCreatorSimple.
  2. Fit the seeds selected by the ElectronNHitSeedProducer and produce a new ElectronSeedCollection with proper state information in the PTrajectoryStateOnDet. This is done by the SeedFitter

The subsequent producers in the path then can use the fitted information as usual. The features have been presented in the GPU meeting on 17.11.2025. As a lot of unnecessary work is omitted, the seed creation is expected to be significantly faster, but reliable timing studies are still pending. First tests show that the physics performance is essentially unchanged. Few differences arise from the fact that the TrajectorySeed objects produced by the default SeedFromConsecutiveHitsCreator contain the hit information updated in the fit, while the new implementation directly uses the existing hit, and the difference in position can sometimes be large enough for a seed to be rejected or not in the ElectronNHitSeedProducer. More detailed physics performance studies will follow.

This PR will also lay the ground for a later Alpaka based version of theElectronNHitSeedProducer, which will operate on the simple seed objects without fit information, too. The new feature could potentially be used in the 2026 data taking to speed up the seed creation.

PR validation:

Basic test of the physics performance of the newly introduced producers with an adapted HLT chain.

chrishanw avatar Nov 21 '25 16:11 chrishanw

cms-bot internal usage

cmsbuild avatar Nov 21 '25 16:11 cmsbuild

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46911

Code check has found code style and quality issues which could be resolved by applying following patch(s)

  • code-checks: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46911/code-checks.patch e.g. curl -k https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46911/code-checks.patch | patch -p1 You can also run scram build code-checks to apply code checks directly

  • code-format: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46911/code-format.patch e.g. curl -k https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46911/code-format.patch | patch -p1 You can also run scram build code-format to apply code format directly

cmsbuild avatar Nov 21 '25 16:11 cmsbuild

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46912

Code check has found code style and quality issues which could be resolved by applying following patch(s)

  • code-checks: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46912/code-checks.patch e.g. curl -k https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46912/code-checks.patch | patch -p1 You can also run scram build code-checks to apply code checks directly

cmsbuild avatar Nov 21 '25 16:11 cmsbuild

I just ran scram build code-checks and scram build code-format and pushed the changed files with the last commit 7c7b5c0, and it running scram build code-checks again resulted in no updates of any files subject to this PR. I don't know how to resolve this

chrishanw avatar Nov 21 '25 16:11 chrishanw

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46914

cmsbuild avatar Nov 21 '25 17:11 cmsbuild

A new Pull Request was created by @chrishanw for master.

It involves the following packages:

  • RecoTracker/TkSeedGenerator (reconstruction)

@cmsbuild, @jfernan2, @mandrenguyen, @srimanob can you please review it and eventually sign? Thanks. @GiacomoSguazzoni, @VinInn, @VourMa, @dgulhan, @elusian, @felicepantaleo, @gpetruc, @mmasciov, @mmusich, @mtosi, @rovere this is something you requested to watch as well. @ftenchini, @mandrenguyen, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

cmsbuild avatar Nov 21 '25 17:11 cmsbuild

I will commit and push the changes based on the comments once we agreed on a solution to https://github.com/cms-sw/cmssw/pull/49436#discussion_r2560048163. For now, I tend to keep the header and not merge the two files @slava77

chrishanw avatar Nov 25 '25 17:11 chrishanw

On 11/25/25 9:34 AM, chrishanw wrote:

@.**** commented on this pull request.


In RecoTracker/TkSeedGenerator/plugins/SeedFitter.h <https://github.com/ cms-sw/cmssw/pull/49436#discussion_r2560865040>:

The header is included in |SealModules.cc|, so if I did this, I would have to include the |.cc| file there. So I think it's better to keep it.

FWIW, SealModules.cc should've been removed at least 10 years ago Plugin registration can go with just the FWK macros

— Reply to this email directly, view it on GitHub <https://github.com/cms- sw/cmssw/pull/49436#discussion_r2560865040>, or unsubscribe <https:// github.com/notifications/unsubscribe-auth/ ABDVY3THPHMATCXSHS3YM2336SHJTAVCNFSM6AAAAACM2NB3C2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKMBWGE2TSMZRGY>. You are receiving this because you commented.Message ID: <cms-sw/cmssw/ @.***>

slava77 avatar Nov 25 '25 20:11 slava77

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46956

  • Found files with invalid states:
    • RecoTracker/TkSeedGenerator/plugins/SeedFitter.h:
      • Added: 2e65d840566f3ca693cb445194bce4ac8d411550
      • Modified: 7c7b5c09c39cfd9fb7d93b3c0b5de23cba1f5fcc
      • Deleted: 796abea8232244ac5d8f3f066051b6c469c17ac8
    • RecoTracker/TkSeedGenerator/plugins/SeedFitter.cc:
      • Added: 2e65d840566f3ca693cb445194bce4ac8d411550
      • Modified: 7c7b5c09c39cfd9fb7d93b3c0b5de23cba1f5fcc, 97d73c8e2c4a30fbf7b78576c9bc15d921188816
      • Deleted: 796abea8232244ac5d8f3f066051b6c469c17ac8
    • RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreatorSimple.h:
      • Added: f49d247d87754f238c05ff49c6932131669d58b1
      • Deleted: 796abea8232244ac5d8f3f066051b6c469c17ac8

Code check has found code style and quality issues which could be resolved by applying following patch(s)

  • code-checks: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46956/code-checks.patch e.g. curl -k https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46956/code-checks.patch | patch -p1 You can also run scram build code-checks to apply code checks directly

cmsbuild avatar Nov 26 '25 08:11 cmsbuild

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46957

  • Found files with invalid states:
    • RecoTracker/TkSeedGenerator/plugins/SeedFitter.h:
      • Added: 2e65d840566f3ca693cb445194bce4ac8d411550
      • Modified: 7c7b5c09c39cfd9fb7d93b3c0b5de23cba1f5fcc
      • Deleted: 796abea8232244ac5d8f3f066051b6c469c17ac8
    • RecoTracker/TkSeedGenerator/plugins/SeedFitter.cc:
      • Added: 2e65d840566f3ca693cb445194bce4ac8d411550
      • Modified: 7c7b5c09c39cfd9fb7d93b3c0b5de23cba1f5fcc, 97d73c8e2c4a30fbf7b78576c9bc15d921188816
      • Deleted: 796abea8232244ac5d8f3f066051b6c469c17ac8
    • RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreatorSimple.h:
      • Added: f49d247d87754f238c05ff49c6932131669d58b1
      • Deleted: 796abea8232244ac5d8f3f066051b6c469c17ac8

cmsbuild avatar Nov 26 '25 08:11 cmsbuild

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46958

  • Found files with invalid states:
    • RecoTracker/TkSeedGenerator/plugins/SeedFitter.h:
      • Added: 2e65d840566f3ca693cb445194bce4ac8d411550
      • Modified: 7c7b5c09c39cfd9fb7d93b3c0b5de23cba1f5fcc
      • Deleted: 796abea8232244ac5d8f3f066051b6c469c17ac8
    • RecoTracker/TkSeedGenerator/plugins/SeedFitter.cc:
      • Added: 2e65d840566f3ca693cb445194bce4ac8d411550
      • Modified: 7c7b5c09c39cfd9fb7d93b3c0b5de23cba1f5fcc, 97d73c8e2c4a30fbf7b78576c9bc15d921188816
      • Deleted: 796abea8232244ac5d8f3f066051b6c469c17ac8
    • RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreatorSimple.h:
      • Added: f49d247d87754f238c05ff49c6932131669d58b1
      • Deleted: 796abea8232244ac5d8f3f066051b6c469c17ac8

cmsbuild avatar Nov 26 '25 08:11 cmsbuild

Pull request #49436 was updated. @cmsbuild, @jfernan2, @mandrenguyen, @srimanob can you please check and sign again.

cmsbuild avatar Nov 26 '25 08:11 cmsbuild

@chrishanw before starting the tests, would you mind squashing the commits to 1? If you are unfamiliar with the process the command git cms-squash-topic can be used.

mmusich avatar Nov 26 '25 08:11 mmusich

I think I might have screwed up. I ran git cms-squash-topic --current -m "some useful message" and now I don't see how to proceed as git tells me that the branches have diverged and that I should git pull first.

chrishanw avatar Nov 26 '25 08:11 chrishanw

OK. Another way is to start from scratch in the old fashioned way:

cmsrel CMSSW_16_0_X_2025-11-25-2300
cd CMSSW_16_0_X_2025-11-25-2300/src
git cms-addpkg RecoTracker/TkSeedGenerator
git cherry-pick f49d247d87754f238c05ff49c6932131669d58b1^..3b0a3848c9d446f721fb8792e97091a892a3b118
git rebase -i CMSSW_16_0_X_2025-11-25-2300
# edit the prompt such that all commits are markes as "s" excepted the first 
git push my-cmssw +HEAD:feature/simplified-pixel-seed-creation

mmusich avatar Nov 26 '25 08:11 mmusich

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46960

cmsbuild avatar Nov 26 '25 09:11 cmsbuild

Pull request #49436 was updated. @cmsbuild, @jfernan2, @mandrenguyen, @srimanob can you please check and sign again.

cmsbuild avatar Nov 26 '25 09:11 cmsbuild

@cmsbuild, please test

mmusich avatar Nov 26 '25 09:11 mmusich

+1

Size: This PR adds an extra 28KB to repository Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-17fbd4/49687/summary.html COMMIT: b19219aeb3706537177babaf0775d7ce84dc910d CMSSW: CMSSW_16_0_X_2025-11-25-2300/el8_amd64_gcc13 User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/49436/49687/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 1 lines to the logs
  • Reco comparison results: 10 differences found in the comparisons
  • Reco comparison had 4 failed jobs
  • DQMHistoTests: Total files compared: 55
  • DQMHistoTests: Total histograms compared: 4502606
  • DQMHistoTests: Total failures: 12
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 4502574
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 54 files compared)
  • Checked 235 log files, 208 edm output root files, 55 DQM output files
  • TriggerResults: found differences in 1 / 53 workflows

cmsbuild avatar Nov 26 '25 11:11 cmsbuild

+1

jfernan2 avatar Nov 26 '25 12:11 jfernan2

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @mandrenguyen, @sextonkennedy, @ftenchini (and backports should be raised in the release meeting by the corresponding L2)

cmsbuild avatar Nov 26 '25 12:11 cmsbuild

I forgot that I also need to modify the / a HLT sequence, but I am not really sure how I would do that. @fwyzard told me this:

the usual approach is to write a customisation function in python, that can take the current HLT configuration as input and modify it to use the new module, call it customizeHLTfor49436 and put it in HLTrigger/Configuration/python/customizeHLTforCMSSW.py

but from what is in that file I do not really understand how I would

  • replace a specific producer
  • add a new producer at a certain point.

Can anyone provide some additional guidance to me?

chrishanw avatar Nov 26 '25 12:11 chrishanw

Can anyone provide some additional guidance to me?

I can. Let's take this offline for maximum efficiency.

mmusich avatar Nov 26 '25 12:11 mmusich

hold

  • see https://github.com/cms-sw/cmssw/pull/49436#issuecomment-3581090833

mmusich avatar Nov 26 '25 12:11 mmusich

Pull request has been put on hold by @mmusich They need to issue an unhold command to remove the hold state or L1 can unhold it for all

cmsbuild avatar Nov 26 '25 12:11 cmsbuild

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46987

Code check has found code style and quality issues which could be resolved by applying following patch(s)

  • code-format: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46987/code-format.patch e.g. curl -k https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46987/code-format.patch | patch -p1 You can also run scram build code-format to apply code format directly

cmsbuild avatar Nov 26 '25 14:11 cmsbuild

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46991

  • Found files with invalid states:
    • RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreatorNoFit.cc:
      • Added: 97a6d3da463184bc5209a4b2c28a52898a5d6f97
      • Deleted: fbaaeb8861bfe83b8c77ed7213caf90f2bebb24d

cmsbuild avatar Nov 26 '25 16:11 cmsbuild

Pull request #49436 was updated. @cmsbuild, @jfernan2, @mandrenguyen, @srimanob can you please check and sign again.

cmsbuild avatar Nov 26 '25 16:11 cmsbuild

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49436/46997

  • Found files with invalid states:
    • RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreatorNoFit.cc:
      • Added: 97a6d3da463184bc5209a4b2c28a52898a5d6f97
      • Deleted: fbaaeb8861bfe83b8c77ed7213caf90f2bebb24d

cmsbuild avatar Nov 27 '25 10:11 cmsbuild

Pull request #49436 was updated. @cmsbuild, @jfernan2, @mandrenguyen, @srimanob can you please check and sign again.

cmsbuild avatar Nov 27 '25 10:11 cmsbuild