LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::OverlapMatrix< T > Class Template Reference

OverlapMatrix class. More...

#include "LArOverlapMatrix.h"

Classes

class  Element
 Element class. More...
 

Public Types

typedef T OverlapResult
 
typedef std::vector< ElementElementList
 
typedef std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterNavigationMap
 
typedef std::unordered_map< const pandora::Cluster *, OverlapResultOverlapList
 
typedef std::unordered_map< const pandora::Cluster *, OverlapListTheMatrix
 
typedef TheMatrix::const_iterator const_iterator
 

Public Member Functions

void GetUnambiguousElements (const bool ignoreUnavailable, ElementList &elementList) const
 Get unambiguous elements. More...
 
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. More...
 
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. More...
 
void GetConnectedElements (const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
 Get a list of elements connected to a specified cluster. More...
 
void GetConnectedElements (const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList, unsigned int &n1, unsigned int &n2) const
 Get a list of elements connected to a specified cluster. More...
 
const_iterator begin () const
 Returns an iterator referring to the first element in the overlap matrix. More...
 
const_iterator end () const
 Returns an iterator referring to the past-the-end element in the overlap matrix. More...
 
void GetSortedKeyClusters (pandora::ClusterVector &sortedKeyClusters) const
 Get a sorted vector of key clusters (view 1 clusters with current implementation) More...
 
const OverlapResultGetOverlapResult (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2) const
 Get the overlap result for a specified pair of clusters. More...
 
const OverlapListGetOverlapList (const pandora::Cluster *const pCluster1) const
 Get the overlap list for a specified cluster. More...
 
const ClusterNavigationMapGetClusterNavigationMap12 () const
 Get the cluster navigation map 1->2. More...
 
const ClusterNavigationMapGetClusterNavigationMap21 () const
 Get the cluster navigation map 2->1. More...
 
void SetOverlapResult (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const OverlapResult &overlapResult)
 Set overlap result. More...
 
void ReplaceOverlapResult (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const OverlapResult &overlapResult)
 SetReplace an existing overlap result. More...
 
void RemoveCluster (const pandora::Cluster *const pCluster)
 Remove entries from matrix corresponding to specified cluster. More...
 
void Clear ()
 Clear overlap matrix. More...
 

Private Member Functions

void GetConnectedElements (const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList, pandora::ClusterList &clusterList1, pandora::ClusterList &clusterList2) const
 Get elements connected to a specified cluster. More...
 
void ExploreConnections (const pandora::Cluster *const pCluster, const bool ignoreUnavailable, pandora::ClusterList &clusterList1, pandora::ClusterList &clusterList2) const
 Explore connections associated with a given cluster. More...
 

Private Attributes

TheMatrix m_overlapMatrix
 The overlap matrix. More...
 
ClusterNavigationMap m_clusterNavigationMap12
 The cluster navigation map 1->2. More...
 
ClusterNavigationMap m_clusterNavigationMap21
 The cluster navigation map 2->1. More...
 

Detailed Description

template<typename T>
class lar_content::OverlapMatrix< T >

OverlapMatrix class.

Definition at line 23 of file LArOverlapMatrix.h.

Member Typedef Documentation

template<typename T>
typedef std::unordered_map<const pandora::Cluster *, pandora::ClusterList> lar_content::OverlapMatrix< T >::ClusterNavigationMap

Definition at line 131 of file LArOverlapMatrix.h.

template<typename T>
typedef TheMatrix::const_iterator lar_content::OverlapMatrix< T >::const_iterator

Definition at line 135 of file LArOverlapMatrix.h.

template<typename T>
typedef std::vector<Element> lar_content::OverlapMatrix< T >::ElementList

Definition at line 77 of file LArOverlapMatrix.h.

template<typename T>
typedef std::unordered_map<const pandora::Cluster *, OverlapResult> lar_content::OverlapMatrix< T >::OverlapList

Definition at line 132 of file LArOverlapMatrix.h.

template<typename T>
typedef T lar_content::OverlapMatrix< T >::OverlapResult

Definition at line 26 of file LArOverlapMatrix.h.

template<typename T>
typedef std::unordered_map<const pandora::Cluster *, OverlapList> lar_content::OverlapMatrix< T >::TheMatrix

Definition at line 133 of file LArOverlapMatrix.h.

Member Function Documentation

template<typename T >
OverlapMatrix< T >::const_iterator lar_content::OverlapMatrix< T >::begin ( ) const
inline

Returns an iterator referring to the first element in the overlap matrix.

Definition at line 265 of file LArOverlapMatrix.h.

References lar_content::OverlapMatrix< T >::m_overlapMatrix.

266 {
267  return m_overlapMatrix.begin();
268 }
TheMatrix m_overlapMatrix
The overlap matrix.
template<typename T >
void lar_content::OverlapMatrix< T >::Clear ( )
inline

Clear overlap matrix.

Definition at line 325 of file LArOverlapMatrix.h.

References lar_content::OverlapMatrix< T >::m_clusterNavigationMap12, lar_content::OverlapMatrix< T >::m_clusterNavigationMap21, and lar_content::OverlapMatrix< T >::m_overlapMatrix.

Referenced by lar_content::TwoViewMatchingControl< T >::TidyUp().

326 {
327  m_overlapMatrix.clear();
328  m_clusterNavigationMap12.clear();
329  m_clusterNavigationMap21.clear();
330 }
ClusterNavigationMap m_clusterNavigationMap12
The cluster navigation map 1->2.
TheMatrix m_overlapMatrix
The overlap matrix.
ClusterNavigationMap m_clusterNavigationMap21
The cluster navigation map 2->1.
template<typename T>
bool lar_content::OverlapMatrix< T >::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.

Parameters
clusterList1cluster list 1
clusterList2cluster list 2
pCluster1to receive the address of the unambiguous cluster 1
pCluster2to receive the address of the unambiguous cluster 2
Returns
boolean

Definition at line 63 of file LArOverlapMatrix.cc.

65 {
66  if ((1 != clusterList1.size()) || (1 != clusterList2.size()))
67  return false;
68 
69  pCluster1 = *(clusterList1.begin());
70  pCluster2 = *(clusterList2.begin());
71 
72  return true;
73 }
template<typename T >
OverlapMatrix< T >::const_iterator lar_content::OverlapMatrix< T >::end ( ) const
inline

Returns an iterator referring to the past-the-end element in the overlap matrix.

Definition at line 273 of file LArOverlapMatrix.h.

References lar_content::OverlapMatrix< T >::m_overlapMatrix.

274 {
275  return m_overlapMatrix.end();
276 }
TheMatrix m_overlapMatrix
The overlap matrix.
template<typename T>
void lar_content::OverlapMatrix< T >::ExploreConnections ( const pandora::Cluster *const  pCluster,
const bool  ignoreUnavailable,
pandora::ClusterList &  clusterList1,
pandora::ClusterList &  clusterList2 
) const
private

Explore connections associated with a given cluster.

Parameters
pClusteraddress of the cluster
clusterList1connected view 1 clusters
clusterList2connected view 2 clusters

Definition at line 235 of file LArOverlapMatrix.cc.

237 {
238  if (ignoreUnavailable && !pCluster->IsAvailable())
239  return;
240 
241  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
242  const bool clusterFromView1(
244  const bool clusterFromView2(
246 
247  if (clusterFromView1 == clusterFromView2)
248  throw StatusCodeException(STATUS_CODE_FAILURE);
249 
250  ClusterList &clusterList(clusterFromView1 ? clusterList1 : clusterList2);
251  const ClusterNavigationMap &navigationMap(clusterFromView1 ? m_clusterNavigationMap12 : m_clusterNavigationMap21);
252 
253  if (clusterList.end() != std::find(clusterList.begin(), clusterList.end(), pCluster))
254  return;
255 
256  clusterList.push_back(pCluster);
257  ClusterNavigationMap::const_iterator iter = navigationMap.find(pCluster);
258 
259  if (navigationMap.end() == iter)
260  throw StatusCodeException(STATUS_CODE_FAILURE);
261 
262  for (ClusterList::const_iterator cIter = iter->second.begin(), cIterEnd = iter->second.end(); cIter != cIterEnd; ++cIter)
263  this->ExploreConnections(*cIter, ignoreUnavailable, clusterList1, clusterList2);
264 }
intermediate_table::const_iterator const_iterator
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
ClusterNavigationMap m_clusterNavigationMap12
The cluster navigation map 1->2.
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterNavigationMap
void ExploreConnections(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, pandora::ClusterList &clusterList1, pandora::ClusterList &clusterList2) const
Explore connections associated with a given cluster.
HitType
Definition: HitType.h:12
ClusterNavigationMap m_clusterNavigationMap21
The cluster navigation map 2->1.
template<typename T >
const OverlapMatrix< T >::ClusterNavigationMap & lar_content::OverlapMatrix< T >::GetClusterNavigationMap12 ( ) const
inline

Get the cluster navigation map 1->2.

Returns
the cluster navigation map 1->2

Definition at line 309 of file LArOverlapMatrix.h.

References lar_content::OverlapMatrix< T >::m_clusterNavigationMap12.

310 {
312 }
ClusterNavigationMap m_clusterNavigationMap12
The cluster navigation map 1->2.
template<typename T >
const OverlapMatrix< T >::ClusterNavigationMap & lar_content::OverlapMatrix< T >::GetClusterNavigationMap21 ( ) const
inline

Get the cluster navigation map 2->1.

Returns
the cluster navigation map 2->1

Definition at line 317 of file LArOverlapMatrix.h.

References lar_content::OverlapMatrix< T >::m_clusterNavigationMap21.

318 {
320 }
ClusterNavigationMap m_clusterNavigationMap21
The cluster navigation map 2->1.
template<typename T >
void lar_content::OverlapMatrix< T >::GetConnectedElements ( const pandora::Cluster *const  pCluster,
const bool  ignoreUnavailable,
ElementList elementList 
) const
inline

Get a list of elements connected to a specified cluster.

Parameters
pClusteraddress of a cluster
ignoreUnavailablewhether to ignore unavailable clusters
elementListto receive the connected element list

Definition at line 256 of file LArOverlapMatrix.h.

Referenced by lar_content::TwoViewAmbiguousDeltaRayTool::ExamineConnectedElements(), lar_content::TwoViewSimpleTracksTool::FindBestTrack(), lar_content::TwoViewLongTracksTool::FindLongTracks(), lar_content::TwoViewThreeDKinkTool::GetModifications(), lar_content::OverlapMatrix< T >::GetNConnections(), lar_content::TransverseMatrixVisualizationTool::Run(), and lar_content::TwoViewCosmicRayRemovalTool::Run().

257 {
258  unsigned int n1(0), n2(0);
259  this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, n1, n2);
260 }
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
template<typename T >
void lar_content::OverlapMatrix< T >::GetConnectedElements ( const pandora::Cluster *const  pCluster,
const bool  ignoreUnavailable,
ElementList elementList,
unsigned int &  n1,
unsigned int &  n2 
) const

Get a list of elements connected to a specified cluster.

Parameters
pClusteraddress of a cluster
ignoreUnavailablewhether to ignore unavailable clusters
elementListto receive the connected element list
n1to receive the number of view 1 connections
n2to receive the number of view 2 connections

Definition at line 78 of file LArOverlapMatrix.cc.

80 {
81  ClusterList clusterList1, clusterList2;
82  this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, clusterList1, clusterList2);
83  n1 = clusterList1.size();
84  n2 = clusterList2.size();
85 }
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
template<typename T>
void lar_content::OverlapMatrix< T >::GetConnectedElements ( const pandora::Cluster *const  pCluster,
const bool  ignoreUnavailable,
ElementList elementList,
pandora::ClusterList &  clusterList1,
pandora::ClusterList &  clusterList2 
) const
private

Get elements connected to a specified cluster.

Parameters
pClusteraddress of the cluster
elementListthe element list
clusterList1connected view 1 clusters
clusterList2connected view 2 clusters
template<typename T >
void lar_content::OverlapMatrix< T >::GetNConnections ( const pandora::Cluster *const  pCluster,
const bool  ignoreUnavailable,
unsigned int &  n1,
unsigned int &  n2 
) const
inline

Get the number of connections for a specified cluster.

Parameters
pClusteraddress of a cluster
ignoreUnavailablewhether to ignore unavailable clusters
n1to receive the number of view 1 connections
n2to receive the number of view 2 connections

Definition at line 247 of file LArOverlapMatrix.h.

References lar_content::OverlapMatrix< T >::GetConnectedElements().

248 {
249  ElementList elementList;
250  this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, n1, n2);
251 }
std::vector< Element > ElementList
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
template<typename T >
const OverlapMatrix< T >::OverlapList & lar_content::OverlapMatrix< T >::GetOverlapList ( const pandora::Cluster *const  pCluster1) const
inline

