LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
SimpleClusterMergingAlgorithm.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
14 
15 using namespace pandora;
16 
17 namespace lar_content
18 {
19 
20 SimpleClusterMergingAlgorithm::SimpleClusterMergingAlgorithm() :
21  m_minCaloHitsPerCluster(5),
22  m_maxClusterSeparation(2.5f)
23 {
24 }
25 
26 //------------------------------------------------------------------------------------------------------------------------------------------
27 
28 void SimpleClusterMergingAlgorithm::GetListOfCleanClusters(const ClusterList *const pClusterList, ClusterVector &clusterVector) const
29 {
30  for (ClusterList::const_iterator iter = pClusterList->begin(), iterEnd = pClusterList->end(); iter != iterEnd; ++iter)
31  {
32  const Cluster *const pCluster = *iter;
33 
34  if (!pCluster->IsAvailable())
35  continue;
36 
37  if (pCluster->GetNCaloHits() < m_minCaloHitsPerCluster)
38  continue;
39 
40  clusterVector.push_back(pCluster);
41  }
42 
43  std::sort(clusterVector.begin(), clusterVector.end(), LArClusterHelper::SortByNHits);
44 }
45 
46 //------------------------------------------------------------------------------------------------------------------------------------------
47 
49 {
50  for (ClusterVector::const_iterator iterI = clusterVector.begin(), iterEndI = clusterVector.end(); iterI != iterEndI; ++iterI)
51  {
52  const Cluster *const pClusterI = *iterI;
53 
54  for (ClusterVector::const_iterator iterJ = iterI, iterEndJ = clusterVector.end(); iterJ != iterEndJ; ++iterJ)
55  {
56  const Cluster *const pClusterJ = *iterJ;
57 
58  if (pClusterI == pClusterJ)
59  continue;
60 
61  if (this->IsAssociated(pClusterI, pClusterJ))
62  {
63  clusterMergeMap[pClusterI].push_back(pClusterJ);
64  clusterMergeMap[pClusterJ].push_back(pClusterI);
65  }
66  }
67  }
68 }
69 
70 //------------------------------------------------------------------------------------------------------------------------------------------
71 
72 bool SimpleClusterMergingAlgorithm::IsAssociated(const Cluster *const pClusterI, const Cluster *const pClusterJ) const
73 {
75  return false;
76 
77  return true;
78 }
79 
80 //------------------------------------------------------------------------------------------------------------------------------------------
81 
82 StatusCode SimpleClusterMergingAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
83 {
84  PANDORA_RETURN_RESULT_IF_AND_IF(
85  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinCaloHitsPerCluster", m_minCaloHitsPerCluster));
86 
87  PANDORA_RETURN_RESULT_IF_AND_IF(
88  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxClusterSeparation", m_maxClusterSeparation));
89 
90  return ClusterMergingAlgorithm::ReadSettings(xmlHandle);
91 }
92 
93 } // namespace lar_content
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.
unsigned int m_minCaloHitsPerCluster
The min number of calo hits per candidate cluster.
float m_maxClusterSeparation
Maximum distance at which clusters can be joined.
intermediate_table::const_iterator const_iterator
TFile f
Definition: plotHisto.C:6
Header file for the simple cluster merging algorithm class.
Header file for the cluster helper class.
void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &clusterVector) const
Populate cluster vector with subset of cluster list, containing clusters judged to be clean...
bool IsAssociated(const pandora::Cluster *const pClusterI, const pandora::Cluster *const pClusterJ) const
Decide whether two clusters are associated.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterMergeMap
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void PopulateClusterMergeMap(const pandora::ClusterVector &clusterVector, ClusterMergeMap &clusterMergeMap) const
Form associations between pointing clusters.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.