LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::OverlapTensor< T > Class Template Reference

OverlapTensor class. More...

#include "LArOverlapTensor.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 *, OverlapListOverlapMatrix
 
typedef std::unordered_map< const pandora::Cluster *, OverlapMatrixTheTensor
 
typedef TheTensor::const_iterator const_iterator
 

Public Member Functions

void GetUnambiguousElements (const bool ignoreUnavailable, ElementList &elementList) const
 Get unambiguous elements. More...
 
bool DefaultAmbiguityFunction (const pandora::ClusterList &clusterListU, const pandora::ClusterList &clusterListV, const pandora::ClusterList &clusterListW, const pandora::Cluster *&pClusterU, const pandora::Cluster *&pClusterV, const pandora::Cluster *&pClusterW) const
 Default ambiguity function, checking that only one U, V and W cluster is found. More...
 
void GetNConnections (const pandora::Cluster *const pCluster, const bool ignoreUnavailable, unsigned int &nU, unsigned int &nV, unsigned int &nW) 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 &nU, unsigned int &nV, unsigned int &nW) 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 tensor. More...
 
const_iterator end () const
 Returns an iterator referring to the past-the-end element in the overlap tensor. More...
 
void GetSortedKeyClusters (pandora::ClusterVector &sortedKeyClusters) const
 Get a sorted vector of key clusters (U clusters with current implementation) More...
 
const OverlapResultGetOverlapResult (const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW) const
 Get the overlap result for a specified trio of clusters. More...
 
const OverlapListGetOverlapList (const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV) const
 Get the overlap list for a specified pair of clusters. More...
 
const OverlapMatrixGetOverlapMatrix (const pandora::Cluster *const pClusterU) const
 Get the cluster overlap matrix for a specified cluster. More...
 
const ClusterNavigationMapGetClusterNavigationMapUV () const
 Get the cluster navigation map U->V. More...
 
const ClusterNavigationMapGetClusterNavigationMapVW () const
 Get the cluster navigation map V->W. More...
 
const ClusterNavigationMapGetClusterNavigationMapWU () const
 Get the cluster navigation map W->U. More...
 
void SetOverlapResult (const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW, const OverlapResult &overlapResult)
 Set overlap result. More...
 
void ReplaceOverlapResult (const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW, const OverlapResult &overlapResult)
 SetReplace an existing overlap result. More...
 
void RemoveCluster (const pandora::Cluster *const pCluster)
 Remove entries from tensor corresponding to specified cluster. More...
 
void Clear ()
 Clear overlap tensor. More...
 

Private Member Functions

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

Private Attributes

TheTensor m_overlapTensor
 The overlap tensor. More...
 
ClusterNavigationMap m_clusterNavigationMapUV
 The cluster navigation map U->V. More...
 
ClusterNavigationMap m_clusterNavigationMapVW
 The cluster navigation map V->W. More...
 
ClusterNavigationMap m_clusterNavigationMapWU
 The cluster navigation map W->U. More...
 

Detailed Description

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

OverlapTensor class.

Definition at line 23 of file LArOverlapTensor.h.

Member Typedef Documentation

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

Definition at line 144 of file LArOverlapTensor.h.

template<typename T>
typedef TheTensor::const_iterator lar_content::OverlapTensor< T >::const_iterator

Definition at line 149 of file LArOverlapTensor.h.

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

Definition at line 86 of file LArOverlapTensor.h.

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

Definition at line 145 of file LArOverlapTensor.h.

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

Definition at line 146 of file LArOverlapTensor.h.

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

Definition at line 26 of file LArOverlapTensor.h.

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

Definition at line 147 of file LArOverlapTensor.h.

Member Function Documentation

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

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

Definition at line 303 of file LArOverlapTensor.h.

References lar_content::OverlapTensor< T >::m_overlapTensor.

Referenced by lar_content::ClearTrackFragmentsTool::GetAffectedKeyClusters().

