Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::TransverseExtensionAlgorithm Class Reference

TransverseExtensionAlgorithm class. More...

#include <TransverseExtensionAlgorithm.h>

Inheritance diagram for lar_content::TransverseExtensionAlgorithm:
lar_content::ClusterExtensionAlgorithm lar_content::ClusterMergingAlgorithm

Public Member Functions

 TransverseExtensionAlgorithm ()
 Default constructor. More...
 

Private Member Functions

void GetListOfCleanClusters (const pandora::ClusterList *const pClusterList, pandora::ClusterVector &clusterVector) const
 Populate cluster vector with subset of cluster list, containing clusters judged to be clean. More...
 
void FillClusterAssociationMatrix (const pandora::ClusterVector &clusterVector, ClusterAssociationMatrix &clusterAssociationMatrix) const
 Fill the cluster association matrix. More...
 
void FillClusterMergeMap (const ClusterAssociationMatrix &clusterAssociationMatrix, ClusterMergeMap &clusterMergeMap) const
 Fill the cluster merge map. More...
 
void FillClusterAssociationMatrix (const LArPointingCluster &parentCluster, const pandora::Cluster *const pDaughterCluster, ClusterAssociationMatrix &clusterAssociationMatrix) const
 Form associations between parent and daughter clusters. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

float m_minClusterLength
 
float m_maxLongitudinalDisplacement
 
float m_maxTransverseDisplacement
 

Additional Inherited Members

- Protected Types inherited from lar_content::ClusterExtensionAlgorithm
typedef std::unordered_map< const pandora::Cluster *, ClusterAssociationClusterAssociationMap
 
typedef std::unordered_map< const pandora::Cluster *, ClusterAssociationMapClusterAssociationMatrix
 
- Protected Types inherited from lar_content::ClusterMergingAlgorithm
typedef std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterMergeMap
 
- Protected Member Functions inherited from lar_content::ClusterExtensionAlgorithm
void PopulateClusterMergeMap (const pandora::ClusterVector &clusterVector, ClusterMergeMap &clusterMergeMatrix) const
 Form associations between pointing clusters. More...
 
- Protected Member Functions inherited from lar_content::ClusterMergingAlgorithm
virtual pandora::StatusCode Run ()
 
void MergeClusters (pandora::ClusterVector &clusterVector, ClusterMergeMap &clusterMergeMap) const
 Merge associated clusters. More...
 
void CollectAssociatedClusters (const pandora::Cluster *const pSeedCluster, const ClusterMergeMap &clusterMergeMap, pandora::ClusterList &associatedClusterList) const
 Collect up all clusters associations related to a given seed cluster. More...
 
void CollectAssociatedClusters (const pandora::Cluster *const pSeedCluster, const pandora::Cluster *const pCurrentCluster, const ClusterMergeMap &clusterMergeMap, const pandora::ClusterSet &clusterVetoList, pandora::ClusterList &associatedClusterList) const
 Collect up all clusters associations related to a given seed cluster. More...
 
void GetSortedListOfCleanClusters (const pandora::ClusterVector &inputClusters, pandora::ClusterVector &outputClusters) const
 Sort the selected clusters, so that they have a well-defined ordering. More...
 
- Protected Attributes inherited from lar_content::ClusterMergingAlgorithm
std::string m_inputClusterListName
 The name of the input cluster list. If not specified, will access current list. More...
 

Detailed Description

TransverseExtensionAlgorithm class.

Definition at line 23 of file TransverseExtensionAlgorithm.h.

Constructor & Destructor Documentation

lar_content::TransverseExtensionAlgorithm::TransverseExtensionAlgorithm ( )

Member Function Documentation

void lar_content::TransverseExtensionAlgorithm::FillClusterAssociationMatrix ( const pandora::ClusterVector &  clusterVector,
ClusterAssociationMatrix clusterAssociationMatrix 
) const
privatevirtual

Fill the cluster association matrix.

Parameters
clusterVectorthe input vector of clusters
clusterAssociationMatrixthe matrix of associations

Implements lar_content::ClusterExtensionAlgorithm.