Get the overlap list for a specified cluster.

Parameters
pCluster1address of cluster 1
Returns
the cluster overlap list

Definition at line 296 of file LArOverlapMatrix.h.

References lar_content::OverlapMatrix< T >::m_overlapMatrix.

Referenced by lar_content::OverlapMatrix< T >::GetOverlapResult().

297 {
298  typename TheMatrix::const_iterator iter = m_overlapMatrix.find(pCluster1);
299 
300  if (m_overlapMatrix.end() == iter)
301  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
302 
303  return iter->second;
304 }
intermediate_table::const_iterator const_iterator
TheMatrix m_overlapMatrix
The overlap matrix.
template<typename T >
const OverlapMatrix< T >::OverlapResult & lar_content::OverlapMatrix< T >::GetOverlapResult ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2 
) const
inline

Get the overlap result for a specified pair of clusters.

Parameters
pCluster1address of cluster 1
pCluster2address of cluster 2
Returns
the address of the overlap result

Definition at line 281 of file LArOverlapMatrix.h.

References lar_content::OverlapMatrix< T >::GetOverlapList().

283 {
284  const OverlapList &overlapList(this->GetOverlapList(pCluster1));
285  typename OverlapList::const_iterator iter = overlapList.find(pCluster2);
286 
287  if (overlapList.end() == iter)
288  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
289 
290  return iter->second;
291 }
intermediate_table::const_iterator const_iterator
const OverlapList & GetOverlapList(const pandora::Cluster *const pCluster1) const
Get the overlap list for a specified cluster.
std::unordered_map< const pandora::Cluster *, OverlapResult > OverlapList
template<typename T>
void lar_content::OverlapMatrix< T >::GetSortedKeyClusters ( pandora::ClusterVector &  sortedKeyClusters) const

