Skip to content
Snippets Groups Projects
Commit a8887bc6 authored by Christos Anastopoulos's avatar Christos Anastopoulos Committed by Walter Lampl
Browse files

Surface : Add by value local to global methods

parent fcc583bc
No related branches found
No related tags found
No related merge requests found
......@@ -152,7 +152,8 @@ public:
* rotation) */
virtual const Amg::Vector3D& normal() const;
/** Returns a normal vector at a specific local position */
/** Returns a normal vector at a specific local position
*/
virtual const Amg::Vector3D* normal(const Amg::Vector2D& lp) const;
/** Returns a global reference point on the surface,
......@@ -177,7 +178,8 @@ public:
virtual const Trk::Surface* baseSurface() const;
/** Use the Surface as a ParametersBase constructor, from local parameters -
* charged */
* charged. The caller assumes ownership of the returned ptr.
*/
virtual ParametersBase<5, Trk::Charged>* createTrackParameters(
double,
double,
......@@ -187,7 +189,8 @@ public:
AmgSymMatrix(5) * cov = nullptr) const = 0;
/** Use the Surface as a ParametersBase constructor, from global parameters -
* charged*/
* charged The caller assumes ownership of the returned ptr
*/
virtual ParametersBase<5, Trk::Charged>* createTrackParameters(
const Amg::Vector3D&,
const Amg::Vector3D&,
......@@ -195,7 +198,8 @@ public:
AmgSymMatrix(5) * cov = nullptr) const = 0;
/** Use the Surface as a ParametersBase constructor, from local parameters -
* neutral */
* neutral. The caller assumes ownership of the returned ptr
*/
virtual ParametersBase<5, Trk::Neutral>* createNeutralParameters(
double,
double,
......@@ -205,7 +209,8 @@ public:
AmgSymMatrix(5) * cov = nullptr) const = 0;
/** Use the Surface as a ParametersBase constructor, from global parameters -
* neutral */
* neutral. The caller assumes ownership of the returned ptr
*/
virtual ParametersBase<5, Trk::Neutral>* createNeutralParameters(
const Amg::Vector3D&,
const Amg::Vector3D&,
......@@ -213,14 +218,18 @@ public:
AmgSymMatrix(5) * cov = nullptr) const = 0;
/** positionOnSurface() returns a pointer to a LocalPosition on the
Surface,<br> If BoundaryCheck==false it just returns the value of
globalToLocal (including NULL pointer possibility), if BoundaryCheck==true
it checks whether the point is inside bounds or not (returns NULL pointer in
this case). */
const Amg::Vector2D* positionOnSurface(const Amg::Vector3D& glopo,
const BoundaryCheck& bchk = true,
double tol1 = 0.,
double tol2 = 0.) const;
Surface,<br>
If BoundaryCheck==false it just returns the value of
globalToLocal (including nullptr possibility),
if BoundaryCheck==true
it checks whether the point is inside bounds or not (returns nullptr
pointer in this case).
The caller assumes ownership of the returned ptr.
*/
Amg::Vector2D* positionOnSurface(const Amg::Vector3D& glopo,
const BoundaryCheck& bchk = true,
double tol1 = 0.,
double tol2 = 0.) const;
/** The templated Parameters OnSurface method - checks on surface pointer
* first */
......@@ -244,33 +253,73 @@ public:
virtual bool insideBoundsCheck(const Amg::Vector2D& locpos,
const BoundaryCheck& bchk) const = 0;
/** Specified by each surface type: LocalToGlobal method without dynamic
* memory allocation */
virtual void localToGlobal(const Amg::Vector2D& locp,
const Amg::Vector3D& mom,
Amg::Vector3D& glob) const = 0;
/** This method returns the GlobalPosition from a LocalPosition
* uses the per surface localToGlobal and pefrorms dynamic allocations.
* The caller is responsible for deleting the ptr.
*/
Amg::Vector3D* localToGlobal(const Amg::Vector2D& locpos) const;
/** This method returns the GlobalPosition from a LocalPosition
The LocalPosition can be outside Surface bounds - only for planar, cylinder
surfaces fully defined */
const Amg::Vector3D* localToGlobal(const Amg::Vector2D& locpos) const;
* uses the per surface localToGlobal. Return by value
*/
Amg::Vector3D localToGlobalPos(const Amg::Vector2D& locpos) const;
/** This method returns the GlobalPosition from a LocalPosition
The LocalPosition can be outside Surface bounds - for generality with
momentum*/
const Amg::Vector3D* localToGlobal(const Amg::Vector2D& locpos,
const Amg::Vector3D& glomom) const;
* The LocalPosition can be outside Surface bounds - for generality with
* momentum
*
* Uses the per surface localToGlobal and pefrorms dynamic allocations.
* The caller is responsible for deleting the ptr.
*/
Amg::Vector3D* localToGlobal(const Amg::Vector2D& locpos,
const Amg::Vector3D& glomom) const;
/** This method returns the GlobalPosition from a LocalPosition
* The LocalPosition can be outside Surface bounds - for generality with
* momentum
* Return by value No memeory allocation
*/
Amg::Vector3D localToGlobalPos(const Amg::Vector2D& locpos,
const Amg::Vector3D& glomom) const;
/** This method returns the GlobalPosition from LocalParameters
The LocalParameters can be outside Surface bounds - only for planar,
cylinder surfaces fully defined */
const Amg::Vector3D* localToGlobal(const LocalParameters& locpars) const;
* The LocalParameters can be outside Surface bounds.
* Uses the per surface localToGlobal and pefrorms dynamic allocations.
* The caller is responsible for deleting the ptr.
*/
Amg::Vector3D* localToGlobal(const LocalParameters& locpars) const;
/** This method returns the GlobalPosition from LocalParameters
The LocalParameters can be outside Surface bounds - for generality with
momentum */
const Amg::Vector3D* localToGlobal(const LocalParameters& locpars,
const Amg::Vector3D& glomom) const;
* The LocalParameters can be outside Surface bounds.
* Uses the per surface localToGlobal and pefrorms dynamic allocations.
* Return by value no memory allocation
*/
Amg::Vector3D localToGlobalPos(const LocalParameters& locpars) const;
/** Specified by each surface type: LocalToGlobal method without dynamic
* memory allocation */
virtual void localToGlobal(const Amg::Vector2D& locp,
const Amg::Vector3D& mom,
Amg::Vector3D& glob) const = 0;
/** This method returns the GlobalPosition from LocalParameters
* The LocalParameters can be outside Surface bounds - for generality with
* momentum
* Uses the per surface localToGlobal and pefrorms dynamic allocations.
* The caller is responsible for deleting the ptr.
*/
Amg::Vector3D* localToGlobal(const LocalParameters& locpars,
const Amg::Vector3D& glomom) const;
/** This method returns the GlobalPosition from LocalParameters
* The LocalParameters can be outside Surface bounds - for generality with
* momentum
* Uses the per surface localToGlobal and pefrorms dynamic allocations.
* Return by value no memory allocation
*/
Amg::Vector3D localToGlobalPos(const LocalParameters& locpars,
const Amg::Vector3D& glomom) const;
/** Specified by each surface type: GlobalToLocal method without dynamic
* memory allocation - boolean checks if on surface */
......@@ -283,16 +332,16 @@ public:
This method does not check if the calculated LocalPosition is inside surface
bounds. If this check is needed, use positionOnSurface - only for planar,
cylinder surface fully defined*/
const Amg::Vector2D* globalToLocal(const Amg::Vector3D& glopos,
double tol = 0.) const;
Amg::Vector2D* globalToLocal(const Amg::Vector3D& glopos,
double tol = 0.) const;
/** This method returns the LocalPosition from a provided GlobalPosition.
If the GlobalPosition is not on the Surface, it returns a NULL pointer.
This method does not check if the calculated LocalPosition is inside
surface bounds. If this check is needed, use positionOnSurface - for
generality with momentum */
const Amg::Vector2D* globalToLocal(const Amg::Vector3D& glopos,
const Amg::Vector3D& glomom) const;
Amg::Vector2D* globalToLocal(const Amg::Vector3D& glopos,
const Amg::Vector3D& glomom) const;
/** Optionally specified by each surface type : LocalParameters to Vector2D */
virtual Amg::Vector2D localParametersToPosition(
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
namespace Trk {
......@@ -96,34 +96,62 @@ Surface::onSurface(const T& pars, const Trk::BoundaryCheck& bcheck) const
return isOnSurface(pars.position(), bcheck);
}
// common to all surface, uses memory optized method
inline const Amg::Vector3D*
/// Local to Global implementations
// From Local position
inline Amg::Vector3D*
Surface::localToGlobal(const Amg::Vector2D& locpos) const
{
Amg::Vector3D* gPosition = new Amg::Vector3D;
localToGlobal(locpos, Amg::Vector3D(1., 1., 1.), *gPosition);
return gPosition;
}
// common to all surfaces uses memory optimized method
inline const Amg::Vector3D*
inline Amg::Vector3D
Surface::localToGlobalPos(const Amg::Vector2D& locpos) const
{
Amg::Vector3D gPosition;
localToGlobal(locpos, Amg::Vector3D(1., 1., 1.), gPosition);
return gPosition;
}
// From local position and momentum
inline Amg::Vector3D*
Surface::localToGlobal(const Amg::Vector2D& locpos,
const Amg::Vector3D& glomom) const
{
Amg::Vector3D* gPosition = new Amg::Vector3D;
Amg::Vector3D* gPosition = new Amg::Vector3D(0., 0., 0.);
localToGlobal(locpos, glomom, *gPosition);
return gPosition;
}
// common to all surface, uses memory optized method
inline const Amg::Vector3D*
inline Amg::Vector3D
Surface::localToGlobalPos(const Amg::Vector2D& locpos,
const Amg::Vector3D& glomom) const
{
Amg::Vector3D gPosition(0., 0., 0.);
localToGlobal(locpos, glomom, gPosition);
return gPosition;
}
// From Local parameters
inline Amg::Vector3D*
Surface::localToGlobal(const LocalParameters& locpars) const
{
Amg::Vector3D* gPosition = new Amg::Vector3D;
Amg::Vector3D* gPosition = new Amg::Vector3D(0., 0., 0.);
localToGlobal(
localParametersToPosition(locpars), Amg::Vector3D(1., 1., 1.), *gPosition);
return gPosition;
}
// common to all surfaces uses memory optimized method
inline const Amg::Vector3D*
inline Amg::Vector3D
Surface::localToGlobalPos(const LocalParameters& locpars) const
{
Amg::Vector3D gPosition(0., 0., 0.);
localToGlobal(
localParametersToPosition(locpars), Amg::Vector3D(1., 1., 1.), gPosition);
return gPosition;
}
// From Local parameters and momementum
inline Amg::Vector3D*
Surface::localToGlobal(const LocalParameters& locpars,
const Amg::Vector3D& glomom) const
{
......@@ -131,8 +159,17 @@ Surface::localToGlobal(const LocalParameters& locpars,
localToGlobal(localParametersToPosition(locpars), glomom, *gPosition);
return gPosition;
}
inline Amg::Vector3D
Surface::localToGlobalPos(const LocalParameters& locpars,
const Amg::Vector3D& glomom) const
{
Amg::Vector3D gPosition(0., 0., 0.);
localToGlobal(localParametersToPosition(locpars), glomom, gPosition);
return gPosition;
}
// common to all surfaces, uses memory optized method
inline const Amg::Vector2D*
inline Amg::Vector2D*
Surface::globalToLocal(const Amg::Vector3D& glopos, double) const
{
Amg::Vector2D* lPosition = new Amg::Vector2D(0., 0.);
......@@ -142,7 +179,7 @@ Surface::globalToLocal(const Amg::Vector3D& glopos, double) const
return nullptr;
}
// common to all surfaces, uses memory optized method
inline const Amg::Vector2D*
inline Amg::Vector2D*
Surface::globalToLocal(const Amg::Vector3D& glopos,
const Amg::Vector3D& glomom) const
{
......
......@@ -164,10 +164,13 @@ Trk::Surface::operator=(const Trk::Surface& sf)
}
// returns the LocalPosition on a surface of a GlobalPosition
const Amg::Vector2D*
Trk::Surface::positionOnSurface(const Amg::Vector3D& glopo, const BoundaryCheck& bchk, double tol1, double tol2) const
Amg::Vector2D*
Trk::Surface::positionOnSurface(const Amg::Vector3D& glopo,
const BoundaryCheck& bchk,
double tol1,
double tol2) const
{
const Amg::Vector2D* posOnSurface = globalToLocal(glopo, tol1);
Amg::Vector2D* posOnSurface = globalToLocal(glopo, tol1);
if (!bchk){
return posOnSurface;
}
......@@ -180,7 +183,10 @@ Trk::Surface::positionOnSurface(const Amg::Vector3D& glopo, const BoundaryCheck&
// checks if GlobalPosition is on Surface and inside bounds
bool
Trk::Surface::isOnSurface(const Amg::Vector3D& glopo, BoundaryCheck bchk, double tol1, double tol2) const
Trk::Surface::isOnSurface(const Amg::Vector3D& glopo,
BoundaryCheck bchk,
double tol1,
double tol2) const
{
const Amg::Vector2D* posOnSurface = positionOnSurface(glopo, bchk, tol1, tol2);
if (posOnSurface) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment