25 m_minClusterLength(5.f),
26 m_maxClusterSeparation(5.f),
27 m_minVertexDisplacement(2.f),
28 m_maxIntersectDisplacement(1.5f),
29 m_minSplitDisplacement(10.f)
37 for (ClusterList::const_iterator iter = pClusterList->begin(), iterEnd = pClusterList->end(); iter != iterEnd; ++iter)
39 const Cluster *
const pCluster = *iter;
44 clusterVector.push_back(pCluster);
71 for (
const auto &mapEntry : slidingFitResultMap)
72 clusterList.push_back(mapEntry.first);
75 for (
const Cluster *
const pCluster1 : clusterList)
79 for (
const Cluster *
const pCluster2 : clusterList)
81 if (pCluster1 == pCluster2)
95 const bool useInner((innerDisplacement < outerDisplacement) ?
true :
false);
99 float rL2(0.f), rT2(0.f);
115 float rL1(0.f), rT1(0.f);
116 CartesianVector projectedPosition1(0.f, 0.f, 0.f), projectedDirection1(0.f, 0.f, 0.f);
120 if (STATUS_CODE_SUCCESS != statusCodePosition)
124 if (STATUS_CODE_SUCCESS != statusCodeDirection)
128 const CartesianVector projectedDirection2(clusterVertex.GetDirection());
131 float firstDisplacement(0.f), secondDisplacement(0.f);
137 projectedDirection2, intersectPosition1, firstDisplacement, secondDisplacement);
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);
166 if (STATUS_CODE_FAILURE == statusCodeException.
GetStatusCode())
167 throw statusCodeException;
179 for (
const auto &mapEntry : clusterIntersectionMap)
180 clusterList.push_back(mapEntry.first);
183 for (
const Cluster *
const pCluster : clusterList)
187 if (inputPositionVector.empty())
190 TwoDSlidingFitResultMap::const_iterator sIter = slidingFitResultMap.find(pCluster);
191 if (slidingFitResultMap.end() == sIter)
197 for (CartesianPointVector::const_iterator pIter = inputPositionVector.begin(), pIterEnd = inputPositionVector.end(); pIter != pIterEnd; ++pIter)
200 float rL(0.f), rT(0.f);
207 if (trajectoryPointList.empty())
210 for (MyTrajectoryPointList::const_iterator qIter = trajectoryPointList.begin(), qIterEnd = trajectoryPointList.end(); qIter != qIterEnd; ++qIter)
213 sortedIntersectionMap[pCluster].push_back(clusterPosition);
223 for (
const auto &mapEntry : clusterIntersectionMap)
224 clusterList.push_back(mapEntry.first);
227 for (
const Cluster *
const pCluster : clusterList)
231 if (inputPositionVector.empty())
237 bool foundPrevPosition(
false);
240 for (CartesianPointVector::const_iterator pIter = inputPositionVector.begin(), pIterEnd = inputPositionVector.end(); pIter != pIterEnd; ++pIter)
244 if (foundPrevPosition)
246 const CartesianVector averagePosition((nextPosition + prevPosition) * 0.5f);
247 const float displacementSquared((nextPosition - prevPosition).GetMagnitudeSquared());
250 candidatePositionList.push_back(
MyTrajectoryPoint(displacementSquared, averagePosition));
253 prevPosition = nextPosition;
254 foundPrevPosition =
true;
257 if (candidatePositionList.empty())
263 bool foundPrevCandidate(
false);
266 for (MyTrajectoryPointList::const_iterator pIter = candidatePositionList.begin(), pIterEnd = candidatePositionList.end();
267 pIter != pIterEnd; ++pIter)
271 if (foundPrevCandidate)
277 clusterSplittingMap[pCluster].push_back(nextCandidate);
278 prevCandidate = nextCandidate;
279 foundPrevCandidate =
true;
288 if (lhs.first != rhs.first)
289 return (lhs.first < rhs.first);
291 return (lhs.second.GetMagnitudeSquared() > rhs.second.GetMagnitudeSquared());
Header file for the cluster helper class.
Header file for the lar pointing cluster class.
Header file for the overshoot splitting algorithm class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
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,...
static float GetLengthSquared(const pandora::Cluster *const pCluster)
Get length squared of cluster.
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.
const pandora::CartesianVector & GetPosition() const
Get the vertex position.
static void GetIntersection(const LArPointingCluster::Vertex &firstVertex, const LArPointingCluster::Vertex &secondVertex, pandora::CartesianVector &intersectPosition, float &firstDisplacement, float &secondDisplacement)
Get intersection of two vertices.
LArPointingCluster class.
const Vertex & GetInnerVertex() const
Get the inner vertex.
const Vertex & GetOuterVertex() const
Get the outer vertex.
float m_maxClusterSeparation
float m_minSplitDisplacement
std::pair< float, pandora::CartesianVector > MyTrajectoryPoint
void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &clusterVector) const
Populate cluster vector with subset of cluster list, containing clusters judged to be clean.
std::vector< MyTrajectoryPoint > MyTrajectoryPointList
void PopulateSplitPositionMap(const ClusterPositionMap &sortedIntersectionMap, ClusterPositionMap &clusterSplittingMap) const
Select split positions from sorted list of candidate positions.
void BuildIntersectionMap(const TwoDSlidingFitResultMap &slidingFitResultMap, ClusterPositionMap &clusterIntersectionMap) const
Use sliding fit results to calculate intersections of clusters.
void FindBestSplitPositions(const TwoDSlidingFitResultMap &slidingFitResultMap, ClusterPositionMap &clusterSplittingMap) const
Determine best split positions based on sliding fit result.
float m_maxIntersectDisplacement
OvershootSplittingAlgorithm()
Default constructor.
float m_minVertexDisplacement
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
static bool SortByHitProjection(const MyTrajectoryPoint &lhs, const MyTrajectoryPoint &rhs)
Sort pfos by number of constituent hits.
void BuildSortedIntersectionMap(const TwoDSlidingFitResultMap &slidingFitResultMap, const ClusterPositionMap &clusterIntersectionMap, ClusterPositionMap &sortedIntersectionMap) const
Use intersection points to decide on splitting points.
TwoDTrackSplittingAlgorithm class.
std::unordered_map< const pandora::Cluster *, pandora::CartesianPointVector > ClusterPositionMap
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
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 GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
pandora::StatusCode GetGlobalFitDirection(const float rL, pandora::CartesianVector &direction) const
Get global fit direction for a given longitudinal coordinate.
StatusCodeException class.
StatusCode GetStatusCode() const
Get status code.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
std::unordered_map< const pandora::Cluster *, TwoDSlidingFitResult > TwoDSlidingFitResultMap
std::vector< const Cluster * > ClusterVector
MANAGED_CONTAINER< const Cluster * > ClusterList
std::vector< CartesianVector > CartesianPointVector
StatusCode
The StatusCode enum.