Get a sorted vector of key clusters (view 1 clusters with current implementation)

Parameters
sortedKeyClustersto receive the sorted vector of key clusters

Definition at line 90 of file LArOverlapMatrix.cc.

References util::begin(), and util::end().

Referenced by lar_content::TwoViewAmbiguousDeltaRayTool::ExamineConnectedElements(), lar_content::TwoViewSimpleTracksTool::FindBestTrack(), lar_content::TwoViewLongTracksTool::FindLongTracks(), lar_content::TwoViewThreeDKinkTool::GetModifications(), lar_content::TransverseMatrixVisualizationTool::Run(), and lar_content::TwoViewCosmicRayRemovalTool::Run().

91 {
92  for (typename TheMatrix::const_iterator iter1 = this->begin(), iter1End = this->end(); iter1 != iter1End; ++iter1)
93  sortedKeyClusters.push_back(iter1->first);
94 
95  std::sort(sortedKeyClusters.begin(), sortedKeyClusters.end(), LArClusterHelper::SortByNHits);
96 }
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.
intermediate_table::const_iterator const_iterator
const_iterator begin() const
Returns an iterator referring to the first element in the overlap matrix.
const_iterator end() const
Returns an iterator referring to the past-the-end element in the overlap matrix.
template<typename T >
void lar_content::OverlapMatrix< T >::GetUnambiguousElements ( const bool  ignoreUnavailable,
ElementList elementList 
) const

