8 #ifndef LAR_OVERLAP_MATRIX_H
9 #define LAR_OVERLAP_MATRIX_H 1
11 #include "Pandora/PandoraInternal.h"
13 #include <unordered_map>
41 Element(
const pandora::Cluster *
const pCluster1,
const pandora::Cluster *
const pCluster2,
const OverlapResult &overlapResult);
98 const pandora::Cluster *&pCluster1,
const pandora::Cluster *&pCluster2)
const;
108 void GetNConnections(
const pandora::Cluster *
const pCluster,
const bool ignoreUnavailable,
unsigned int &n1,
unsigned int &n2)
const;
129 unsigned int &n1,
unsigned int &n2)
const;
132 typedef std::unordered_map<const pandora::Cluster *, OverlapResult>
OverlapList;
133 typedef std::unordered_map<const pandora::Cluster *, OverlapList>
TheMatrix;
227 pandora::ClusterList &clusterList1, pandora::ClusterList &clusterList2)
const;
236 void ExploreConnections(
const pandora::Cluster *
const pCluster,
const bool ignoreUnavailable, pandora::ClusterList &clusterList1,
237 pandora::ClusterList &clusterList2)
const;
246 template <
typename T>
250 this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, n1, n2);
255 template <
typename T>
258 unsigned int n1(0), n2(0);
259 this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, n1, n2);
264 template <
typename T>
267 return m_overlapMatrix.begin();
272 template <
typename T>
275 return m_overlapMatrix.end();
280 template <
typename T>
282 const pandora::Cluster *
const pCluster1,
const pandora::Cluster *
const pCluster2)
const
284 const OverlapList &overlapList(this->GetOverlapList(pCluster1));
285 typename OverlapList::const_iterator iter = overlapList.find(pCluster2);
287 if (overlapList.end() == iter)
288 throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
295 template <
typename T>
298 typename TheMatrix::const_iterator iter = m_overlapMatrix.find(pCluster1);
300 if (m_overlapMatrix.end() == iter)
301 throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
308 template <
typename T>
311 return m_clusterNavigationMap12;
316 template <
typename T>
319 return m_clusterNavigationMap21;
324 template <
typename T>
327 m_overlapMatrix.clear();
328 m_clusterNavigationMap12.clear();
329 m_clusterNavigationMap21.clear();
335 template <
typename T>
337 const pandora::Cluster *
const pCluster1,
const pandora::Cluster *
const pCluster2,
const OverlapResult &overlapResult) :
338 m_pCluster1(pCluster1),
339 m_pCluster2(pCluster2),
340 m_overlapResult(overlapResult)
346 template <
typename T>
354 template <
typename T>
362 template <
typename T>
365 return m_overlapResult;
370 template <
typename T>
381 #endif // #ifndef LAR_OVERLAP_MATRIX_H
OverlapResult m_overlapResult
The overlap result.
const pandora::Cluster * m_pCluster1
The address of cluster 1.
void Clear()
Clear overlap matrix.
void RemoveCluster(const pandora::Cluster *const pCluster)
Remove entries from matrix corresponding to specified cluster.
Element(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const OverlapResult &overlapResult)
Constructor.
bool DefaultAmbiguityFunction(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2, const pandora::Cluster *&pCluster1, const pandora::Cluster *&pCluster2) const
Default ambiguity function, checking that only one cluster from view 1 and view 2 is found...
const OverlapResult & GetOverlapResult() const
Get the overlap result.
const ClusterNavigationMap & GetClusterNavigationMap12() const
Get the cluster navigation map 1->2.
std::vector< Element > ElementList
void GetSortedKeyClusters(pandora::ClusterVector &sortedKeyClusters) const
Get a sorted vector of key clusters (view 1 clusters with current implementation) ...
const OverlapResult & GetOverlapResult(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2) const
Get the overlap result for a specified pair of clusters.
ClusterNavigationMap m_clusterNavigationMap12
The cluster navigation map 1->2.
const OverlapList & GetOverlapList(const pandora::Cluster *const pCluster1) const
Get the overlap list for a specified cluster.
TwoViewDeltaRayOverlapResult class.
bool operator<(const Element &rhs) const
Element less than operator.
const ClusterNavigationMap & GetClusterNavigationMap21() const
Get the cluster navigation map 2->1.
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterNavigationMap
const_iterator begin() const
Returns an iterator referring to the first element in the overlap matrix.
TheMatrix::const_iterator const_iterator
std::unordered_map< const pandora::Cluster *, OverlapResult > OverlapList
void GetUnambiguousElements(const bool ignoreUnavailable, ElementList &elementList) const
Get unambiguous elements.
void SetOverlapResult(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const OverlapResult &overlapResult)
Set overlap result.
TheMatrix m_overlapMatrix
The overlap matrix.
void ExploreConnections(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, pandora::ClusterList &clusterList1, pandora::ClusterList &clusterList2) const
Explore connections associated with a given cluster.
const pandora::Cluster * GetCluster2() const
Get the address of cluster 2.
const_iterator end() const
Returns an iterator referring to the past-the-end element in the overlap matrix.
std::unordered_map< const pandora::Cluster *, OverlapList > TheMatrix
const pandora::Cluster * m_pCluster2
The address of cluster 2.
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void ReplaceOverlapResult(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const OverlapResult &overlapResult)
SetReplace an existing overlap result.
ClusterNavigationMap m_clusterNavigationMap21
The cluster navigation map 2->1.
const pandora::Cluster * GetCluster1() const
Get the address of cluster 1.
void GetNConnections(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, unsigned int &n1, unsigned int &n2) const
Get the number of connections for a specified cluster.