LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::SimpleClusterGrowingAlgorithm Class Reference

SimpleClusterGrowingAlgorithm class. More...

#include "SimpleClusterGrowingAlgorithm.h"

Inheritance diagram for lar_content::SimpleClusterGrowingAlgorithm:
lar_content::ClusterGrowingAlgorithm

Public Member Functions

 SimpleClusterGrowingAlgorithm ()
 Default constructor. More...
 

Protected Types

typedef std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterMergeMap
 

Protected Member Functions

virtual pandora::StatusCode Run ()
 

Private Member Functions

void GetListOfCleanClusters (const pandora::ClusterList *const pClusterList, pandora::ClusterVector &cleanClusters) const
 Populate cluster vector with the subset of clusters judged to be clean. More...
 
void GetListOfSeedClusters (const pandora::ClusterVector &inputClusters, pandora::ClusterVector &seedClusters) const
 Select seed clusters for growing. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

unsigned int m_minCaloHitsPerCluster
 The minimum number of calo hits per seed cluster. More...
 

Detailed Description

Member Typedef Documentation

typedef std::unordered_map<const pandora::Cluster*, pandora::ClusterList> lar_content::ClusterGrowingAlgorithm::ClusterMergeMap
protectedinherited

Definition at line 33 of file ClusterGrowingAlgorithm.h.

Constructor & Destructor Documentation

lar_content::SimpleClusterGrowingAlgorithm::SimpleClusterGrowingAlgorithm ( )

Default constructor.

Definition at line 20 of file SimpleClusterGrowingAlgorithm.cc.

20  :
22 {
23 }
unsigned int m_minCaloHitsPerCluster
The minimum number of calo hits per seed cluster.

Member Function Documentation

void lar_content::SimpleClusterGrowingAlgorithm::GetListOfCleanClusters ( const pandora::ClusterList *const  pClusterList,
pandora::ClusterVector &  cleanClusters 
) const
privatevirtual

Populate cluster vector with the subset of clusters judged to be clean.

Parameters
pClusterListaddress of the cluster list
cleanClustersthe output vector of clean clusters

Implements lar_content::ClusterGrowingAlgorithm.

Definition at line 27 of file SimpleClusterGrowingAlgorithm.cc.

References lar_content::LArClusterHelper::SortByNHits().

28 {
29  for (ClusterList::const_iterator iter = pClusterList->begin(), iterEnd = pClusterList->end(); iter != iterEnd; ++iter)
30  {
31  const Cluster *const pCluster = *iter;
32 
33  if (!pCluster->IsAvailable())
34  continue;
35 
36  clusterVector.push_back(pCluster);
37  }
38 
39  std::sort(clusterVector.begin(), clusterVector.end(), LArClusterHelper::SortByNHits);
40 }
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
void lar_content::SimpleClusterGrowingAlgorithm::GetListOfSeedClusters ( const pandora::ClusterVector &  cleanClusters,
pandora::ClusterVector &  seedClusters 
) const
privatevirtual

Select seed clusters for growing.

Parameters
cleanClustersthe input vector of clean clusters
seedClustersthe output vector of seed clusters

Implements lar_content::ClusterGrowingAlgorithm.

Definition at line 44 of file SimpleClusterGrowingAlgorithm.cc.

References m_minCaloHitsPerCluster, and lar_content::LArClusterHelper::SortByNHits().

45 {
46  for (ClusterVector::const_iterator cIter = inputClusters.begin(), cIterEnd = inputClusters.end(); cIter != cIterEnd; ++cIter)
47  {
48  const Cluster *const pCluster = *cIter;
49 
50  if (pCluster->GetNCaloHits() < m_minCaloHitsPerCluster)
51  continue;
52 
53  seedClusters.push_back(pCluster);
54  }
55 
56  std::sort(seedClusters.begin(), seedClusters.end(), LArClusterHelper::SortByNHits);
57 }
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
unsigned int m_minCaloHitsPerCluster
The minimum number of calo hits per seed cluster.
StatusCode lar_content::SimpleClusterGrowingAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::ClusterGrowingAlgorithm.

