9 #include "Pandora/AlgorithmHeaders.h" 20 DeltaRaySplittingAlgorithm::DeltaRaySplittingAlgorithm() :
22 m_maxTransverseDisplacement(1.5
f),
23 m_maxLongitudinalDisplacement(10.
f),
24 m_minCosRelativeAngle(0.985
f)
31 CartesianVector &principalStartPosition, CartesianVector &branchSplitPosition, CartesianVector &branchSplitDirection)
const 39 for (
unsigned int principalForward = 0; principalForward < 2; ++principalForward)
41 const CartesianVector principalVertex(
43 const CartesianVector principalEnd(
51 for (
unsigned int branchForward = 0; branchForward < 2; ++branchForward)
53 const CartesianVector branchVertex(
55 const CartesianVector branchEnd(
57 const CartesianVector branchDirection(
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.5
f *
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);
103 CartesianVector truncatedPosition(0.
f, 0.
f, 0.
f);
104 CartesianVector forwardDirection(0.
f, 0.
f, 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;
134 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
141 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"StepSize",
m_stepSize));
143 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
146 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
149 PANDORA_RETURN_RESULT_IF_AND_IF(
150 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinCosRelativeAngle",
m_minCosRelativeAngle));
static void GetImpactParameters(const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
Calculate impact parameters between a pair of pointing vertices.
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.
float GetLayerFitHalfWindowLength() const
Get the layer fit half window length.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::CartesianVector GetGlobalMinLayerDirection() const
Get global direction corresponding to the fit result in minimum fit layer.
Header file for the delta ray splitting algorithm class.
pandora::StatusCode GetGlobalFitPosition(const float rL, pandora::CartesianVector &position) const
Get global fit position for a given longitudinal coordinate.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
const pandora::Cluster * GetCluster() const
Get the address of the cluster, if originally provided.
pandora::StatusCode GetGlobalFitDirection(const float rL, pandora::CartesianVector &direction) const
Get global fit direction for a given longitudinal coordinate.
float m_maxLongitudinalDisplacement
pandora::CartesianVector GetGlobalMaxLayerDirection() const
Get global direction corresponding to the fit result in maximum fit layer.
float m_maxTransverseDisplacement
float m_minCosRelativeAngle
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
pandora::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
TwoDSlidingFitResult class.
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.