9 #include "Pandora/AlgorithmHeaders.h" 18 TrackConsolidationAlgorithm::TrackConsolidationAlgorithm() :
19 m_maxTransverseDisplacement(1.
f),
20 m_minAssociatedSpan(1.
f),
21 m_minAssociatedFraction(0.5
f)
32 const Cluster *
const pClusterI = slidingFitResultI.GetCluster();
35 for (
const Cluster *
const pClusterJ : showerClustersJ)
39 if (pClusterI == pClusterJ)
42 if (2.
f * thisLengthSquaredJ > thisLengthSquaredI)
45 this->
GetReclusteredHits(slidingFitResultI, pClusterJ, caloHitsToAddI, caloHitsToRemoveJ);
55 const Cluster *
const pClusterI(slidingFitResultI.
GetCluster());
57 CaloHitList associatedHits, caloHitListJ;
58 pClusterJ->GetOrderedCaloHitList().FillCaloHitList(caloHitListJ);
79 const CaloHit *
const pCaloHitJ = *iterJ;
81 const CartesianVector positionJ(pCaloHitJ->GetPositionVector());
84 float rL(0.
f), rT(0.
f);
85 CartesianVector positionK(0.
f, 0.
f, 0.
f);
92 const float rsqIJ((positionI - positionJ).GetMagnitudeSquared());
93 const float rsqJK((positionJ - positionK).GetMagnitudeSquared());
94 const float rsqKI((positionK - positionI).GetMagnitudeSquared());
98 if (associatedHits.empty())
109 associatedHits.push_back(pCaloHitJ);
113 const float associatedSpan(maxL - minL);
114 const float associatedFraction(associatedHits.empty() ? 0.f :
static_cast<float>(associatedHits.size()) / static_cast<float>(pClusterJ->GetNCaloHits()));
120 const CaloHit *
const pCaloHit = *iterK;
121 const CaloHitList &caloHitList(caloHitsToRemoveJ[pClusterJ]);
123 if (caloHitList.end() != std::find(caloHitList.begin(), caloHitList.end(), pCaloHit))
126 caloHitsToAddI[pClusterI].push_back(pCaloHit);
127 caloHitsToRemoveJ[pClusterJ].push_back(pCaloHit);
136 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
139 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
142 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
std::unordered_map< const pandora::Cluster *, pandora::CaloHitList > ClusterToHitMap
Header file for the track consolidation algorithm class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void GetReclusteredHits(const TwoDSlidingFitResultList &slidingFitResultList, const pandora::ClusterVector &showerClusters, ClusterToHitMap &caloHitsToAdd, ClusterToHitMap &caloHitsToRemove) const
Get the list of hits to be added to track clusters and removed from shower clusters.
std::vector< TwoDSlidingFitResult > TwoDSlidingFitResultList
float m_maxTransverseDisplacement
std::vector< art::Ptr< recob::Cluster > > ClusterVector
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.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_minAssociatedSpan
static float GetLengthSquared(const pandora::Cluster *const pCluster)
Get length squared of cluster.
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.
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
float m_minAssociatedFraction
TwoDSlidingFitResult class.