void lar_content::TransverseExtensionAlgorithm::FillClusterAssociationMatrix ( const LArPointingCluster parentCluster,
const pandora::Cluster *const  pDaughterCluster,
ClusterAssociationMatrix clusterAssociationMatrix 
) const
private

Form associations between parent and daughter clusters.

Parameters
parentClusterthe parent pointing cluster
pDaughterClusterthe address of the daughter cluster
clusterAssociationMatrixthe matrix of cluster associations
void lar_content::TransverseExtensionAlgorithm::FillClusterMergeMap ( const ClusterAssociationMatrix clusterAssociationMatrix,
ClusterMergeMap clusterMergeMap 
) const
privatevirtual

Fill the cluster merge map.

Parameters
clusterAssociationMatrixthe matrix of cluster associations
clusterMergeMapthe map of cluster merges

Implements lar_content::ClusterExtensionAlgorithm.

Definition at line 131 of file TransverseExtensionAlgorithm.cc.

132 {
133  ClusterAssociationMatrix daughterToParentMatrix;
134 
135  // Loop over parent clusters and select nearby daughter clusters that are closer than another parent cluster
136  ClusterVector sortedParentClusters;
137  for (const auto &mapEntry : parentToDaughterMatrix)
138  sortedParentClusters.push_back(mapEntry.first);
139  std::sort(sortedParentClusters.begin(), sortedParentClusters.end(), LArClusterHelper::SortByNHits);
140 
141  for (const Cluster *const pParentCluster : sortedParentClusters)
142  {
143  const ClusterAssociationMap &daughterToAssociationMap(parentToDaughterMatrix.at(pParentCluster));
144 
145  float maxDisplacementInner(std::numeric_limits<float>::max());
146  float maxDisplacementOuter(std::numeric_limits<float>::max());
147 
148  // Find the nearest parent cluster
149  ClusterVector sortedLocalDaughterClusters;
150  for (const auto &mapEntry : daughterToAssociationMap)
151  sortedLocalDaughterClusters.push_back(mapEntry.first);
152  std::sort(sortedLocalDaughterClusters.begin(), sortedLocalDaughterClusters.end(), LArClusterHelper::SortByNHits);
153 
154  for (const Cluster *const pDaughterCluster : sortedLocalDaughterClusters)
155  {
156  const ClusterAssociation &clusterAssociation(daughterToAssociationMap.at(pDaughterCluster));
157 
158  if (clusterAssociation.GetAssociation() == ClusterAssociation::WEAK)
159  {
160  if (clusterAssociation.GetParent() == ClusterAssociation::INNER && clusterAssociation.GetFigureOfMerit() < maxDisplacementInner)
161  maxDisplacementInner = clusterAssociation.GetFigureOfMerit();
162 
163  if (clusterAssociation.GetParent() == ClusterAssociation::OUTER && clusterAssociation.GetFigureOfMerit() < maxDisplacementOuter)
164  maxDisplacementOuter = clusterAssociation.GetFigureOfMerit();
165  }
166  }
167 
168  // Select daughter clusters that are closer than the nearest parent cluster
169  for (const Cluster *const pDaughterCluster : sortedLocalDaughterClusters)
170  {
171  const ClusterAssociation &clusterAssociation(daughterToAssociationMap.at(pDaughterCluster));
172 
173  if (clusterAssociation.GetAssociation() == ClusterAssociation::STRONG)
174  {
175  if (clusterAssociation.GetParent() == ClusterAssociation::INNER && clusterAssociation.GetFigureOfMerit() < maxDisplacementInner)
176  (void)daughterToParentMatrix[pDaughterCluster].insert(ClusterAssociationMap::value_type(pParentCluster, clusterAssociation));
177 
178  if (clusterAssociation.GetParent() == ClusterAssociation::OUTER && clusterAssociation.GetFigureOfMerit() < maxDisplacementOuter)
179  (void)daughterToParentMatrix[pDaughterCluster].insert(ClusterAssociationMap::value_type(pParentCluster, clusterAssociation));
180  }
181  }
182  }
183 
184  // Loop over daughter clusters and select the nearest parent clusters
185  ClusterVector sortedDaughterClusters;
186  for (const auto &mapEntry : daughterToParentMatrix)
187  sortedDaughterClusters.push_back(mapEntry.first);
188  std::sort(sortedDaughterClusters.begin(), sortedDaughterClusters.end(), LArClusterHelper::SortByNHits);
189 
190  // Loop over parent clusters and select nearby daughter clusters that are closer than another parent cluster
191  for (const Cluster *const pDaughterCluster : sortedDaughterClusters)
192  {
193  const ClusterAssociationMap &parentToAssociationMap(daughterToParentMatrix.at(pDaughterCluster));
194 
195  const Cluster *pParentCluster(nullptr);
196  float minDisplacement(std::numeric_limits<float>::max());
197 
198  ClusterVector sortedLocalParentClusters;
199  for (const auto &mapEntry : parentToAssociationMap)
200  sortedLocalParentClusters.push_back(mapEntry.first);
201  std::sort(sortedLocalParentClusters.begin(), sortedLocalParentClusters.end(), LArClusterHelper::SortByNHits);
202 
203  for (const Cluster *const pCandidateParentCluster : sortedLocalParentClusters)
204  {
205  const ClusterAssociation &clusterAssociation(parentToAssociationMap.at(pCandidateParentCluster));
206 
207  if (clusterAssociation.GetFigureOfMerit() < minDisplacement)
208  {
209  minDisplacement = clusterAssociation.GetFigureOfMerit();
210  pParentCluster = pCandidateParentCluster;
211  }
212  }
213 
214  if (pParentCluster)
215  {
216  ClusterList &parentList(clusterMergeMap[pParentCluster]);
217 
218  if (parentList.end() == std::find(parentList.begin(), parentList.end(), pDaughterCluster))
219  parentList.push_back(pDaughterCluster);
220 
221  ClusterList &daughterList(clusterMergeMap[pDaughterCluster]);
222 
223  if (daughterList.end() == std::find(daughterList.begin(), daughterList.end(), pParentCluster))
224  daughterList.push_back(pParentCluster);
225  }
226  }
227 }
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.
std::unordered_map< const pandora::Cluster *, ClusterAssociation > ClusterAssociationMap
std::unordered_map< const pandora::Cluster *, ClusterAssociationMap > ClusterAssociationMatrix
static int max(int a, int b)
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void lar_content::TransverseExtensionAlgorithm::GetListOfCleanClusters ( const pandora::ClusterList *const  pClusterList,
pandora::ClusterVector &  clusterVector 
) const
privatevirtual

