22 m_minClusterLength(15.f),
23 m_microSlidingFitWindow(20),
24 m_macroSlidingFitWindow(1000),
25 m_stableRegionClusterFraction(0.05f),
26 m_mergePointMinCosAngleDeviation(0.999f),
27 m_minHitFractionForHitRemoval(0.05f),
28 m_maxDistanceFromMainTrack(0.75f),
29 m_maxHitDistanceFromCluster(4.f),
30 m_maxHitSeparationForConnectedCluster(4.f),
32 m_lineSegmentLength(3.f),
45 for (
const Cluster *
const pCluster : *pClusterList)
55 slidingFitResultMapPair.first->insert(TwoDSlidingFitResultMap::value_type(pCluster, microSlidingFitResult));
56 slidingFitResultMapPair.second->insert(TwoDSlidingFitResultMap::value_type(pCluster, macroSlidingFitResult));
57 clusterVector.push_back(pCluster);
64 std::sort(clusterVector.begin(), clusterVector.end(), sortFunction);
73 CartesianVector clusterAverageDirection(0.f, 0.f, 0.f), associatedAverageDirection(0.f, 0.f, 0.f);
78 const int startLayer(isEndUpstream ? clusterMicroFitResult.
GetMinLayer() : clusterMicroFitResult.
GetMaxLayer());
79 const int endLayer(isEndUpstream ? clusterMicroFitResult.
GetMaxLayer() : clusterMicroFitResult.
GetMinLayer());
80 const int loopTerminationLayer(endLayer + (isEndUpstream ? 1 : -1));
81 const int step(isEndUpstream ? 1 : -1);
85 unsigned int goodLayerCount(0);
87 clusterMicroLayerFitResultMap.at(endLayer);
89 for (
int i = startLayer; i != loopTerminationLayer; i += step)
91 const auto microIter(clusterMicroLayerFitResultMap.find(i));
93 if (microIter == clusterMicroLayerFitResultMap.end())
97 clusterMicroFitResult.
GetGlobalDirection(microIter->second.GetGradient(), microDirection);
99 const float cosDirectionOpeningAngle(microDirection.
GetCosOpeningAngle(associatedAverageDirection));
103 if (goodLayerCount == 0)
105 clusterMergeDirection = clusterAverageDirection;
107 STATUS_CODE_SUCCESS, !=, clusterMicroFitResult.
GetGlobalFitPosition(microIter->second.GetL(), clusterMergePosition));
117 if (goodLayerCount > gradientStabilityWindow)
132 const ClusterList &unavailableProtectedClusters,
const float distanceToLine)
const
134 const float minX(std::min(firstCorner.
GetX(), secondCorner.
GetX())), maxX(std::max(firstCorner.
GetX(), secondCorner.
GetX()));
135 const float minZ(std::min(firstCorner.
GetZ(), secondCorner.
GetZ())), maxZ(std::max(firstCorner.
GetZ(), secondCorner.
GetZ()));
138 connectingLineDirection = connectingLineDirection.
GetUnitVector();
140 for (
const Cluster *
const pCluster : *pClusterList)
142 if (std::find(unavailableProtectedClusters.begin(), unavailableProtectedClusters.end(), pCluster) != unavailableProtectedClusters.end())
148 for (
const CaloHit *
const pCaloHit : *mapEntry.second)
151 : pCaloHit->GetPositionVector());
156 if (distanceToLine > 0.f)
158 if (!this->
IsCloseToLine(hitPosition, firstCorner, connectingLineDirection, distanceToLine))
162 clusterToCaloHitListMap[pCluster].push_back(pCaloHit);
171 const float minX,
const float maxX,
const float minZ,
const float maxZ,
const CartesianVector &hitPosition)
const
173 return !((hitPosition.
GetX() < minX) || (hitPosition.
GetX() > maxX) || (hitPosition.
GetZ() < minZ) || (hitPosition.
GetZ() > maxZ));
179 const CartesianVector &lineDirection,
const float distanceToLine)
const
183 return (transverseDistanceFromLine < distanceToLine);
191 for (
const auto &entry : clusterToCaloHitListMap)
192 extrapolatedHitVector.insert(extrapolatedHitVector.begin(), entry.second.begin(), entry.second.end());
195 std::sort(extrapolatedHitVector.begin(), extrapolatedHitVector.end(),
201 if (clusterToCaloHitListMap.empty())
216 return (distanceToBoundary < boundaryTolerance);
226 if (trackSegmentBoundaries.size() < 2)
228 std::cout <<
"TrackInEMShowerAlgorithm: Less than two track segment boundaries" << std::endl;
229 throw STATUS_CODE_NOT_ALLOWED;
232 unsigned int segmentsWithoutHits(0);
233 CaloHitVector::const_iterator caloHitIter(extrapolatedCaloHitVector.begin());
236 : (*caloHitIter)->GetPositionVector());
238 for (
unsigned int i = 0; i < (trackSegmentBoundaries.size() - 1); ++i)
240 if (caloHitIter == extrapolatedCaloHitVector.end())
242 ++segmentsWithoutHits;
250 unsigned int hitsInSegment(0);
251 while (this->
IsInLineSegment(trackSegmentBoundaries.at(i), trackSegmentBoundaries.at(i + 1), hitPosition))
256 if (caloHitIter == extrapolatedCaloHitVector.end())
261 : (*caloHitIter)->GetPositionVector();
264 segmentsWithoutHits = hitsInSegment ? 0 : segmentsWithoutHits + 1;
279 std::cout <<
"TrackInEMShowerAlgorithm: Line segment length must be positive and nonzero" << std::endl;
280 throw STATUS_CODE_INVALID_PARAMETER;
290 consideredGaps.clear();
294 if (fullSegments == 0)
303 const int numberOfBoundaries(fullSegments + (splitFinalSegment ? 2 : 1));
307 trackSegmentBoundaries.push_back(segmentUpstreamBoundary);
309 for (
int i = 1; i < numberOfBoundaries; ++i)
311 if (i < fullSegments)
317 if (splitFinalSegment)
319 segmentDownstreamBoundary += trackDirection * (
m_lineSegmentLength + lengthOfTrackRemainder) * 0.5f;
323 segmentDownstreamBoundary += trackDirection * (
m_lineSegmentLength + lengthOfTrackRemainder);
327 float distanceInGap(this->
DistanceInGap(segmentUpstreamBoundary, segmentDownstreamBoundary, trackDirection, consideredGaps));
328 while (distanceInGap > std::numeric_limits<float>::epsilon())
331 segmentDownstreamBoundary += trackDirection * distanceInGap;
332 distanceInGap = this->
DistanceInGap(segmentUpstreamBoundary, segmentDownstreamBoundary, trackDirection, consideredGaps);
335 trackSegmentBoundaries.push_back(segmentDownstreamBoundary);
344 for (
const DetectorGap *
const pDetectorGap : detectorGapList)
346 const LineGap *
const pLineGap(
dynamic_cast<const LineGap *
>(pDetectorGap));
356 if (std::fabs(mergeDirection.
GetX()) < std::numeric_limits<float>::epsilon())
359 const float gradient(mergeDirection.
GetZ() / mergeDirection.
GetX());
370 if (std::fabs(mergeDirection.
GetZ()) < std::numeric_limits<float>::epsilon())
373 const float gradient(mergeDirection.
GetX() / mergeDirection.
GetZ());
388 const CartesianVector &lowerXPoint(upstreamPoint.
GetX() < downstreamPoint.
GetX() ? upstreamPoint : downstreamPoint);
389 const CartesianVector &higherXPoint(upstreamPoint.
GetX() < downstreamPoint.
GetX() ? downstreamPoint : upstreamPoint);
394 float distanceInGaps(0.f);
396 for (
const DetectorGap *
const pDetectorGap : detectorGapList)
398 if (std::find(consideredGaps.begin(), consideredGaps.end(), pDetectorGap) != consideredGaps.end())
401 const LineGap *
const pLineGap(
dynamic_cast<const LineGap *
>(pDetectorGap));
409 float xDistanceInGap(0.f);
417 xDistanceInGap = (pLineGap->
GetLineEndX() - lowerXPoint.GetX());
421 xDistanceInGap = (higherXPoint.GetX() - pLineGap->
GetLineStartX());
428 if (std::fabs(cosAngleToX) < std::numeric_limits<float>::epsilon())
431 distanceInGaps += (xDistanceInGap / cosAngleToX);
433 consideredGaps.push_back(pDetectorGap);
438 float zDistanceInGap(0.f);
457 if (std::fabs(cosAngleToZ) < std::numeric_limits<float>::epsilon())
460 distanceInGaps += (zDistanceInGap / cosAngleToZ);
462 consideredGaps.push_back(pDetectorGap);
467 return distanceInGaps;
475 const float segmentBoundaryGradient = (-1.f) * (upperBoundary.
GetX() - lowerBoundary.
GetX()) / (upperBoundary.
GetZ() - lowerBoundary.
GetZ());
476 const float xPointOnUpperLine((point.
GetZ() - upperBoundary.
GetZ()) / segmentBoundaryGradient + upperBoundary.
GetX());
477 const float xPointOnLowerLine((point.
GetZ() - lowerBoundary.
GetZ()) / segmentBoundaryGradient + lowerBoundary.
GetX());
479 if (std::fabs(xPointOnUpperLine - point.
GetX()) < std::numeric_limits<float>::epsilon())
482 if (std::fabs(xPointOnLowerLine - point.
GetX()) < std::numeric_limits<float>::epsilon())
485 if ((point.
GetX() > xPointOnUpperLine) && (point.
GetX() > xPointOnLowerLine))
488 if ((point.
GetX() < xPointOnUpperLine) && (point.
GetX() < xPointOnLowerLine))
500 float rL(0.f), rT(0.f);
508 const bool isVertical(std::fabs(averageDirection.
GetX()) < std::numeric_limits<float>::epsilon());
509 const float clusterGradient(isVertical ? 0.f : averageDirection.
GetZ() / averageDirection.
GetX());
510 const float clusterIntercept(isVertical ? splitPosition.
GetX() : splitPosition.
GetZ() - (clusterGradient * splitPosition.
GetX()));
513 std::string originalListName, fragmentListName;
514 const ClusterList originalClusterList(1, pCluster);
518 const Cluster *pMainTrackCluster(
nullptr), *pAboveCluster(
nullptr), *pBelowCluster(
nullptr);
523 for (
const CaloHit *
const pCaloHit : *mapEntry.second)
526 float thisL(0.f), thisT(0.f);
528 microFitResult.
GetLocalPosition(pCaloHit->GetPositionVector(), thisL, thisT);
530 bool isAnExtrapolatedHit(
false);
531 const auto extrapolatedCaloHitIter(clusterToCaloHitListMap.find(pCluster));
533 if (extrapolatedCaloHitIter != clusterToCaloHitListMap.end())
534 isAnExtrapolatedHit = std::find(extrapolatedCaloHitIter->second.begin(), extrapolatedCaloHitIter->second.end(), pCaloHit) !=
535 extrapolatedCaloHitIter->second.end();
537 const bool isAbove(((clusterGradient * hitPosition.
GetX()) + clusterIntercept) < (isVertical ? hitPosition.
GetX() : hitPosition.
GetZ()));
538 const bool isToRemove(!isAnExtrapolatedHit && (((thisL < rL) && isEndUpstream) || ((thisL > rL) && !isEndUpstream)));
540 const Cluster *&pClusterToModify(isToRemove ? (isAbove ? pAboveCluster : pBelowCluster) : pMainTrackCluster);
542 if (pClusterToModify)
548 PandoraContentApi::Cluster::Parameters parameters;
549 parameters.m_caloHitList.push_back(pCaloHit);
550 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, parameters, pClusterToModify));
552 if (pClusterToModify != pMainTrackCluster)
553 remnantClusterList.push_back(pClusterToModify);
559 if (pAboveCluster || pBelowCluster)
562 return pMainTrackCluster;
581 if (pShowerCluster->
GetNCaloHits() == caloHitsToMerge.size())
588 std::string originalListName, fragmentListName;
589 const ClusterList originalClusterList(1, pShowerCluster);
593 const Cluster *pAboveCluster(
nullptr), *pBelowCluster(
nullptr);
596 const float connectingLineGradient(
605 for (
const CaloHit *
const pCaloHit : *mapEntry.second)
607 const bool isAnExtrapolatedHit(std::find(caloHitsToMerge.begin(), caloHitsToMerge.end(), pCaloHit) != caloHitsToMerge.end());
608 if (isAnExtrapolatedHit)
616 const bool isAbove(((connectingLineGradient * hitPosition.
GetX()) + connectingLineIntercept) <
617 (isVertical ? hitPosition.
GetX() : hitPosition.
GetZ()));
618 const Cluster *&pClusterToModify(isAbove ? pAboveCluster : pBelowCluster);
620 if (pClusterToModify)
626 PandoraContentApi::Cluster::Parameters parameters;
627 parameters.m_caloHitList.push_back(pCaloHit);
628 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, parameters, pClusterToModify));
630 remnantClusterList.push_back(pClusterToModify);
645 for (
const Cluster *
const pRemnantCluster : remnantClusterList)
653 fragmentedClusters.push_back(pRemnantCluster);
657 for (
const Cluster *
const pFragmentedCluster : fragmentedClusters)
659 if ((pFragmentedCluster->GetNCaloHits() == 1) && (this->
AddToNearestCluster(pFragmentedCluster, pMainTrackCluster, pClusterList)))
662 createdClusters.push_back(pFragmentedCluster);
669 const Cluster *
const pClusterToMerge,
const Cluster *
const pMainTrackCluster,
const ClusterList *
const pClusterList)
const
671 const Cluster *pClosestCluster(
nullptr);
672 float closestDistance(std::numeric_limits<float>::max());
674 for (
const Cluster *
const pCluster : *pClusterList)
676 if (pCluster == pClusterToMerge)
681 if (separationDistance < closestDistance)
686 pClosestCluster = pCluster;
687 closestDistance = separationDistance;
708 const CaloHit *pPreviousCaloHit(orderedCaloHitList.
begin()->second->front());
712 for (
const CaloHit *
const pCaloHit : *mapEntry.second)
714 if (pCaloHit == pPreviousCaloHit)
717 const float separationDistanceSquared(pCaloHit->GetPositionVector().GetDistanceSquared(pPreviousCaloHit->
GetPositionVector()));
722 pPreviousCaloHit = pCaloHit;
734 std::string originalListName, fragmentListName;
735 const ClusterList originalClusterList(1, pRemnantCluster);
744 for (
const CaloHit *
const pCaloHit : *mapEntry.second)
746 const Cluster *pClosestCluster(
nullptr);
748 if (!createdClusters.empty())
750 float closestDistance(std::numeric_limits<float>::max());
752 for (
const Cluster *
const pCreatedCluster : createdClusters)
757 closestDistance = separationDistance;
758 pClosestCluster = pCreatedCluster;
769 PandoraContentApi::Cluster::Parameters parameters;
770 parameters.m_caloHitList.push_back(pCaloHit);
771 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, parameters, pClosestCluster));
772 createdClusters.push_back(pClosestCluster);
778 if (createdClusters.empty())
781 fragmentedClusterList.push_back(pRemnantCluster);
786 fragmentedClusterList.insert(fragmentedClusterList.begin(), createdClusters.begin(), createdClusters.end());
797 for (
const Cluster *
const pClusterToDelete : clustersToDelete)
800 this->
InitialiseContainers(&clustersToAdd, sortFunction, clusterVector, slidingFitResultMapPair);
808 const TwoDSlidingFitResultMap::const_iterator microFitToDelete(slidingFitResultMapPair.first->find(pClusterToRemove));
809 if (microFitToDelete != slidingFitResultMapPair.first->end())
810 slidingFitResultMapPair.first->erase(microFitToDelete);
812 const TwoDSlidingFitResultMap::const_iterator macroFitToDelete(slidingFitResultMapPair.second->find(pClusterToRemove));
813 if (macroFitToDelete != slidingFitResultMapPair.second->end())
814 slidingFitResultMapPair.second->erase(macroFitToDelete);
816 const ClusterVector::const_iterator clusterToDelete(std::find(clusterVector.begin(), clusterVector.end(), pClusterToRemove));
817 if (clusterToDelete != clusterVector.end())
818 clusterVector.erase(clusterToDelete);
859 std::cout <<
"TrackInEMShowerAlgorithm: Line segment length must be positive and nonzero" << std::endl;
860 throw STATUS_CODE_INVALID_PARAMETER;
865 return STATUS_CODE_SUCCESS;
882 if (std::fabs(lhsLongitudinal - rhsLongitudinal) > std::numeric_limits<float>::epsilon())
885 return (lhsLongitudinal < rhsLongitudinal);
896template void TrackRefinementBaseAlgorithm::UpdateContainers<SortFunction>(
898template void TrackRefinementBaseAlgorithm::InitialiseContainers<SortFunction>(
Header file for the cluster helper class.
Header file for the geometry helper class.
Header file for the lar hit width helper class.
#define PANDORA_THROW_RESULT_IF(StatusCode1, Operator, Command)
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Header file for the track refinement base class.
static pandora::StatusCode InitializeFragmentation(const pandora::Algorithm &algorithm, const pandora::ClusterList &inputClusterList, std::string &originalClustersListName, std::string &fragmentClustersListName)
Initialize cluster fragmentation operations on clusters in the algorithm input list....
static pandora::StatusCode EndFragmentation(const pandora::Algorithm &algorithm, const std::string &clusterListToSaveName, const std::string &clusterListToDeleteName)
End cluster fragmentation operations on clusters in the algorithm input list.
static pandora::StatusCode MergeAndDeleteClusters(const pandora::Algorithm &algorithm, const pandora::Cluster *const pClusterToEnlarge, const pandora::Cluster *const pClusterToDelete)
Merge two clusters in the current list, enlarging one cluster and deleting the second.
static pandora::StatusCode AddToCluster(const pandora::Algorithm &algorithm, const pandora::Cluster *const pCluster, const T *const pT)
Add a calo hit, or a list of calo hits, to a cluster.
static pandora::StatusCode RemoveFromCluster(const pandora::Algorithm &algorithm, const pandora::Cluster *const pCluster, const pandora::CaloHit *const pCaloHit)
Remove a calo hit from a cluster. Note this function will not remove the final calo hit from a cluste...
ClusterAssociation class.
const pandora::CartesianVector GetConnectingLineDirection() const
Returns the unit vector of the line connecting the upstream and downstream merge points (upstream -> ...
const pandora::CartesianVector GetUpstreamMergePoint() const
Returns the upstream cluster merge point.
const pandora::CartesianVector GetDownstreamMergePoint() const
Returns the downstream cluster merge point.
static bool SortHitsByPulseHeight(const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
Sort calo hits by their pulse height.
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.
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
static pandora::CartesianVector GetClosestPointToLine2D(const pandora::CartesianVector &lineStart, const pandora::CartesianVector &lineDirection, const pandora::CaloHit *const pCaloHit)
Consider the hit width to find the closest position of a calo hit to a specified line.
static float GetClosestDistanceToPoint2D(const pandora::CaloHit *const pCaloHit, const pandora::CartesianVector &point2D)
Consider the hit width to find the smallest distance between a calo hit and a given point.
SortByDistanceAlongLine class.
pandora::CartesianVector m_lineDirection
The line end point.
bool m_hitWidthMode
Wether to consider hit widths or not.
pandora::CartesianVector m_startPoint
The line start point.
bool operator()(const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs) const
Sort hits by their projected distance along a line from a start point.
bool IsInBoundingBox(const float minX, const float maxX, const float minZ, const float maxZ, const pandora::CartesianVector &hitPosition) const
check whether a hit is contained within a defined square region
bool GetClusterMergingCoordinates(const TwoDSlidingFitResult &clusterMicroFitResult, const TwoDSlidingFitResult &clusterMacroFitResult, const TwoDSlidingFitResult &associatedMacroFitResult, const bool isEndUpstream, pandora::CartesianVector &clusterMergePosition, pandora::CartesianVector &clusterMergeDirection) const
Get the merging coordinate and direction for an input cluster with respect to an associated cluster.
bool IsClusterRemnantDisconnected(const pandora::Cluster *const pRemnantCluster) const
Whether a remnant cluster is considered to be disconnected and therefore should undergo further fragm...
float m_maxHitSeparationForConnectedCluster
The maximum separation between two adjacent (in z) hits in a connected cluster.
std::pair< TwoDSlidingFitResultMap *, TwoDSlidingFitResultMap * > SlidingFitResultMapPair
void AddHitsToMainTrack(const pandora::Cluster *const pMainTrackCluster, const pandora::Cluster *const pShowerTrackCluster, const pandora::CaloHitList &caloHitsToMerge, const ClusterAssociation &clusterAssociation, pandora::ClusterList &remnantClusterList) const
Remove the hits from a shower cluster that belong to the main track and add them into the main track ...
std::unordered_map< const pandora::Cluster *, pandora::CaloHitList > ClusterToCaloHitListMap
const pandora::Cluster * RemoveOffAxisHitsFromTrack(const pandora::Cluster *const pCluster, const pandora::CartesianVector &splitPosition, const bool isEndUpstream, const ClusterToCaloHitListMap &clusterToCaloHitListMap, pandora::ClusterList &remnantClusterList, TwoDSlidingFitResultMap µSlidingFitResultMap, TwoDSlidingFitResultMap ¯oSlidingFitResultMap) const
Remove any hits in the upstream/downstream cluster that lie off of the main track axis (i....
float m_maxHitDistanceFromCluster
The threshold separation between a hit and cluster for the hit to be merged into the cluster.
TrackRefinementBaseAlgorithm()
Default constructor.
unsigned int m_maxTrackGaps
The maximum number of graps allowed in the extrapolated hit vector.
float m_lineSegmentLength
The length of a track gap.
bool IsNearBoundary(const pandora::CaloHit *const pCaloHit, const pandora::CartesianVector &boundaryPosition2D, const float boundaryTolerance) const
Check whether a hit is close to a boundary point.
bool IsTrackContinuous(const ClusterAssociation &clusterAssociation, const pandora::CaloHitVector &extrapolatedCaloHitVector) const
Check whether the extrapolatedCaloHitVector contains a continuous line of hits between the cluster me...
unsigned int m_microSlidingFitWindow
The sliding fit window used in the fits contained within the microSlidingFitResultMap.
float m_stableRegionClusterFraction
The threshold fraction of fit contributing layers which defines the stable region.
void GetHitsInBoundingBox(const pandora::CartesianVector &firstCorner, const pandora::CartesianVector &secondCorner, const pandora::ClusterList *const pClusterList, ClusterToCaloHitListMap &clusterToCaloHitListMap, const pandora::ClusterList &unavailableProtectedClusters=pandora::ClusterList(), const float distanceToLine=-1.f) const
Find the unprotected hits that are contained within a defined box with the option to apply a cut on t...
void RepositionIfInGap(const pandora::CartesianVector &mergeDirection, pandora::CartesianVector &trackPoint) const
Move an input position to the higher line gap edge if it lies within a gap.
float m_mergePointMinCosAngleDeviation
The threshold cos opening angle between the cluster local gradient and the associated cluster global ...
bool IsInLineSegment(const pandora::CartesianVector &lowerBoundary, const pandora::CartesianVector &upperBoundary, const pandora::CartesianVector &point) const
Whether a position falls within a specified segment of the cluster connecting line.
void RemoveClusterFromContainers(const pandora::Cluster *const pClustertoRemove, pandora::ClusterVector &clusterVector, SlidingFitResultMapPair &slidingFitResultMapPair) const
Remove a cluster from the cluster vector and sliding fit maps.
bool AddToNearestCluster(const pandora::Cluster *const pClusterToMerge, const pandora::Cluster *const pMainTrackCluster, const pandora::ClusterList *const pClusterList) const
Add a cluster to the nearest cluster satisfying separation distance thresholds.
void FragmentRemnantCluster(const pandora::Cluster *const pRemnantCluster, pandora::ClusterList &fragmentedClusterList) const
Fragment a cluster using simple hit separation logic.
bool IsCloseToLine(const pandora::CartesianVector &hitPosition, const pandora::CartesianVector &lineStart, const pandora::CartesianVector &lineDirection, const float distanceToLine) const
Check whether a hit is close to a line.
unsigned int m_macroSlidingFitWindow
The sliding fit window used in the fits contained within the macroSlidingFitResultMap.
void UpdateContainers(const pandora::ClusterList &clustersToAdd, const pandora::ClusterList &clustersToDelete, const T sortFunction, pandora::ClusterVector &clusterVector, SlidingFitResultMapPair &slidingFitResultMapPair) const
Remove deleted clusters from the cluster vector and sliding fit maps and add in created clusters that...
float m_maxDistanceFromMainTrack
The threshold distance for a hit to be added to the main track.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)=0
Read the algorithm settings.
void InitialiseContainers(const pandora::ClusterList *pClusterList, const T sortFunction, pandora::ClusterVector &clusterVector, SlidingFitResultMapPair &slidingFitResultMapPair) const
Fill the cluster vector and sliding fit maps with clusters that are determined to be track-like.
float m_minHitFractionForHitRemoval
The threshold fraction of hits to be removed from the cluster for hit removal to proceed.
virtual bool AreExtrapolatedHitsNearBoundaries(const pandora::CaloHitVector &extrapolatedHitVector, ClusterAssociation &clusterAssociation) const =0
Check the separation of the extremal extrapolated hits with the expected endpoints or,...
bool m_hitWidthMode
Whether to consider the width of hits.
void ProcessRemnantClusters(const pandora::ClusterList &remnantClusterList, const pandora::Cluster *const pMainTrackCluster, const pandora::ClusterList *const pClusterList, pandora::ClusterList &createdClusters) const
Process the remnant clusters separating those that stradle the main track.
void GetTrackSegmentBoundaries(const ClusterAssociation &clusterAssociation, pandora::CartesianPointVector &trackSegmentBoundaries) const
Obtain the segment boundaries of the connecting line to test whether extrapolated hits are continuous...
float DistanceInGap(const pandora::CartesianVector &upstreamPoint, const pandora::CartesianVector &downstreamPoint, const pandora::CartesianVector &connectingLine, pandora::DetectorGapList &consideredGaps) const
Calculate the track length between two points that lies in gaps.
float m_minClusterLength
The minimum length of a considered cluster.
bool AreExtrapolatedHitsGood(const ClusterToCaloHitListMap &clusterToCaloHitListMap, ClusterAssociation &clusterAssociation) const
Perform topological checks on the collected hits to ensure no gaps are present.
TwoDSlidingFitResult class.
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
const LayerFitResultMap & GetLayerFitResultMap() const
Get the layer fit result map.
pandora::StatusCode GetGlobalFitPosition(const float rL, pandora::CartesianVector &position) const
Get global fit position for a given longitudinal coordinate.
int GetMaxLayer() const
Get the maximum occupied layer in the sliding fit.
int GetMinLayer() const
Get the minimum occupied layer in the sliding fit.
void GetGlobalDirection(const float dTdL, pandora::CartesianVector &direction) const
Get global direction coordinates for given sliding linear fit gradient.
const CartesianVector & GetPositionVector() const
Get the position vector of center of calorimeter cell, units mm.
float GetCosOpeningAngle(const CartesianVector &rhs) const
Get the cosine of the opening angle of the cartesian vector with respect to a second cartesian vector...
float GetX() const
Get the cartesian x coordinate.
CartesianVector GetUnitVector() const
Get a unit vector in the direction of the cartesian vector.
float GetZ() const
Get the cartesian z coordinate.
float GetDotProduct(const CartesianVector &rhs) const
Get the dot product of the cartesian vector with a second cartesian vector.
float GetMagnitude() const
Get the magnitude.
CartesianVector GetCrossProduct(const CartesianVector &rhs) const
Get the cross product of the cartesian vector with a second cartesian vector.
unsigned int GetNCaloHits() const
Get the number of calo hits in the cluster.
const OrderedCaloHitList & GetOrderedCaloHitList() const
Get the ordered calo hit list.
LineGap class, associated only with 2D TPC hit types and applied only to the z coordinate when sampli...
float GetLineEndZ() const
Get the line end z coordinate.
LineGapType GetLineGapType() const
Get the line gap type.
float GetLineStartX() const
Get the line start x coordinate.
float GetLineStartZ() const
Get the line start z coordinate.
float GetLineEndX() const
Get the line end x coordinate.
Calo hit lists arranged by pseudo layer.
const_iterator begin() const
Returns a const iterator referring to the first element in the ordered calo hit list.
TheList::value_type value_type
const Pandora & GetPandora() const
Get the associated pandora instance.
StatusCodeException class.
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::map< int, LayerFitResult > LayerFitResultMap
bool(* SortFunction)(const Cluster *, const Cluster *)
std::vector< const CaloHit * > CaloHitVector
std::vector< const Cluster * > ClusterVector
MANAGED_CONTAINER< const Cluster * > ClusterList
std::vector< CartesianVector > CartesianPointVector
MANAGED_CONTAINER< const DetectorGap * > DetectorGapList
MANAGED_CONTAINER< const CaloHit * > CaloHitList
StatusCode
The StatusCode enum.
LineGapType
Line gap type.