LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::TwoDSlidingFitSplittingAlgorithm Class Referenceabstract

TwoDSlidingFitSplittingAlgorithm class. More...

#include "TwoDSlidingFitSplittingAlgorithm.h"

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

Public Member Functions

 TwoDSlidingFitSplittingAlgorithm ()
 Default constructor. More...
 

Protected Member Functions

virtual pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
virtual pandora::StatusCode FindBestSplitPosition (const TwoDSlidingFitResult &slidingFitResult, pandora::CartesianVector &splitPosition) const =0
 Use sliding linear fit to identify the best split position. More...
 
virtual pandora::StatusCode Run ()
 
pandora::StatusCode RunUsingCurrentList () const
 Run the algorithm using the current cluster list as input. More...
 

Protected Attributes

unsigned int m_slidingFitHalfWindow
 
float m_minClusterLength
 

Private Member Functions

pandora::StatusCode DivideCaloHits (const pandora::Cluster *const pCluster, pandora::CaloHitList &firstCaloHitList, pandora::CaloHitList &secondCaloHitList) const
 Divide calo hits in a cluster into two lists, each associated with a separate fragment cluster. More...
 
pandora::StatusCode DivideCaloHits (const TwoDSlidingFitResult &slidingFitResult, const pandora::CartesianVector &splitPosition, pandora::CaloHitList &firstCaloHitList, pandora::CaloHitList &secondCaloHitList) const
 Use sliding linear fit to separate cluster into two fragments. More...
 

Detailed Description

Constructor & Destructor Documentation

Member Function Documentation

pandora::StatusCode lar_content::TwoDSlidingFitSplittingAlgorithm::DivideCaloHits ( const pandora::Cluster *const  pCluster,
pandora::CaloHitList &  firstCaloHitList,
pandora::CaloHitList &  secondCaloHitList 
) const
privatevirtual

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

Implements lar_content::ClusterSplittingAlgorithm.

Referenced by TwoDSlidingFitSplittingAlgorithm().

pandora::StatusCode lar_content::TwoDSlidingFitSplittingAlgorithm::DivideCaloHits ( const TwoDSlidingFitResult slidingFitResult,
const pandora::CartesianVector &  splitPosition,
pandora::CaloHitList &  firstCaloHitList,
pandora::CaloHitList &  secondCaloHitList 
) const
private

Use sliding linear fit to separate cluster into two fragments.

Parameters
slidingFitResultthe input sliding fit result
splitPositionthe split position
firstCaloHitListthe hits in the first cluster fragment
secondCaloHitListthe hits in the second cluster fragment
Returns
pandora::StatusCode
virtual pandora::StatusCode lar_content::TwoDSlidingFitSplittingAlgorithm::FindBestSplitPosition ( const TwoDSlidingFitResult slidingFitResult,
pandora::CartesianVector &  splitPosition 
) const
protectedpure virtual

Use sliding linear fit to identify the best split position.

Parameters
slidingFitResultthe input sliding fit result
splitPositionthe best split position
Returns
pandora::StatusCode

Implemented in lar_content::KinkSplittingAlgorithm, and lar_content::VertexSplittingAlgorithm.

Referenced by TwoDSlidingFitSplittingAlgorithm().

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

Reimplemented from lar_content::ClusterSplittingAlgorithm.

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

Definition at line 94 of file TwoDSlidingFitSplittingAlgorithm.cc.

References m_minClusterLength, m_slidingFitHalfWindow, and lar_content::ClusterSplittingAlgorithm::ReadSettings().

Referenced by lar_content::KinkSplittingAlgorithm::ReadSettings(), and lar_content::VertexSplittingAlgorithm::ReadSettings().

95 {
96  PANDORA_RETURN_RESULT_IF_AND_IF(
97  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitHalfWindow", m_slidingFitHalfWindow));
98 
99  PANDORA_RETURN_RESULT_IF_AND_IF(
100  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterLength", m_minClusterLength));
101 
102  return ClusterSplittingAlgorithm::ReadSettings(xmlHandle);
103 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
StatusCode lar_content::ClusterSplittingAlgorithm::Run ( )
protectedvirtualinherited

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.
StatusCode lar_content::ClusterSplittingAlgorithm::RunUsingCurrentList ( ) const
protectedinherited

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 }
intermediate_table::iterator iterator
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.

Member Data Documentation

float lar_content::TwoDSlidingFitSplittingAlgorithm::m_minClusterLength
protected
unsigned int lar_content::TwoDSlidingFitSplittingAlgorithm::m_slidingFitHalfWindow
protected

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