LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 870 of file TrackRefinementBaseAlgorithm.cc.

References lar_content::LArHitWidthHelper::GetClosestPointToLine2D(), lar_content::TrackRefinementBaseAlgorithm::m_hitWidthMode, and lar_content::LArClusterHelper::SortHitsByPulseHeight().

871 {
872  const CartesianVector lhsHitPosition(
874 
875  const CartesianVector rhsHitPosition(
877 
878  const float lhsLongitudinal = m_lineDirection.GetDotProduct(lhsHitPosition - m_startPoint);
879  const float rhsLongitudinal = m_lineDirection.GetDotProduct(rhsHitPosition - m_startPoint);
880 
881  if (std::fabs(lhsLongitudinal - rhsLongitudinal) > std::numeric_limits<float>::epsilon())
882  {
883  // ATTN: Order from closest to furthest away
884  return (lhsLongitudinal < rhsLongitudinal);
885  }
886 
887  // ATTN: To deal with tiebreaks
888  return LArClusterHelper::SortHitsByPulseHeight(pLhs, pRhs);
889 }
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: