Public Member Functions | Private Attributes | List of all members
lar_content::TrackRefinementBaseAlgorithm::SortByDistanceAlongLine Class Reference

SortByDistanceAlongLine class. More...

#include <TrackRefinementBaseAlgorithm.h>

Public Member Functions

 SortByDistanceAlongLine (const pandora::CartesianVector &startPoint, const pandora::CartesianVector &lineDirection, const bool hitWidthMode)
 Constructor. More...
 
bool operator() (const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs) const
 Sort hits by their projected distance along a line from a start point. More...
 

Private Attributes

pandora::CartesianVector m_startPoint
 The line start point. More...
 
pandora::CartesianVector m_lineDirection
 The line end point. More...
 
bool m_hitWidthMode
 Wether to consider hit widths or not. More...
 

Detailed Description

SortByDistanceAlongLine class.

Definition at line 36 of file TrackRefinementBaseAlgorithm.h.

Constructor & Destructor Documentation

lar_content::TrackRefinementBaseAlgorithm::SortByDistanceAlongLine::SortByDistanceAlongLine ( const pandora::CartesianVector &  startPoint,
const pandora::CartesianVector &  lineDirection,
const bool  hitWidthMode 
)
inline

Constructor.

Parameters
startPointthe line start point
lineDirectionthe line direction unit vector
hitWidthModewhether to consider hit widths or not

Definition at line 323 of file TrackRefinementBaseAlgorithm.h.

324  :
325  m_startPoint(startPoint),
326  m_lineDirection(lineDirection.GetUnitVector()),
327  m_hitWidthMode(hitWidthMode)
328 {
329 }

Member Function Documentation

bool lar_content::TrackRefinementBaseAlgorithm::SortByDistanceAlongLine::operator() ( const pandora::CaloHit *const  pLhs,
const pandora::CaloHit *const  pRhs 
) const

Sort hits by their projected distance along a line from a start point.

Parameters
pLhsthe address of the first hit
pRhsthe address of the second hit
Returns
whether lhs hit has a smaller projected distance along the line than rhs hit

Definition at line 871 of file TrackRefinementBaseAlgorithm.cc.

872 {
873  const CartesianVector lhsHitPosition(
875 
876  const CartesianVector rhsHitPosition(
878 
879  const float lhsLongitudinal = m_lineDirection.GetDotProduct(lhsHitPosition - m_startPoint);
880  const float rhsLongitudinal = m_lineDirection.GetDotProduct(rhsHitPosition - m_startPoint);
881 
882  if (std::fabs(lhsLongitudinal - rhsLongitudinal) > std::numeric_limits<float>::epsilon())
883  {
884  // ATTN: Order from closest to furthest away
885  return (lhsLongitudinal < rhsLongitudinal);
886  }
887 
888  // ATTN: To deal with tiebreaks
889  return LArClusterHelper::SortHitsByPulseHeight(pLhs, pRhs);
890 }
static bool SortHitsByPulseHeight(const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
Sort calo hits by their pulse height.
static pandora::CartesianVector GetClosestPointToLine2D(const pandora::CartesianVector &lineStart, const pandora::CartesianVector &lineDirection, const pandora::CaloHit *const pCaloHit)
Consider the hit width to find the closest position of a calo hit to a specified line.

Member Data Documentation

bool lar_content::TrackRefinementBaseAlgorithm::SortByDistanceAlongLine::m_hitWidthMode
private

Wether to consider hit widths or not.

Definition at line 61 of file TrackRefinementBaseAlgorithm.h.

pandora::CartesianVector lar_content::TrackRefinementBaseAlgorithm::SortByDistanceAlongLine::m_lineDirection
private

The line end point.

Definition at line 60 of file TrackRefinementBaseAlgorithm.h.

pandora::CartesianVector lar_content::TrackRefinementBaseAlgorithm::SortByDistanceAlongLine::m_startPoint
private

The line start point.

Definition at line 59 of file TrackRefinementBaseAlgorithm.h.


The documentation for this class was generated from the following files: