Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 155 of file LArOverlapTensor.h.

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

Definition at line 160 of file LArOverlapTensor.h.

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

Definition at line 96 of file LArOverlapTensor.h.

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

Definition at line 156 of file LArOverlapTensor.h.

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

Definition at line 157 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 158 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 317 of file LArOverlapTensor.h.

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

Clear overlap tensor.

Definition at line 400 of file LArOverlapTensor.h.

401 {
402  m_overlapTensor.clear();
403  m_clusterNavigationMapUV.clear();
404  m_clusterNavigationMapVW.clear();
405  m_clusterNavigationMapWU.clear();
406 }
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 79 of file LArOverlapTensor.cc.

81 {
82  if ((1 != clusterListU.size()) || (1 != clusterListV.size()) || (1 != clusterListW.size()))
83  return false;
84 
85  pClusterU = *(clusterListU.begin());
86  pClusterV = *(clusterListV.begin());
87  pClusterW = *(clusterListW.begin());
88 
89  return true;
90 }
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 325 of file LArOverlapTensor.h.

326 {
327  return m_overlapTensor.end();
328 }
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 295 of file LArOverlapTensor.cc.

297 {
298  if (ignoreUnavailable && !pCluster->IsAvailable())
299  return;
300 
301  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
302 
303  if (!((TPC_VIEW_U == hitType) || (TPC_VIEW_V == hitType) || (TPC_VIEW_W == hitType)))
304  throw StatusCodeException(STATUS_CODE_FAILURE);
305 
306  ClusterList &clusterList((TPC_VIEW_U == hitType) ? clusterListU : (TPC_VIEW_V == hitType) ? clusterListV : clusterListW);
307  const ClusterNavigationMap &navigationMap(
308  (TPC_VIEW_U == hitType) ? m_clusterNavigationMapUV : (TPC_VIEW_V == hitType) ? m_clusterNavigationMapVW : m_clusterNavigationMapWU);
309 
310  if (clusterList.end() != std::find(clusterList.begin(), clusterList.end(), pCluster))
311  return;
312 
313  clusterList.push_back(pCluster);
314  ClusterNavigationMap::const_iterator iter = navigationMap.find(pCluster);
315 
316  if (navigationMap.end() == iter)
317  throw StatusCodeException(STATUS_CODE_FAILURE);
318 
319  for (ClusterList::const_iterator cIter = iter->second.begin(), cIterEnd = iter->second.end(); cIter != cIterEnd; ++cIter)
320  this->ExploreConnections(*cIter, ignoreUnavailable, clusterListU, clusterListV, clusterListW);
321 }
ClusterNavigationMap m_clusterNavigationMapVW
The cluster navigation map V->W.
ClusterNavigationMap m_clusterNavigationMapUV
The cluster navigation map U->V.
enum cvn::HType HitType
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.
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_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 376 of file LArOverlapTensor.h.

377 {
379 }
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 384 of file LArOverlapTensor.h.

385 {
387 }
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 392 of file LArOverlapTensor.h.

393 {
395 }
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 308 of file LArOverlapTensor.h.

309 {
310  unsigned int nU(0), nV(0), nW(0);
311  this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, nU, nV, nW);
312 }
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 95 of file LArOverlapTensor.cc.

97 {
98  ClusterList clusterListU, clusterListV, clusterListW;
99  this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, clusterListU, clusterListV, clusterListW);
100  nU = clusterListU.size();
101  nV = clusterListV.size();
102  nW = clusterListW.size();
103 }
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 298 of file LArOverlapTensor.h.

300 {
301  ElementList elementList;
302  this->GetConnectedElements(pCluster, ignoreUnavailable, elementList, nU, nV, nW);
303 }
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 348 of file LArOverlapTensor.h.

350 {
351  const OverlapMatrix &overlapMatrix(this->GetOverlapMatrix(pClusterU));
352  typename OverlapMatrix::const_iterator iter = overlapMatrix.find(pClusterV);
353 
354  if (overlapMatrix.end() == iter)
355  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
356 
357  return iter->second;
358 }
const OverlapMatrix & GetOverlapMatrix(const pandora::Cluster *const pClusterU) const
Get the cluster overlap matrix for a specified cluster.
TheMatrix::const_iterator const_iterator
std::unordered_map< const pandora::Cluster *, OverlapList > OverlapMatrix
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 363 of file LArOverlapTensor.h.

364 {
365  typename TheTensor::const_iterator iter = m_overlapTensor.find(pClusterU);
366 
367  if (m_overlapTensor.end() == iter)
368  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
369 
370  return iter->second;
371 }
intermediate_table::const_iterator const_iterator
TheTensor m_overlapTensor
The overlap tensor.
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 333 of file LArOverlapTensor.h.

335 {
336  const OverlapList &overlapList(this->GetOverlapList(pClusterU, pClusterV));
337  typename OverlapList::const_iterator iter = overlapList.find(pClusterW);
338 
339  if (overlapList.end() == iter)
340  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
341 
342  return iter->second;
343 }
intermediate_table::const_iterator const_iterator
const OverlapList & GetOverlapList(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV) const
Get the overlap list for a specified pair of clusters.
std::unordered_map< const pandora::Cluster *, OverlapResult > OverlapList
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 108 of file LArOverlapTensor.cc.

109 {
110  for (typename TheTensor::const_iterator iterU = this->begin(), iterUEnd = this->end(); iterU != iterUEnd; ++iterU)
111  sortedKeyClusters.push_back(iterU->first);
112 
113  std::sort(sortedKeyClusters.begin(), sortedKeyClusters.end(), LArClusterHelper::SortByNHits);
114 }
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.
intermediate_table::const_iterator const_iterator
const_iterator end() const
Returns an iterator referring to the past-the-end element in the overlap tensor.
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 42 of file LArOverlapTensor.cc.

43 {
44  for (typename TheTensor::const_iterator iterU = this->begin(), iterUEnd = this->end(); iterU != iterUEnd; ++iterU)
45  {
46  ElementList tempElementList;
47  ClusterList clusterListU, clusterListV, clusterListW;
48  this->GetConnectedElements(iterU->first, ignoreUnavailable, tempElementList, clusterListU, clusterListV, clusterListW);
49 
50  const Cluster *pClusterU(nullptr), *pClusterV(nullptr), *pClusterW(nullptr);
51  if (!this->DefaultAmbiguityFunction(clusterListU, clusterListV, clusterListW, pClusterU, pClusterV, pClusterW))
52  continue;
53 
54  // ATTN With HIT_CUSTOM definitions, it is possible to navigate from different U clusters to same combination
55  if (iterU->first != pClusterU)
56  continue;
57 
58  if (!pClusterU || !pClusterV || !pClusterW)
59  continue;
60 
61  typename OverlapMatrix::const_iterator iterV = iterU->second.find(pClusterV);
62  if (iterU->second.end() == iterV)
63  throw StatusCodeException(STATUS_CODE_FAILURE);
64 
65  typename OverlapList::const_iterator iterW = iterV->second.find(pClusterW);
66  if (iterV->second.end() == iterW)
67  throw StatusCodeException(STATUS_CODE_FAILURE);
68 
69  Element element(pClusterU, pClusterV, pClusterW, iterW->second);
70  elementList.push_back(element);
71  }
72 
73  std::sort(elementList.begin(), elementList.end());
74 }
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.
intermediate_table::const_iterator const_iterator
const_iterator end() const
Returns an iterator referring to the past-the-end element in the overlap tensor.
std::vector< Element > ElementList
TheMatrix::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 170 of file LArOverlapTensor.cc.

171 {
172  ClusterList additionalRemovals;
173 
174  if (m_clusterNavigationMapUV.erase(pCluster) > 0)
175  {
176  typename TheTensor::iterator iter = m_overlapTensor.find(pCluster);
177 
178  if (m_overlapTensor.end() != iter)
179  m_overlapTensor.erase(iter);
180 
181  for (ClusterNavigationMap::iterator navIter = m_clusterNavigationMapWU.begin(); navIter != m_clusterNavigationMapWU.end();)
182  {
183  ClusterNavigationMap::iterator thisIter = navIter++;
184  ClusterList::iterator listIter = std::find(thisIter->second.begin(), thisIter->second.end(), pCluster);
185 
186  if (thisIter->second.end() != listIter)
187  thisIter->second.erase(listIter);
188 
189  if (thisIter->second.empty())
190  additionalRemovals.push_back(thisIter->first);
191  }
192  }
193 
194  if (m_clusterNavigationMapVW.erase(pCluster) > 0)
195  {
196  for (typename TheTensor::iterator iterU = m_overlapTensor.begin(), iterUEnd = m_overlapTensor.end(); iterU != iterUEnd; ++iterU)
197  {
198  typename OverlapMatrix::iterator iter = iterU->second.find(pCluster);
199 
200  if (iterU->second.end() != iter)
201  iterU->second.erase(iter);
202  }
203 
204  for (ClusterNavigationMap::iterator navIter = m_clusterNavigationMapUV.begin(); navIter != m_clusterNavigationMapUV.end();)
205  {
206  ClusterNavigationMap::iterator thisIter = navIter++;
207  ClusterList::iterator listIter = std::find(thisIter->second.begin(), thisIter->second.end(), pCluster);
208 
209  if (thisIter->second.end() != listIter)
210  thisIter->second.erase(listIter);
211 
212  if (thisIter->second.empty())
213  additionalRemovals.push_back(thisIter->first);
214  }
215  }
216 
217  if (m_clusterNavigationMapWU.erase(pCluster) > 0)
218  {
219  for (typename TheTensor::iterator iterU = m_overlapTensor.begin(), iterUEnd = m_overlapTensor.end(); iterU != iterUEnd; ++iterU)
220  {
221  for (typename OverlapMatrix::iterator iterV = iterU->second.begin(), iterVEnd = iterU->second.end(); iterV != iterVEnd; ++iterV)
222  {
223  typename OverlapList::iterator iter = iterV->second.find(pCluster);
224 
225  if (iterV->second.end() != iter)
226  iterV->second.erase(iter);
227  }
228  }
229 
230  for (ClusterNavigationMap::iterator navIter = m_clusterNavigationMapVW.begin(); navIter != m_clusterNavigationMapVW.end();)
231  {
232  ClusterNavigationMap::iterator thisIter = navIter++;
233  ClusterList::iterator listIter = std::find(thisIter->second.begin(), thisIter->second.end(), pCluster);
234 
235  if (thisIter->second.end() != listIter)
236  thisIter->second.erase(listIter);
237 
238  if (thisIter->second.empty())
239  additionalRemovals.push_back(thisIter->first);
240  }
241  }
242 
243  additionalRemovals.sort(LArClusterHelper::SortByNHits);
244 
245  for (ClusterList::const_iterator iter = additionalRemovals.begin(), iterEnd = additionalRemovals.end(); iter != iterEnd; ++iter)
246  this->RemoveCluster(*iter);
247 }
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.
ClusterNavigationMap m_clusterNavigationMapVW
The cluster navigation map V->W.
ClusterNavigationMap m_clusterNavigationMapUV
The cluster navigation map U->V.
intermediate_table::const_iterator const_iterator
TheTensor m_overlapTensor
The overlap tensor.
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 146 of file LArOverlapTensor.cc.

148 {
149  typename TheTensor::iterator iterU = m_overlapTensor.find(pClusterU);
150 
151  if (m_overlapTensor.end() == iterU)
152  throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
153 
154  typename OverlapMatrix::iterator iterV = iterU->second.find(pClusterV);
155 
156  if (iterU->second.end() == iterV)
157  throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
158 
159  typename OverlapList::iterator iterW = iterV->second.find(pClusterW);
160 
161  if (iterV->second.end() == iterW)
162  throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
163 
164  iterW->second = overlapResult;
165 }
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 119 of file LArOverlapTensor.cc.

121 {
122  OverlapList &overlapList = m_overlapTensor[pClusterU][pClusterV];
123  typename OverlapList::const_iterator iter = overlapList.find(pClusterW);
124 
125  if (overlapList.end() != iter)
126  throw pandora::StatusCodeException(pandora::STATUS_CODE_ALREADY_PRESENT);
127 
128  if (!overlapList.insert(typename OverlapList::value_type(pClusterW, overlapResult)).second)
129  throw pandora::StatusCodeException(pandora::STATUS_CODE_FAILURE);
130 
131  ClusterList &navigationUV(m_clusterNavigationMapUV[pClusterU]);
132  ClusterList &navigationVW(m_clusterNavigationMapVW[pClusterV]);
133  ClusterList &navigationWU(m_clusterNavigationMapWU[pClusterW]);
134 
135  if (navigationUV.end() == std::find(navigationUV.begin(), navigationUV.end(), pClusterV))
136  navigationUV.push_back(pClusterV);
137  if (navigationVW.end() == std::find(navigationVW.begin(), navigationVW.end(), pClusterW))
138  navigationVW.push_back(pClusterW);
139  if (navigationWU.end() == std::find(navigationWU.begin(), navigationWU.end(), pClusterU))
140  navigationWU.push_back(pClusterU);
141 }
ClusterNavigationMap m_clusterNavigationMapVW
The cluster navigation map V->W.
ClusterNavigationMap m_clusterNavigationMapUV
The cluster navigation map U->V.
intermediate_table::const_iterator const_iterator
TheTensor m_overlapTensor
The overlap tensor.
ClusterNavigationMap m_clusterNavigationMapWU
The cluster navigation map W->U.
std::unordered_map< const pandora::Cluster *, OverlapResult > OverlapList

Member Data Documentation

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

The cluster navigation map U->V.

Definition at line 290 of file LArOverlapTensor.h.

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

The cluster navigation map V->W.

Definition at line 291 of file LArOverlapTensor.h.

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

The cluster navigation map W->U.

Definition at line 292 of file LArOverlapTensor.h.

template<typename T>
TheTensor lar_content::OverlapTensor< T >::m_overlapTensor
private

The overlap tensor.

Definition at line 289 of file LArOverlapTensor.h.


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