ClusterMergingAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTwoDReco/LArClusterAssociation/ClusterMergingAlgorithm.h
3  *
4  * @brief Header file for the cluster merging algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_CLUSTER_MERGING_ALGORITHM_H
9 #define LAR_CLUSTER_MERGING_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
13 #include <unordered_map>
14 
15 namespace lar_content
16 {
17 
18 /**
19  * @brief ClusterMergingAlgorithm class
20  */
21 class ClusterMergingAlgorithm : public pandora::Algorithm
22 {
23 protected:
24  virtual pandora::StatusCode Run();
25  virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
26 
27  typedef std::unordered_map<const pandora::Cluster *, pandora::ClusterList> ClusterMergeMap;
28 
29  /**
30  * @brief Populate cluster vector with subset of cluster list, containing clusters judged to be clean
31  *
32  * @param pClusterList address of the cluster list
33  * @param clusterVector to receive the populated cluster vector
34  */
35  virtual void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &clusterVector) const = 0;
36 
37  /**
38  * @brief Form associations between pointing clusters
39  *
40  * @param clusterVector the vector of clean clusters
41  * @param clusterMergeMap the matrix of cluster associations
42  */
43  virtual void PopulateClusterMergeMap(const pandora::ClusterVector &clusterVector, ClusterMergeMap &clusterMergeMap) const = 0;
44 
45  /**
46  * @brief Merge associated clusters
47  *
48  * @param clusterVector the vector of clean clusters
49  * @param clusterMergeMap the matrix of cluster associations
50  */
51  void MergeClusters(pandora::ClusterVector &clusterVector, ClusterMergeMap &clusterMergeMap) const;
52 
53  /**
54  * @brief Collect up all clusters associations related to a given seed cluster
55  *
56  * @param pSeedCluster pointer to the initial cluster
57  * @param clusterMergeMap the map of cluster associations
58  * @param associatedClusterList the output list of associated clusters
59  */
60  void CollectAssociatedClusters(const pandora::Cluster *const pSeedCluster, const ClusterMergeMap &clusterMergeMap,
61  pandora::ClusterList &associatedClusterList) const;
62 
63  /**
64  * @brief Collect up all clusters associations related to a given seed cluster
65  *
66  * @param pSeedCluster pointer to the initial cluster
67  * @param pCurrentCluster pointer to the current cluster
68  * @param clusterMergeMap the map of cluster associations
69  * @param clusterVetoList the list of clusters that have already been merged
70  * @param associatedClusterList the output list of associated clusters
71  */
72  void CollectAssociatedClusters(const pandora::Cluster *const pSeedCluster, const pandora::Cluster *const pCurrentCluster,
73  const ClusterMergeMap &clusterMergeMap, const pandora::ClusterSet &clusterVetoList, pandora::ClusterList &associatedClusterList) const;
74 
75  /**
76  * @brief Sort the selected clusters, so that they have a well-defined ordering
77  *
78  * @param inputClusters the input vector of clusters
79  * @param outputClusters the output vector of clusters
80  */
81  void GetSortedListOfCleanClusters(const pandora::ClusterVector &inputClusters, pandora::ClusterVector &outputClusters) const;
82 
83  std::string m_inputClusterListName; ///< The name of the input cluster list. If not specified, will access current list.
84 };
85 
86 } // namespace lar_content
87 
88 #endif // #ifndef LAR_CLUSTER_MERGING_ALGORITHM_H
std::string string
Definition: nybbler.cc:12
std::string m_inputClusterListName
The name of the input cluster list. If not specified, will access current list.
virtual void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &clusterVector) const =0
Populate cluster vector with subset of cluster list, containing clusters judged to be clean...
virtual void PopulateClusterMergeMap(const pandora::ClusterVector &clusterVector, ClusterMergeMap &clusterMergeMap) const =0
Form associations between pointing clusters.
void MergeClusters(pandora::ClusterVector &clusterVector, ClusterMergeMap &clusterMergeMap) const
Merge associated clusters.
void GetSortedListOfCleanClusters(const pandora::ClusterVector &inputClusters, pandora::ClusterVector &outputClusters) const
Sort the selected clusters, so that they have a well-defined ordering.
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterMergeMap
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void CollectAssociatedClusters(const pandora::Cluster *const pSeedCluster, const ClusterMergeMap &clusterMergeMap, pandora::ClusterList &associatedClusterList) const
Collect up all clusters associations related to a given seed cluster.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
ClusterMergingAlgorithm class.