9 #include "Pandora/AlgorithmHeaders.h" 20 TrackConsolidationAlgorithm::TrackConsolidationAlgorithm() :
21 m_maxTransverseDisplacement(1.
f),
22 m_minAssociatedSpan(1.
f),
23 m_minAssociatedFraction(0.5
f)
34 const Cluster *
const pClusterI = slidingFitResultI.GetCluster();
37 for (
const Cluster *
const pClusterJ : showerClustersJ)
41 if (pClusterI == pClusterJ)
44 if (2.
f * thisLengthSquaredJ > thisLengthSquaredI)
47 this->
GetReclusteredHits(slidingFitResultI, pClusterJ, caloHitsToAddI, caloHitsToRemoveJ);
57 const Cluster *
const pClusterI(slidingFitResultI.
GetCluster());
62 CaloHitList associatedHits, caloHitListJ;
63 pClusterJ->GetOrderedCaloHitList().FillCaloHitList(caloHitListJ);
65 float minL(std::numeric_limits<float>::max());
66 float maxL(std::numeric_limits<float>::max());
84 const CaloHit *
const pCaloHitJ = *iterJ;
86 const CartesianVector positionJ(pCaloHitJ->GetPositionVector());
89 float rL(0.
f), rT(0.
f);
90 CartesianVector positionK(0.
f, 0.
f, 0.
f);
97 const float rsqIJ((positionI - positionJ).GetMagnitudeSquared());
98 const float rsqJK((positionJ - positionK).GetMagnitudeSquared());
99 const float rsqKI((positionK - positionI).GetMagnitudeSquared());
101 if (rsqJK < std::min(maxTransverseDisplacementAdjusted * maxTransverseDisplacementAdjusted, std::min(rsqIJ, rsqKI)))
103 if (associatedHits.empty())
110 minL = std::min(minL, rL);
111 maxL = std::max(maxL, rL);
114 associatedHits.push_back(pCaloHitJ);
118 const float associatedSpan(maxL - minL);
119 const float associatedFraction(
120 associatedHits.empty() ? 0.f :
static_cast<float>(associatedHits.size()) / static_cast<float>(pClusterJ->GetNCaloHits()));
126 const CaloHit *
const pCaloHit = *iterK;
127 const CaloHitList &caloHitList(caloHitsToRemoveJ[pClusterJ]);
129 if (caloHitList.end() != std::find(caloHitList.begin(), caloHitList.end(), pCaloHit))
132 caloHitsToAddI[pClusterI].push_back(pCaloHit);
133 caloHitsToRemoveJ[pClusterJ].push_back(pCaloHit);
142 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
145 PANDORA_RETURN_RESULT_IF_AND_IF(
146 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinAssociatedSpan",
m_minAssociatedSpan));
148 PANDORA_RETURN_RESULT_IF_AND_IF(
149 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinAssociatedFraction",
m_minAssociatedFraction));
static float GetWirePitchRatio(const pandora::Pandora &pandora, const pandora::HitType view)
Return the ratio of the wire pitch of the specified view to the minimum wire pitch for the detector...
std::unordered_map< const pandora::Cluster *, pandora::CaloHitList > ClusterToHitMap
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
Header file for the track consolidation algorithm class.
Header file for the geometry helper 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
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.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
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.