Repository navigation
Conversation
Contributor
|
For security reason, the pull request test does not run code from forks. I will try to find a workaround. |
Contributor
Author
|
Hey Alex, sorry about that. I remember that being an issue previously as well. Is there some alternative way for me to open PRs? I'm assuming I can't just push my branch to this upstream repo right? |
Contributor
|
No worry, I triggered the test manually and even found a bug in the reporting. |
|
Test status for this pull request: SUCCESS Summary: summary.txt Build log: make_jserwe_fix_eventwriter.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, one covariance matrix is written into a branch per event by role, e.g. Photon1__ErrMatrix, PiPlus__ErrMatrix, etc. However, which shower or track is assigned to which role varies by combo. Therefore in the current scheme, each __ErrMatrix slot is filled once per combo per event, with each combo overwriting the previous combo's matrix elements. Any consumer of written covariance matrices therefore reads another particle's matrix whenever its track/shower in that role differs from the assignment of the last combo written.
This PR fixes the issue by indexing the covariance matrices based on the reconstructed particles they belong to (ie. via the ChargedHypo and NeutralHypo arrays). Matrices can now be accessed by first getting the correct hypothesis index from the Role__ChargedIndex or Role__NeutralIndex arrays, then using that index to access the array: &ChargedHypo__ErrMatrix[hypo_index * numEntries_ParticleErrM]. That obtains a pointer to the first element of the packed covariance matrix, with elements 0 through numEntries_ParticleErrM - 1 accessible via pointer arithmetic. Role__ErrMatrix branches are no longer written, replaced by ChargedHypo__ErrMatrix, NeutralHypo__ErrMatrix, and the length counters NumChargedHypoErrM / NumNeutralHypoErrM.
Additionally, this PR fixes a bug in numEntries_ShowerErrM's sizing: it was hardcoded to 15, but P4-only fits write the 7×7 neutral particle matrix (28 elements), so only the first 15 elements were saved. Its value now depends on the kinfit type.
Neutral hypotheses would access NeutralHypo__ErrMatrix with stride numEntries_ShowerErrM.
All the covariance matrix related logic has been moved out of Create_Branches_KinFitData() and Fill_KinFitData() and spread between the Create_Branches_*Hypotheses and Fill functions.