All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimpleClusterGrowingAlgorithm.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTwoDReco/LArClusterAssociation/SimpleClusterGrowingAlgorithm.cc
3  *
4  * @brief Implementation of the simple cluster growing algorithm class.
5  *
6  * $Log: $
7  */
8 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
14 
15 using namespace pandora;
16 
17 namespace lar_content
18 {
19 
20 SimpleClusterGrowingAlgorithm::SimpleClusterGrowingAlgorithm() : m_minCaloHitsPerCluster(5)
21 {
22 }
23 
24 //------------------------------------------------------------------------------------------------------------------------------------------
25 
26 void SimpleClusterGrowingAlgorithm::GetListOfCleanClusters(const ClusterList *const pClusterList, ClusterVector &clusterVector) const
27 {
28  for (ClusterList::const_iterator iter = pClusterList->begin(), iterEnd = pClusterList->end(); iter != iterEnd; ++iter)
29  {
30  const Cluster *const pCluster = *iter;
31 
32  if (!pCluster->IsAvailable())
33  continue;
34 
35  clusterVector.push_back(pCluster);
36  }
37 
38  std::sort(clusterVector.begin(), clusterVector.end(), LArClusterHelper::SortByNHits);
39 }
40 
41 //------------------------------------------------------------------------------------------------------------------------------------------
42 
44 {
45  for (ClusterVector::const_iterator cIter = inputClusters.begin(), cIterEnd = inputClusters.end(); cIter != cIterEnd; ++cIter)
46  {
47  const Cluster *const pCluster = *cIter;
48 
49  if (pCluster->GetNCaloHits() < m_minCaloHitsPerCluster)
50  continue;
51 
52  seedClusters.push_back(pCluster);
53  }
54 
55  std::sort(seedClusters.begin(), seedClusters.end(), LArClusterHelper::SortByNHits);
56 }
57 
58 //------------------------------------------------------------------------------------------------------------------------------------------
59 
60 StatusCode SimpleClusterGrowingAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
61 {
62  PANDORA_RETURN_RESULT_IF_AND_IF(
63  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinCaloHitsPerCluster", m_minCaloHitsPerCluster));
64 
65  return ClusterGrowingAlgorithm::ReadSettings(xmlHandle);
66 }
67 
68 } // 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.
Header file for the cluster helper class.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &cleanClusters) const
Populate cluster vector with the subset of clusters judged to be clean.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
Definition: reco_sbnd.fcl:182
std::vector< art::Ptr< recob::Cluster > > ClusterVector
unsigned int m_minCaloHitsPerCluster
The minimum number of calo hits per seed cluster.