9 #include "Pandora/AlgorithmHeaders.h" 21 NearbyClusterMopUpAlgorithm::NearbyClusterMopUpAlgorithm() :
22 m_minHitsInCluster(5),
23 m_vertexProximity(5.
f),
24 m_minClusterSeparation(2.5
f),
25 m_touchingDistance(0.001
f)
36 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*
this, pVertexList));
37 const Vertex *
const pVertex(
38 ((pVertexList->size() == 1) && (VERTEX_3D == (*(pVertexList->begin()))->GetVertexType())) ? *(pVertexList->begin()) : NULL);
40 ClusterVector sortedPfoClusters(pfoClusters.begin(), pfoClusters.end());
43 ClusterVector sortedRemnantClusters(remnantClusters.begin(), remnantClusters.end());
46 for (
const Cluster *
const pClusterP : sortedPfoClusters)
49 const CartesianVector vertexPosition2D(
52 const float innerPV((vertexPosition2D - pClusterP->GetCentroid(pClusterP->GetInnerPseudoLayer())).GetMagnitude());
53 const float outerPV((vertexPosition2D - pClusterP->GetCentroid(pClusterP->GetOuterPseudoLayer())).GetMagnitude());
55 for (
const Cluster *
const pClusterR : sortedRemnantClusters)
60 const float innerRV((vertexPosition2D - pClusterR->GetCentroid(pClusterR->GetInnerPseudoLayer())).GetMagnitude());
61 const float outerRV((vertexPosition2D - pClusterR->GetCentroid(pClusterR->GetOuterPseudoLayer())).GetMagnitude());
70 const float minSeparation(std::min(innerRP, outerRP));
77 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
82 if (!associationDetails.insert(AssociationDetails::value_type(pClusterP, figureOfMerit)).second)
83 throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
94 PANDORA_RETURN_RESULT_IF_AND_IF(
95 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinHitsInCluster",
m_minHitsInCluster));
97 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"VertexProximity",
m_vertexProximity));
99 PANDORA_RETURN_RESULT_IF_AND_IF(
100 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinClusterSeparation",
m_minClusterSeparation));
102 PANDORA_RETURN_RESULT_IF_AND_IF(
103 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"TouchingDistance",
m_touchingDistance));
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, then pulse-height.
virtual void MakeClusterMerges(const ClusterAssociationMap &clusterAssociationMap) const
Make the cluster merges specified in the cluster association map, using list name information in the ...
float m_vertexProximity
Distance between cluster inner/outer centroid and vtx to declare cluster vtx associated.
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
std::unordered_map< const pandora::Cluster *, AssociationDetails > ClusterAssociationMap
Header file for the geometry helper class.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_minHitsInCluster
Minimum number of hits in order to consider a cluster.
float m_touchingDistance
Threshold (small) distance below which parent and daughter clusters are declated touching.
Header file for the cluster helper class.
void ClusterMopUp(const pandora::ClusterList &pfoClusters, const pandora::ClusterList &remnantClusters) const
Cluster mop up for a single view. This function is responsible for instructing pandora to make cluste...
float m_minClusterSeparation
Minimum distance between parent and daughter clusters to declare clusters associated.
std::unordered_map< const pandora::Cluster *, float > AssociationDetails
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Header file for the nearby cluster mop up algorithm class.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
std::list< Vertex > VertexList
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.