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)
48 for (
unsigned int branchForward = 0; branchForward < 2; ++branchForward)
55 const float vertex_to_vertex((principalVertex - branchVertex).GetMagnitudeSquared());
56 const float vertex_to_end((principalVertex - branchEnd).GetMagnitudeSquared());
57 const float end_to_vertex((principalEnd - branchVertex).GetMagnitudeSquared());
58 const float end_to_end((principalEnd - branchEnd).GetMagnitudeSquared());
61 const float vertexProjection(+branchDirection.GetDotProduct(principalVertex - branchVertex));
62 const float cosRelativeAngle(-branchDirection.GetDotProduct(principalDirection));
64 if (vertex_to_vertex >
std::min(end_to_end,
std::min(vertex_to_end, end_to_vertex)))
67 if (end_to_end <
std::max(vertex_to_vertex,
std::max(vertex_to_end, end_to_vertex)))
73 if (cosRelativeAngle < 0.
f)
77 bool foundSplit(
false);
80 const float deltaL(1==branchForward ? +halfWindowLength : -halfWindowLength);
88 const CartesianVector linearProjection(branchVertex + branchDirection * branchDistance);
93 if ((linearProjection - branchVertex).GetMagnitudeSquared() > (linearProjection - branchEnd).GetMagnitudeSquared())
96 float localL(0.
f), localT(0.
f);
97 CartesianVector truncatedPosition(0.
f,0.
f,0.
f);
98 CartesianVector forwardDirection(0.
f,0.
f,0.
f);
101 if ((STATUS_CODE_SUCCESS != branchSlidingFit.
GetGlobalFitPosition(localL, truncatedPosition)) ||
107 CartesianVector truncatedDirection(1==branchForward ? forwardDirection : forwardDirection * -1.
f);
108 const float cosTheta(-truncatedDirection.GetDotProduct(principalDirection));
110 float rT1(0.
f), rL1(0.
f), rT2(0.
f), rL2(0.
f);
117 principalStartPosition = principalVertex;
118 branchSplitPosition = truncatedPosition;
119 branchSplitDirection = truncatedDirection * -1.f;
128 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
135 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
138 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
141 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
144 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
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.