15#ifndef TRKNIRVANA_TSOSCOMPARISONFUNCTION_H
16#define TRKNIRVANA_TSOSCOMPARISONFUNCTION_H
68 if ( ! (
one->trackParameters() ||
one->measurementOnTrack() ) ){
69 std::cout <<
"TrackStateOnSurfaceComparisonFunction: input TSOS one not sufficient" << std::endl;
72 if ( ! (
two->trackParameters() ||
two->measurementOnTrack() ) ){
73 std::cout <<
"TrackStateOnSurfaceComparisonFunction: input TSOS two not sufficient" << std::endl;
76 if (
one->trackParameters()){
77 gp1 =
one->trackParameters()->position();
78 surf1 = &
one->trackParameters()->associatedSurface();
79 if (!surf1 &&
one->measurementOnTrack() ) surf1 = &(
one->measurementOnTrack()->associatedSurface());
80 }
else if (
one->measurementOnTrack()){
81 gp1 =
one->measurementOnTrack()->globalPosition();
82 surf1 = &(
one->measurementOnTrack()->associatedSurface());
84 if (
two->trackParameters()){
85 gp2 =
two->trackParameters()->position();
86 surf2 = &
two->trackParameters()->associatedSurface();
87 if (!surf2 &&
two->measurementOnTrack() ) surf2 = &(
two->measurementOnTrack()->associatedSurface());
88 }
else if (
two->measurementOnTrack()) {
89 gp2 =
two->measurementOnTrack()->globalPosition();
90 surf2 = &(
two->measurementOnTrack()->associatedSurface());
100 if ( ! ( surf1 && surf2 ) ){
101 std::cout <<
"TrackStateOnSurfaceComparisonFunction: surface missing" << std::endl;
106 return path1 < path2;
120 switch (pSurface->
type()){
137 std::cout <<
"TrackStateOnSurfaceComparisonFunction: surface type error" << std::endl;
155 double denom = 1 - parallelity*parallelity;
156 return (std::abs(denom)>10e-7) ?
158 - trackToWire.dot(dirWire)*parallelity)/denom :
166 double denom = 1 - parallelity*parallelity;
167 return (std::abs(denom)>10e-7) ?
195 double k = (direc.y())/(direc.x());
196 double d = (point2.x()*point1.y() - point1.x()*point2.y())/(point2.x() - point1.x());
204 double q = d*d - R*R;
205 double discriminant = p*p - 4*
a*q;
206 if (discriminant<0) {
210 double x0 = -0.5*(p + (p>0 ? std::sqrt(discriminant) : -std::sqrt(discriminant)));
214 double t1 = (first - point1.x())/direc.x();
215 double t2 = (second - point1.x())/direc.x();
220 if ( dist1raw.mag() < dist2raw.mag() ) {
Scalar mag() const
mag method
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
virtual double r() const override final
This method returns the radius.
Class for a CylinderSurface in the ATLAS detector.
virtual const CylinderBounds & bounds() const override final
This method returns the CylinderBounds by reference (NoBounds is not possible for cylinder)
Class for a DiscSurface in the ATLAS detector.
Class describing the Line to which the Perigee refers to.
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
Class for a StraightLineSurface in the ATLAS detector to describe dirft tube and straw like detectors...
Abstract Base Class for tracking surfaces.
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
virtual constexpr SurfaceType type() const =0
Returns the Surface type to avoid dynamic casts.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
double pathIntersectWithPlane(const Trk::PlaneSurface *psf) const
TrackStateOnSurfaceComparisonFunction(double cradius)
Default Constructor, using a given radius.
double pathIntersectWithCylinder(const Trk::CylinderSurface *csf, const Amg::Vector3D &globalHit) const
double pathIntersectWithLine(const Trk::StraightLineSurface *lsf) const
double calculateAppropriatePath(const Trk::Surface *pSurface, const Amg::Vector3D gp) const
double pathIntersectWithLine(const Trk::PerigeeSurface *pgsf) const
const Amg::Vector3D m_point
TrackStateOnSurfaceComparisonFunction(const Amg::Vector3D &dir)
Simple relation definition using a 3d distance to the reference point.
TrackStateOnSurfaceComparisonFunction(const Amg::Vector3D &sp, const Amg::Vector3D &dir)
Full relation definition using a straight line propagation.
const Amg::Vector3D m_direction
const ComparisonMode m_mode
bool operator()(const Trk::TrackStateOnSurface *one, const Trk::TrackStateOnSurface *two) const
The comparison function defining in what case a PRD is 'smaller' than a second one.
double pathIntersectWithDisc(const Trk::DiscSurface *dsf) const
represents the track state (measurement, material, fit parameters and quality) at a surface.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
static const Amg::Vector3D s_zAxis(0, 0, 1)
global z Axis;