All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
lar_content::ThreeViewMatchingControl< T > Class Template Reference

ThreeViewMatchingControl class. More...

#include <ThreeViewMatchingControl.h>

Inheritance diagram for lar_content::ThreeViewMatchingControl< T >:
lar_content::NViewMatchingControl

Public Types

typedef OverlapTensor< T > TensorType
 

Public Member Functions

 ThreeViewMatchingControl (MatchingBaseAlgorithm *const pAlgorithm)
 Constructor. More...
 
virtual ~ThreeViewMatchingControl ()
 Destructor. More...
 
TensorTypeGetOverlapTensor ()
 Get the overlap tensor. More...
 
- Public Member Functions inherited from lar_content::NViewMatchingControl
 NViewMatchingControl (MatchingBaseAlgorithm *const pAlgorithm)
 Constructor. More...
 
virtual ~NViewMatchingControl ()
 Destructor. More...
 

Private Member Functions

void UpdateForNewCluster (const pandora::Cluster *const pNewCluster)
 Update to reflect addition of a new cluster to the problem space. More...
 
void UpdateUponDeletion (const pandora::Cluster *const pDeletedCluster)
 Update to reflect cluster deletion. More...
 
const std::string & GetClusterListName (const pandora::HitType hitType) const
 Get the cluster list name corresponding to a specified hit type. More...
 
const pandora::ClusterList & GetInputClusterList (const pandora::HitType hitType) const
 Get the input cluster list corresponding to a specified hit type. More...
 
const pandora::ClusterList & GetSelectedClusterList (const pandora::HitType hitType) const
 Get the selected cluster list corresponding to a specified hit type. More...
 
void SelectAllInputClusters ()
 Select a subset of input clusters for processing in this algorithm. More...
 
void PrepareAllInputClusters ()
 Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results. More...
 
void PerformMainLoop ()
 Main loop over cluster combinations in order to populate the overlap container. Responsible for calling CalculateOverlapResult. More...
 
void TidyUp ()
 Tidy member variables. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 Read settings from xml. More...
 

Private Attributes

const pandora::ClusterList * m_pInputClusterListU
 Address of the input cluster list U. More...
 
const pandora::ClusterList * m_pInputClusterListV
 Address of the input cluster list V. More...
 
const pandora::ClusterList * m_pInputClusterListW
 Address of the input cluster list W. More...
 
pandora::ClusterList m_clusterListU
 The selected modified cluster list U. More...
 
pandora::ClusterList m_clusterListV
 The selected modified cluster list V. More...
 
pandora::ClusterList m_clusterListW
 The selected modified cluster list W. More...
 
TensorType m_overlapTensor
 The overlap tensor. More...
 
std::string m_inputClusterListNameU
 The name of the view U cluster list. More...
 
std::string m_inputClusterListNameV
 The name of the view V cluster list. More...
 
std::string m_inputClusterListNameW
 The name of the view W cluster list. More...
 

Friends

class ThreeViewTrackFragmentsAlgorithm
 ATTN This is for legacy purposes only. More...
 
class ThreeViewDeltaRayMatchingAlgorithm
 
template<typename U >
class NViewMatchingAlgorithm
 

Additional Inherited Members

- Protected Attributes inherited from lar_content::NViewMatchingControl
MatchingBaseAlgorithmm_pAlgorithm
 The address of the matching base algorithm. More...
 

Detailed Description

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

ThreeViewMatchingControl class.

Definition at line 22 of file ThreeViewMatchingControl.h.

Member Typedef Documentation

template<typename T>
typedef OverlapTensor<T> lar_content::ThreeViewMatchingControl< T >::TensorType

Definition at line 25 of file ThreeViewMatchingControl.h.

Constructor & Destructor Documentation

template<typename T >
lar_content::ThreeViewMatchingControl< T >::ThreeViewMatchingControl ( MatchingBaseAlgorithm *const  pAlgorithm)

Constructor.

Parameters
pAlgorithmaddress of the matching base algorithm

