-
Notifications
You must be signed in to change notification settings - Fork 36
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 dedicated covariance matrix components and use them #287
Conversation
7a457e2
to
e3476db
Compare
The release based CI workflows fail because AIDASoft/podio#553 is not yet in there. |
|
ccc6555
to
fa20c37
Compare
I have also removed the storage details from the docstrings of the covariance matrix members, as that should be (almost) completely be abstracted away by the components. |
837c1c8
to
f195635
Compare
f195635
to
509c7ef
Compare
bf181d6
to
81a41cc
Compare
Because this came up at the EDM4hep meeting: This still has the same issues for
|
81a41cc
to
bf60352
Compare
/// Get the covariance matrix value for the two passed parameters\n | ||
constexpr float getCovMatrix(edm4hep::TrackParams parI, edm4hep::TrackParams parJ) const { return covMatrix.getValue(parI, parJ); }\n | ||
/// Set the covariance matrix value for the two passed parameters\n | ||
constexpr void setCovMatrix(float value, edm4hep::TrackParams parI, edm4hep::TrackParams parJ) { covMatrix.setValue(value, parI, parJ); } |
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.
setCovMatrix(std::array const&) missing
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.
Shouldn't the setCovMatrix
be put in MutableExtraCode
instead of ExtraCode
?
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.
Definitely. Let me check again to have that consistently.
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.
After having had another look; The TrackState
is actually a component. Hence, it only has ExtraCode
and it doesn't need a setCovMatrix
because you can just assign to covMatrix
directly (without having to go through the setter).
I have removed the template <typename ...Vs>
CovMatrixNf(Vs... vs) : values{vs...} {} to the covariance matrix components. This makes direct initialization from initializer lists via the datatypes possible, e.g. as in the tests auto trackerHit = MutableTrackerHit3D{};
trackerHit.setCovMatrix({1.f, 2.f, 3.f, 4.f, 5.f, 6.f});
REQUIRE(trackerHit.getCovMatrix() == std::array{1.f, 2.f, 3.f, 4.f, 5.f, 6.f});
const std::array arrValues = {6.f, 5.f, 4.f, 3.f, 2.f, 1.f};
trackerHit.setCovMatrix(arrValues);
REQUIRE(trackerHit.getCovMatrix() == std::array{6.f, 5.f, 4.f, 3.f, 2.f, 1.f}); This accepts everything that is convertible to a float and emits a narrowing warning if a narrowing conversion happens (if enabled). |
BEGINRELEASENOTES
edm4hep::CovMatrix[2,3,4,6}f
components to represent covariance matricesstd::array<float, N>
under the hoodenum class
es for defining dimensions, e.g.TrackParams
orCartesian
std::array
s in datatypes and other components and tie the interpretation of the values to the approriate dimensionenum class
Usage example:
ENDRELEASENOTES
I am not yet sure whether I really like the duplication of all the extra code here. Especially for the components it is effectively always the same and this could in principle be easily templated. However, then we would have to mix jinja and c++ templates, so I am not entirely sure if we want that.
One possibility would be to put that part of the extra code into some
ipp
file and just#include
it in the ExtraCode declaration.