Get unambiguous elements.

Parameters
ignoreUnavailablewhether to ignore unavailable clusters
elementListto receive the unambiguous element list

Definition at line 30 of file LArOverlapMatrix.cc.

References util::begin(), and util::end().

Referenced by lar_content::TwoViewClearTracksTool::Run().

31 {
32  for (typename TheMatrix::const_iterator iter1 = this->begin(), iter1End = this->end(); iter1 != iter1End; ++iter1)
33  {
34  ElementList tempElementList;
35  ClusterList clusterList1, clusterList2;
36  this->GetConnectedElements(iter1->first, ignoreUnavailable, tempElementList, clusterList1, clusterList2);
37 
38  const Cluster *pCluster1(nullptr), *pCluster2(nullptr);
39  if (!this->DefaultAmbiguityFunction(clusterList1, clusterList2, pCluster1, pCluster2))
40  continue;
41 
42  // ATTN With HIT_CUSTOM definitions, it is possible to navigate from different view 1 clusters to same combination
43  if (iter1->first != pCluster1)
44  continue;
45 
46  if (!pCluster1 || !pCluster2)
47  continue;
48 
49  typename OverlapList::const_iterator iter2 = iter1->second.find(pCluster2);
50  if (iter1->second.end() == iter2)
51  throw StatusCodeException(STATUS_CODE_FAILURE);
52 
53  Element element(pCluster1, pCluster2, iter2->second);
54  elementList.push_back(element);
55  }
56 
57  std::sort(elementList.begin(), elementList.end());
58 }
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...
intermediate_table::const_iterator const_iterator
std::vector< Element > ElementList
const_iterator begin() const
Returns an iterator referring to the first element in the overlap matrix.
const_iterator end() const
Returns an iterator referring to the past-the-end element in the overlap matrix.
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
template<typename T >
void lar_content::OverlapMatrix< T >::RemoveCluster ( const pandora::Cluster *const  pCluster)

