39 for (
unsigned int principalForward = 0; principalForward < 2; ++principalForward)
51 for (
unsigned int branchForward = 0; branchForward < 2; ++branchForward)
61 const float vertex_to_vertex((principalVertex - branchVertex).GetMagnitudeSquared());
62 const float vertex_to_end((principalVertex - branchEnd).GetMagnitudeSquared());
63 const float end_to_vertex((principalEnd - branchVertex).GetMagnitudeSquared());
64 const float end_to_end((principalEnd - branchEnd).GetMagnitudeSquared());
67 const float vertexProjection(+branchDirection.GetDotProduct(principalVertex - branchVertex));
68 const float cosRelativeAngle(-branchDirection.GetDotProduct(principalDirection));
70 if (vertex_to_vertex > std::min(end_to_end, std::min(vertex_to_end, end_to_vertex)))
73 if (end_to_end < std::max(vertex_to_vertex, std::max(vertex_to_end, end_to_vertex)))
79 if (cosRelativeAngle < 0.f)
83 bool foundSplit(
false);
86 const float deltaL(1 == branchForward ? +halfWindowLength : -halfWindowLength);
88 float branchDistance(std::max(0.f, vertexProjection) + 0.5f *
m_stepSize);
94 const CartesianVector linearProjection(branchVertex + branchDirection * branchDistance);
99 if ((linearProjection - branchVertex).GetMagnitudeSquared() > (linearProjection - branchEnd).GetMagnitudeSquared())
102 float localL(0.f), localT(0.f);
107 if ((STATUS_CODE_SUCCESS != branchSlidingFit.
GetGlobalFitPosition(localL, truncatedPosition)) ||
113 CartesianVector truncatedDirection(1 == branchForward ? forwardDirection : forwardDirection * -1.f);
114 const float cosTheta(-truncatedDirection.
GetDotProduct(principalDirection));
116 float rT1(0.f), rL1(0.f), rT2(0.f), rL2(0.f);
123 principalStartPosition = principalVertex;
124 branchSplitPosition = truncatedPosition;
125 branchSplitDirection = truncatedDirection * -1.f;
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
DeltaRaySplittingAlgorithm()
Default constructor.
void FindBestSplitPosition(const TwoDSlidingFitResult &branchSlidingFit, const TwoDSlidingFitResult &replacementSlidingFit, pandora::CartesianVector &replacementStartPosition, pandora::CartesianVector &branchSplitPosition, pandora::CartesianVector &branchSplitDirection) const
Output the best split positions in branch and replacement clusters.
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.
static void GetImpactParameters(const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
Calculate impact parameters between a pair of pointing vertices.
TwoDSlidingFitResult class.
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
pandora::StatusCode GetGlobalFitPosition(const float rL, pandora::CartesianVector &position) const
Get global fit position for a given longitudinal coordinate.
pandora::CartesianVector GetGlobalMinLayerDirection() const
Get global direction corresponding to the fit result in minimum fit layer.
pandora::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
float GetLayerFitHalfWindowLength() const
Get the layer fit half window length.
pandora::StatusCode GetGlobalFitDirection(const float rL, pandora::CartesianVector &direction) const
Get global fit direction for a given longitudinal coordinate.
const pandora::Cluster * GetCluster() const
Get the address of the cluster, if originally provided.
pandora::CartesianVector GetGlobalMaxLayerDirection() const
Get global direction corresponding to the fit result in maximum fit layer.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.