ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | List of all members
Trk::BoundarySubtractedCylinderSurface< Tvol > Class Template Referencefinal

#include <BoundarySubtractedCylinderSurface.h>

Inheritance diagram for Trk::BoundarySubtractedCylinderSurface< Tvol >:
Collaboration diagram for Trk::BoundarySubtractedCylinderSurface< Tvol >:

Public Types

using ChargedTrackParametersUniquePtr = std::unique_ptr< ParametersBase< 5, Trk::Charged > >
 Unique ptr types. More...
 
using NeutralTrackParametersUniquePtr = std::unique_ptr< ParametersBase< 5, Trk::Neutral > >
 

Public Member Functions

 BoundarySubtractedCylinderSurface ()=default
 Default Constructor - needed for pool and inherited classes. More...
 
 BoundarySubtractedCylinderSurface (const BoundarySubtractedCylinderSurface< Tvol > &bcs)=default
 Copy constructor. More...
 
virtual ~BoundarySubtractedCylinderSurface ()=default
 Virtual Destructor. More...
 
BoundarySubtractedCylinderSurfaceoperator= (const BoundarySubtractedCylinderSurface &vol)=default
 Assignment operator. More...
 
 BoundarySubtractedCylinderSurface (const Tvol *inside, const Tvol *outside, const SubtractedCylinderSurface &csf)
 Constructor for a Boundary with exact two Volumes attached to it. More...
 
 BoundarySubtractedCylinderSurface (SharedObject< VolumeArray > insideArray, SharedObject< VolumeArray > outsideArray, const SubtractedCylinderSurface &csf)
 Constructor for a Boundary with two VolumeArrays attached to it. More...
 
 BoundarySubtractedCylinderSurface (const Tvol *inside, const Tvol *outside, const SubtractedCylinderSurface &csf, const Amg::Transform3D &tr)
 Copy constructor with a shift. More...
 
virtual const Tvol * attachedVolume (const TrackParameters &parms, PropDirection dir) const override final
 Get the next Volume depending on the TrackParameters and the requested direction, gives back 0 if there's no volume attached to the requested direction. More...
 
virtual const Tvol * attachedVolume (const Amg::Vector3D &pos, const Amg::Vector3D &mom, PropDirection dir) const override final
 Get the next Volume depending on GlobalPosition, GlobalMomentum, dir on the TrackParameters and the requested direction. More...
 
virtual const SurfacesurfaceRepresentation () const override final
 The Surface Representation of this. More...
 
virtual SurfacesurfaceRepresentation () override final
 
template<class T >
bool onBoundary (const T &pars) const
 templated onBoundary method More...
 
void debugInfo (MsgStream &msg) const
 output debug information More...
 
Tvol constinsideVolume () const
 getters/setters for inside/outside Volume More...
 
void setInsideVolume (const Tvol *)
 
Tvol constoutsideVolume () const
 
void setOutsideVolume (const Tvol *)
 
const SharedObject< VolumeArray > & insideVolumeArray () const
 getters/setters for inside/outside Volume arrays More...
 
void setInsideVolumeArray (const SharedObject< VolumeArray > &)
 
const SharedObject< VolumeArray > & outsideVolumeArray () const
 
void setOutsideVolumeArray (const SharedObject< VolumeArray > &)
 
virtual bool operator== (const Surface &sf) const override final
 Equality operator. More...
 
bool operator== (const CylinderSurface &cf) const
 
bool shared () const
 This method indicates the subtraction mode. More...
 