Remove entries from matrix corresponding to specified cluster.

Parameters
pClusteraddress of the cluster

Definition at line 142 of file LArOverlapMatrix.cc.

References util::begin(), and util::end().

Referenced by lar_content::TwoViewMatchingControl< T >::UpdateUponDeletion().

143 {
144  ClusterList additionalRemovals;
145 
146  if (m_clusterNavigationMap12.erase(pCluster) > 0)
147  {
148  typename TheMatrix::iterator iter = m_overlapMatrix.find(pCluster);
149 
150  if (m_overlapMatrix.end() != iter)
151  m_overlapMatrix.erase(iter);
152 
153  for (ClusterNavigationMap::iterator navIter = m_clusterNavigationMap21.begin(); navIter != m_clusterNavigationMap21.end();)
154  {
155  ClusterNavigationMap::iterator thisIter = navIter++;
156  ClusterList::iterator listIter = std::find(thisIter->second.begin(), thisIter->second.end(), pCluster);
157 
158  if (thisIter->second.end() != listIter)
159  thisIter->second.erase(listIter);
160 
161  if (thisIter->second.empty())
162  additionalRemovals.push_back(thisIter->first);
163  }
164  }
165 
166  if (m_clusterNavigationMap21.erase(pCluster) > 0)
167  {
168  for (typename TheMatrix::iterator iter1 = m_overlapMatrix.begin(), iter1End = m_overlapMatrix.end(); iter1 != iter1End; ++iter1)
169  {
170  typename OverlapList::iterator iter = iter1->second.find(pCluster);
171 
172  if (iter1->second.end() != iter)
173  iter1->second.erase(iter);
174  }
175 
176  for (ClusterNavigationMap::iterator navIter = m_clusterNavigationMap12.begin(); navIter != m_clusterNavigationMap12.end();)
177  {
178  ClusterNavigationMap::iterator thisIter = navIter++;
179  ClusterList::iterator listIter = std::find(thisIter->second.begin(), thisIter->second.end(), pCluster);
180 
181  if (thisIter->second.end() != listIter)
182  thisIter->second.erase(listIter);
183 
184  if (thisIter->second.empty())
185  additionalRemovals.push_back(thisIter->first);
186  }
187  }
188 
189  additionalRemovals.sort(LArClusterHelper::SortByNHits);
190 
191  for (ClusterList::const_iterator iter = additionalRemovals.begin(), iterEnd = additionalRemovals.end(); iter != iterEnd; ++iter)
192  this->RemoveCluster(*iter);
193 }
intermediate_table::iterator iterator
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.
void RemoveCluster(const pandora::Cluster *const pCluster)
Remove entries from matrix corresponding to specified cluster.
intermediate_table::const_iterator const_iterator
ClusterNavigationMap m_clusterNavigationMap12
The cluster navigation map 1->2.
TheMatrix m_overlapMatrix
The overlap matrix.
ClusterNavigationMap m_clusterNavigationMap21
The cluster navigation map 2->1.
template<typename T >
void lar_content::OverlapMatrix< T >::ReplaceOverlapResult ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
const OverlapResult overlapResult 
)