Definition at line 25 of file ThreeViewMatchingControl.cc.

25  :
26  NViewMatchingControl(pAlgorithm),
27  m_pInputClusterListU(nullptr),
28  m_pInputClusterListV(nullptr),
29  m_pInputClusterListW(nullptr)
30 {
31 }
NViewMatchingControl(MatchingBaseAlgorithm *const pAlgorithm)
Constructor.
const pandora::ClusterList * m_pInputClusterListU
Address of the input cluster list U.
const pandora::ClusterList * m_pInputClusterListV
Address of the input cluster list V.
const pandora::ClusterList * m_pInputClusterListW
Address of the input cluster list W.
template<typename T >
lar_content::ThreeViewMatchingControl< T >::~ThreeViewMatchingControl ( )
virtual

Destructor.

Definition at line 36 of file ThreeViewMatchingControl.cc.

37 {
38 }

Member Function Documentation

template<typename T>
const std::string & lar_content::ThreeViewMatchingControl< T >::GetClusterListName ( const pandora::HitType  hitType) const
privatevirtual

Get the cluster list name corresponding to a specified hit type.

Parameters
hitTypethe hit type
Returns
the cluster list name

Implements lar_content::NViewMatchingControl.

Definition at line 117 of file ThreeViewMatchingControl.cc.

118 {
119  if (TPC_VIEW_U == hitType)
121 
122  if (TPC_VIEW_V == hitType)
124 
125  if (TPC_VIEW_W == hitType)
127 
128  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
129 }
std::string m_inputClusterListNameW
The name of the view W cluster list.
std::string m_inputClusterListNameV
The name of the view V cluster list.
std::string m_inputClusterListNameU
The name of the view U cluster list.
template<typename T>
const pandora::ClusterList & lar_content::ThreeViewMatchingControl< T >::GetInputClusterList ( const pandora::HitType  hitType) const
privatevirtual

Get the input cluster list corresponding to a specified hit type.

Parameters
hitTypethe hit type
Returns
the input cluster list

Implements lar_content::NViewMatchingControl.

Definition at line 134 of file ThreeViewMatchingControl.cc.

135 {
136  if ((TPC_VIEW_U == hitType) && m_pInputClusterListU)
137  return (*m_pInputClusterListU);
138 
139  if ((TPC_VIEW_V == hitType) && m_pInputClusterListV)
140  return (*m_pInputClusterListV);
141 
142  if ((TPC_VIEW_W == hitType) && m_pInputClusterListW)
143  return (*m_pInputClusterListW);
144 
145  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
146 }
const pandora::ClusterList * m_pInputClusterListU
Address of the input cluster list U.
const pandora::ClusterList * m_pInputClusterListV
Address of the input cluster list V.
const pandora::ClusterList * m_pInputClusterListW
Address of the input cluster list W.
template<typename T >
ThreeViewMatchingControl< T >::TensorType & lar_content::ThreeViewMatchingControl< T >::GetOverlapTensor ( )

Get the overlap tensor.

Returns
the overlap tensor

Definition at line 43 of file ThreeViewMatchingControl.cc.

44 {
45  return m_overlapTensor;
46 }
TensorType m_overlapTensor
The overlap tensor.
template<typename T>
const pandora::ClusterList & lar_content::ThreeViewMatchingControl< T >::GetSelectedClusterList ( const pandora::HitType  hitType) const
privatevirtual

Get the selected cluster list corresponding to a specified hit type.

Parameters
hitTypethe hit type
Returns
the selected cluster list

Implements lar_content::NViewMatchingControl.

Definition at line 151 of file ThreeViewMatchingControl.cc.

152 {
153  if (TPC_VIEW_U == hitType)
154  return m_clusterListU;
155 
156  if (TPC_VIEW_V == hitType)
157  return m_clusterListV;
158 
159  if (TPC_VIEW_W == hitType)
160  return m_clusterListW;
161 
162  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
163 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
template<typename T >
void lar_content::ThreeViewMatchingControl< T >::PerformMainLoop ( )
privatevirtual

Main loop over cluster combinations in order to populate the overlap container. Responsible for calling CalculateOverlapResult.

Implements lar_content::NViewMatchingControl.

Definition at line 219 of file ThreeViewMatchingControl.cc.

220 {
221  ClusterVector clusterVectorU(m_clusterListU.begin(), m_clusterListU.end());
222  ClusterVector clusterVectorV(m_clusterListV.begin(), m_clusterListV.end());
223  ClusterVector clusterVectorW(m_clusterListW.begin(), m_clusterListW.end());
224  std::sort(clusterVectorU.begin(), clusterVectorU.end(), LArClusterHelper::SortByNHits);
225  std::sort(clusterVectorV.begin(), clusterVectorV.end(), LArClusterHelper::SortByNHits);
226  std::sort(clusterVectorW.begin(), clusterVectorW.end(), LArClusterHelper::SortByNHits);
227 
228  for (const Cluster *const pClusterU : clusterVectorU)
229  {
230  for (const Cluster *const pClusterV : clusterVectorV)
231  {
232  for (const Cluster *const pClusterW : clusterVectorW)
233  m_pAlgorithm->CalculateOverlapResult(pClusterU, pClusterV, pClusterW);
234  }
235  }
236 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
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.
MatchingBaseAlgorithm * m_pAlgorithm
The address of the matching base algorithm.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
virtual void CalculateOverlapResult(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3=nullptr)=0
Calculate cluster overlap result and store in container.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
template<typename T >
void lar_content::ThreeViewMatchingControl< T >::PrepareAllInputClusters ( )
privatevirtual

Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results.

Implements lar_content::NViewMatchingControl.

Definition at line 193 of file ThreeViewMatchingControl.cc.

194 {
198 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
MatchingBaseAlgorithm * m_pAlgorithm
The address of the matching base algorithm.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
virtual void PrepareInputClusters(pandora::ClusterList &preparedClusterList)
Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results...
template<typename T>
StatusCode lar_content::ThreeViewMatchingControl< T >::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Read settings from xml.

Parameters
xmlHandlethe xml handle

Implements lar_content::NViewMatchingControl.

Definition at line 241 of file ThreeViewMatchingControl.cc.

242 {
243  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameU", m_inputClusterListNameU));
244  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameV", m_inputClusterListNameV));
245  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameW", m_inputClusterListNameW));
246 
247  return STATUS_CODE_SUCCESS;
248 }
std::string m_inputClusterListNameW
The name of the view W cluster list.
std::string m_inputClusterListNameV
The name of the view V cluster list.
std::string m_inputClusterListNameU
The name of the view U cluster list.
template<typename T >
void lar_content::ThreeViewMatchingControl< T >::SelectAllInputClusters ( )
privatevirtual

Select a subset of input clusters for processing in this algorithm.

Implements lar_content::NViewMatchingControl.

Definition at line 168 of file ThreeViewMatchingControl.cc.

169 {
170  PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=,
171  PandoraContentApi::GetList(*m_pAlgorithm, m_inputClusterListNameU, m_pInputClusterListU));
172  PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=,
173  PandoraContentApi::GetList(*m_pAlgorithm, m_inputClusterListNameV, m_pInputClusterListV));
174  PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=,
175  PandoraContentApi::GetList(*m_pAlgorithm, m_inputClusterListNameW, m_pInputClusterListW));
176 
178  {
179  if (PandoraContentApi::GetSettings(*m_pAlgorithm)->ShouldDisplayAlgorithmInfo())
180  std::cout << "ThreeViewMatchingControl: one or more input cluster lists unavailable." << std::endl;
181 
182  throw StatusCodeException(STATUS_CODE_SUCCESS);
183  }
184 
188 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
std::string m_inputClusterListNameW
The name of the view W cluster list.
MatchingBaseAlgorithm * m_pAlgorithm
The address of the matching base algorithm.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
virtual void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const
Select a subset of input clusters for processing in this algorithm.
std::string m_inputClusterListNameV
The name of the view V cluster list.
const pandora::ClusterList * m_pInputClusterListU
Address of the input cluster list U.
const pandora::ClusterList * m_pInputClusterListV
Address of the input cluster list V.
const pandora::ClusterList * m_pInputClusterListW
Address of the input cluster list W.
std::string m_inputClusterListNameU
The name of the view U cluster list.
BEGIN_PROLOG could also be cout
template<typename T >
void lar_content::ThreeViewMatchingControl< T >::TidyUp ( )
privatevirtual

Tidy member variables.

Implements lar_content::NViewMatchingControl.

Definition at line 203 of file ThreeViewMatchingControl.cc.

204 {
206 
207  m_pInputClusterListU = nullptr;
208  m_pInputClusterListV = nullptr;
209  m_pInputClusterListW = nullptr;
210 
211  m_clusterListU.clear();
212  m_clusterListV.clear();
213  m_clusterListW.clear();
214 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
void Clear()
Clear overlap tensor.
const pandora::ClusterList * m_pInputClusterListU
Address of the input cluster list U.
TensorType m_overlapTensor
The overlap tensor.
const pandora::ClusterList * m_pInputClusterListV
Address of the input cluster list V.
const pandora::ClusterList * m_pInputClusterListW
Address of the input cluster list W.
template<typename T>
void lar_content::ThreeViewMatchingControl< T >::UpdateForNewCluster ( const pandora::Cluster *const  pNewCluster)
privatevirtual

Update to reflect addition of a new cluster to the problem space.

Parameters
pNewClusteraddress of the new cluster

Implements lar_content::NViewMatchingControl.

Definition at line 51 of file ThreeViewMatchingControl.cc.

52 {
53  const HitType hitType(LArClusterHelper::GetClusterHitType(pNewCluster));
54 
55  if (!((TPC_VIEW_U == hitType) || (TPC_VIEW_V == hitType) || (TPC_VIEW_W == hitType)))
56  throw StatusCodeException(STATUS_CODE_FAILURE);
57 
58  ClusterList &clusterList((TPC_VIEW_U == hitType) ? m_clusterListU : (TPC_VIEW_V == hitType) ? m_clusterListV : m_clusterListW);
59 
60  if (clusterList.end() != std::find(clusterList.begin(), clusterList.end(), pNewCluster))
61  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
62 
63  clusterList.push_back(pNewCluster);
64 
65  const ClusterList &clusterList2((TPC_VIEW_U == hitType) ? m_clusterListV : m_clusterListU);
66  const ClusterList &clusterList3((TPC_VIEW_W == hitType) ? m_clusterListV : m_clusterListW);
67 
68  ClusterVector clusterVector2(clusterList2.begin(), clusterList2.end());
69  ClusterVector clusterVector3(clusterList3.begin(), clusterList3.end());
70  std::sort(clusterVector2.begin(), clusterVector2.end(), LArClusterHelper::SortByNHits);
71  std::sort(clusterVector3.begin(), clusterVector3.end(), LArClusterHelper::SortByNHits);
72 
73  for (const Cluster *const pCluster2 : clusterVector2)
74  {
75  for (const Cluster *const pCluster3 : clusterVector3)
76  {
77  if (TPC_VIEW_U == hitType)
78  {
79  m_pAlgorithm->CalculateOverlapResult(pNewCluster, pCluster2, pCluster3);
80  }
81  else if (TPC_VIEW_V == hitType)
82  {
83  m_pAlgorithm->CalculateOverlapResult(pCluster2, pNewCluster, pCluster3);
84  }
85  else
86  {
87  m_pAlgorithm->CalculateOverlapResult(pCluster2, pCluster3, pNewCluster);
88  }
89  }
90  }
91 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
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.
MatchingBaseAlgorithm * m_pAlgorithm
The address of the matching base algorithm.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
virtual void CalculateOverlapResult(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3=nullptr)=0
Calculate cluster overlap result and store in container.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
template<typename T>
void lar_content::ThreeViewMatchingControl< T >::UpdateUponDeletion ( const pandora::Cluster *const  pDeletedCluster)
privatevirtual

Update to reflect cluster deletion.

Parameters
pDeletedClusteraddress of the deleted cluster

Implements lar_content::NViewMatchingControl.

Definition at line 96 of file ThreeViewMatchingControl.cc.

97 {
98  ClusterList::iterator iterU = std::find(m_clusterListU.begin(), m_clusterListU.end(), pDeletedCluster);
99  ClusterList::iterator iterV = std::find(m_clusterListV.begin(), m_clusterListV.end(), pDeletedCluster);
100  ClusterList::iterator iterW = std::find(m_clusterListW.begin(), m_clusterListW.end(), pDeletedCluster);
101 
102  if (m_clusterListU.end() != iterU)
103  m_clusterListU.erase(iterU);
104 
105  if (m_clusterListV.end() != iterV)
106  m_clusterListV.erase(iterV);
107 
108  if (m_clusterListW.end() != iterW)
109  m_clusterListW.erase(iterW);
110 
111  m_overlapTensor.RemoveCluster(pDeletedCluster);
112 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
TensorType m_overlapTensor
The overlap tensor.
void RemoveCluster(const pandora::Cluster *const pCluster)
Remove entries from tensor corresponding to specified cluster.

Friends And Related Function Documentation

template<typename T>
template<typename U >
friend class NViewMatchingAlgorithm
friend

Definition at line 76 of file ThreeViewMatchingControl.h.

template<typename T>
friend class ThreeViewDeltaRayMatchingAlgorithm
friend

Definition at line 73 of file ThreeViewMatchingControl.h.

template<typename T>
friend class ThreeViewTrackFragmentsAlgorithm
friend

ATTN This is for legacy purposes only.

Definition at line 72 of file ThreeViewMatchingControl.h.

Member Data Documentation

template<typename T>
pandora::ClusterList lar_content::ThreeViewMatchingControl< T >::m_clusterListU
private

The selected modified cluster list U.

Definition at line 62 of file ThreeViewMatchingControl.h.

template<typename T>
pandora::ClusterList lar_content::ThreeViewMatchingControl< T >::m_clusterListV
private

The selected modified cluster list V.

Definition at line 63 of file ThreeViewMatchingControl.h.

template<typename T>
pandora::ClusterList lar_content::ThreeViewMatchingControl< T >::m_clusterListW
private

The selected modified cluster list W.

Definition at line 64 of file ThreeViewMatchingControl.h.

template<typename T>
std::string lar_content::ThreeViewMatchingControl< T >::m_inputClusterListNameU
private

The name of the view U cluster list.

Definition at line 68 of file ThreeViewMatchingControl.h.

template<typename T>
std::string lar_content::ThreeViewMatchingControl< T >::m_inputClusterListNameV
private

The name of the view V cluster list.

Definition at line 69 of file ThreeViewMatchingControl.h.

template<typename T>
std::string lar_content::ThreeViewMatchingControl< T >::m_inputClusterListNameW
private

The name of the view W cluster list.

Definition at line 70 of file ThreeViewMatchingControl.h.

template<typename T>
TensorType lar_content::ThreeViewMatchingControl< T >::m_overlapTensor
private

The overlap tensor.

Definition at line 66 of file ThreeViewMatchingControl.h.

template<typename T>
const pandora::ClusterList* lar_content::ThreeViewMatchingControl< T >::m_pInputClusterListU
private

Address of the input cluster list U.

Definition at line 58 of file ThreeViewMatchingControl.h.

template<typename T>
const pandora::ClusterList* lar_content::ThreeViewMatchingControl< T >::m_pInputClusterListV
private

Address of the input cluster list V.

Definition at line 59 of file ThreeViewMatchingControl.h.

template<typename T>
const pandora::ClusterList* lar_content::ThreeViewMatchingControl< T >::m_pInputClusterListW
private

Address of the input cluster list W.

Definition at line 60 of file ThreeViewMatchingControl.h.


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