Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add muonBestTrackType value #47031

Merged
merged 2 commits into from
Jan 9, 2025
Merged

Add muonBestTrackType value #47031

merged 2 commits into from
Jan 9, 2025

Conversation

namapane
Copy link
Contributor

PR description:

This PR adds the muonBestTrackType() as an int8 value to NanoAODs.

The reason for this is to enable analyzers to detect occurrences of muons that are isGlobal and/or isTracker, but whose default parameters are taken from the standalone muon fit. These are marked as muonBestTrackType()==2 in miniAODs, but in nanoAODs there is currently no way of knowing - they may appear as perfectly good global and tracker muon that may even pass cut-based IDs and IP cuts, but in realty their momentum and impact parameters are very poorly measured.
This issue has been known since more than 10 years, and some analyses like H->4l have been rejecting these muons in Run2.
Some examples of such muons in 2022 data are listed below.

The reason why the addition of this variable in nanoAODs was not proposed earlier was the belief that this behavior was pathological, and that the right solution would have been to fit it upstream.
Upon some investigation with @ferrico and @bellan, it turns out that the choice of the STA track as the best track happens in the PF post-cleaning step, with a logic that was specifically crafted in the PF development, which involves the MET assignment. PF conveners thus pointed out that changing this logic may have unwanted side effects and that from their perspective it is much safer to let concerned analyzers handle these cases if they wish.
We thus propose the addition of this variable in v15. The impact on nanoAOD size is negligible and there's no possible side effect.

PR validation:

Tested on a DYJetsToLL sample in 15_0_0_pre1; the size increase is 0.8 b/item.

Some examples of GLB/TK Muons with bestTrackType==2

Some examples, in case anybody is interested, taken from /store/data/Run2022F/Muon/MINIAOD/22Sep2023-v2/2550000/086c7233-8352-473a-9def-3cca7b470cc7.root
(dataset: /Muon/Run2022F-22Sep2023-v2/MINIAOD):

In 361303:2183:4542134810
pt= 74.1754 eta= 0.223418 phi= -2.30594
pass: isGlobal, isTracker, isLooseMuon, isMediumMuon
Tracker: pt,eta,phi: 33.1955 0.222571 -2.26291; validFraction: 1 normalizedChi2: 0.608714
GLB: pt,eta,phi: 33.1846 0.222568 -2.26291 validFraction: 1 normalizedChi2 0.762897

In 361303:2184:4544165596
pt= 32.035 eta= -2.32739 phi= 0.388782
pass: isGlobal, isLooseMuon
Tracker: pt,eta,phi: 94.5429 -2.33026 0.403547 validFraction: 0.666667 normChi2 0.940081
GLB: pt,eta,phi: 63.6122 -2.33019 0.404392 validFraction: 1 normChi2 1.8665

In 361318:139:254795536
pt= 39.6768 eta= -1.23819 phi= -2.05707
pass: isTracker, isLooseMuon
Tracker: pt,eta,phi: 2.03231 -1.38233 -0.980531 validFraction: 0.714286 normChi2 9.18183

In 361318:140:255901697
pt= 28.8683 eta= 0.269369 phi= -1.65092
pass: isGlobal, isTracker, isLooseMuon, isMediumMuon
Tracker: pt,eta,phi: 20.5644 0.272467 -1.60871 validFraction: 1 normChi2 0.663753
GLB: pt,eta,phi: 20.5427 0.272464 -1.6087 validFraction: 1 normChi2 0.763495

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 28, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

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

It involves the following packages:

  • PhysicsTools/NanoAOD (xpog)

@cmsbuild, @ftorrresd, @hqucms can you please review it and eventually sign? Thanks.
@AnnikaStein, @gpetruc 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

@ftorrresd
Copy link
Contributor

enable nano

@ftorrresd
Copy link
Contributor

please test

@ftorrresd
Copy link
Contributor

Hi @namapane,

Since you're adding variables, might be interesting to also add them to nanoDQM. similar to what was done at https://github.com/cms-sw/cmssw/pull/46287/files (check the changes in PhysicsTools/NanoAOD/python/nanoDQM_cfi.py) .

Felipe

@namapane
Copy link
Contributor Author

