24 m_maxClusterSeparation(2.f),
25 m_maxClusterSeparationSquared(m_maxClusterSeparation * m_maxClusterSeparation),
26 m_minCosRelativeAngle(0.966f),
39 for (
const Cluster *
const pCluster : clusterVector)
42 pCluster->GetOrderedCaloHitList().FillCaloHitList(daughterHits);
43 allCaloHits.insert(allCaloHits.end(), daughterHits.begin(), daughterHits.end());
45 for (
const CaloHit *
const pCaloHit : daughterHits)
46 (
void)hitToClusterMap.insert(HitToClusterMap::value_type(pCaloHit, pCluster));
53 kdTree.
build(hitKDNode2DList, hitsBoundingRegion2D);
55 for (
const Cluster *
const pCluster : clusterVector)
58 pCluster->GetOrderedCaloHitList().FillCaloHitList(daughterHits);
60 for (
const CaloHit *
const pCaloHit : daughterHits)
65 kdTree.
search(searchRegionHits, found);
67 for (
const auto &hit : found)
72 return STATUS_CODE_SUCCESS;
81 return STATUS_CODE_SUCCESS;
94 return STATUS_CODE_NOT_FOUND;
109 return STATUS_CODE_NOT_FOUND;
113 return STATUS_CODE_NOT_FOUND;
118 if (candidateVector.empty())
119 return STATUS_CODE_NOT_FOUND;
122 bool foundSplit(
false);
123 float closestSeparationSquared(std::numeric_limits<float>::max());
128 for (CartesianPointVector::const_iterator iter = candidateVector.begin(), iterEnd = candidateVector.end(); iter != iterEnd; ++iter)
133 float rL1(0.f), rT1(0.f);
142 if ((STATUS_CODE_SUCCESS != slidingFitResult1.
GetGlobalFitPosition(rL1 + halfWindowLength1, F1)) ||
149 float rL2(0.f), rT2(0.f);
158 if ((STATUS_CODE_SUCCESS != slidingFitResult2.
GetGlobalFitPosition(rL2 + halfWindowLength2, F2)) ||
188 for (
unsigned int iForward = 0; iForward < 2; ++iForward)
205 float mu1(0.f), mu2(0.f);
217 if (mu1 < 0.f || mu2 < 0.f || mu1 > (b1 - a1).GetMagnitude() || mu2 > (b2 - a2).GetMagnitude())
220 const float thisSeparationSquared((C0 - C1).GetMagnitudeSquared());
222 if (thisSeparationSquared < closestSeparationSquared)
224 closestSeparationSquared = thisSeparationSquared;
225 splitPosition = (C0 + C1) * 0.5;
226 firstDirection = t2 * -1.f;
227 secondDirection = t1;
234 return STATUS_CODE_NOT_FOUND;
236 return STATUS_CODE_SUCCESS;
249 CaloHitVector caloHitVector1(caloHitList1.begin(), caloHitList1.end()), caloHitVector2(caloHitList2.begin(), caloHitList2.end());
253 for (
const CaloHit *
const pCaloHit : caloHitVector1)
259 candidateVector.push_back((position1 + position2) * 0.5);
262 for (
const CaloHit *
const pCaloHit : caloHitVector2)
268 candidateVector.push_back((position2 + position1) * 0.5);
Header file for the crossed track splitting algorithm class.
Header file for the kd tree linker algo template class.
Header file for the cluster helper class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
float m_minCosRelativeAngle
maximum relative angle between tracks after un-crossing
float m_maxClusterSeparation
maximum separation of two clusters
void FindCandidateSplitPositions(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, pandora::CartesianPointVector &candidateVector) const
Find average positions of pairs of hits within a maximum separation.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
pandora::StatusCode TidyUpStep()
Tidy up any information cached in e.g. the preparation step.
float m_maxClusterSeparationSquared
maximum separation of two clusters (squared)
pandora::StatusCode FindBestSplitPosition(const TwoDSlidingFitResult &slidingFit1, const TwoDSlidingFitResult &slidingFit2, pandora::CartesianVector &splitPosition, pandora::CartesianVector &direction1, pandora::CartesianVector &direction2) const
Find the best split position and direction for a pair of clusters.
std::unordered_map< const pandora::CaloHit *, const pandora::Cluster * > HitToClusterMap
pandora::StatusCode PreparationStep(const pandora::ClusterVector &clusterVector)
Perform any preparatory actions, such as caching information for subsequent expensive calculations.
ClusterToClustersMap m_nearbyClusters
The nearby clusters map.
CrossedTrackSplittingAlgorithm()
Default constructor.
std::vector< HitKDNode2D > HitKDNode2DList
float m_searchRegion1D
Search region, applied to each dimension, for look-up from kd-trees.
Box structure used to define 2D field. It's used in KDTree building step to divide the detector space...
void build(std::vector< KDTreeNodeInfoT< DATA, DIM > > &eltList, const KDTreeBoxT< DIM > ®ion)
Build the KD tree from the "eltList" in the space define by "region".
void search(const KDTreeBoxT< DIM > &searchBox, std::vector< KDTreeNodeInfoT< DATA, DIM > > &resRecHitList)
Search in the KDTree for all points that would be contained in the given searchbox The founded points...
static pandora::CartesianVector GetClosestPosition(const pandora::CartesianVector &position, const pandora::ClusterList &clusterList)
Get closest position in a list of clusters to a specified input position vector.
static bool SortHitsByPosition(const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
Sort calo hits by their position (use Z, followed by X, followed by Y)
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.
static void GetIntersection(const LArPointingCluster::Vertex &firstVertex, const LArPointingCluster::Vertex &secondVertex, pandora::CartesianVector &intersectPosition, float &firstDisplacement, float &secondDisplacement)
Get intersection of two vertices.
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.
float GetLayerFitHalfWindowLength() const
Get the layer fit half window length.
const pandora::Cluster * GetCluster() const
Get the address of the cluster, if originally provided.
pandora::StatusCode GetGlobalFitProjection(const pandora::CartesianVector &inputPosition, pandora::CartesianVector &projectedPosition) const
Get projected position on global fit for a given position vector.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
float GetDotProduct(const CartesianVector &rhs) const
Get the dot product of the cartesian vector with a second cartesian vector.
const OrderedCaloHitList & GetOrderedCaloHitList() const
Get the ordered calo hit list.
void FillCaloHitList(CaloHitList &caloHitList) const
Fill a provided calo hit list with all the calo hits in the ordered calo hit list.
StatusCodeException class.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
KDTreeBox fill_and_bound_2d_kd_tree(const MANAGED_CONTAINER< const T * > &points, std::vector< KDTreeNodeInfoT< const T *, 2 > > &nodes)
fill_and_bound_2d_kd_tree
KDTreeBox build_2d_kd_search_region(const pandora::CaloHit *const point, const float x_span, const float z_span)
build_2d_kd_search_region
std::vector< const CaloHit * > CaloHitVector
std::vector< const Cluster * > ClusterVector
std::vector< CartesianVector > CartesianPointVector
MANAGED_CONTAINER< const CaloHit * > CaloHitList
StatusCode
The StatusCode enum.