Definition at line 61 of file SimpleClusterGrowingAlgorithm.cc.

References m_minCaloHitsPerCluster, and lar_content::ClusterGrowingAlgorithm::ReadSettings().

62 {
63  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
64  "MinCaloHitsPerCluster", m_minCaloHitsPerCluster));
65 
66  return ClusterGrowingAlgorithm::ReadSettings(xmlHandle);
67 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_minCaloHitsPerCluster
The minimum number of calo hits per seed cluster.
StatusCode lar_content::ClusterGrowingAlgorithm::Run ( )
protectedvirtualinherited

Definition at line 27 of file ClusterGrowingAlgorithm.cc.

References lar_content::ClusterGrowingAlgorithm::GetListOfCleanClusters(), lar_content::ClusterGrowingAlgorithm::GetListOfNonSeedClusters(), lar_content::ClusterGrowingAlgorithm::GetListOfSeedClusters(), lar_content::ClusterGrowingAlgorithm::m_inputClusterListName, lar_content::ClusterGrowingAlgorithm::MergeClusters(), and lar_content::ClusterGrowingAlgorithm::PopulateClusterMergeMap().

28 {
29  const ClusterList *pClusterList = NULL;
30 
31  if (m_inputClusterListName.empty())
32  {
33  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pClusterList));
34  }
35  else
36  {
37  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, m_inputClusterListName, pClusterList));
38  }
39 
40  if (!pClusterList || pClusterList->empty())
41  {
42  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
43  std::cout << "ClusterGrowingAlgorithm: unable to find cluster list " << m_inputClusterListName << std::endl;
44 
45  return STATUS_CODE_SUCCESS;
46  }
47 
48  ClusterVector inputClusters, seedClusters;
49  this->GetListOfCleanClusters(pClusterList, inputClusters);
50  this->GetListOfSeedClusters(inputClusters, seedClusters);
51 
52  while (true)
53  {
54  ClusterVector currentClusters, nonSeedClusters;
55  this->GetListOfCleanClusters(pClusterList, currentClusters);
56  this->GetListOfNonSeedClusters(currentClusters, seedClusters, nonSeedClusters);
57 
58  ClusterMergeMap clusterMergeMap;
59  this->PopulateClusterMergeMap(seedClusters, nonSeedClusters, clusterMergeMap);
60 
61  if (clusterMergeMap.empty())
62  break;
63 
64  this->MergeClusters(clusterMergeMap);
65  }
66 
67  return STATUS_CODE_SUCCESS;
68 }
void GetListOfNonSeedClusters(const pandora::ClusterVector &inputClusters, const pandora::ClusterVector &seedClusters, pandora::ClusterVector &nonSeedClusters) const
Get List of non-seed clusters.
void MergeClusters(const ClusterMergeMap &clusterMergeMap) const
Merge clusters.
virtual void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &cleanClusters) const =0
Populate cluster vector with the subset of clusters judged to be clean.
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterMergeMap
std::string m_inputClusterListName
The name of the input cluster list. If not specified, will access current list.
virtual void GetListOfSeedClusters(const pandora::ClusterVector &cleanClusters, pandora::ClusterVector &seedClusters) const =0
Select seed clusters for growing.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void PopulateClusterMergeMap(const pandora::ClusterVector &seedClusters, const pandora::ClusterVector &nonSeedClusters, ClusterMergeMap &clusterMergeMap) const
Identify a set of cluster merges.

Member Data Documentation

unsigned int lar_content::SimpleClusterGrowingAlgorithm::m_minCaloHitsPerCluster
private

The minimum number of calo hits per seed cluster.

Definition at line 35 of file SimpleClusterGrowingAlgorithm.h.

Referenced by GetListOfSeedClusters(), and ReadSettings().


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