namapane commented Jan 7, 2025

Hi @namapane,

Since you're adding variables, might be interesting to also add them to nanoDQM. similar to what was done at https://github.com/cms-sw/cmssw/pull/46287/files (check the changes in PhysicsTools/NanoAOD/python/nanoDQM_cfi.py) .

Felipe

Ops, I completely forgot about that. Adding it right away. Thanks for pointing this up.

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 7, 2025

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 7, 2025

Pull request #47031 was updated. @cmsbuild, @ftorrresd, @hqucms can you please check and sign again.

@cmsbuild cmsbuild mentioned this pull request Jan 8, 2025
@ftorrresd
Copy link
Contributor

please abort

@ftorrresd
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 9, 2025

+1

Size: This PR adds an extra 20KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-5a1d1a/43697/summary.html
COMMIT: 4a3d101
CMSSW: CMSSW_15_0_X_2025-01-09-1100/el8_amd64_gcc12
Additional Tests: NANO
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/47031/43697/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
  • ROOTFileChecks: Some differences in event products or their sizes found
  • Reco comparison results: 153 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3818730
  • DQMHistoTests: Total failures: 65
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3818645
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 3.7189999999999985 KiB( 48 files compared)
  • DQMHistoSizes: changed ( 11634.0,... ): 0.226 KiB Physics/NanoAODDQM
  • DQMHistoSizes: changed ( 13234.0,... ): 0.147 KiB Physics/NanoAODDQM
  • Checked 214 log files, 184 edm output root files, 49 DQM output files
  • TriggerResults: no differences found

NANO Comparison Summary

Summary:

  • You potentially removed 899 lines from the logs
  • ROOTFileChecks: Some differences in event products or their sizes found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 21
  • DQMHistoTests: Total histograms compared: 74922
  • DQMHistoTests: Total failures: 0
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 74922
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 2.159 KiB( 20 files compared)
  • DQMHistoSizes: changed ( 2500.001,... ): 0.226 KiB Physics/NanoAODDQM
  • DQMHistoSizes: changed ( 2500.011,... ): 0.147 KiB Physics/NanoAODDQM
  • Checked 105 log files, 60 edm output root files, 21 DQM output files
  • TriggerResults: no differences found

Nano size comparison Summary:

Sample kb/ev ref kb/ev diff kb/ev ev/s/thd ref ev/s/thd diff rate mem/thd ref mem/thd
2500.001 3.077 3.076 0.001 ( +0.0% ) 6.33 5.02 +26.1% 2.543 2.550
2500.002 3.193 3.192 0.001 ( +0.0% ) 5.64 4.49 +25.5% 2.972 2.978
2500.003 3.133 3.133 0.000 ( +0.0% ) 5.90 4.65 +27.0% 2.951 2.962
2500.011 1.644 1.644 0.000 ( +0.0% ) 10.07 7.63 +32.0% 2.631 2.635
2500.012 2.184 2.184 0.001 ( +0.0% ) 5.89 4.69 +25.5% 2.817 2.812
2500.013 2.000 1.999 0.000 ( +0.0% ) 8.23 6.43 +28.0% 2.725 2.725
2500.021 0.022 0.022 0.000 ( +0.0% ) 2.03 1.46 +39.0% 2.598 2.595
2500.022 0.022 0.022 0.000 ( +0.0% ) 1.96 1.41 +39.4% 2.602 2.594
2500.023 0.022 0.022 0.000 ( +0.0% ) 1.88 1.40 +34.0% 2.469 2.467
2500.024 0.022 0.022 0.000 ( +0.0% ) 1.54 1.17 +31.6% 2.699 2.694
2500.031 0.035 0.035 0.000 ( +0.0% ) 1.76 1.36 +29.6% 2.661 2.650
2500.032 0.036 0.036 0.000 ( +0.0% ) 1.77 1.34 +32.0% 2.621 2.612
2500.033 0.037 0.037 0.000 ( +0.0% ) 1.70 1.25 +35.6% 2.697 2.703
2500.034 0.036 0.036 0.000 ( +0.0% ) 1.68 1.26 +33.5% 2.688 2.677
2500.101 2.803 2.803 0.000 ( +0.0% ) 16.25 11.94 +36.1% 2.631 2.636
2500.111 1.463 1.462 0.001 ( +0.1% ) 30.82 23.01 +34.0% 2.322 2.332
2500.112 1.883 1.882 0.001 ( +0.1% ) 25.39 19.47 +30.4% 2.397 2.400
2500.131 0.750 0.750 0.000 ( +0.0% ) 36.67 28.24 +29.8% 1.508 1.513
2500.201 2.638 2.637 0.001 ( +0.0% ) 13.42 9.66 +38.9% 2.210 2.203
2500.211 1.806 1.805 0.001 ( +0.1% ) 26.61 19.93 +33.5% 2.398 2.391
2500.212 2.203 2.202 0.001 ( +0.0% ) 21.99 16.18 +35.9% 2.478 2.481
2500.221 2.038 2.037 0.001 ( +0.0% ) 14.30 10.18 +40.4% 2.115 2.123
2500.222 3.441 3.440 0.001 ( +0.0% ) 13.11 9.38 +39.8% 2.206 2.215
2500.223 9.407 9.406 0.001 ( +0.0% ) 4.20 3.13 +34.0% 2.293 2.292
2500.224 6.266 6.265 0.001 ( +0.0% ) 1.38 1.07 +28.6% 2.234 2.220
2500.225 6.313 6.312 0.001 ( +0.0% ) 1.29 1.00 +28.6% 2.439 2.445
2500.226 3.135 3.134 0.001 ( +0.0% ) 13.54 10.44 +29.8% 2.208 2.204
2500.227 1.442 1.442 0.000 ( +0.0% ) 23.45 18.32 +27.9% 1.447 1.440
2500.228 3.921 3.921 0.001 ( +0.0% ) 8.97 6.90 +30.0% 2.310 2.301
2500.231 1.456 1.455 0.001 ( +0.1% ) 22.35 17.17 +30.1% 2.284 2.291
2500.232 2.462 2.461 0.001 ( +0.0% ) 20.63 14.87 +38.7% 2.397 2.394
2500.233 4.954 4.953 0.001 ( +0.0% ) 6.12 4.62 +32.7% 2.472 2.473
2500.234 3.842 3.841 0.001 ( +0.0% ) 1.76 1.38 +28.1% 2.175 2.184
2500.235 3.873 3.872 0.001 ( +0.0% ) 1.65 1.29 +28.2% 2.366 2.368
2500.236 2.252 2.251 0.001 ( +0.0% ) 22.16 15.77 +40.5% 2.392 2.391
2500.237 1.018 1.018 0.000 ( +0.0% ) 34.69 27.27 +27.2% 1.462 1.453
2500.238 2.444 2.443 0.000 ( +0.0% ) 17.09 13.61 +25.6% 2.470 2.473
2500.241 9.404 9.404 0.000 ( +0.0% ) 7.14 5.47 +30.5% 1.928 1.925
2500.242 10.331 10.331 0.000 ( +0.0% ) 1.68 1.35 +24.4% 1.728 1.726
2500.243 2.712 2.712 0.000 ( +0.0% ) 15.83 11.54 +37.1% 1.055 1.065
2500.244 486.016 486.016 0.000 ( +0.0% ) 1.15 0.89 +28.7% 1.682 1.685
2500.245 826.413 826.413 0.000 ( +0.0% ) 1.53 1.13 +35.3% 1.667 1.690
2500.901 1.778 1.778 0.000 ( +0.0% ) 44.12 33.45 +31.9% 1.444 1.442
2500.902 1.628 1.628 0.000 ( +0.0% ) 47.62 37.83 +25.9% 1.332 1.334
2500.911 14.041 14.041 0.000 ( +0.0% ) 8.80 6.90 +27.5% 1.086 1.081
2500.912 0.310 0.729 -0.419 ( -57.5% ) 2.43 1.93 +25.8% 0.843 0.846
2500.913 0.110 0.110 0.000 ( +0.0% ) 2.65 1.99 +33.4% 0.852 0.850

@ftorrresd
Copy link
Contributor

+1

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 9, 2025

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

@mandrenguyen
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit cf4902e into cms-sw:master Jan 9, 2025
13 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.

4 participants