Populate cluster vector with subset of cluster list, containing clusters judged to be clean.

Parameters
pClusterListaddress of the cluster list
clusterVectorto receive the populated cluster vector

Implements lar_content::ClusterMergingAlgorithm.

Definition at line 30 of file TransverseExtensionAlgorithm.cc.

31 {
32  for (ClusterList::const_iterator iter = pClusterList->begin(), iterEnd = pClusterList->end(); iter != iterEnd; ++iter)
33  clusterVector.push_back(*iter);
34 
35  std::sort(clusterVector.begin(), clusterVector.end(), LArClusterHelper::SortByNHits);
36 }
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
StatusCode lar_content::TransverseExtensionAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::ClusterMergingAlgorithm.

Definition at line 231 of file TransverseExtensionAlgorithm.cc.

232 {
233  PANDORA_RETURN_RESULT_IF_AND_IF(
234  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterLength", m_minClusterLength));
235 
236  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
237  XmlHelper::ReadValue(xmlHandle, "MaxLongitudinalDisplacement", m_maxLongitudinalDisplacement));
238 
239  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
240  XmlHelper::ReadValue(xmlHandle, "MaxTransverseDisplacement", m_maxTransverseDisplacement));
241 
242  return ClusterExtensionAlgorithm::ReadSettings(xmlHandle);
243 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)

Member Data Documentation

float lar_content::TransverseExtensionAlgorithm::m_maxLongitudinalDisplacement
private

Definition at line 49 of file TransverseExtensionAlgorithm.h.

float lar_content::TransverseExtensionAlgorithm::m_maxTransverseDisplacement
private

Definition at line 50 of file TransverseExtensionAlgorithm.h.

float lar_content::TransverseExtensionAlgorithm::m_minClusterLength
private

Definition at line 48 of file TransverseExtensionAlgorithm.h.


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