Output the best split positions in branch and replacement clusters.
39 for (
unsigned int principalForward = 0; principalForward < 2; ++principalForward)
41 const CartesianVector principalVertex(
42 1 == principalForward ? principalSlidingFit.GetGlobalMinLayerPosition() : principalSlidingFit.GetGlobalMaxLayerPosition());
43 const CartesianVector principalEnd(
44 1 == principalForward ? principalSlidingFit.GetGlobalMaxLayerPosition() : principalSlidingFit.GetGlobalMinLayerPosition());
45 const CartesianVector principalDirection(1 == principalForward ? principalSlidingFit.GetGlobalMinLayerDirection()
46 : principalSlidingFit.GetGlobalMaxLayerDirection() * -1.f);
51 for (
unsigned int branchForward = 0; branchForward < 2; ++branchForward)
53 const CartesianVector branchVertex(
54 1 == branchForward ? branchSlidingFit.GetGlobalMinLayerPosition() : branchSlidingFit.GetGlobalMaxLayerPosition());
55 const CartesianVector branchEnd(
56 1 == branchForward ? branchSlidingFit.GetGlobalMaxLayerPosition() : branchSlidingFit.GetGlobalMinLayerPosition());
57 const CartesianVector branchDirection(
58 1 == branchForward ? branchSlidingFit.GetGlobalMinLayerDirection() : branchSlidingFit.GetGlobalMaxLayerDirection() * -1.f);
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);
85 const float halfWindowLength(branchSlidingFit.GetLayerFitHalfWindowLength());
86 const float deltaL(1 == branchForward ? +halfWindowLength : -halfWindowLength);
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);
105 branchSlidingFit.GetLocalPosition(linearProjection, localL, localT);
107 if ((STATUS_CODE_SUCCESS != branchSlidingFit.GetGlobalFitPosition(localL, truncatedPosition)) ||
108 (STATUS_CODE_SUCCESS != branchSlidingFit.GetGlobalFitDirection(localL + deltaL, forwardDirection)))
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);
static void GetImpactParameters(const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
Calculate impact parameters between a pair of pointing vertices.
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
float m_maxLongitudinalDisplacement
float m_maxTransverseDisplacement
float m_minCosRelativeAngle
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.