Skip to content

[Phase-2 HLT] Add hltHpsPFTau table to HLT Nano#48295

Merged
cmsbuild merged 4 commits intocms-sw:masterfrom
artlbv:hlt_ph2nano_hpstaus
Jun 19, 2025
Merged

[Phase-2 HLT] Add hltHpsPFTau table to HLT Nano#48295
cmsbuild merged 4 commits intocms-sw:masterfrom
artlbv:hlt_ph2nano_hpstaus

Conversation

@artlbv
Copy link
Copy Markdown
Contributor

@artlbv artlbv commented Jun 11, 2025

PR description:

This adds the hltHpsPFTau objects to the HLT Nano introduced in #48091
This is based on the HLT nano ntupler config from the Tau POG and the central tau nano.

One thing I did not manage to add are the DeepTau scores. I tried the same approach as done for the Btagging scores of PFJets using ExtVar, but CMSSW complains it cannot find the collection "hltHpsPFTauDeepTauProducer","VSjet" despite this being produced in the HPSTau HLT path. I left the code commented for review/testing.

Apart from the DeepTau score the rest works fine!

FYI @brallmond @kandrosov

PR validation:

Tested with the HLT nano commands.
I first produced a new FEVT file with re-run L1:

cmsDriver.py Phase2 -s L1,L1TrackTrigger \                          
    --conditions auto:phase2_realistic_T33 \
    --geometry ExtendedRun4D110 \                        
    --era Phase2C17I13M9 \                    
    --eventcontent FEVTDEBUGHLT \      
    --datatier GEN-SIM-DIGI-RAW-MINIAOD \                                                     
    --customise SLHCUpgradeSimulations/Configuration/aging.customise_aging_1000,Configuration/DataProcessing/Utils.addMonitoring,L1Trigger/Configuration/customisePhase2FEVTDEBUGHLT.customisePhase2FEVTDEBUGHLT,L1Trigger/Configuration/customisePhase2TTOn110.customisePhase2TTOn110 \
    --filein /store/mc/Phase2Spring24DIGIRECOMiniAOD/TT_TuneCP5_14TeV-powheg-pythia8/GEN-SIM-DIGI-RAW-MINIAOD/PU200_AllTP_140X_mcRun4_realistic_v4-v1/2560000/11d1f6f0-5f03-421e-90c7-b5815197fc85.root \
    --fileout file:output_Phase2_L1T.root \                 
    --python_filename rerunL1_cfg.py \
    --inputCommands="keep *, drop l1tPFJets_*_*_*, drop l1tTrackerMuons_l1tTkMuonsGmt*_*_HLT" \                   
    --outputCommands="drop l1tTrackerMuons_l1tTkMuonsGmt*_*_HLT" \
    --mc \                                                                  
    -n 1 --nThreads 1

and then ran the HLT nano:

cmsDriver.py Phase2 -s L1P2GT,HLT:NGTScouting,NANO:@NGTScouting \   
             --processName=HLTX \       
             --conditions auto:phase2_realistic_T33 \
             --geometry ExtendedRun4D110 \
             --era Phase2C17I13M9 \
             --customise SLHCUpgradeSimulations/Configuration/aging.customise_aging_1000 \
             --datatier NANOAODSIM \                                                                                                                                                                                                                                                
             --eventcontent NANOAODSIM \                                                                                                                                                             
             --filein=file:output_Phase2_L1T.root \
             --mc \               
             --inputCommands="keep *, drop *_hlt*_*_HLT, drop triggerTriggerFilterObjectWithRefs_l1t*_*_HLT" \
             -n -1 \                                          
             --customise_commands='process.options.wantSummary = True' \

If this PR is a backport please specify the original PR and why you need to backport that PR. If this PR will be backported please specify to which release cycle the backport is meant for:

No backport needed.

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented Jun 11, 2025

cms-bot internal usage

@artlbv
Copy link
Copy Markdown
Contributor Author

