-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Option to make track covariance Pos-def in packedcandidate #39599
Conversation
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-39599/32394
Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
@vlimant first of all, thanks ! I'm afraid the code needs to be forced to follow the code-format |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-39599/32395
|
A new Pull Request was created by @vlimant (vlimant) for master. It involves the following packages:
@cmsbuild, @mandrenguyen, @clacaputo can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
Hello a quick note that was also suggested in a similar PR (#34446, which added a method to obtain a low quality cov matrix in case none was stored and initially used a parameter in This means that if you require a positive definite matrix you must always call What we ended up doing in the LUT PR was adding the modification as a method and not inside the unpacking (in this case it would mean adding a |
@@ -1019,7 +1023,7 @@ namespace pat { | |||
void packVtx(bool unpackAfterwards = true); | |||
void unpackVtx() const; | |||
void packCovariance(const reco::TrackBase::CovarianceMatrix &m, bool unpackAfterwards = true); | |||
void unpackCovariance() const; | |||
void unpackCovariance(bool forcePosDef = true) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need a default for protected interface? All calls should be under control.
Also, IIUC, for many users the old (not forced positive) is OK
double det_(0); | ||
bool computed_ = m->Det(det_); | ||
// std::cout<<"during unpacking, the determinant is: "<<det_<<std::endl; | ||
if (computed_ && det_ < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in mkFit context we apply a full Sylvester's criterion; computing determinants for sub-matrices. The extra cost is not that much compared to computing the det for the full matrix
cmssw/RecoTracker/MkFit/plugins/MkFitOutputConverter.cc
Lines 321 to 338 in 17333a9
//Sylvester's criterion, start from the smaller submatrix size | |
double det = 0; | |
if ((!fts.curvilinearError().matrix().Sub<AlgebraicSymMatrix22>(0, 0).Det(det)) || det < 0) { | |
edm::LogInfo("MkFitOutputConverter") | |
<< "Fail pos-def check sub2.det for candidate " << candIndex << " with fts " << fts; | |
continue; | |
} else if ((!fts.curvilinearError().matrix().Sub<AlgebraicSymMatrix33>(0, 0).Det(det)) || det < 0) { | |
edm::LogInfo("MkFitOutputConverter") | |
<< "Fail pos-def check sub3.det for candidate " << candIndex << " with fts " << fts; | |
continue; | |
} else if ((!fts.curvilinearError().matrix().Sub<AlgebraicSymMatrix44>(0, 0).Det(det)) || det < 0) { | |
edm::LogInfo("MkFitOutputConverter") | |
<< "Fail pos-def check sub4.det for candidate " << candIndex << " with fts " << fts; | |
continue; | |
} else if ((!fts.curvilinearError().matrix().Det2(det)) || det < 0) { | |
edm::LogInfo("MkFitOutputConverter") | |
<< "Fail pos-def check det for candidate " << candIndex << " with fts " << fts; | |
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the pointer indeed.
// std::cout<<"unpacking enforcing positive-definite cov matrix"<<std::endl; | ||
//calculate the determinant and verify positivity | ||
double det_(0); | ||
bool computed_ = m->Det(det_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please follow CMSSW style (lower case camelCaps, no trailing underscore in locals); the comment is for the full file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the reminder. "camelCaps" rule for local could be added to http://cms-sw.github.io/cms_coding_rules.html (unless I could not find it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the reminder. "camelCaps" rule for local could be added to http://cms-sw.github.io/cms_coding_rules.html (unless I could not find it)
it's kind of there in rule 2.8, but the locals are in rule 2.9. So, the wording is not perfect.
good point on race condition @elusian ; the scope of interest for posdef covariance matrix is small for the time being (BPH only?) and they should have it under control in their analysis code. Nothing changes for all other users. |
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-39599/32399
Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-4f311f/28255/summary.html Comparison SummarySummary:
|
all good @clacaputo ? |
+reconstruction
|
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. @perrotta, @dpiparo, @rappoccio (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
It would be nice to backport this to 10_6_X. @vlimant would you be available to do this? |
10.6 and everything in between ? |
10.6 would be needed because it's the main release for UL analysis. I think this feature is innocent enough to be added to all of that is in- between. What do @cms-sw/orp-l2 think? |
I guess 12_4 for Run3 2022 analyses. I'm not sure also about 12_6: was there a plan to run re-miniAOD here? |
Maybe it will not be really used in all them, but I'd add it to the release that can be still used in analyses: besides 10_6 for UL, 12_4 for 2022 pp, 12_5 for 2022 HI. 12_6 for re-nano and MC studies. |
|
PR description:
as reported in BPH https://indico.cern.ch/event/1155820/contributions/4853223/ the packing scheme of the track covariance in MINIAOD introduces the possibility for the covariance matrix to not be positive-definite, with implications to vertex refitting.
The PR adds a new method to PackedCanidate responsible for returning a reference to a pseudoTrack with positive defined covariance matrix.
PR validation:
a simple analyser reading packed candidate was run retrieving the
pseudoPosDefTrack
to check that the determinant is getting positive.