304 {
305  return m_overlapTensor.begin();
306 }
TheTensor m_overlapTensor
The overlap tensor.
template<typename T >
void lar_content::OverlapTensor< T >::Clear ( )
inline

Clear overlap tensor.

Definition at line 387 of file LArOverlapTensor.h.

References lar_content::OverlapTensor< T >::m_clusterNavigationMapUV, lar_content::OverlapTensor< T >::m_clusterNavigationMapVW, lar_content::OverlapTensor< T >::m_clusterNavigationMapWU, and lar_content::OverlapTensor< T >::m_overlapTensor.

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

388 {
389  m_overlapTensor.clear();
390  m_clusterNavigationMapUV.clear();
391  m_clusterNavigationMapVW.clear();
392  m_clusterNavigationMapWU.clear();
393 }
ClusterNavigationMap m_clusterNavigationMapVW
The cluster navigation map V->W.
ClusterNavigationMap m_clusterNavigationMapUV
The cluster navigation map U->V.
TheTensor m_overlapTensor
The overlap tensor.
ClusterNavigationMap m_clusterNavigationMapWU
The cluster navigation map W->U.
template<typename T>
bool lar_content::OverlapTensor< T >::DefaultAmbiguityFunction ( const pandora::ClusterList &  clusterListU,
const pandora::ClusterList &  clusterListV,
const pandora::ClusterList &  clusterListW,
const pandora::Cluster *&  pClusterU,
const pandora::Cluster *&  pClusterV,
const pandora::Cluster *&  pClusterW 
) const

Default ambiguity function, checking that only one U, V and W cluster is found.

Parameters
clusterListUcluster list U
clusterListVcluster list V
clusterListWcluster list W
pClusterUto receive the address of the unambiguous U cluster
pClusterVto receive the address of the unambiguous V cluster
pClusterWto receive the address of the unambiguous W cluster
Returns
boolean

Definition at line 68 of file LArOverlapTensor.cc.

70 {
71  if ((1 != clusterListU.size()) || (1 != clusterListV.size()) || (1 != clusterListW.size()))
72  return false;
73 
74  pClusterU = *(clusterListU.begin());
75  pClusterV = *(clusterListV.begin());
76  pClusterW = *(clusterListW.begin());
77 
78  return true;
79 }
template<typename T >
OverlapTensor< T >::const_iterator lar_content::OverlapTensor< T >::end ( ) const
inline

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

Definition at line 311 of file LArOverlapTensor.h.

References lar_content::OverlapTensor< T >::m_overlapTensor.

Referenced by lar_content::ClearTrackFragmentsTool::GetAffectedKeyClusters().

312 {
313  return m_overlapTensor.end();
314 }
TheTensor m_overlapTensor
The overlap tensor.
template<typename T>
void lar_content::OverlapTensor< T >::ExploreConnections ( const pandora::Cluster *const  pCluster,
const bool  ignoreUnavailable,
pandora::ClusterList &  clusterListU,
pandora::ClusterList &  clusterListV,
pandora::ClusterList &  clusterListW 
) const
private

Explore connections associated with a given cluster.

Parameters
pClusteraddress of the cluster
clusterListUconnected u clusters
clusterListVconnected v clusters
clusterListWconnected w clusters

Definition at line 273 of file LArOverlapTensor.cc.

275 {
276  if (ignoreUnavailable && !pCluster->IsAvailable())
277  return;
278 
279  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
280 
281  if (!((TPC_VIEW_U == hitType) || (TPC_VIEW_V == hitType) || (TPC_VIEW_W == hitType)))
282  throw StatusCodeException(STATUS_CODE_FAILURE);
283 
284  ClusterList &clusterList((TPC_VIEW_U == hitType) ? clusterListU : (TPC_VIEW_V == hitType) ? clusterListV : clusterListW);
285  const ClusterNavigationMap &navigationMap((TPC_VIEW_U == hitType) ? m_clusterNavigationMapUV : (TPC_VIEW_V == hitType) ? m_clusterNavigationMapVW : m_clusterNavigationMapWU);
286 
287  if (clusterList.end() != std::find(clusterList.begin(), clusterList.end(), pCluster))
288  return;
289 
290  clusterList.push_back(pCluster);
291  ClusterNavigationMap::const_iterator iter = navigationMap.find(pCluster);
292 
293  if (navigationMap.end() == iter)
294  throw StatusCodeException(STATUS_CODE_FAILURE);
295 
296  for (ClusterList::const_iterator cIter = iter->second.begin(), cIterEnd = iter->second.end(); cIter != cIterEnd; ++cIter)
297  this->ExploreConnections(*cIter, ignoreUnavailable, clusterListU, clusterListV, clusterListW);
298 }
ClusterNavigationMap m_clusterNavigationMapVW
The cluster navigation map V->W.
ClusterNavigationMap m_clusterNavigationMapUV
The cluster navigation map U->V.
void ExploreConnections(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
Explore connections associated with a given cluster.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
intermediate_table::const_iterator const_iterator
ClusterNavigationMap m_clusterNavigationMapWU
The cluster navigation map W->U.
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterNavigationMap
template<typename T >
const OverlapTensor< T >::ClusterNavigationMap & lar_content::OverlapTensor< T >::GetClusterNavigationMapUV ( ) const
inline

Get the cluster navigation map U->V.

Returns
the cluster navigation map U->V

Definition at line 363 of file LArOverlapTensor.h.

References lar_content::OverlapTensor< T >::m_clusterNavigationMapUV.

Referenced by lar_content::ThreeDBaseAlgorithm< T >::RemoveUnavailableTensorElements().

364 {
366 }
ClusterNavigationMap m_clusterNavigationMapUV
The cluster navigation map U->V.
template<typename T >
const OverlapTensor< T >::ClusterNavigationMap & lar_content::OverlapTensor< T >::GetClusterNavigationMapVW ( ) const
inline

Get the cluster navigation map V->W.

Returns
the cluster navigation map V->W

Definition at line 371 of file LArOverlapTensor.h.

References lar_content::OverlapTensor< T >::m_clusterNavigationMapVW.

Referenced by lar_content::ThreeDBaseAlgorithm< T >::RemoveUnavailableTensorElements().

372 {
374 }
ClusterNavigationMap m_clusterNavigationMapVW
The cluster navigation map V->W.
template<typename T >
const OverlapTensor< T >::ClusterNavigationMap & lar_content::OverlapTensor< T >::GetClusterNavigationMapWU ( ) const
inline

Get the cluster navigation map W->U.

Returns
the cluster navigation map W->U

Definition at line 379 of file LArOverlapTensor.h.

References lar_content::OverlapTensor< T >::m_clusterNavigationMapWU.

Referenced by lar_content::ThreeDBaseAlgorithm< T >::RemoveUnavailableTensorElements().

380 {
382 }
ClusterNavigationMap m_clusterNavigationMapWU
The cluster navigation map W->U.
template<typename T >
void lar_content::OverlapTensor< 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 294 of file LArOverlapTensor.h.

Referenced by lar_content::SimpleShowersTool::FindBestShower(), lar_content::MopUpRemnantsTool::FindBestShowers(), lar_content::ClearShowersTool::FindClearShowers(), lar_content::ConnectedRemnantsTool::FindConnectedShowers(), lar_content::LongTracksTool::FindLongTracks(), lar_content::MatchedEndPointsTool::FindMatchedTracks(), lar_content::MissingTrackTool::FindMissingTracks(), lar_content::SplitShowersTool::FindSplitShowers(), lar_content::TracksCrossingGapsTool::FindTracks(), lar_content::TrackSplittingTool::FindTracks(), lar_content::MissingTrackSegmentTool::FindTracks(), lar_content::ClearTrackFragmentsTool::GetAndCheckElementList(), lar_content::ThreeDKinkBaseTool::GetModifications(), lar_content::OverlapTensor< T >::GetNConnections(), lar_content::TransverseTensorVisualizationTool::Run(), and lar_content::ShowerTensorVisualizationTool::Run().

295 {
296  unsigned int nU(0), nV(0), nW(0);
297  this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, nU, nV, nW);
298 }
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::OverlapTensor< T >::GetConnectedElements ( const pandora::Cluster *const  pCluster,
const bool  ignoreUnavailable,
ElementList elementList,
unsigned int &  nU,
unsigned int &  nV,
unsigned int &  nW 
) 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
nUto receive the number of u connections
nVto receive the number of v connections
nWto receive the number of w connections

Definition at line 84 of file LArOverlapTensor.cc.

86 {
87  ClusterList clusterListU, clusterListV, clusterListW;
88  this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, clusterListU, clusterListV, clusterListW);
89  nU = clusterListU.size(); nV = clusterListV.size(); nW = clusterListW.size();
90 }
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::OverlapTensor< T >::GetConnectedElements ( const pandora::Cluster *const  pCluster,
const bool  ignoreUnavailable,
ElementList elementList,
pandora::ClusterList &  clusterListU,
pandora::ClusterList &  clusterListV,
pandora::ClusterList &  clusterListW 
) const
private

Get elements connected to a specified cluster.

Parameters
pClusteraddress of the cluster
elementListthe element list
clusterListUconnected u clusters
clusterListVconnected v clusters
clusterListWconnected w clusters
template<typename T >
void lar_content::OverlapTensor< T >::GetNConnections ( const pandora::Cluster *const  pCluster,
const bool  ignoreUnavailable,
unsigned int &  nU,
unsigned int &  nV,
unsigned int &  nW 
) const
inline

Get the number of connections for a specified cluster.

Parameters
pClusteraddress of a cluster
ignoreUnavailablewhether to ignore unavailable clusters
nUto receive the number of u connections
nVto receive the number of v connections
nWto receive the number of w connections

Definition at line 284 of file LArOverlapTensor.h.

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

286 {
287  ElementList elementList;
288  this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, nU, nV, nW);
289 }
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< Element > ElementList
template<typename T >
const OverlapTensor< T >::OverlapList & lar_content::OverlapTensor< T >::GetOverlapList ( const pandora::Cluster *const  pClusterU,
const pandora::Cluster *const  pClusterV 
) const
inline

Get the overlap list for a specified pair of clusters.

Parameters
pClusterUaddress of cluster u
pClusterVaddress of cluster v
Returns
the cluster overlap list

Definition at line 334 of file LArOverlapTensor.h.

References lar_content::OverlapTensor< T >::GetOverlapMatrix().

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

336 {
337  const OverlapMatrix &overlapMatrix(this->GetOverlapMatrix(pClusterU));
338  typename OverlapMatrix::const_iterator iter = overlapMatrix.find(pClusterV);
339 
340  if (overlapMatrix.end() == iter)
341  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
342 
343  return iter->second;
344 }
std::unordered_map< const pandora::Cluster *, OverlapList > OverlapMatrix
intermediate_table::const_iterator const_iterator
const OverlapMatrix & GetOverlapMatrix(const pandora::Cluster *const pClusterU) const
Get the cluster overlap matrix for a specified cluster.
template<typename T >
const OverlapTensor< T >::OverlapMatrix & lar_content::OverlapTensor< T >::GetOverlapMatrix ( const pandora::Cluster *const  pClusterU) const
inline

Get the cluster overlap matrix for a specified cluster.

Parameters
pClusterUaddress of cluster u
Returns
the cluster overlap matrix

Definition at line 349 of file LArOverlapTensor.h.

References lar_content::OverlapTensor< T >::m_overlapTensor.

Referenced by lar_content::OverlapTensor< T >::GetOverlapList().

351 {
352  typename TheTensor::const_iterator iter = m_overlapTensor.find(pClusterU);
353 
354  if (m_overlapTensor.end() == iter)
355  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
356 
357  return iter->second;
358 }
TheTensor m_overlapTensor
The overlap tensor.
intermediate_table::const_iterator const_iterator
template<typename T >
const OverlapTensor< T >::OverlapResult & lar_content::OverlapTensor< T >::GetOverlapResult ( const pandora::Cluster *const  pClusterU,
const pandora::Cluster *const  pClusterV,
const pandora::Cluster *const  pClusterW 
) const
inline

Get the overlap result for a specified trio of clusters.

Parameters
pClusterUaddress of cluster u
pClusterVaddress of cluster v
pClusterWaddress of cluster w
Returns
the address of the overlap result

Definition at line 319 of file LArOverlapTensor.h.

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

Referenced by lar_content::ThreeDTrackFragmentsAlgorithm::PerformMainLoop().

321 {
322  const OverlapList &overlapList(this->GetOverlapList(pClusterU, pClusterV));
323  typename OverlapList::const_iterator iter = overlapList.find(pClusterW);
324 
325  if (overlapList.end() == iter)
326  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
327 
328  return iter->second;
329 }
std::unordered_map< const pandora::Cluster *, OverlapResult > OverlapList
const OverlapList & GetOverlapList(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV) const
Get the overlap list for a specified pair of clusters.
intermediate_table::const_iterator const_iterator
template<typename T>
void lar_content::OverlapTensor< T >::GetSortedKeyClusters ( pandora::ClusterVector &  sortedKeyClusters) const

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

Parameters
sortedKeyClustersto receive the sorted vector of key clusters

Definition at line 95 of file LArOverlapTensor.cc.

References evd::details::begin(), and evd::details::end().

Referenced by lar_content::SimpleShowersTool::FindBestShower(), lar_content::MopUpRemnantsTool::FindBestShowers(), lar_content::ClearShowersTool::FindClearShowers(), lar_content::ConnectedRemnantsTool::FindConnectedShowers(), lar_content::LongTracksTool::FindLongTracks(), lar_content::MatchedEndPointsTool::FindMatchedTracks(), lar_content::MissingTrackTool::FindMissingTracks(), lar_content::SplitShowersTool::FindSplitShowers(), lar_content::ClearTrackFragmentsTool::FindTrackFragments(), lar_content::TracksCrossingGapsTool::FindTracks(), lar_content::TrackSplittingTool::FindTracks(), lar_content::MissingTrackSegmentTool::FindTracks(), lar_content::ThreeDKinkBaseTool::GetModifications(), lar_content::ShowerTensorVisualizationTool::Run(), and lar_content::TransverseTensorVisualizationTool::Run().

96 {
97  for (typename TheTensor::const_iterator iterU = this->begin(), iterUEnd = this->end(); iterU != iterUEnd; ++iterU)
98  sortedKeyClusters.push_back(iterU->first);
99 
100  std::sort(sortedKeyClusters.begin(), sortedKeyClusters.end(), LArClusterHelper::SortByNHits);
101 }
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.
const_iterator begin() const
Returns an iterator referring to the first element in the overlap tensor.
const_iterator end() const
Returns an iterator referring to the past-the-end element in the overlap tensor.
intermediate_table::const_iterator const_iterator
template<typename T >
void lar_content::OverlapTensor< 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 31 of file LArOverlapTensor.cc.

References evd::details::begin(), and evd::details::end().

Referenced by lar_content::ClearRemnantsTool::Run(), lar_content::ClearTracksTool::Run(), and lar_content::ClearLongitudinalTracksTool::Run().

32 {
33  for (typename TheTensor::const_iterator iterU = this->begin(), iterUEnd = this->end(); iterU != iterUEnd; ++iterU)
34  {
35  ElementList tempElementList;
36  ClusterList clusterListU, clusterListV, clusterListW;
37  this->GetConnectedElements(iterU->first, ignoreUnavailable, tempElementList, clusterListU, clusterListV, clusterListW);
38 
39  const Cluster *pClusterU(NULL), *pClusterV(NULL), *pClusterW(NULL);
40  if (!this->DefaultAmbiguityFunction(clusterListU, clusterListV, clusterListW, pClusterU, pClusterV, pClusterW))
41  continue;
42 
43  // ATTN With HIT_CUSTOM definitions, it is possible to navigate from different U clusters to same combination
44  if (iterU->first != pClusterU)
45  continue;
46 
47  if ((NULL == pClusterU) || (NULL == pClusterV) || (NULL == pClusterW))
48  continue;
49 
50  typename OverlapMatrix::const_iterator iterV = iterU->second.find(pClusterV);
51  if (iterU->second.end() == iterV)
52  throw StatusCodeException(STATUS_CODE_FAILURE);
53 
54  typename OverlapList::const_iterator iterW = iterV->second.find(pClusterW);
55  if (iterV->second.end() == iterW)
56  throw StatusCodeException(STATUS_CODE_FAILURE);
57 
58  Element element(pClusterU, pClusterV, pClusterW, iterW->second);
59  elementList.push_back(element);
60  }
61 
62  std::sort(elementList.begin(), elementList.end());
63 }
const_iterator begin() const
Returns an iterator referring to the first element in the overlap tensor.
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
const_iterator end() const
Returns an iterator referring to the past-the-end element in the overlap tensor.
std::vector< Element > ElementList
intermediate_table::const_iterator const_iterator
bool DefaultAmbiguityFunction(const pandora::ClusterList &clusterListU, const pandora::ClusterList &clusterListV, const pandora::ClusterList &clusterListW, const pandora::Cluster *&pClusterU, const pandora::Cluster *&pClusterV, const pandora::Cluster *&pClusterW) const
Default ambiguity function, checking that only one U, V and W cluster is found.
template<typename T >
void lar_content::OverlapTensor< T >::RemoveCluster ( const pandora::Cluster *const  pCluster)

Remove entries from tensor corresponding to specified cluster.

Parameters
pClusteraddress of the cluster

Definition at line 154 of file LArOverlapTensor.cc.

References evd::details::begin(), and evd::details::end().

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

155 {
156  ClusterList additionalRemovals;
157 
158  if (m_clusterNavigationMapUV.erase(pCluster) > 0)
159  {
160  typename TheTensor::iterator iter = m_overlapTensor.find(pCluster);
161 
162  if (m_overlapTensor.end() != iter)
163  m_overlapTensor.erase(iter);
164 
165  for (ClusterNavigationMap::iterator navIter = m_clusterNavigationMapWU.begin(); navIter != m_clusterNavigationMapWU.end(); )
166  {
167  ClusterNavigationMap::iterator thisIter = navIter++;
168  ClusterList::iterator listIter = std::find(thisIter->second.begin(), thisIter->second.end(), pCluster);
169 
170  if (thisIter->second.end() != listIter)
171  thisIter->second.erase(listIter);
172 
173  if (thisIter->second.empty())
174  additionalRemovals.push_back(thisIter->first);
175  }
176  }
177 
178  if (m_clusterNavigationMapVW.erase(pCluster) > 0)
179  {
180  for (typename TheTensor::iterator iterU = m_overlapTensor.begin(), iterUEnd = m_overlapTensor.end(); iterU != iterUEnd; ++iterU)
181  {
182  typename OverlapMatrix::iterator iter = iterU->second.find(pCluster);
183 
184  if (iterU->second.end() != iter)
185  iterU->second.erase(iter);
186  }
187 
188  for (ClusterNavigationMap::iterator navIter = m_clusterNavigationMapUV.begin(); navIter != m_clusterNavigationMapUV.end(); )
189  {
190  ClusterNavigationMap::iterator thisIter = navIter++;
191  ClusterList::iterator listIter = std::find(thisIter->second.begin(), thisIter->second.end(), pCluster);
192 
193  if (thisIter->second.end() != listIter)
194  thisIter->second.erase(listIter);
195 
196  if (thisIter->second.empty())
197  additionalRemovals.push_back(thisIter->first);
198  }
199  }
200 
201  if (m_clusterNavigationMapWU.erase(pCluster) > 0)
202  {
203  for (typename TheTensor::iterator iterU = m_overlapTensor.begin(), iterUEnd = m_overlapTensor.end(); iterU != iterUEnd; ++iterU)
204  {
205  for (typename OverlapMatrix::iterator iterV = iterU->second.begin(), iterVEnd = iterU->second.end(); iterV != iterVEnd; ++iterV)
206  {
207  typename OverlapList::iterator iter = iterV->second.find(pCluster);
208 
209  if (iterV->second.end() != iter)
210  iterV->second.erase(iter);
211  }
212  }
213 
214  for (ClusterNavigationMap::iterator navIter = m_clusterNavigationMapVW.begin(); navIter != m_clusterNavigationMapVW.end(); )
215  {
216  ClusterNavigationMap::iterator thisIter = navIter++;
217  ClusterList::iterator listIter = std::find(thisIter->second.begin(), thisIter->second.end(), pCluster);
218 
219  if (thisIter->second.end() != listIter)
220  thisIter->second.erase(listIter);
221 
222  if (thisIter->second.empty())
223  additionalRemovals.push_back(thisIter->first);
224  }
225  }
226 
227  additionalRemovals.sort(LArClusterHelper::SortByNHits);
228 
229  for (ClusterList::const_iterator iter = additionalRemovals.begin(), iterEnd = additionalRemovals.end(); iter != iterEnd; ++iter)
230  this->RemoveCluster(*iter);
231 }
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.
ClusterNavigationMap m_clusterNavigationMapVW
The cluster navigation map V->W.
ClusterNavigationMap m_clusterNavigationMapUV
The cluster navigation map U->V.
intermediate_table::iterator iterator
TheTensor m_overlapTensor
The overlap tensor.
intermediate_table::const_iterator const_iterator
ClusterNavigationMap m_clusterNavigationMapWU
The cluster navigation map W->U.
void RemoveCluster(const pandora::Cluster *const pCluster)
Remove entries from tensor corresponding to specified cluster.
template<typename T >
void lar_content::OverlapTensor< T >::ReplaceOverlapResult ( const pandora::Cluster *const  pClusterU,
const pandora::Cluster *const  pClusterV,
const pandora::Cluster *const  pClusterW,
const OverlapResult overlapResult 
)

SetReplace an existing overlap result.

Parameters
pClusterUaddress of cluster u
pClusterVaddress of cluster v
pClusterWaddress of cluster w
overlapResultthe overlap result

Definition at line 130 of file LArOverlapTensor.cc.

Referenced by lar_content::ThreeDTrackFragmentsAlgorithm::PerformMainLoop().

132 {
133  typename TheTensor::iterator iterU = m_overlapTensor.find(pClusterU);
134 
135  if (m_overlapTensor.end() == iterU)
136  throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
137 
138  typename OverlapMatrix::iterator iterV = iterU->second.find(pClusterV);
139 
140  if (iterU->second.end() == iterV)
141  throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
142 
143  typename OverlapList::iterator iterW = iterV->second.find(pClusterW);
144 
145  if (iterV->second.end() == iterW)
146  throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
147 
148  iterW->second = overlapResult;
149 }
intermediate_table::iterator iterator
TheTensor m_overlapTensor
The overlap tensor.
template<typename T >
void lar_content::OverlapTensor< T >::SetOverlapResult ( const pandora::Cluster *const  pClusterU,
const pandora::Cluster *const  pClusterV,
const pandora::Cluster *const  pClusterW,
const OverlapResult overlapResult 
)

Set overlap result.

Parameters
pClusterUaddress of cluster u
pClusterVaddress of cluster v
pClusterWaddress of cluster w
overlapResultthe overlap result

Definition at line 106 of file LArOverlapTensor.cc.

Referenced by lar_content::ThreeDRemnantsAlgorithm::CalculateOverlapResult(), lar_content::ThreeDTrackFragmentsAlgorithm::PerformMainLoop(), lar_content::ThreeDShowersAlgorithm::RemoveFromSlidingFitCache(), lar_content::ThreeDLongitudinalTracksAlgorithm::ThreeDLongitudinalTracksAlgorithm(), and lar_content::ThreeDTransverseTracksAlgorithm::ThreeDTransverseTracksAlgorithm().

108 {
109  OverlapList &overlapList = m_overlapTensor[pClusterU][pClusterV];
110  typename OverlapList::const_iterator iter = overlapList.find(pClusterW);
111 
112  if (overlapList.end() != iter)
113  throw pandora::StatusCodeException(pandora::STATUS_CODE_ALREADY_PRESENT);
114 
115  if (!overlapList.insert(typename OverlapList::value_type(pClusterW, overlapResult)).second)
116  throw pandora::StatusCodeException(pandora::STATUS_CODE_FAILURE);
117 
118  ClusterList &navigationUV(m_clusterNavigationMapUV[pClusterU]);
119  ClusterList &navigationVW(m_clusterNavigationMapVW[pClusterV]);
120  ClusterList &navigationWU(m_clusterNavigationMapWU[pClusterW]);
121 
122  if (navigationUV.end() == std::find(navigationUV.begin(), navigationUV.end(), pClusterV)) navigationUV.push_back(pClusterV);
123  if (navigationVW.end() == std::find(navigationVW.begin(), navigationVW.end(), pClusterW)) navigationVW.push_back(pClusterW);
124  if (navigationWU.end() == std::find(navigationWU.begin(), navigationWU.end(), pClusterU)) navigationWU.push_back(pClusterU);
125 }
ClusterNavigationMap m_clusterNavigationMapVW
The cluster navigation map V->W.
ClusterNavigationMap m_clusterNavigationMapUV
The cluster navigation map U->V.
TheTensor m_overlapTensor
The overlap tensor.
std::unordered_map< const pandora::Cluster *, OverlapResult > OverlapList
intermediate_table::const_iterator const_iterator
ClusterNavigationMap m_clusterNavigationMapWU
The cluster navigation map W->U.

Member Data Documentation

template<typename T>
ClusterNavigationMap lar_content::OverlapTensor< T >::m_clusterNavigationMapUV
private

The cluster navigation map U->V.

Definition at line 276 of file LArOverlapTensor.h.

Referenced by lar_content::OverlapTensor< T >::Clear(), and lar_content::OverlapTensor< T >::GetClusterNavigationMapUV().

template<typename T>
ClusterNavigationMap lar_content::OverlapTensor< T >::m_clusterNavigationMapVW
private

The cluster navigation map V->W.

Definition at line 277 of file LArOverlapTensor.h.

Referenced by lar_content::OverlapTensor< T >::Clear(), and lar_content::OverlapTensor< T >::GetClusterNavigationMapVW().

template<typename T>
ClusterNavigationMap lar_content::OverlapTensor< T >::m_clusterNavigationMapWU
private

The cluster navigation map W->U.

Definition at line 278 of file LArOverlapTensor.h.

Referenced by lar_content::OverlapTensor< T >::Clear(), and lar_content::OverlapTensor< T >::GetClusterNavigationMapWU().


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