Skip to content

Remove unsafe localToGlobal returning naked ptr.

Remove unsafe localToGlobal returning naked ptr in favour of value (i.e what was added as localToGlobalPos in the recent past)

Migrate clients.

In cases this actually fixes potential memory leaks, thankfully in what seems to be test code.

@sroe after this MR. The remaining ones from the Surface side that probably need some care should be:

0270   /** positionOnSurface() returns a pointer to a LocalPosition on the
0271     Surface,<br>
0272     If BoundaryCheck==false it just returns the value of
0273     globalToLocal (including nullptr possibility),
0274     if BoundaryCheck==true
0275     it checks whether the point is inside bounds or not (returns nullptr
0276     pointer in this case).
0277     The caller assumes ownership of the returned ptr.
0278     */
0279   Amg::Vector2D* positionOnSurface(const Amg::Vector3D& glopo,
0280                                    const BoundaryCheck& bchk = true,
0281                                    double tol1 = 0.,
0282                                    double tol2 = 0.) const;
 /** This method returns the LocalPosition from a provided GlobalPosition.
0378     If the GlobalPosition is not on the Surface, it returns a NULL pointer.
0379     This method does not check if the calculated LocalPosition is inside surface
0380     bounds. If this check is needed, use positionOnSurface - only for planar,
0381     cylinder surface fully defined*/
0382   Amg::Vector2D* globalToLocal(const Amg::Vector3D& glopos,
0383                                double tol = 0.) const;
0384 
0385   /** This method returns the LocalPosition from a provided GlobalPosition.
0386       If the GlobalPosition is not on the Surface, it returns a NULL pointer.
0387       This method does not check if the calculated LocalPosition is inside
0388      surface bounds. If this check is needed, use positionOnSurface - for
0389      generality with momentum */
0390   Amg::Vector2D* globalToLocal(const Amg::Vector3D& glopos,
0391                                const Amg::Vector3D& glomom) const;

So we need 1 or 2 more MRs ...

Edited by Christos Anastopoulos

Merge request reports