virtual bool insideBounds (const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const override final
 This method calls the inside() method of the Bounds. More...
 
SharedObject< AreaExcludersubtractedVolume () const
 This method allows access to the subtracted part. More...
 
virtual std::string name () const override final
 Return properly formatted class name for screen output. More...
 
virtual CylinderSurfaceclone () const override
 Implicit Constructor. More...
 
virtual Surface::ChargedTrackParametersUniquePtr createUniqueTrackParameters (double l1, double l2, double phi, double theta, double qop, std::optional< AmgSymMatrix(5)> cov=std::nullopt) const override final
 Use the Surface as a ParametersBase constructor, from local parameters - charged. More...
 
virtual Surface::ChargedTrackParametersUniquePtr createUniqueTrackParameters (const Amg::Vector3D &position, const Amg::Vector3D &momentum, double charge, std::optional< AmgSymMatrix(5)> cov=std::nullopt) const override final
 Use the Surface as a ParametersBase constructor, from global parameters - charged. More...
 
virtual NeutralTrackParametersUniquePtr createUniqueNeutralParameters (double l1, double l2, double phi, double theta, double qop, std::optional< AmgSymMatrix(5)> cov=std::nullopt) const override final
 Use the Surface as a ParametersBase constructor, from local parameters - neutral. More...
 
virtual NeutralTrackParametersUniquePtr createUniqueNeutralParameters (const Amg::Vector3D &position, const Amg::Vector3D &momentum, double charge, std::optional< AmgSymMatrix(5)> cov=std::nullopt) const override final
 Use the Surface as a ParametersBase constructor, from global parameters - neutral. More...
 
template<int DIM, class T >
std::unique_ptr< ParametersT< DIM, T, CylinderSurface > > createUniqueParameters (double l1, double l2, double phi, double theta, double qop, std::optional< AmgSymMatrix(DIM)> cov=std::nullopt) const
 Use the Surface as a ParametersBase constructor, from local parameters. More...
 
template<int DIM, class T >
std::unique_ptr< ParametersT< DIM, T, CylinderSurface > > createUniqueParameters (const Amg::Vector3D &position, const Amg::Vector3D &momentum, double charge, std::optional< AmgSymMatrix(DIM)> cov=std::nullopt) const
 Use the Surface as a ParametersBase constructor, from global parameters. More...
 
virtual Amg::RotationMatrix3D measurementFrame (const Amg::Vector3D &glopos, const Amg::Vector3D &glomom) const override final
 Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perigee Surface. More...
 
constexpr virtual SurfaceType type () const override final
 Return the surface type. More...
 
virtual const Amg::Vector3DglobalReferencePoint () const override final
 Returns a global reference point: For the Cylinder this is \( (R*cos(\phi), R*sin(\phi),0)*transform() \) Where \( \phi \) denotes the averagePhi() of the cylinderBounds. More...
 
virtual Amg::Vector3D normal (const Amg::Vector2D &locpo) const override final
 Return method for surface normal information at a given local point, overwrites the normal() from base class. More...
 
virtual const Amg::Vector3Dnormal () const
 Returns the normal vector of the Surface (i.e. More...
 
virtual const Amg::Vector3DrotSymmetryAxis () const
 Return method for the rotational symmetry axis - the z-Axis of the HepTransform. More...
 
virtual const CylinderBoundsbounds () const override final
 This method returns the CylinderBounds by reference (NoBounds is not possible for cylinder) More...
 
bool hasBounds () const
 
virtual bool insideBoundsCheck (const Amg::Vector2D &locpos, const BoundaryCheck &bchk) const override final
 
virtual Amg::Vector2D localParametersToPosition (const LocalParameters &locpars) const override final
 Specialized for CylinderSurface : LocalParameters to Vector2D. More...
 
virtual void localToGlobal (const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override
 Specialized for CylinderSurface : LocalToGlobal method without dynamic memory allocation. More...
 
Amg::Vector3D localToGlobal (const Amg::Vector2D &locpos) const
 This method returns the GlobalPosition from a LocalPosition uses the per surface localToGlobal. More...
 
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. More...
 
Amg::Vector3D localToGlobal (const LocalParameters &locpars) const
 This method returns the GlobalPosition from LocalParameters The LocalParameters can be outside Surface bounds. More...
 
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. More...
 
virtual bool globalToLocal (const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override
 Specialized for CylinderSurface : GlobalToLocal method without dynamic memory allocation - boolean checks if on surface. More...
 
std::optional< Amg::Vector2DglobalToLocal (const Amg::Vector3D &glopos, double tol=0.) const
 This method returns the LocalPosition from a provided GlobalPosition. More...
 
std::optional< Amg::Vector2DglobalToLocal (const Amg::Vector3D &glopos, const Amg::Vector3D &glomom) const
 This method returns the LocalPosition from a provided GlobalPosition. More...
 
virtual bool isOnSurface (const Amg::Vector3D &glopo, const BoundaryCheck &bchk=true, double tol1=0., double tol2=0.) const override
 This method returns true if the GlobalPosition is on the Surface for both, within or without check of whether the local position is inside boundaries or not. More...
 
virtual Intersection straightLineIntersection (const Amg::Vector3D &pos, const Amg::Vector3D &dir, bool forceDir=false, Trk::BoundaryCheck bchk=false) const override final
 fast straight line intersection schema - provides closest intersection and (signed) path length More...
 
template<class T >
Intersection straightLineIntersection (const T &pars, bool forceDir=false, const Trk::BoundaryCheck &bchk=false) const
 fst straight line intersection schema - templated for charged and neutral parameters More...
 
virtual DistanceSolution straightLineDistanceEstimate (const Amg::Vector3D &pos, const Amg::Vector3D &dir) const override
 fast distance to Surface More...
 
virtual DistanceSolution straightLineDistanceEstimate (const Amg::Vector3D &pos, const Amg::Vector3D &dir, bool bound) const override
 fast distance to Surface - with bounds directive More...
 
virtual double pathCorrection (const Amg::Vector3D &pos, const Amg::Vector3D &mom) const override
 the pathCorrection for derived classes with thickness More...
 
bool operator!= (const Surface &sf) const
 Non-equality operator. More...
 
std::unique_ptr< SurfaceuniqueClone () const
 NVI method returning unique_ptr clone. More...
 
const Amg::Transform3DcachedTransform () const
 Return the cached transformation directly. More...
 
const Amg::Transform3Dtransform () const
 Returns HepGeom::Transform3D by reference. More...
 
const Amg::Vector3Dcenter () const
 Returns the center position of the Surface. More...
 
const TrkDetElementBaseassociatedDetectorElement () const
 return associated Detector Element More...
 
Identifier associatedDetectorElementIdentifier () const
 return Identifier of the associated Detector Element More...
 
const Trk::LayerassociatedLayer () const
 return the associated Layer More...
 
const Trk::LayermaterialLayer () const
 return the material Layer More...
 
Trk::LayermaterialLayer ()
 
virtual const Trk::SurfacebaseSurface () const
 return the base surface (simplified for persistification) More...
 
std::optional< Amg::Vector2DpositionOnSurface (const Amg::Vector3D &glopo, const BoundaryCheck &bchk=true, double tol1=0., double tol2=0.) const
 positionOnSurface() returns the LocalPosition on the Surface,
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 std::nullopt in this case). More...
 
template<class T >
bool onSurface (const T &parameters, const BoundaryCheck &bchk=BoundaryCheck(true)) const
 The templated Parameters OnSurface method - checks on surface pointer first. More...
 
bool isFree () const
 Returns 'true' if this surface is 'free', i.e. More...
 
bool isActive () const
 Return 'true' if this surface is owned by the detector element. More...
 
void setTransform (const Amg::Transform3D &trans)
 Set the transform updates center and normal. More...
 
void setOwner (SurfaceOwner x)
 set Ownership More...
 
SurfaceOwner owner () const
 return ownership More...
 
void setMaterialLayer (std::shared_ptr< Layer > mlay)
 set material layer More...
 
virtual MsgStream & dump (MsgStream &sl) const
 Output Method for MsgStream, to be overloaded by child classes. More...
 
virtual std::ostream & dump (std::ostream &sl) const
 Output Method for std::ostream, to be overloaded by child classes. More...
 
void associateLayer (const Layer &lay)
 method to associate the associated Trk::Layer which is alreay owned More...
 

Static Public Member Functions

static std::size_t numberOfInstantiations ()
 

Static Public Attributes

static constexpr SurfaceType staticType = SurfaceType::Cylinder
 The surface type static constexpr. More...
 
static std::atomic_size_t s_numberOfInstantiations
 

Protected Member Functions

Amg::Transform3D inverseTransformHelper () const
 Helper method to factorize in one place common operations calculate inverse transofrm and multiply with position. More...
 
Amg::Vector3D inverseTransformMultHelper (const Amg::Vector3D &glopos) const
 

Protected Attributes

const Tvol * m_insideVolume
 
const Tvol * m_outsideVolume
 
SharedObject< VolumeArraym_insideVolumeArray
 
SharedObject< VolumeArraym_outsideVolumeArray
 
SharedObject< AreaExcluderm_subtrVol
 
bool m_shared
 
SharedObject< const CylinderBoundsm_bounds
 The global reference point (== a point on the surface) More...
 
CxxUtils::CachedUniquePtr< Amg::Vector3Dm_referencePoint
 The rotational symmetry axis. More...
 
CxxUtils::CachedUniquePtr< Amg::Vector3Dm_rotSymmetryAxis
 
std::unique_ptr< Transformsm_transforms {}
 
const TrkDetElementBasem_associatedDetElement {}
 Not owning Pointer to the TrkDetElementBase. More...
 
Identifier m_associatedDetElementId {}
 Identifier for the TrkDetElementBase. More...
 
const Layerm_associatedLayer {}
 The associated layer Trk::Layer. More...
 
std::shared_ptr< Layerm_materialLayer {}
 Possibility to attach a material descrption. More...
 
SurfaceOwner m_owner {SurfaceOwner::noOwn}
 enum for surface owner : 0 free surface More...
 

Static Protected Attributes

static constexpr double s_onSurfaceTolerance = 10e-5
 Tolerance for being on Surface. More...
 

Private Types

typedef BinnedArray< Tvol > VolumeArray
 typedef the BinnedArray More...
 

Detailed Description

template<class Tvol>
class Trk::BoundarySubtractedCylinderSurface< Tvol >

BoundarySubtractedCylinderSurface description inside the tracking realm, it extends the Surface description to make a surface being a boundary of a Trk::Volume

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch
Christos Anastopoulos (Athena MT modifications)

Definition at line 36 of file BoundarySubtractedCylinderSurface.h.

Member Typedef Documentation

◆ ChargedTrackParametersUniquePtr

Unique ptr types.

Definition at line 124 of file Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h.

◆ NeutralTrackParametersUniquePtr

◆ VolumeArray

template<class Tvol >
typedef BinnedArray<Tvol> Trk::BoundarySubtractedCylinderSurface< Tvol >::VolumeArray
private

typedef the BinnedArray

Definition at line 40 of file BoundarySubtractedCylinderSurface.h.

Constructor & Destructor Documentation

◆ BoundarySubtractedCylinderSurface() [1/5]

Default Constructor - needed for pool and inherited classes.

◆ BoundarySubtractedCylinderSurface() [2/5]

Copy constructor.

◆ ~BoundarySubtractedCylinderSurface()

template<class Tvol >
virtual Trk::BoundarySubtractedCylinderSurface< Tvol >::~BoundarySubtractedCylinderSurface ( )
virtualdefault

Virtual Destructor.

◆ BoundarySubtractedCylinderSurface() [3/5]

template<class Tvol >
Trk::BoundarySubtractedCylinderSurface< Tvol >::BoundarySubtractedCylinderSurface ( const Tvol *  inside,
const Tvol *  outside,
const SubtractedCylinderSurface csf 
)
inline

Constructor for a Boundary with exact two Volumes attached to it.

Definition at line 58 of file BoundarySubtractedCylinderSurface.h.

60  : BoundarySurface<Tvol>(inside, outside),

◆ BoundarySubtractedCylinderSurface() [4/5]

template<class Tvol >
Trk::BoundarySubtractedCylinderSurface< Tvol >::BoundarySubtractedCylinderSurface ( SharedObject< VolumeArray insideArray,
SharedObject< VolumeArray outsideArray,
const SubtractedCylinderSurface csf 
)
inline

Constructor for a Boundary with two VolumeArrays attached to it.

Definition at line 64 of file BoundarySubtractedCylinderSurface.h.

67  : BoundarySurface<Tvol>(insideArray, outsideArray),

◆ BoundarySubtractedCylinderSurface() [5/5]

template<class Tvol >
Trk::BoundarySubtractedCylinderSurface< Tvol >::BoundarySubtractedCylinderSurface ( const Tvol *  inside,
const Tvol *  outside,
const SubtractedCylinderSurface csf,
const Amg::Transform3D tr 
)
inline

Copy constructor with a shift.

Definition at line 71 of file BoundarySubtractedCylinderSurface.h.

74  : BoundarySurface<Tvol>(inside, outside),
75  SubtractedCylinderSurface(csf, tr) {}

Member Function Documentation

◆ associatedDetectorElement()

const TrkDetElementBase* Trk::Surface::associatedDetectorElement ( ) const
inherited

return associated Detector Element

◆ associatedDetectorElementIdentifier()

Identifier Trk::Surface::associatedDetectorElementIdentifier ( ) const
inherited

return Identifier of the associated Detector Element

◆ associatedLayer()

const Trk::Layer* Trk::Surface::associatedLayer ( ) const
inherited

return the associated Layer

◆ associateLayer()

void Trk::Surface::associateLayer ( const Layer lay)
inherited

method to associate the associated Trk::Layer which is alreay owned

  • only allowed by LayerBuilder
  • only done if no Layer is set already

◆ attachedVolume() [1/2]

template<class Tvol >
virtual const Tvol* Trk::BoundarySubtractedCylinderSurface< Tvol >::attachedVolume ( const Amg::Vector3D pos,
const Amg::Vector3D mom,
PropDirection  dir 
) const
finaloverridevirtual

Get the next Volume depending on GlobalPosition, GlobalMomentum, dir on the TrackParameters and the requested direction.

Implements Trk::BoundarySurface< Tvol >.

◆ attachedVolume() [2/2]

template<class Tvol >
virtual const Tvol* Trk::BoundarySubtractedCylinderSurface< Tvol >::attachedVolume ( const TrackParameters parms,
PropDirection  dir 
) const
finaloverridevirtual

Get the next Volume depending on the TrackParameters and the requested direction, gives back 0 if there's no volume attached to the requested direction.

  • this is speed optimized as it doesn't invoke a local to global transformation

Implements Trk::BoundarySurface< Tvol >.

◆ baseSurface()

virtual const Trk::Surface* Trk::Surface::baseSurface ( ) const
virtualinherited

return the base surface (simplified for persistification)

◆ bounds()

virtual const CylinderBounds& Trk::CylinderSurface::bounds ( ) const
finaloverridevirtualinherited

This method returns the CylinderBounds by reference (NoBounds is not possible for cylinder)

Implements Trk::Surface.

◆ cachedTransform()

const Amg::Transform3D* Trk::Surface::cachedTransform ( ) const
inherited

Return the cached transformation directly.

Don't try to make a new transform if it's not here.

◆ center()

const Amg::Vector3D& Trk::Surface::center ( ) const
inherited

Returns the center position of the Surface.

◆ clone()

virtual CylinderSurface* Trk::CylinderSurface::clone ( ) const
overridevirtualinherited

Implicit Constructor.

Implements Trk::Surface.

◆ createUniqueNeutralParameters() [1/2]

Trk::Surface::NeutralTrackParametersUniquePtr Trk::CylinderSurface::createUniqueNeutralParameters ( const Amg::Vector3D position,
const Amg::Vector3D momentum,
double  charge,
std::optional< AmgSymMatrix(5)>  cov = std::nullopt 
) const
finaloverridevirtualinherited

Use the Surface as a ParametersBase constructor, from global parameters - neutral.

Implements Trk::Surface.

Definition at line 159 of file CylinderSurface.cxx.

161  {
162  return std::make_unique<ParametersT<5, Neutral, CylinderSurface>>(
163  position, momentum, charge, *this, std::move(cov));
164 }

◆ createUniqueNeutralParameters() [2/2]

Trk::Surface::NeutralTrackParametersUniquePtr Trk::CylinderSurface::createUniqueNeutralParameters ( double  l1,
double  l2,
double  phi,
double  theta,
double  qop,
std::optional< AmgSymMatrix(5)>  cov = std::nullopt 
) const
finaloverridevirtualinherited

Use the Surface as a ParametersBase constructor, from local parameters - neutral.

Implements Trk::Surface.

Definition at line 149 of file CylinderSurface.cxx.

151  {
152  return std::make_unique<ParametersT<5, Neutral, CylinderSurface>>(
153  l1, l2, phi, theta, qop, *this, std::move(cov));
154 }

◆ createUniqueParameters() [1/2]

template<int DIM, class T >
std::unique_ptr<ParametersT<DIM, T, CylinderSurface> > Trk::CylinderSurface::createUniqueParameters ( const Amg::Vector3D position,
const Amg::Vector3D momentum,
double  charge,
std::optional< AmgSymMatrix(DIM)>  cov = std::nullopt 
) const
inherited

Use the Surface as a ParametersBase constructor, from global parameters.

◆ createUniqueParameters() [2/2]

template<int DIM, class T >
std::unique_ptr<ParametersT<DIM, T, CylinderSurface> > Trk::CylinderSurface::createUniqueParameters ( double  l1,
double  l2,
double  phi,
double  theta,
double  qop,
std::optional< AmgSymMatrix(DIM)>  cov = std::nullopt 
) const
inherited

Use the Surface as a ParametersBase constructor, from local parameters.

◆ createUniqueTrackParameters() [1/2]

Trk::Surface::ChargedTrackParametersUniquePtr Trk::CylinderSurface::createUniqueTrackParameters ( const Amg::Vector3D position,
const Amg::Vector3D momentum,
double  charge,
std::optional< AmgSymMatrix(5)>  cov = std::nullopt 
) const
finaloverridevirtualinherited

Use the Surface as a ParametersBase constructor, from global parameters - charged.

Implements Trk::Surface.

Definition at line 139 of file CylinderSurface.cxx.

141  {
142  return std::make_unique<ParametersT<5, Charged, CylinderSurface>>(
143  position, momentum, charge, *this, std::move(cov));
144 }

◆ createUniqueTrackParameters() [2/2]

Trk::Surface::ChargedTrackParametersUniquePtr Trk::CylinderSurface::createUniqueTrackParameters ( double  l1,
double  l2,
double  phi,
double  theta,
double  qop,
std::optional< AmgSymMatrix(5)>  cov = std::nullopt 
) const
finaloverridevirtualinherited

Use the Surface as a ParametersBase constructor, from local parameters - charged.

Implements Trk::Surface.

Definition at line 129 of file CylinderSurface.cxx.

131  {
132  return std::make_unique<ParametersT<5, Charged, CylinderSurface>>(
133  l1, l2, phi, theta, qop, *this, std::move(cov));
134 }

◆ debugInfo()

template<class Tvol >
void Trk::BoundarySurface< Tvol >::debugInfo ( MsgStream &  msg) const
inlineinherited

output debug information

Definition at line 165 of file BoundarySurface.h.

165  {
166  msg << "BoundarySurface debug information: " << std::endl;
167  msg << " -> pointer to insideVolume = " << m_insideVolume
168  << std::endl;
169  msg << " -> pointer to insideVolumeArray = "
170  << m_insideVolumeArray.get() << std::endl;
171  msg << " -> pointer to outsideVolume = " << m_outsideVolume
172  << std::endl;
173  msg << " -> pointer to outsideVolumeArray = "
174  << m_outsideVolumeArray.get() << endmsg;
175 }

◆ dump() [1/2]

MsgStream & Surface::dump ( MsgStream &  sl) const
virtualinherited

Output Method for MsgStream, to be overloaded by child classes.

Reimplemented in Trk::PerigeeSurface, and Trk::DetElementSurface.

Definition at line 143 of file Surface.cxx.

144 {
145  sl << std::setiosflags(std::ios::fixed);
146  sl << std::setprecision(4);
147  sl << name() << std::endl;
148  if (associatedDetectorElement()!=nullptr){
149  sl<<" Detector Type = "<<associatedDetectorElement()->detectorTypeString()<<std::endl;
150  }
151  sl << " Center position (x, y, z) = (" << center().x() << ", " << center().y() << ", " << center().z() << ")"
152  << std::endl;
154  Amg::Vector3D rotX(rot.col(0));
155  Amg::Vector3D rotY(rot.col(1));
156  Amg::Vector3D rotZ(rot.col(2));
157  sl << std::setprecision(6);
158  sl << " Rotation: colX = (" << rotX(0) << ", " << rotX(1) << ", " << rotX(2) << ")" << std::endl;
159  sl << " colY = (" << rotY(0) << ", " << rotY(1) << ", " << rotY(2) << ")" << std::endl;
160  sl << " colZ = (" << rotZ(0) << ", " << rotZ(1) << ", " << rotZ(2) << ")" << std::endl;
161  sl << " Bounds : " << bounds();
162  sl << std::setprecision(-1);
163  return sl;
164 }

◆ dump() [2/2]

std::ostream & Surface::dump ( std::ostream &  sl) const
virtualinherited

Output Method for std::ostream, to be overloaded by child classes.

Reimplemented in Trk::PerigeeSurface, and Trk::DetElementSurface.

Definition at line 168 of file Surface.cxx.

169 {
170  sl << std::setiosflags(std::ios::fixed);
171  sl << std::setprecision(4);
172  sl << name() << std::endl;
173  if (associatedDetectorElement()!=nullptr){
174  sl<<" Detector Type = "<<associatedDetectorElement()->detectorTypeString()<<std::endl;
175  }
176  sl << " Center position (x, y, z) = (" << center().x() << ", " << center().y() << ", " << center().z() << ")"
177  << std::endl;
179  Amg::Vector3D rotX(rot.col(0));
180  Amg::Vector3D rotY(rot.col(1));
181  Amg::Vector3D rotZ(rot.col(2));
182  sl << std::setprecision(6);
183  sl << " Rotation: colX = (" << rotX(0) << ", " << rotX(1) << ", " << rotX(2) << ")" << std::endl;
184  sl << " colY = (" << rotY(0) << ", " << rotY(1) << ", " << rotY(2) << ")" << std::endl;
185  sl << " colZ = (" << rotZ(0) << ", " << rotZ(1) << ", " << rotZ(2) << ")" << std::endl;
186  sl << " Bounds : " << bounds();
187  sl << std::setprecision(-1);
188  return sl;
189 }

◆ globalReferencePoint()

const Amg::Vector3D & Trk::CylinderSurface::globalReferencePoint ( ) const
finaloverridevirtualinherited

Returns a global reference point: For the Cylinder this is \( (R*cos(\phi), R*sin(\phi),0)*transform() \) Where \( \phi \) denotes the averagePhi() of the cylinderBounds.

Reimplemented from Trk::Surface.

Definition at line 167 of file CylinderSurface.cxx.

168 {
169  if (!m_referencePoint) {
170  double rMedium = bounds().r();
171  double phi = bounds().averagePhi();
172  Amg::Vector3D gp(rMedium * cos(phi), rMedium * sin(phi), 0.);
173  m_referencePoint.set(std::make_unique<Amg::Vector3D>(transform() * gp));
174  }
175  return (*m_referencePoint);
176 }

◆ globalToLocal() [1/3]

bool Trk::CylinderSurface::globalToLocal ( const Amg::Vector3D glob,
const Amg::Vector3D mom,
Amg::Vector2D loc 
) const
overridevirtualinherited

Specialized for CylinderSurface : GlobalToLocal method without dynamic memory allocation - boolean checks if on surface.

Implements Trk::Surface.

Reimplemented in Trk::SlidingCylinderSurface.

Definition at line 238 of file CylinderSurface.cxx.

241 {
242  // get the transform & transform global position into cylinder frame
243  // transform it to the globalframe: CylinderSurfaces are allowed to have 0
244  // pointer transform
245  double radius = 0.;
246  double inttol = bounds().r() * 0.0001;
247  if (inttol < 0.01)
248  inttol = 0.01;
249  // do the transformation or not
251  Amg::Vector3D loc3Dframe(inverseTransformMultHelper(glopos));
252  locpos = Amg::Vector2D(bounds().r() * loc3Dframe.phi(), loc3Dframe.z());
253  radius = loc3Dframe.perp();
254  } else {
255  locpos = Amg::Vector2D(bounds().r() * glopos.phi(), glopos.z());
256  radius = glopos.perp();
257  }
258  // return true or false
259  return (fabs(radius - bounds().r()) <= inttol);
260 }

◆ globalToLocal() [2/3]

std::optional<Amg::Vector2D> Trk::Surface::globalToLocal ( const Amg::Vector3D glopos,
const Amg::Vector3D glomom 
) const
inherited

This method returns the LocalPosition from a provided GlobalPosition.

If the GlobalPosition is not on the Surface, it returns a nullopt This method does not check if the calculated LocalPosition is inside surface bounds. If this check is needed, use positionOnSurface - for generality with momentum

◆ globalToLocal() [3/3]

std::optional<Amg::Vector2D> Trk::Surface::globalToLocal ( const Amg::Vector3D glopos,
double  tol = 0. 
) const
inherited

This method returns the LocalPosition from a provided GlobalPosition.

If the GlobalPosition is not on the Surface, it returns nullopt 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

◆ hasBounds()

bool Trk::CylinderSurface::hasBounds ( ) const
inherited

◆ insideBounds()

virtual bool Trk::SubtractedCylinderSurface::insideBounds ( const Amg::Vector2D locpos,
double  tol1 = 0.,
double  tol2 = 0. 
) const
finaloverridevirtualinherited

This method calls the inside() method of the Bounds.

Reimplemented from Trk::CylinderSurface.

◆ insideBoundsCheck()

virtual bool Trk::CylinderSurface::insideBoundsCheck ( const Amg::Vector2D locpos,
const BoundaryCheck bchk 
) const
finaloverridevirtualinherited

Implements Trk::Surface.

◆ insideVolume()

template<class Tvol >
Tvol const * Trk::BoundarySurface< Tvol >::insideVolume
inherited

getters/setters for inside/outside Volume

Definition at line 125 of file BoundarySurface.h.

125  {
126  return m_insideVolume;
127 }

◆ insideVolumeArray()

template<class Tvol >
const SharedObject< BinnedArray< Tvol > > & Trk::BoundarySurface< Tvol >::insideVolumeArray
inherited

getters/setters for inside/outside Volume arrays

Definition at line 144 of file BoundarySurface.h.

144  {
145  return m_insideVolumeArray;
146 }

◆ inverseTransformHelper()

Amg::Transform3D Trk::Surface::inverseTransformHelper ( ) const
protectedinherited

Helper method to factorize in one place common operations calculate inverse transofrm and multiply with position.

◆ inverseTransformMultHelper()

Amg::Vector3D Trk::Surface::inverseTransformMultHelper ( const Amg::Vector3D glopos) const
protectedinherited

◆ isActive()

bool Trk::Surface::isActive ( ) const
inherited

Return 'true' if this surface is owned by the detector element.

◆ isFree()

bool Trk::Surface::isFree ( ) const
inherited

Returns 'true' if this surface is 'free', i.e.

it does not belong to a detector element (and returns false otherwise

◆ isOnSurface()

bool Trk::CylinderSurface::isOnSurface ( const Amg::Vector3D glopo,
const BoundaryCheck bchk = true,
double  tol1 = 0.,
double  tol2 = 0. 
) const
overridevirtualinherited

This method returns true if the GlobalPosition is on the Surface for both, within or without check of whether the local position is inside boundaries or not.

Reimplemented from Trk::Surface.

Reimplemented in Trk::SlidingCylinderSurface.

Definition at line 263 of file CylinderSurface.cxx.

267 {
268  Amg::Vector3D loc3Dframe =
270  return (bchk ? bounds().inside3D(loc3Dframe,
271  tol1 + s_onSurfaceTolerance,
272  tol2 + s_onSurfaceTolerance)
273  : true);
274 }

◆ localParametersToPosition()

virtual Amg::Vector2D Trk::CylinderSurface::localParametersToPosition ( const LocalParameters locpars) const
finaloverridevirtualinherited

Specialized for CylinderSurface : LocalParameters to Vector2D.

Reimplemented from Trk::Surface.

◆ localToGlobal() [1/5]

ATH_FLATTEN void Trk::CylinderSurface::localToGlobal ( const Amg::Vector2D locp,
const Amg::Vector3D mom,
Amg::Vector3D glob 
) const
overridevirtualinherited

Specialized for CylinderSurface : LocalToGlobal method without dynamic memory allocation.

Implements Trk::Surface.

Reimplemented in Trk::SlidingCylinderSurface.

Definition at line 223 of file CylinderSurface.cxx.

226 {
227  // create the position in the local 3d frame
228  double r = bounds().r();
229  double phi = locpos[Trk::locRPhi] / r;
230  glopos = Amg::Vector3D(r * cos(phi), r * sin(phi), locpos[Trk::locZ]);
231  // transform it to the globalframe: CylinderSurfaces are allowed to have 0
232  // pointer transform
234  glopos = transform() * glopos;
235 }

◆ localToGlobal() [2/5]

Amg::Vector3D Trk::Surface::localToGlobal ( const Amg::Vector2D locpos) const
inherited

This method returns the GlobalPosition from a LocalPosition uses the per surface localToGlobal.

◆ localToGlobal() [3/5]

Amg::Vector3D Trk::Surface::localToGlobal ( const Amg::Vector2D locpos,
const Amg::Vector3D glomom 
) const
inherited

This method returns the GlobalPosition from a LocalPosition The LocalPosition can be outside Surface bounds - for generality with momentum.

◆ localToGlobal() [4/5]

Amg::Vector3D Trk::Surface::localToGlobal ( const LocalParameters locpars) const
inherited

This method returns the GlobalPosition from LocalParameters The LocalParameters can be outside Surface bounds.

◆ localToGlobal() [5/5]

Amg::Vector3D Trk::Surface::localToGlobal ( const LocalParameters locpars,
const Amg::Vector3D glomom 
) const
inherited

This method returns the GlobalPosition from LocalParameters The LocalParameters can be outside Surface bounds - for generality with momentum.

◆ materialLayer() [1/2]

Trk::Layer* Trk::Surface::materialLayer ( )
inherited

◆ materialLayer() [2/2]

const Trk::Layer* Trk::Surface::materialLayer ( ) const
inherited

return the material Layer

◆ measurementFrame()

Amg::RotationMatrix3D Trk::CylinderSurface::measurementFrame ( const Amg::Vector3D glopos,
const Amg::Vector3D glomom 
) const
finaloverridevirtualinherited

Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perigee Surface.

  • the default implementation is the the RotationMatrix3D of the transform

Reimplemented from Trk::Surface.

Definition at line 190 of file CylinderSurface.cxx.

192 {
193  Amg::RotationMatrix3D mFrame;
194  // construct the measurement frame
195  Amg::Vector3D measY(
196  transform().rotation().col(2)); // measured Y is the z axis
197  Amg::Vector3D measDepth =
198  Amg::Vector3D(pos.x(), pos.y(), 0.)
199  .unit(); // measured z is the position transverse normalized
200  Amg::Vector3D measX(
201  measY.cross(measDepth).unit()); // measured X is what comoes out of it
202  // the columnes
203  mFrame.col(0) = measX;
204  mFrame.col(1) = measY;
205  mFrame.col(2) = measDepth;
206  // return the rotation matrix
207  return mFrame;
208 }

◆ name()

virtual std::string Trk::SubtractedCylinderSurface::name ( ) const
inlinefinaloverridevirtualinherited

Return properly formatted class name for screen output.

Reimplemented from Trk::CylinderSurface.

Definition at line 71 of file SubtractedCylinderSurface.h.

72  {
73  return "Trk::SubtractedCylinderSurface";
74  }

◆ normal() [1/2]

virtual const Amg::Vector3D& Trk::Surface::normal ( ) const
virtualinherited

Returns the normal vector of the Surface (i.e.

in generall z-axis of rotation)

Reimplemented in Trk::PerigeeSurface.

◆ normal() [2/2]

virtual Amg::Vector3D Trk::CylinderSurface::normal ( const Amg::Vector2D locpo) const
finaloverridevirtualinherited

Return method for surface normal information at a given local point, overwrites the normal() from base class.

Reimplemented from Trk::Surface.

◆ numberOfInstantiations()

static std::size_t Trk::ObjectCounter< Trk::Surface >::numberOfInstantiations ( )
inlinestaticinherited

Definition at line 25 of file TrkObjectCounter.h.

26  {
27 #ifndef NDEBUG
28  return s_numberOfInstantiations.load();
29 #endif
30  return 0;
31  }

◆ onBoundary()

template<class Tvol >
template<class T >
bool Trk::BoundarySurface< Tvol >::onBoundary ( const T &  pars) const
inlineinherited

templated onBoundary method

Definition at line 90 of file BoundarySurface.h.

90  {
92  }

◆ onSurface()

template<class T >
bool Trk::Surface::onSurface ( const T &  parameters,
const BoundaryCheck bchk = BoundaryCheck(true) 
) const
inherited

The templated Parameters OnSurface method - checks on surface pointer first.

◆ operator!=()

bool Trk::Surface::operator!= ( const Surface sf) const
inherited

Non-equality operator.

◆ operator=()

template<class Tvol >
BoundarySubtractedCylinderSurface& Trk::BoundarySubtractedCylinderSurface< Tvol >::operator= ( const BoundarySubtractedCylinderSurface< Tvol > &  vol)
default

Assignment operator.

◆ operator==() [1/2]

bool Trk::CylinderSurface::operator== ( const CylinderSurface cf) const
inherited

◆ operator==() [2/2]

bool Trk::SubtractedCylinderSurface::operator== ( const Surface sf) const
finaloverridevirtualinherited

Equality operator.

Reimplemented from Trk::CylinderSurface.

Definition at line 60 of file SubtractedCylinderSurface.cxx.

61 {
62  // first check the type not to compare apples with oranges
63  const Trk::SubtractedCylinderSurface* scsf = dynamic_cast<const Trk::SubtractedCylinderSurface*>(&sf);
64  if (!scsf)
65  return false;
66  bool surfaceEqual = Trk::CylinderSurface::operator==(sf);
67  bool sharedEqual = (surfaceEqual) ? (shared() == scsf->shared()) : false;
68  return sharedEqual;
69 }

◆ outsideVolume()

template<class Tvol >
Tvol const * Trk::BoundarySurface< Tvol >::outsideVolume
inherited

Definition at line 134 of file BoundarySurface.h.

134  {
135  return m_outsideVolume;
136 }

◆ outsideVolumeArray()

template<class Tvol >
const SharedObject< BinnedArray< Tvol > > & Trk::BoundarySurface< Tvol >::outsideVolumeArray
inherited

Definition at line 155 of file BoundarySurface.h.

155  {
156  return m_outsideVolumeArray;
157 }

◆ owner()

SurfaceOwner Trk::Surface::owner ( ) const
inherited

return ownership

◆ pathCorrection()

virtual double Trk::CylinderSurface::pathCorrection ( const Amg::Vector3D pos,
const Amg::Vector3D mom 
) const
overridevirtualinherited

the pathCorrection for derived classes with thickness

Reimplemented from Trk::Surface.

◆ positionOnSurface()

std::optional< Amg::Vector2D > Surface::positionOnSurface ( const Amg::Vector3D glopo,
const BoundaryCheck bchk = true,
double  tol1 = 0.,
double  tol2 = 0. 
) const
inherited

positionOnSurface() returns the LocalPosition on the Surface,
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 std::nullopt in this case).

Definition at line 106 of file Surface.cxx.

110 {
111  std::optional<Amg::Vector2D> posOnSurface = globalToLocal(glopo, tol1);
112  if (!bchk){
113  return posOnSurface;
114  }
115  if (posOnSurface && insideBounds(*posOnSurface, tol1, tol2)){
116  return posOnSurface;
117  }
118  return std::nullopt;
119 }

◆ rotSymmetryAxis()

const Amg::Vector3D & Trk::CylinderSurface::rotSymmetryAxis ( ) const
virtualinherited

Return method for the rotational symmetry axis - the z-Axis of the HepTransform.

Definition at line 211 of file CylinderSurface.cxx.

212 {
213  if (!m_rotSymmetryAxis) {
215  m_rotSymmetryAxis.set(std::make_unique<Amg::Vector3D>(zAxis));
216  }
217  return (*m_rotSymmetryAxis);
218 }

◆ setInsideVolume()

template<class Tvol >
void Trk::BoundarySurface< Tvol >::setInsideVolume ( const Tvol *  vol)
inherited

Definition at line 129 of file BoundarySurface.h.

129  {
130  m_insideVolume = vol;
131 }

◆ setInsideVolumeArray()

template<class Tvol >
void Trk::BoundarySurface< Tvol >::setInsideVolumeArray ( const SharedObject< VolumeArray > &  )
inherited

Definition at line 148 of file BoundarySurface.h.

149  {
150  m_insideVolumeArray = volArray;
151 }

◆ setMaterialLayer()

void Trk::Surface::setMaterialLayer ( std::shared_ptr< Layer mlay)
inherited

set material layer

◆ setOutsideVolume()

template<class Tvol >
void Trk::BoundarySurface< Tvol >::setOutsideVolume ( const Tvol *  vol)
inherited

Definition at line 138 of file BoundarySurface.h.

138  {
139  m_outsideVolume = vol;
140 }

◆ setOutsideVolumeArray()

template<class Tvol >
void Trk::BoundarySurface< Tvol >::setOutsideVolumeArray ( const SharedObject< VolumeArray > &  )
inherited

Definition at line 159 of file BoundarySurface.h.

160  {
161  m_outsideVolumeArray = volArray;
162 }

◆ setOwner()

void Trk::Surface::setOwner ( SurfaceOwner  x)
inherited

set Ownership

◆ setTransform()

void Trk::Surface::setTransform ( const Amg::Transform3D trans)
inherited

Set the transform updates center and normal.

◆ shared()

bool Trk::SubtractedCylinderSurface::shared ( ) const
inherited

This method indicates the subtraction mode.

◆ straightLineDistanceEstimate() [1/2]

ATH_FLATTEN Trk::DistanceSolution Trk::CylinderSurface::straightLineDistanceEstimate ( const Amg::Vector3D pos,
const Amg::Vector3D dir 
) const
overridevirtualinherited

fast distance to Surface

distance to surface

Implements Trk::Surface.

Reimplemented in Trk::SlidingCylinderSurface.

Definition at line 377 of file CylinderSurface.cxx.

380 {
381  double tol = 0.001;
382 
383  const Amg::Vector3D& X = center(); // point
384  const Amg::Vector3D& S = normal(); // vector
385 
386  double radius = bounds().r();
387  double sp = pos.dot(S);
388  double sc = X.dot(S);
389  double dp = dir.dot(S);
390  Amg::Vector3D dx = X - pos - (sc - sp) * S; // vector
391  Amg::Vector3D ax = dir - dp * S; // vector
392 
393  double A = ax.dot(ax); // size of projected direction (squared)
394  double B = ax.dot(dx); // dot product (->cos angle)
395  double C = dx.dot(dx); // distance to axis (squared)
396  double currDist = radius - sqrt(C);
397 
398  if (A == 0.) { // direction parallel to cylinder axis
399  if (fabs(currDist) < tol) {
400  return {1, 0., true, 0.}; // solution at surface
401  }
402  return {
403  0, currDist, true, 0.}; // point of closest approach without intersection
404  }
405 
406  // minimal distance to cylinder axis
407  // The [[maybe_unused]] declaration is to suppress redundant division checking
408  // here. Even a tiny change in rmin (~1e-13) can cause huge changes in the
409  // reconstructed output, so don't change how it's evaluated.
410  [[maybe_unused]] const double rmin_tmp = B * B / A;
411  const double rmin2 = C - rmin_tmp;
412  const double rmin = rmin2 < 0 ? 0 : sqrt(rmin2);
413 
414  if (rmin > radius) { // no intersection
415  double first = B / A;
416  return {
417  0,
418  currDist,
419  true,
420  first}; // point of closest approach without intersection
421  }
422  if (fabs(rmin - radius) <
423  tol) { // tangential 'intersection' - return double solution
424  double first = B / A;
425  return {2, currDist, true, first, first};
426  }
427  // The [[maybe_unused]] declaration here suppresses redundant division
428  // checking. We don't want to rewrite how this is evaluated due to
429  // instabilities.
430  [[maybe_unused]] const double b_a = B / A;
431  const double x = sqrt((radius - rmin) * (radius + rmin) / A);
432  double first = b_a - x;
433  double second = b_a + x;
434  if (first >= 0.) {
435  return {2, currDist, true, first, second};
436  }
437  if (second <= 0.) {
438  return {2, currDist, true, second, first};
439  } // inside cylinder
440  return {2, currDist, true, second, first};
441 }

◆ straightLineDistanceEstimate() [2/2]

Trk::DistanceSolution Trk::CylinderSurface::straightLineDistanceEstimate ( const Amg::Vector3D pos,
const Amg::Vector3D dir,
bool  bound 
) const
overridevirtualinherited

fast distance to Surface - with bounds directive

Implements Trk::Surface.

Reimplemented in Trk::SlidingCylinderSurface.

Definition at line 444 of file CylinderSurface.cxx.

447 {
448  const double tolb = .01;
449 
450  const Amg::Transform3D& T = transform();
451  // double Ax[3] = {T.xx(),T.yx(),T.zx()};
452  // double Ay[3] = {T.xy(),T.yy(),T.zy()};
453  // double Az[3] = {T.xz(),T.yz(),T.zz()};
454 
455  // Transformation to cylinder system coordinates
456  //
457 
458  // BEGIN here is what i guess this might mean: BEGIN
459  Amg::Vector3D Ax = T.rotation().col(0);
460  Amg::Vector3D Ay = T.rotation().col(1);
461  Amg::Vector3D Az = T.rotation().col(2);
462 
463  Amg::Vector3D dxyz = pos - T.translation();
464  double x = dxyz.dot(Ax);
465  double y = dxyz.dot(Ay);
466  double z = dxyz.dot(Az);
467  double ax = dir.dot(Ax);
468  double ay = dir.dot(Ay);
469  double at = ax * ax + ay * ay;
470  double r = sqrt(x * x + y * y);
471  double R = bounds().r();
472 
473  // END here is what i guessed this means END
474 
475  // double dx = pos[0]-T.dx() ;
476  // double dy = pos[1]-T.dy() ;
477  // double dz = pos[2]-T.dz() ;
478  // double x = dx*Ax[0]+dy*Ax[1]+dz*Ax[2] ;
479  // double y = dx*Ay[0]+dy*Ay[1]+dz*Ay[2] ;
480  // double z = dx*Az[0]+dy*Az[1]+dz*Az[2] ;
481  // double ax = dir[0]*Ax[0]+dir[1]*Ax[1]+dir[2]*Ax[2];
482  // double ay = dir[0]*Ay[0]+dir[1]*Ay[1]+dir[2]*Ay[2];
483  // double at = ax*ax+ay*ay ;
484  // double r = sqrt(x*x+y*y) ;
485  // double R = bounds().r() ;
486 
487  // Step to surface
488  //
489  int ns = 0;
490  double s1 = 0.;
491  double s2 = 0.;
492 
493  if (at != 0.) {
494 
495  const double inv_at = 1. / at;
496  double A = -(ax * x + ay * y) * inv_at;
497  double B = A * A + (R - r) * (R - r) * inv_at;
498 
499  if (B >= 0.) {
500 
501  B = sqrt(B);
502  if (B > tolb) {
503  if (A > 0.) {
504  s1 = A - B;
505  s2 = A + B;
506  } else {
507  s1 = A + B;
508  s2 = A - B;
509  }
510  ns = 2;
511  } else {
512  s1 = A;
513  ns = 1;
514  }
515  }
516  }
517  double sr = r - R;
518  if (!bound)
519  return {ns, fabs(sr), true, s1, s2};
520 
521  // Min distance to surface
522  //
523  Amg::Vector2D lp(atan2(y, x) * R, 0.);
524 
525  double d = bounds().minDistance(lp);
526  double sz = fabs(z) - bounds().halflengthZ();
527  if (sz <= 0.)
528  sz = 0.;
529  double dist = sr * sr + sz * sz;
530  if (d > 0.)
531  dist += ((d * d) * (sr / R + 1.));
532 
533  return {ns, sqrt(dist), true, s1, s2};
534 }

◆ straightLineIntersection() [1/2]

Trk::Intersection Trk::CylinderSurface::straightLineIntersection ( const Amg::Vector3D pos,
const Amg::Vector3D dir,
bool  forceDir = false,
Trk::BoundaryCheck  bchk = false 
) const
finaloverridevirtualinherited

fast straight line intersection schema - provides closest intersection and (signed) path length

mathematical motivation:

The calculation will be done in the 3-dim frame of the cylinder, i.e. the symmetry axis of the cylinder is the z-axis, x- and y-axis are perpenticular to the the z-axis. In this frame the cylinder is centered around the origin. Therefore the two points describing the line have to be first recalculated into the new frame. Suppose, this is done, the intersection is straight forward:
may \(p_{1}=(p_{1x}, p_{1y}, p_{1z}), p_{2}=(p_{2x}, p_{2y}, p_{2z}) \)@_fakenlthe two points describing the 3D-line, then the line in the \(x-y\)plane can be written as \(y=kx+d\), where \(k =\frac{p_{2y}-p_{1y}}{p_{2x}-p_{1x}}\)such as \(d=\frac{p_{2x}p_{1y}-p_{1x}p_{2y}}{p_{2x}-p_{1x}},\)
and intersects with the corresponding circle \(x^{2}+y^{2} = R^{2}. \)
The solutions can then be found by a simple quadratic equation and reinsertion into the line equation.

Implements Trk::Surface.

Definition at line 277 of file CylinderSurface.cxx.

281 {
282  bool needsTransform = m_transforms || m_associatedDetElement;
283  // create the hep points
284  Amg::Vector3D point1 = pos;
285  Amg::Vector3D direction = dir;
286  if (needsTransform) {
288  point1 = invTrans * pos;
289  direction = invTrans.linear() * dir;
290  }
291  // the bounds radius
292  double R = bounds().r();
293  double t1 = 0.;
294  double t2 = 0.;
295  if (direction.x()) {
296  // get line and circle constants
297  double idirx = 1. / direction.x();
298  double k = direction.y() * idirx;
299  double d = point1.y() - point1.x() * k;
300  // and solve the qaudratic equation
301  Trk::RealQuadraticEquation pquad(1 + k * k, 2 * k * d, d * d - R * R);
302  if (pquad.solutions != Trk::none) {
303  // the solutions in the 3D frame of the cylinder
304  t1 = (pquad.first - point1.x()) * idirx;
305  t2 = (pquad.second - point1.x()) * idirx;
306  } else // bail out if no solution exists
307  return {pos, 0., false};
308  } else if (direction.y()) {
309  // x value is the one of point1
310  // x^2 + y^2 = R^2
311  // y = sqrt(R^2-x^2)
312  double x = point1.x();
313  double r2mx2 = R * R - x * x;
314  // bail out if no solution
315  if (r2mx2 < 0.)
316  return {pos, 0., false};
317  double y = sqrt(r2mx2);
318  // assign parameters and solutions
319  double idiry = 1. / direction.y();
320  t1 = (y - point1.y()) * idiry;
321  t2 = (-y - point1.y()) * idiry;
322  } else {
323  return {pos, 0., false};
324  }
325  Amg::Vector3D sol1raw(point1 + t1 * direction);
326  Amg::Vector3D sol2raw(point1 + t2 * direction);
327  // now reorder and return
328  Amg::Vector3D solution(0, 0, 0);
329  double path = 0.;
330 
331  // first check the validity of the direction
332  bool isValid = true;
333 
334  // both solutions are of same sign, take the smaller, but flag as false if not
335  // forward
336  if (t1 * t2 > 0 || !forceDir) {
337  // asign validity
338  isValid = forceDir ? (t1 > 0.) : true;
339  // assign the right solution
340  if (t1 * t1 < t2 * t2) {
341  solution = sol1raw;
342  path = t1;
343  } else {
344  solution = sol2raw;
345  path = t2;
346  }
347  } else {
348  if (t1 > 0.) {
349  solution = sol1raw;
350  path = t1;
351  } else {
352  solution = sol2raw;
353  path = t2;
354  }
355  }
356  // the solution is still in the local 3D frame, direct check
357  isValid =
358  bchk ? (isValid && m_bounds->inside3D(solution,
361  : isValid;
362 
363  // now return
364  return needsTransform ? Intersection(transform() * solution, path, isValid)
365  : Intersection(solution, path, isValid);
366 }

◆ straightLineIntersection() [2/2]

template<class T >
Intersection Trk::Surface::straightLineIntersection ( const T &  pars,
bool  forceDir = false,
const Trk::BoundaryCheck bchk = false 
) const
inlineinherited

fst straight line intersection schema - templated for charged and neutral parameters

Definition at line 351 of file Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h.

355  {
357  pars.position(), pars.momentum().unit(), forceDir, bchk);
358  }

◆ subtractedVolume()

SharedObject<AreaExcluder> Trk::SubtractedCylinderSurface::subtractedVolume ( ) const
inherited

This method allows access to the subtracted part.

◆ surfaceRepresentation() [1/2]

template<class Tvol >
virtual const Surface& Trk::BoundarySubtractedCylinderSurface< Tvol >::surfaceRepresentation ( ) const
finaloverridevirtual

The Surface Representation of this.

Implements Trk::BoundarySurface< Tvol >.

◆ surfaceRepresentation() [2/2]

template<class Tvol >
virtual Surface& Trk::BoundarySubtractedCylinderSurface< Tvol >::surfaceRepresentation ( )
finaloverridevirtual

◆ transform()

const Amg::Transform3D& Trk::Surface::transform ( ) const
inherited

Returns HepGeom::Transform3D by reference.

◆ type()

constexpr virtual SurfaceType Trk::CylinderSurface::type ( ) const
constexprfinaloverridevirtualinherited

Return the surface type.

Implements Trk::Surface.

◆ uniqueClone()

std::unique_ptr<Surface> Trk::Surface::uniqueClone ( ) const
inherited

NVI method returning unique_ptr clone.

Member Data Documentation

◆ m_associatedDetElement

const TrkDetElementBase* Trk::Surface::m_associatedDetElement {}
protectedinherited

Not owning Pointer to the TrkDetElementBase.

Definition at line 439 of file Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h.

◆ m_associatedDetElementId

Identifier Trk::Surface::m_associatedDetElementId {}
protectedinherited

◆ m_associatedLayer

const Layer* Trk::Surface::m_associatedLayer {}
protectedinherited

The associated layer Trk::Layer.

  • layer in which the Surface is embedded (not owning pointed)

Definition at line 448 of file Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h.

◆ m_bounds

SharedObject<const CylinderBounds> Trk::CylinderSurface::m_bounds
protectedinherited

The global reference point (== a point on the surface)

Definition at line 290 of file CylinderSurface.h.

◆ m_insideVolume

template<class Tvol >
const Tvol* Trk::BoundarySurface< Tvol >::m_insideVolume
protectedinherited

Definition at line 118 of file BoundarySurface.h.

◆ m_insideVolumeArray

template<class Tvol >
SharedObject<VolumeArray> Trk::BoundarySurface< Tvol >::m_insideVolumeArray
protectedinherited

Definition at line 120 of file BoundarySurface.h.

◆ m_materialLayer

std::shared_ptr<Layer> Trk::Surface::m_materialLayer {}
protectedinherited

Possibility to attach a material descrption.

  • potentially given as the associated material layer (not owning pointer)

Definition at line 453 of file Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h.

◆ m_outsideVolume

template<class Tvol >
const Tvol* Trk::BoundarySurface< Tvol >::m_outsideVolume
protectedinherited

Definition at line 119 of file BoundarySurface.h.

◆ m_outsideVolumeArray

template<class Tvol >
SharedObject<VolumeArray> Trk::BoundarySurface< Tvol >::m_outsideVolumeArray
protectedinherited

Definition at line 121 of file BoundarySurface.h.

◆ m_owner

SurfaceOwner Trk::Surface::m_owner {SurfaceOwner::noOwn}
protectedinherited

enum for surface owner : 0 free surface

Definition at line 455 of file Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h.

◆ m_referencePoint

CxxUtils::CachedUniquePtr<Amg::Vector3D> Trk::CylinderSurface::m_referencePoint
protectedinherited

The rotational symmetry axis.

Definition at line 292 of file CylinderSurface.h.

◆ m_rotSymmetryAxis

CxxUtils::CachedUniquePtr<Amg::Vector3D> Trk::CylinderSurface::m_rotSymmetryAxis
protectedinherited

Definition at line 294 of file CylinderSurface.h.

◆ m_shared

bool Trk::SubtractedCylinderSurface::m_shared
protectedinherited

Definition at line 78 of file SubtractedCylinderSurface.h.

◆ m_subtrVol

SharedObject<AreaExcluder> Trk::SubtractedCylinderSurface::m_subtrVol
protectedinherited

Definition at line 77 of file SubtractedCylinderSurface.h.

◆ m_transforms

std::unique_ptr<Transforms> Trk::Surface::m_transforms {}
protectedinherited

◆ s_numberOfInstantiations

std::atomic_size_t Trk::ObjectCounter< Trk::Surface >::s_numberOfInstantiations
inlinestaticinherited

Definition at line 22 of file TrkObjectCounter.h.

◆ s_onSurfaceTolerance

constexpr double Trk::Surface::s_onSurfaceTolerance = 10e-5
staticconstexprprotectedinherited

Tolerance for being on Surface.

Definition at line 458 of file Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h.

◆ staticType

constexpr SurfaceType Trk::CylinderSurface::staticType = SurfaceType::Cylinder
staticconstexprinherited

The surface type static constexpr.

Definition at line 59 of file CylinderSurface.h.


The documentation for this class was generated from the following file:
Trk::CylinderBounds::minDistance
virtual double minDistance(const Amg::Vector2D &pos) const override final
Minimal distance to boundary ( > 0 if outside and <=0 if inside)
Definition: CylinderBounds.cxx:62
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
Trk::Surface::m_associatedDetElement
const TrkDetElementBase * m_associatedDetElement
Not owning Pointer to the TrkDetElementBase.
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:439
Trk::y
@ y
Definition: ParamDefs.h:62
beamspotman.r
def r
Definition: beamspotman.py:676
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
Trk::SubtractedCylinderSurface::shared
bool shared() const
This method indicates the subtraction mode.
TileDCSDataPlotter.dp
dp
Definition: TileDCSDataPlotter.py:840
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
Trk::CylinderSurface::operator==
virtual bool operator==(const Surface &sf) const override
Equality operator.
Definition: CylinderSurface.cxx:179
fitman.sz
sz
Definition: fitman.py:527
Trk::Surface::associatedDetectorElement
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
Trk::BoundarySurface::m_insideVolumeArray
SharedObject< VolumeArray > m_insideVolumeArray
Definition: BoundarySurface.h:120
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:126
Trk::Surface::name
virtual std::string name() const =0
Return properly formatted class name.
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:63
fitman.ax
ax
Definition: fitman.py:522
IDTPM::R
float R(const U &p)
Definition: TrackParametersHelper.h:101
PlotCalibFromCool.zAxis
zAxis
Definition: PlotCalibFromCool.py:76
Trk::Surface::straightLineIntersection
Intersection straightLineIntersection(const T &pars, bool forceDir=false, const Trk::BoundaryCheck &bchk=false) const
fst straight line intersection schema - templated for charged and neutral parameters
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:351
Trk::SubtractedCylinderSurface
Definition: SubtractedCylinderSurface.h:33
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
hist_file_dump.d
d
Definition: hist_file_dump.py:137
Trk::locRPhi
@ locRPhi
Definition: ParamDefs.h:46
DMTest::C
C_v1 C
Definition: C.h:26
ALFA_EventTPCnv_Dict::t1
std::vector< ALFA_RawDataCollection_p1 > t1
Definition: ALFA_EventTPCnvDict.h:43
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
Trk::none
@ none
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:21
bound
@ bound
Definition: L1CaloPprPlotManager.h:74
Trk::CylinderSurface::bounds
virtual const CylinderBounds & bounds() const override final
This method returns the CylinderBounds by reference (NoBounds is not possible for cylinder)
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:214
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
JetTiledMap::S
@ S
Definition: TiledEtaPhiMap.h:44
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
Trk::Surface::inverseTransformMultHelper
Amg::Vector3D inverseTransformMultHelper(const Amg::Vector3D &glopos) const
dqt_zlumi_alleff_HIST.A
A
Definition: dqt_zlumi_alleff_HIST.py:110
Trk::TrkDetElementBase::detectorTypeString
std::string detectorTypeString() const
Returns a string of the Detector element type.
Definition: TrkDetElementBase.cxx:10
skel.l2
l2
Definition: skel.GENtoEVGEN.py:426
Trk::Surface::m_transforms
std::unique_ptr< Transforms > m_transforms
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:436
Trk::BoundarySurface::surfaceRepresentation
virtual const Surface & surfaceRepresentation() const =0
The Surface Representation of this.
Trk::Surface::s_onSurfaceTolerance
static constexpr double s_onSurfaceTolerance
Tolerance for being on Surface.
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:458
python.SystemOfUnits.sr
int sr
Definition: SystemOfUnits.py:113
Trk::locZ
@ locZ
local cylindrical
Definition: ParamDefs.h:48
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
Trk::CylinderSurface::m_bounds
SharedObject< const CylinderBounds > m_bounds
The global reference point (== a point on the surface)
Definition: CylinderSurface.h:290
Trk::theta
@ theta
Definition: ParamDefs.h:72
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
xAOD::rotation
rotation
Definition: TrackSurface_v1.cxx:15
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Trk::Surface::normal
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
Trk::RealQuadraticEquation
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:52
Trk::CylinderSurface::m_referencePoint
CxxUtils::CachedUniquePtr< Amg::Vector3D > m_referencePoint
The rotational symmetry axis.
Definition: CylinderSurface.h:292
Trk::SubtractedCylinderSurface::SubtractedCylinderSurface
SubtractedCylinderSurface()
Default Constructor - needed for persistency.
Definition: SubtractedCylinderSurface.cxx:16
Trk::Surface::inverseTransformHelper
Amg::Transform3D inverseTransformHelper() const
Helper method to factorize in one place common operations calculate inverse transofrm and multiply wi...
beamspotman.dir
string dir
Definition: beamspotman.py:623
Trk::BoundarySurface::m_outsideVolumeArray
SharedObject< VolumeArray > m_outsideVolumeArray
Definition: BoundarySurface.h:121
Trk::Surface::bounds
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
charge
double charge(const T &p)
Definition: AtlasPID.h:494
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
Trk::Surface::insideBounds
virtual bool insideBounds(const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const =0
virtual methods to be overwritten by the inherited surfaces
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
query_example.col
col
Definition: query_example.py:7
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::CylinderSurface::m_rotSymmetryAxis
CxxUtils::CachedUniquePtr< Amg::Vector3D > m_rotSymmetryAxis
Definition: CylinderSurface.h:294
Trk::inside
@ inside
Definition: PropDirection.h:29
ALFA_EventTPCnv_Dict::t2
std::vector< ALFA_RawDataContainer_p1 > t2
Definition: ALFA_EventTPCnvDict.h:44
Trk::ObjectCounter< Trk::Surface >::s_numberOfInstantiations
static std::atomic_size_t s_numberOfInstantiations
Definition: TrkObjectCounter.h:22
Trk::Surface::globalToLocal
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const =0
Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean chec...
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
Amg::RotationMatrix3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Definition: GeoPrimitives.h:49
DeMoScan.first
bool first
Definition: DeMoScan.py:534
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
Trk::Surface::onSurface
bool onSurface(const T &parameters, const BoundaryCheck &bchk=BoundaryCheck(true)) const
The templated Parameters OnSurface method - checks on surface pointer first.
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
Trk::outside
@ outside
Definition: PropDirection.h:29
Trk::phi
@ phi
Definition: ParamDefs.h:81
skel.l1
l1
Definition: skel.GENtoEVGEN.py:425
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Trk::x
@ x
Definition: ParamDefs.h:61
Trk::CylinderBounds::averagePhi
double averagePhi() const
This method returns the average phi.
Trk::Surface::transform
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Trk::BoundarySurface::m_outsideVolume
const Tvol * m_outsideVolume
Definition: BoundarySurface.h:119
Trk::BoundarySurface::m_insideVolume
const Tvol * m_insideVolume
Definition: BoundarySurface.h:118
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
fitman.k
k
Definition: fitman.py:528
Trk::CylinderBounds::halflengthZ
double halflengthZ() const
This method returns the halflengthZ.
Trk::CylinderBounds::r
virtual double r() const override final
This method returns the radius.
fitman.ay
ay
Definition: fitman.py:525