artlbv commented Jun 11, 2025

FYI also @elenavernazza @mmusich - maybe you have an idea how to append the deepTau scores?

@cmsbuild
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

@mmusich mmusich left a comment

Choose a reason for hiding this comment

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

just some comment for the code that actually works.
For the missing ValueMap, in order to have it, that would require some modifications to the DeepTauId producer (as we did for b-tagging in this commit 97037fa). Elena will provide more insight.

Comment thread HLTrigger/NGTScouting/python/hltTaus_cfi.py Outdated
Comment thread HLTrigger/NGTScouting/python/hltTaus_cfi.py Outdated
@elenavernazza
Copy link
Copy Markdown
Contributor

FYI also @elenavernazza @mmusich - maybe you have an idea how to append the deepTau scores?

Hi @artlbv

Thank you for this useful development!
We indeed had a similar issue with deepJet scores. The hltHpsPFTauDeepTauProducer.VSjet object seems to provide a vector of floats, while the ExtVar argument only accepts a ValueMap to associate each object of the main collection (hltHpsPFTauProducer) to its own score (hltHpsPFTauDeepTauProducer.VSjet).

After having a look, it seems like the deepTau scores are filled in the DeepTauId producer by the createOutputs function here.
The createOutputs loops over the deepTau scores idoutputs_ (which have been filled in GetIDOutputs) and returns a vector of floats (result) corresponding to the value of the score.

One would need to change the DeepTauId logic in order to return a ValueMap like we have done in this producer.

Please let me know in case more information is needed.

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented Jun 11, 2025

test parameters:

  • relvals_opt = --what upgrade
  • workflows = 29834.759, 29834.771

@artlbv artlbv marked this pull request as ready for review June 12, 2025 08:04
@artlbv
Copy link
Copy Markdown
Contributor Author

artlbv commented Jun 12, 2025

thanks for the insight @mmusich @elenavernazza !
actually before you made your PR I had to use PAT Tools to store the HLT PFJets with the ONNX tagger scores in nano, see here:
https://gist.github.com/artlbv/6d9552eac43f47518b9886eee76e6751#file-cmsrun_cfg_150x_scoutandhltpfjets_fromraw-py-L264-L294

I tried the same with Taus using PATTauProducer but it somehow did not work out.. maybe I'll try again or opt for the modification of the DeepTau producer.

btw, I also tried just saving the deepTau score in a separate table using GlobalVariablesTableProducer:

from PhysicsTools.NanoAOD.globalVariablesTableProducer_cfi import globalVariablesTableProducer

deepTauTable = globalVariablesTableProducer.clone(
    name = cms.string("L1Ttopo"),
    variables = cms.PSet(
        bdtScore = ExtVar( cms.InputTag("hltHpsPFTauDeepTauProducer","VSjet"),"float", doc="DeepTau VsJet score" ),
    ),
) 

but it did not work:

An exception of category 'ProductNotFound' occurred while
   [0] Processing  Event run: 1 lumi: 10 event: 9002 stream: 0
   [1] Running path 'nanoAOD_step'
   [2] Calling method for module GlobalVariablesTableProducer/'deepTauTable'
Exception Message:
Principal::getByToken: Found zero products matching all criteria
Looking for type: float
Looking for module label: hltHpsPFTauDeepTauProducer
Looking for productInstanceName: VSjet

@cmsbuild
Copy link
Copy Markdown
Contributor

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

It involves the following packages:

  • HLTrigger/NGTScouting (hlt)

@Martin-Grunewald, @cmsbuild, @mmusich can you please review it and eventually sign? Thanks.
@Martin-Grunewald, @missirol, @mmusich this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented Jun 12, 2025

@artlbv before starting tests, please address the comments above: #48295 (review).
Also it would be nice to have a comparison in terms of size increase.

@cmsbuild
Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-48295/45168

  • There are other open Pull requests which might conflict with changes you have proposed:

@cmsbuild
Copy link
Copy Markdown
Contributor

Pull request #48295 was updated. @Martin-Grunewald, @cmsbuild, @mmusich can you please check and sign again.

@artlbv
Copy link
Copy Markdown
Contributor Author

artlbv commented Jun 12, 2025

@mmusich I cleaned up the code.
For the size comparisons - the files from @elenavernazza where not available anymore, but it would be best to have the same reference - can you share the input files again?

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented Jun 12, 2025

but it would be best to have the same reference - can you share the input files again?

I would suggest you to run twice on the same input files, one with the PR and one without.

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented Jun 12, 2025

@cmsbuild, please test

@artlbv
Copy link
Copy Markdown
Contributor Author

artlbv commented Jun 18, 2025

as the reconstruction is not filter-less, there is no guarantee that a given set of products is available in all the events

ah that makes sense! how does this work for other objects then? are there always electrons, muons, jets in all events? it seems to me the scouting and "normal" sequences are almost identical modulo the trigger selection.

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented Jun 18, 2025

how does this work for other objects then? are there always electrons, muons, jets in all events? it seems to me the scouting and "normal" sequences are almost identical modulo the trigger selection.

I am starting to realize that it works "by accident". @elenavernazza is taking a look.

@elenavernazza
Copy link
Copy Markdown
Contributor

Yes I confirm the HLTNanoProducer was working "by accident".
Since the hltTriggerAcceptFilter considers the "OR" of all HLT paths, some events might pass the filter without having all objects required to fill all the NanoTables. For example, an event event that only has a high-energy muon could fire HLT_Mu50_FromL1TkMuon path, thus passing the hltTriggerAcceptFilter, but might not have gone through the full reconstruction of HPS taus (the tau paths might have failed before reaching it).

So far, we were not noticing this issue since all the objects that were used in the NanoTables (tracks, jets, b-jets, e-gamma, muons) are by coincidence also reconstructed in the MC paths, while HPS taus are not part of these. So in the example above, the event with a high-energy muon would anyway go through the full reconstruction of tracks, jets, b-jets, e-gamma that are contained in the MC paths (MC_BTV, MC_Ele5_Open_L1Seeded, MC_Ele5_Open_Unseeded, MC_JME).
Indeed, by testing the HLT timing menu - that doesn't include any MC path - the HLTNanoProducer breaks for other objects too.

We will think about a solution not to make this happen. And thanks again for noticing this issue!

Comment thread HLTrigger/NGTScouting/python/HLTNanoProducer_cff.py Outdated
@cmsbuild
Copy link
Copy Markdown
Contributor

@cmsbuild
Copy link
Copy Markdown
Contributor

Pull request #48295 was updated. @Martin-Grunewald, @cmsbuild, @mmusich can you please check and sign again.

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented Jun 19, 2025

@cmsbuild, please test

@cmsbuild
Copy link
Copy Markdown
Contributor

+1

Size: This PR adds an extra 20KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-9af3db/46833/summary.html
COMMIT: ef899dd
CMSSW: CMSSW_15_1_X_2025-06-18-2300/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/48295/46833/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially removed 2 lines from the logs
  • ROOTFileChecks: Some differences in event products or their sizes found
  • Reco comparison results: 9 differences found in the comparisons
  • DQMHistoTests: Total files compared: 50
  • DQMHistoTests: Total histograms compared: 4050825
  • DQMHistoTests: Total failures: 104
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 4050701
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 49 files compared)
  • Checked 219 log files, 190 edm output root files, 50 DQM output files
  • TriggerResults: no differences found

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented Jun 19, 2025

+hlt

@cmsbuild
Copy link
Copy Markdown
Contributor

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. @antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy (and backports should be raised in the release meeting by the corresponding L2)

@mandrenguyen
Copy link
Copy Markdown
Contributor

+1

@cmsbuild cmsbuild merged commit 01b3ca5 into cms-sw:master Jun 19, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants