Use sliding fit results to calculate intersections of clusters.
70 ClusterList clusterList;
71 for (
const auto &mapEntry : slidingFitResultMap)
72 clusterList.push_back(mapEntry.first);
75 for (
const Cluster *
const pCluster1 : clusterList)
77 const TwoDSlidingFitResult &slidingFitResult1(slidingFitResultMap.at(pCluster1));
79 for (
const Cluster *
const pCluster2 : clusterList)
81 if (pCluster1 == pCluster2)
84 const TwoDSlidingFitResult &slidingFitResult2(slidingFitResultMap.at(pCluster2));
88 const LArPointingCluster pointingCluster(slidingFitResult2);
91 const CartesianVector innerPosition(pointingCluster.GetInnerVertex().GetPosition());
92 const CartesianVector outerPosition(pointingCluster.GetOuterVertex().GetPosition());
95 const bool useInner((innerDisplacement < outerDisplacement) ?
true :
false);
97 const LArPointingCluster::Vertex &clusterVertex = (useInner ? pointingCluster.GetInnerVertex() : pointingCluster.GetOuterVertex());
99 float rL2(0.
f), rT2(0.
f);
100 CartesianVector intersectPosition2(0.
f, 0.
f, 0.
f);
106 catch (
const StatusCodeException &)
115 float rL1(0.
f), rT1(0.
f);
116 CartesianVector projectedPosition1(0.
f, 0.
f, 0.
f), projectedDirection1(0.
f, 0.
f, 0.
f);
117 slidingFitResult1.GetLocalPosition(intersectPosition2, rL1, rT1);
119 const StatusCode statusCodePosition(slidingFitResult1.GetGlobalFitPosition(rL1, projectedPosition1));
120 if (STATUS_CODE_SUCCESS != statusCodePosition)
121 throw pandora::StatusCodeException(statusCodePosition);
123 const StatusCode statusCodeDirection(slidingFitResult1.GetGlobalFitDirection(rL1, projectedDirection1));
124 if (STATUS_CODE_SUCCESS != statusCodeDirection)
125 throw pandora::StatusCodeException(statusCodeDirection);
127 const CartesianVector projectedPosition2(clusterVertex.GetPosition());
128 const CartesianVector projectedDirection2(clusterVertex.GetDirection());
131 float firstDisplacement(0.
f), secondDisplacement(0.
f);
132 CartesianVector intersectPosition1(0.
f, 0.
f, 0.
f);
137 projectedDirection2, intersectPosition1, firstDisplacement, secondDisplacement);
139 catch (
const StatusCodeException &)
148 if (
std::max(closestDisplacement1, closestDisplacement2) > m_maxClusterSeparation)
151 const CartesianVector minPosition(slidingFitResult1.GetGlobalMinLayerPosition());
152 const CartesianVector maxPosition(slidingFitResult1.GetGlobalMaxLayerPosition());
153 const float lengthSquared((maxPosition - minPosition).GetMagnitudeSquared());
155 const float minDisplacementSquared((minPosition - intersectPosition1).GetMagnitudeSquared());
156 const float maxDisplacementSquared((maxPosition - intersectPosition1).GetMagnitudeSquared());
159 std::max(minDisplacementSquared, maxDisplacementSquared) > lengthSquared)
162 clusterIntersectionMap[pCluster1].push_back(intersectPosition1);
164 catch (StatusCodeException &statusCodeException)
166 if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
167 throw statusCodeException;
static bool SortByNHits(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by number of hits, then layer span, then inner layer, then position, then pulse-height.
float m_maxClusterSeparation
static void GetIntersection(const LArPointingCluster::Vertex &firstVertex, const LArPointingCluster::Vertex &secondVertex, pandora::CartesianVector &intersectPosition, float &firstDisplacement, float &secondDisplacement)
Get intersection of two vertices.
static int max(int a, int b)
float m_minVertexDisplacement
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.