All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Protected Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::ClusterSplittingAlgorithm Class Referenceabstract

ClusterSplittingAlgorithm class. More...

#include <ClusterSplittingAlgorithm.h>

Inheritance diagram for lar_content::ClusterSplittingAlgorithm:
lar_content::LayerSplittingAlgorithm lar_content::TwoDSlidingFitSplittingAlgorithm lar_content::KinkSplittingAlgorithm lar_content::VertexSplittingAlgorithm

Protected Member Functions

virtual pandora::StatusCode Run ()
 
virtual pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
pandora::StatusCode RunUsingCurrentList () const
 Run the algorithm using the current cluster list as input. More...
 
virtual pandora::StatusCode DivideCaloHits (const pandora::Cluster *const pCluster, pandora::CaloHitList &firstCaloHitList, pandora::CaloHitList &secondCaloHitList) const =0
 Divide calo hits in a cluster into two lists, each associated with a separate fragment cluster. More...
 

Private Member Functions

pandora::StatusCode SplitCluster (const pandora::Cluster *const pCluster, pandora::ClusterList &clusterSplittingList) const
 Split cluster into two fragments. More...
 

Private Attributes

pandora::StringVector m_inputClusterListNames
 The list of input cluster list names - if empty, use the current cluster list. More...
 

Detailed Description

ClusterSplittingAlgorithm class.

Definition at line 21 of file ClusterSplittingAlgorithm.h.

Member Function Documentation

virtual pandora::StatusCode lar_content::ClusterSplittingAlgorithm::DivideCaloHits ( const pandora::Cluster *const  pCluster,
pandora::CaloHitList &  firstCaloHitList,
pandora::CaloHitList &  secondCaloHitList 
) const
protectedpure virtual

Divide calo hits in a cluster into two lists, each associated with a separate fragment cluster.

Parameters
pClusteraddress of the cluster
firstCaloHitListthe hits in the first fragment
secondCaloHitListthe hits in the second fragment

Implemented in lar_content::TwoDSlidingFitSplittingAlgorithm, and lar_content::LayerSplittingAlgorithm.

StatusCode lar_content::ClusterSplittingAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedvirtual

Reimplemented in lar_content::TwoDSlidingFitSplittingAlgorithm, lar_content::VertexSplittingAlgorithm, lar_content::KinkSplittingAlgorithm, and lar_content::LayerSplittingAlgorithm.

Definition at line 111 of file ClusterSplittingAlgorithm.cc.

112 {
113  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
114  XmlHelper::ReadVectorOfValues(xmlHandle, "InputClusterListNames", m_inputClusterListNames));
115 
116  return STATUS_CODE_SUCCESS;
117 }
pandora::StringVector m_inputClusterListNames
The list of input cluster list names - if empty, use the current cluster list.
StatusCode lar_content::ClusterSplittingAlgorithm::Run ( )
protectedvirtual

Definition at line 20 of file ClusterSplittingAlgorithm.cc.

21 {
22  if (m_inputClusterListNames.empty())
23  return this->RunUsingCurrentList();
24 
25  std::string originalListName;
26  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentListName<Cluster>(*this, originalListName));
27 
28  for (const std::string &clusterListName : m_inputClusterListNames)
29  {
30  const StatusCode listChangeStatusCode(PandoraContentApi::ReplaceCurrentList<Cluster>(*this, clusterListName));
31 
32  if (STATUS_CODE_NOT_FOUND == listChangeStatusCode)
33  {
34  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
35  std::cout << "ClusterSplittingAlgorithm: cluster list not found " << clusterListName << std::endl;
36 
37  continue;
38  }
39 
40  if (STATUS_CODE_SUCCESS != listChangeStatusCode)
41  return listChangeStatusCode;
42 
43  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->RunUsingCurrentList());
44  }
45 
46  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, originalListName));
47  return STATUS_CODE_SUCCESS;
48 }
pandora::StatusCode RunUsingCurrentList() const
Run the algorithm using the current cluster list as input.
pandora::StringVector m_inputClusterListNames
The list of input cluster list names - if empty, use the current cluster list.
BEGIN_PROLOG could also be cout
StatusCode lar_content::ClusterSplittingAlgorithm::RunUsingCurrentList ( ) const
protected

Run the algorithm using the current cluster list as input.

Definition at line 52 of file ClusterSplittingAlgorithm.cc.

53 {
54  const ClusterList *pClusterList = NULL;
55  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pClusterList));
56 
57  ClusterList internalClusterList(pClusterList->begin(), pClusterList->end());
58  internalClusterList.sort(LArClusterHelper::SortByNHits);
59 
60  for (ClusterList::iterator iter = internalClusterList.begin(); iter != internalClusterList.end(); ++iter)
61  {
62  const Cluster *const pCluster = *iter;
63  ClusterList clusterSplittingList;
64 
65  if (STATUS_CODE_SUCCESS != this->SplitCluster(pCluster, clusterSplittingList))
66  continue;
67 
68  internalClusterList.splice(internalClusterList.end(), clusterSplittingList);
69  *iter = NULL;
70  }
71 
72  return STATUS_CODE_SUCCESS;
73 }
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 SplitCluster(const pandora::Cluster *const pCluster, pandora::ClusterList &clusterSplittingList) const
Split cluster into two fragments.
StatusCode lar_content::ClusterSplittingAlgorithm::SplitCluster ( const pandora::Cluster *const  pCluster,
pandora::ClusterList &  clusterSplittingList 
) const
private

Split cluster into two fragments.

Parameters
pClusteraddress of the cluster
clusterSplittingListto receive the two cluster fragments

Definition at line 77 of file ClusterSplittingAlgorithm.cc.

78 {
79  // Split cluster into two CaloHit lists
80  PandoraContentApi::Cluster::Parameters firstParameters, secondParameters;
81 
82  if (STATUS_CODE_SUCCESS != this->DivideCaloHits(pCluster, firstParameters.m_caloHitList, secondParameters.m_caloHitList))
83  return STATUS_CODE_NOT_FOUND;
84 
85  if (firstParameters.m_caloHitList.empty() || secondParameters.m_caloHitList.empty())
86  return STATUS_CODE_NOT_ALLOWED;
87 
88  // Begin cluster fragmentation operations
89  const ClusterList clusterList(1, pCluster);
90  std::string clusterListToSaveName, clusterListToDeleteName;
91 
92  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=,
93  PandoraContentApi::InitializeFragmentation(*this, clusterList, clusterListToDeleteName, clusterListToSaveName));
94 
95  // Create new clusters
96  const Cluster *pFirstCluster(NULL), *pSecondCluster(NULL);
97  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*this, firstParameters, pFirstCluster));
98  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*this, secondParameters, pSecondCluster));
99 
100  clusterSplittingList.push_back(pFirstCluster);
101  clusterSplittingList.push_back(pSecondCluster);
102 
103  // End cluster fragmentation operations
104  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::EndFragmentation(*this, clusterListToSaveName, clusterListToDeleteName));
105 
106  return STATUS_CODE_SUCCESS;
107 }
virtual pandora::StatusCode DivideCaloHits(const pandora::Cluster *const pCluster, pandora::CaloHitList &firstCaloHitList, pandora::CaloHitList &secondCaloHitList) const =0
Divide calo hits in a cluster into two lists, each associated with a separate fragment cluster...
fhicl::Table< sbnd::crt::CRTDetSimParams > Parameters

Member Data Documentation

pandora::StringVector lar_content::ClusterSplittingAlgorithm::m_inputClusterListNames
private

The list of input cluster list names - if empty, use the current cluster list.

Definition at line 51 of file ClusterSplittingAlgorithm.h.


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