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

improve precision in jacobianCurvilinearToCartesian #34103

Merged
merged 2 commits into from Jun 15, 2021

Conversation

slava77
Copy link
Contributor

@slava77 slava77 commented Jun 13, 2021

the transformation from q/p, lambda, phi -> p{x,y,z} depends significantly on precision for high momentum tracks. While most of the math in the jacobianCurvilinearToCartesian is in double, the initial step in the momentum space relied on float precision atan to get the polar and azimuth angles, which is extracted only to immediately call sincos.
The angle extraction is not necessary considering that the input momentum is in Cartesian coordinates.

Tested on 1000 muons generated in [0.5 ,1000] GeV range, comparing full double precision implementation with other alternatives at the state conversion of tracking seeds: the number of converted covariances with a fractional change larger than 1e-3 in any of the cov matrix elements goes down by a factor of just over 100.

A more precise alternative is to convert the input momentum from GlobalVector (float precision) to a double-precision version. This, however has a slightly larger computational cost.

@mtosi @VinInn @vmariani @mmusich

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-34103/23294

  • This PR adds an extra 12KB to repository

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

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-34103/23295

  • This PR adds an extra 16KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @slava77 (Slava Krutelyov) for master.

It involves the following packages:

DataFormats/GeometryVector

@cmsbuild, @civanch, @mdhildreth can you please review it and eventually sign? Thanks.
@rovere this is something you requested to watch as well.
@silviodonato, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@slava77
Copy link
Contributor Author

slava77 commented Jun 13, 2021

@cmsbuild please test

@@ -36,10 +36,8 @@ AlgebraicMatrix65 jacobianCurvilinearToCartesian(const GlobalVector& momentum, i
R(5, 5) = 1.;

double p = pvec.mag(), p2 = p * p;
Copy link
Contributor

Choose a reason for hiding this comment

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

p2 = pvec.mag2(), overp = 1./sqrt(p2);
may be more precise and avoids one division below;
one may compute overpt to avoid one more division....

@VinInn
Copy link
Contributor

VinInn commented Jun 13, 2021

since when the jacobians moved to DataFormat????

@slava77
Copy link
Contributor Author

slava77 commented Jun 13, 2021

since when the jacobians moved to DataFormat????

it was done in #5753

@VinInn
Copy link
Contributor

VinInn commented Jun 13, 2021

since when the jacobians moved to DataFormat????

it was done in #5753

Time flies and memory fades...

@civanch
Copy link
Contributor

civanch commented Jun 14, 2021

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c75df9/15935/summary.html
COMMIT: 17b12fe
CMSSW: CMSSW_12_0_X_2021-06-13-2300/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/34103/15935/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 168 differences found in the comparisons
  • DQMHistoTests: Total files compared: 38
  • DQMHistoTests: Total histograms compared: 2862520
  • DQMHistoTests: Total failures: 443
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 2862054
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.004 KiB( 37 files compared)
  • DQMHistoSizes: changed ( 312.0 ): 0.004 KiB MessageLogger/Warnings
  • Checked 160 log files, 37 edm output root files, 38 DQM output files
  • TriggerResults: no differences found

@civanch
Copy link
Contributor

civanch commented Jun 14, 2021

+1

few differences are classified as failing results but histograms are identical.

@cmsbuild
Copy link
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. @silviodonato, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2)

@slava77
Copy link
Contributor Author

slava77 commented Jun 14, 2021

@slava77 Just to confirm, the differences are as expected, right?

some changes are expected. The updated code is not numerically identical (it's somewhat implicitly in the title of the PR).

I looked at the plots and the differences are small, as expected.

@qliphy
Copy link
Contributor

qliphy commented Jun 15, 2021

+1

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.

None yet

5 participants