-
Notifications
You must be signed in to change notification settings - Fork 10
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
Don't use radiusOfInnermostHit for EDM4hep tracks #72
Conversation
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.
Let me check again, where the radius of the innermost hit is actually set for LCIO, resp. where in the reconstruction chain for the input files for the LCIO -> EDM4hep converter tests it is done. Maybe there is an easy way to get to the same result.
k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4EDM4hep2LcioConv.ipp
Outdated
Show resolved
Hide resolved
Looking a bit through the iLCSoft reconstruction chain, these are the places where the radius is set non-trivially (i.e. not simply copied from another track). In most of the cases it is set from the
Then there are two cases where the same information is used, but only the x-y position is used for calculating the radius:
Finally, there is one occurence, where the position of a If we want to have the same behavior as for the first three cases here, we would have to shift the filling of this until after we have all the track states converted and then simply use the same approach as there and then document how we fill this information during the conversion from EDM4hep to LCIO. |
89dc50e
to
97d7639
Compare
and compute it from hits when going from EDM4hep to LCIO. See key4hep/EDM4hep#326
97d7639
to
2bdabbe
Compare
I have introduced a utility function that gets the radius from the track states in a track. It defaults to only using the x and y coordinates, but has a toggle to go to 3D. Currently the 2D version is used in the conversion of the tracks. In order to make all the existing tests pass, we compare against both and are happy if one of them passes. I think the latter is OK because the roundtrip tests pass otherwise as well, and for a direct comparison between converted EDM4hep files and the original LCIO file the "correct choice" depends on which track collection you are looking at and what you actually want to do. From my side this is ready for review and merge |
double radius3D = EDM4hep2LCIOConv::getRadiusOfStateAtFirstHit(edm4hepElem, true).value_or(-1.0); | ||
const double radiusLCIO = lcioElem->getRadiusOfInnermostHit(); | ||
if (std::abs(radius - radiusLCIO) > radiusLCIO / 1e6 && std::abs(radius3D - radiusLCIO) > radiusLCIO / 1e6) { | ||
std::cerr << "radiusOfInnermostHit in Track (LCIO: " << radiusLCIO << "), EDM4hep: 2d: " << radius |
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.
Is this std::cerr
because it doesn't always hold for the test files?
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.
The main reason is that all the other ASSERT_XXX
macros also go to std::cerr
.
@@ -147,4 +147,14 @@ std::unique_ptr<lcio::LCEventImpl> convertEvent(const podio::Frame& edmEvent, co | |||
return lcioEvent; | |||
} | |||
|
|||
std::optional<double> getRadiusOfStateAtFirstHit(const edm4hep::Track& track, bool use3D) { |
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.
The use3D
parameter as it is will never be used other than in the test below? I guess it doesn't hurt but for someone reading the code it could look like you can have the two ways when the converter defaults to one and there isn't a way of setting the other.
I made a couple of comments but this is one of the problems that doesn't have an answer after removing the equivalent quantity. So the possible affected use case would be to go from EDM4hep to LCIO and then using the value of the radius in some processor which I guess no one has (but what if we have tracking in EDM4hep at some point and then keep using the rest of the LCIO chain?). Maybe @Zehvogel can comment on which way he would like the radius to be set. Other than that my doubt is whether to keep the bool parameter or just commit to a single option (even if wrong for some collections). |
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.
I agree, there is no right choice here or the conversion. In the ILD files that we have for testing it looks like the choice is not even consistent within a single collection. Currently the 3D version is mainly there as an option to make the tests pass. They also at least document to expect that either of the two options will match expectations.
In principle we could expose the boolean flag of how to calculate the radius also to the convertTracks
function, but I am not sure how we would actually expose that through the framework in the end, because that would require additional configuration also there, and since it can in principle differ on a track by track basis not even that might solve everything.
For potential issues, I would wait for them to arise, because then we would have a concrete case to work on rather than speculating.
k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4EDM4hep2LcioConv.ipp
Outdated
Show resolved
Hide resolved
double radius3D = EDM4hep2LCIOConv::getRadiusOfStateAtFirstHit(edm4hepElem, true).value_or(-1.0); | ||
const double radiusLCIO = lcioElem->getRadiusOfInnermostHit(); | ||
if (std::abs(radius - radiusLCIO) > radiusLCIO / 1e6 && std::abs(radius3D - radiusLCIO) > radiusLCIO / 1e6) { | ||
std::cerr << "radiusOfInnermostHit in Track (LCIO: " << radiusLCIO << "), EDM4hep: 2d: " << radius |
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.
The main reason is that all the other ASSERT_XXX
macros also go to std::cerr
.
Yes it is quite the mess, but this bad? :o I think the most consistent one should be the 2D as that is the one set in TL; DR:
I agree :( |
Alright, I will merge this then to unblock the EDM4hep PR. |
For whatever it is worth: the use of a '3d' radius in ForwardTracking is a bug that obviously has gone unnoticed for many years. |
and compute it from hits when going from EDM4hep to LCIO. See
key4hep/EDM4hep#326. Uses the utility to compare floats introduced in #71.
Currently there is an issue in the comparisons because in some LCIO collections the radius of the inner most hit doesn't match what you get from the list of hist associated with the track, which isn't enforced anywhere that it should be. One option is to loosen the comparison criteria.
BEGINRELEASENOTES
ENDRELEASENOTES