SetReplace an existing overlap result.

Parameters
pCluster1address of cluster 1
pCluster2address of cluster 2
overlapResultthe overlap result

Definition at line 124 of file LArOverlapMatrix.cc.

125 {
126  typename TheMatrix::iterator iter1 = m_overlapMatrix.find(pCluster1);
127 
128  if (m_overlapMatrix.end() == iter1)
129  throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
130 
131  typename OverlapList::iterator iter2 = iter1->second.find(pCluster2);
132 
133  if (iter1->second.end() == iter2)
134  throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
135 
136  iter2->second = overlapResult;
137 }
intermediate_table::iterator iterator
TheMatrix m_overlapMatrix
The overlap matrix.
template<typename T >
void lar_content::OverlapMatrix< T >::SetOverlapResult ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
const OverlapResult overlapResult 
)

Set overlap result.

Parameters
pCluster1address of cluster 1
pCluster2address of cluster 2
overlapResultthe overlap result

Definition at line 101 of file LArOverlapMatrix.cc.

Referenced by lar_content::TwoViewDeltaRayMatchingAlgorithm::DoesClusterPassTensorThreshold(), and lar_content::TwoViewTransverseTracksAlgorithm::TwoViewTransverseTracksAlgorithm().

102 {
103  OverlapList &overlapList = m_overlapMatrix[pCluster1];
104  typename OverlapList::const_iterator iter = overlapList.find(pCluster2);
105 
106  if (overlapList.end() != iter)
107  throw pandora::StatusCodeException(pandora::STATUS_CODE_ALREADY_PRESENT);
108 
109  if (!overlapList.insert(typename OverlapList::value_type(pCluster2, overlapResult)).second)
110  throw pandora::StatusCodeException(pandora::STATUS_CODE_FAILURE);
111 
112  ClusterList &navigation12(m_clusterNavigationMap12[pCluster1]);
113  ClusterList &navigation21(m_clusterNavigationMap21[pCluster2]);
114 
115  if (navigation12.end() == std::find(navigation12.begin(), navigation12.end(), pCluster2))
116  navigation12.push_back(pCluster2);
117  if (navigation21.end() == std::find(navigation21.begin(), navigation21.end(), pCluster1))
118  navigation21.push_back(pCluster1);
119 }
intermediate_table::const_iterator const_iterator
ClusterNavigationMap m_clusterNavigationMap12
The cluster navigation map 1->2.
std::unordered_map< const pandora::Cluster *, OverlapResult > OverlapList
TheMatrix m_overlapMatrix
The overlap matrix.
ClusterNavigationMap m_clusterNavigationMap21
The cluster navigation map 2->1.

Member Data Documentation

template<typename T>
ClusterNavigationMap lar_content::OverlapMatrix< T >::m_clusterNavigationMap12
private

The cluster navigation map 1->2.

Definition at line 240 of file LArOverlapMatrix.h.

Referenced by lar_content::OverlapMatrix< T >::Clear(), and lar_content::OverlapMatrix< T >::GetClusterNavigationMap12().

template<typename T>
ClusterNavigationMap lar_content::OverlapMatrix< T >::m_clusterNavigationMap21
private

The cluster navigation map 2->1.

Definition at line 241 of file LArOverlapMatrix.h.

Referenced by lar_content::OverlapMatrix< T >::Clear(), and lar_content::OverlapMatrix< T >::GetClusterNavigationMap21().


The documentation for this class was generated from the following files: