LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
SimpleClusterGrowingAlgorithm.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
14 
15 using namespace pandora;
16 
17 namespace lar_content
18 {
19 
20 SimpleClusterGrowingAlgorithm::SimpleClusterGrowingAlgorithm() :
21  m_minCaloHitsPerCluster(5)
22 {
23 }
24 
25 //------------------------------------------------------------------------------------------------------------------------------------------
26 
27 void SimpleClusterGrowingAlgorithm::GetListOfCleanClusters(const ClusterList *const pClusterList, ClusterVector &clusterVector) const
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 }
41 
42 //------------------------------------------------------------------------------------------------------------------------------------------
43 
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 }
58 
59 //------------------------------------------------------------------------------------------------------------------------------------------
60 
61 StatusCode SimpleClusterGrowingAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
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 }
68 
69 } // namespace lar_content
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.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void GetListOfSeedClusters(const pandora::ClusterVector &inputClusters, pandora::ClusterVector &seedClusters) const
Select seed clusters for growing.
Header file for the simple cluster growing algorithm class.
intermediate_table::const_iterator const_iterator
Header file for the cluster helper class.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &cleanClusters) const
Populate cluster vector with the subset of clusters judged to be clean.
unsigned int m_minCaloHitsPerCluster
The minimum number of calo hits per seed cluster.