Follow-up from "Draft: Solve mixup between local and global coordinates in calculation of residuals/chi2"
The following discussion from !524 (merged) should be addressed:
-
@dabacher started a discussion: (+1 comment) To calculate the distance in local coordinates information on the detector the cluster is on is needed to convert from global to local coordinates. We get this information from
Track::get_plane
. Currently the planes have to be registered manually during the tracking by callingTrack::registerPlane
. If the plane is not registeredTrack::get_plane
will return anullptr
that then causes a seg fault. For this reason I added the else clause to not break other modules that I did not have a look at. In the end the else clause should not be present.In principle the planes should be registered immediately when a cluster is added to the track. Having to call
Track::registerPlane
explicitly is not very practical.I would have two possible solutions:
- Add the arguments of
Track::registerPlane
toTrack::addCluster
so that it would beTrack::addCluster(const Cluster* cluster, const std::string& name, double z, double x0, Transform3D g2l)
and then callTrack::registerPlane
from withinTrack::addCluster
. This way a cluster can not be registered without the needed information on the detector andTrack::get_plane
should never returnnullptr
. - Make the nested
Plane
class inTrack
a standalone object and add an instance as a member toCluster
(maybe even on the pixel level?). The when adding the cluster to the track one would just need to add the plane from the cluster to theplanes_
vector of the track.
Please let me know what you think and if you have other ideas :)
- Add the arguments of