Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
lar_content::ClusterMopUpBaseAlgorithm Class Referenceabstract

ClusterMopUpBaseAlgorithm class. More...

#include <ClusterMopUpBaseAlgorithm.h>

Inheritance diagram for lar_content::ClusterMopUpBaseAlgorithm:
lar_content::MopUpBaseAlgorithm lar_content::BoundedClusterMopUpAlgorithm lar_content::ConeClusterMopUpAlgorithm lar_content::IsolatedClusterMopUpAlgorithm lar_content::NearbyClusterMopUpAlgorithm

Public Member Functions

 ClusterMopUpBaseAlgorithm ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::MopUpBaseAlgorithm
template<typename T >
const std::string GetListName (const T *const pT) const
 Find the name of the list hosting a specific object. More...
 

Protected Types

typedef std::unordered_map< const pandora::Cluster *, float > AssociationDetails
 
typedef std::unordered_map< const pandora::Cluster *, AssociationDetailsClusterAssociationMap
 

Protected Member Functions

virtual pandora::StatusCode Run ()
 
virtual void GetPfoClusterLists (pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
 Get the two dimensional clusters contained in the input pfo list, divided into three different views. More...
 
virtual void GetDaughterClusterLists (pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
 Get the two dimensional clusters contained in the input remant/daughter cluster lists, divided into three different views. More...
 
virtual void GetClusterLists (const pandora::ClusterList &inputClusterList, const bool availabilityFlag, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
 Get the two dimensional clusters contained in an input cluster list, divided into three different views. More...
 
virtual void ClusterMopUp (const pandora::ClusterList &pfoClusters, const pandora::ClusterList &remnantClusters) const =0
 Cluster mop up for a single view. This function is responsible for instructing pandora to make cluster alterations. More...
 
virtual void MakeClusterMerges (const ClusterAssociationMap &clusterAssociationMap) const
 Make the cluster merges specified in the cluster association map, using list name information in the cluster list name map. More...
 
virtual pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Protected Attributes

pandora::StringVector m_pfoListNames
 The list of pfo list names. More...
 
bool m_excludePfosContainingTracks
 Whether to exclude any pfos containing clusters flagged as fixed tracks. More...
 
- Protected Attributes inherited from lar_content::MopUpBaseAlgorithm
pandora::StringVector m_daughterListNames
 The list of potential daughter object list names. More...
 

Detailed Description

ClusterMopUpBaseAlgorithm class.

Definition at line 22 of file ClusterMopUpBaseAlgorithm.h.

Member Typedef Documentation

typedef std::unordered_map<const pandora::Cluster *, float> lar_content::ClusterMopUpBaseAlgorithm::AssociationDetails
protected

Definition at line 71 of file ClusterMopUpBaseAlgorithm.h.

typedef std::unordered_map<const pandora::Cluster *, AssociationDetails> lar_content::ClusterMopUpBaseAlgorithm::ClusterAssociationMap
protected

Definition at line 72 of file ClusterMopUpBaseAlgorithm.h.

Constructor & Destructor Documentation

lar_content::ClusterMopUpBaseAlgorithm::ClusterMopUpBaseAlgorithm ( )

Default constructor.

Definition at line 21 of file ClusterMopUpBaseAlgorithm.cc.

22 {
23 }
bool m_excludePfosContainingTracks
Whether to exclude any pfos containing clusters flagged as fixed tracks.

Member Function Documentation

virtual void lar_content::ClusterMopUpBaseAlgorithm::ClusterMopUp ( const pandora::ClusterList &  pfoClusters,
const pandora::ClusterList &  remnantClusters 
) const
protectedpure virtual

Cluster mop up for a single view. This function is responsible for instructing pandora to make cluster alterations.

Parameters
pfoClustersthe list of pfo clusters
remnantClustersthe list of remnant clusters

Implemented in lar_content::BoundedClusterMopUpAlgorithm, lar_content::IsolatedClusterMopUpAlgorithm, lar_content::NearbyClusterMopUpAlgorithm, and lar_content::ConeClusterMopUpAlgorithm.

void lar_content::ClusterMopUpBaseAlgorithm::GetClusterLists ( const pandora::ClusterList &  inputClusterList,
const bool  availabilityFlag,
pandora::ClusterList &  clusterListU,
pandora::ClusterList &  clusterListV,
pandora::ClusterList &  clusterListW 
) const
protectedvirtual

Get the two dimensional clusters contained in an input cluster list, divided into three different views.

Parameters
inputClusterListthe input cluster list
availabilityFlagonly clusters with matching availability will be considered
clusterListUto receive the list of clusters in the u view
clusterListVto receive the list of clusters in the v view
clusterListWto receive the list of clusters in the w view

Definition at line 81 of file ClusterMopUpBaseAlgorithm.cc.

83 {
84  for (ClusterList::const_iterator cIter = inputClusterList.begin(), cIterEnd = inputClusterList.end(); cIter != cIterEnd; ++cIter)
85  {
86  const Cluster *const pCluster(*cIter);
87 
88  if (availabilityFlag != pCluster->IsAvailable())
89  continue;
90 
91  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
92 
93  if ((TPC_VIEW_U != hitType) && (TPC_VIEW_V != hitType) && (TPC_VIEW_W != hitType))
94  continue;
95 
96  ClusterList &target((TPC_VIEW_U == hitType) ? clusterListU : (TPC_VIEW_V == hitType) ? clusterListV : clusterListW);
97  target.push_back(pCluster);
98  }
99 }
enum cvn::HType HitType
intermediate_table::const_iterator const_iterator
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
void lar_content::ClusterMopUpBaseAlgorithm::GetDaughterClusterLists ( pandora::ClusterList &  clusterListU,
pandora::ClusterList &  clusterListV,
pandora::ClusterList &  clusterListW 
) const
protectedvirtual

Get the two dimensional clusters contained in the input remant/daughter cluster lists, divided into three different views.

Parameters
clusterListUto receive the list of clusters in the u view
clusterListVto receive the list of clusters in the v view
clusterListWto receive the list of clusters in the w view

Definition at line 66 of file ClusterMopUpBaseAlgorithm.cc.

67 {
68  for (const std::string &daughterListName : m_daughterListNames)
69  {
70  const ClusterList *pClusterList(nullptr);
71 
72  if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*this, daughterListName, pClusterList))
73  continue;
74 
75  this->GetClusterLists(*pClusterList, true, clusterListU, clusterListV, clusterListW);
76  }
77 }
virtual void GetClusterLists(const pandora::ClusterList &inputClusterList, const bool availabilityFlag, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
Get the two dimensional clusters contained in an input cluster list, divided into three different vie...
std::string string
Definition: nybbler.cc:12
pandora::StringVector m_daughterListNames
The list of potential daughter object list names.
void lar_content::ClusterMopUpBaseAlgorithm::GetPfoClusterLists ( pandora::ClusterList &  clusterListU,
pandora::ClusterList &  clusterListV,
pandora::ClusterList &  clusterListW 
) const
protectedvirtual

Get the two dimensional clusters contained in the input pfo list, divided into three different views.

Parameters
clusterListUto receive the list of clusters in the u view
clusterListVto receive the list of clusters in the v view
clusterListWto receive the list of clusters in the w view

Definition at line 44 of file ClusterMopUpBaseAlgorithm.cc.

45 {
46  for (StringVector::const_iterator sIter = m_pfoListNames.begin(), sIterEnd = m_pfoListNames.end(); sIter != sIterEnd; ++sIter)
47  {
48  const PfoList *pPfoList = NULL;
49  if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*this, *sIter, pPfoList))
50  continue;
51 
52  for (PfoList::const_iterator pIter = pPfoList->begin(), pIterEnd = pPfoList->end(); pIter != pIterEnd; ++pIter)
53  {
54  const ParticleFlowObject *const pPfo = *pIter;
55 
57  continue;
58 
59  this->GetClusterLists(pPfo->GetClusterList(), false, clusterListU, clusterListV, clusterListW);
60  }
61  }
62 }
virtual void GetClusterLists(const pandora::ClusterList &inputClusterList, const bool availabilityFlag, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
Get the two dimensional clusters contained in an input cluster list, divided into three different vie...
bool m_excludePfosContainingTracks
Whether to exclude any pfos containing clusters flagged as fixed tracks.
intermediate_table::const_iterator const_iterator
static bool IsTrack(const pandora::ParticleFlowObject *const pPfo)
Return track flag based on Pfo Particle ID.
pandora::StringVector m_pfoListNames
The list of pfo list names.
void lar_content::ClusterMopUpBaseAlgorithm::MakeClusterMerges ( const ClusterAssociationMap clusterAssociationMap) const
protectedvirtual

Make the cluster merges specified in the cluster association map, using list name information in the cluster list name map.

Parameters
clusterAssociationMapthe cluster association map

Definition at line 103 of file ClusterMopUpBaseAlgorithm.cc.

104 {
105  ClusterVector sortedRemnantClusters;
106  for (const auto &remnantMapEntry : clusterAssociationMap)
107  sortedRemnantClusters.push_back(remnantMapEntry.first);
108  std::sort(sortedRemnantClusters.begin(), sortedRemnantClusters.end(), LArClusterHelper::SortByNHits);
109 
110  for (const Cluster *const pRemnantCluster : sortedRemnantClusters)
111  {
112  const AssociationDetails &associationDetails(clusterAssociationMap.at(pRemnantCluster));
113  const Cluster *pBestPfoCluster(nullptr);
114  float bestFigureOfMerit(-std::numeric_limits<float>::max());
115 
116  ClusterVector sortedPfoClusters;
117  for (const auto &pfoMapEntry : associationDetails)
118  sortedPfoClusters.push_back(pfoMapEntry.first);
119  std::sort(sortedPfoClusters.begin(), sortedPfoClusters.end(), LArClusterHelper::SortByNHits);
120 
121  for (const Cluster *const pPfoCluster : sortedPfoClusters)
122  {
123  const float figureOfMerit(associationDetails.at(pPfoCluster));
124 
125  if (figureOfMerit > bestFigureOfMerit)
126  {
127  pBestPfoCluster = pPfoCluster;
128  bestFigureOfMerit = figureOfMerit;
129  }
130  }
131 
132  if (!pBestPfoCluster)
133  continue;
134 
135  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
136  PandoraContentApi::MergeAndDeleteClusters(
137  *this, pBestPfoCluster, pRemnantCluster, this->GetListName(pBestPfoCluster), this->GetListName(pRemnantCluster)));
138  }
139 }
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.
const std::string GetListName(const T *const pT) const
Find the name of the list hosting a specific object.
std::unordered_map< const pandora::Cluster *, float > AssociationDetails
static int max(int a, int b)
std::vector< art::Ptr< recob::Cluster > > ClusterVector
StatusCode lar_content::ClusterMopUpBaseAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedvirtual

Reimplemented from lar_content::MopUpBaseAlgorithm.

Reimplemented in lar_content::BoundedClusterMopUpAlgorithm, lar_content::IsolatedClusterMopUpAlgorithm, lar_content::ConeClusterMopUpAlgorithm, and lar_content::NearbyClusterMopUpAlgorithm.

Definition at line 143 of file ClusterMopUpBaseAlgorithm.cc.

144 {
145  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "PfoListNames", m_pfoListNames));
146 
147  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
148  XmlHelper::ReadValue(xmlHandle, "ExcludePfosContainingTracks", m_excludePfosContainingTracks));
149 
150  return MopUpBaseAlgorithm::ReadSettings(xmlHandle);
151 }
bool m_excludePfosContainingTracks
Whether to exclude any pfos containing clusters flagged as fixed tracks.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::StringVector m_pfoListNames
The list of pfo list names.
StatusCode lar_content::ClusterMopUpBaseAlgorithm::Run ( )
protectedvirtual

Definition at line 27 of file ClusterMopUpBaseAlgorithm.cc.

28 {
29  ClusterList pfoClusterListU, pfoClusterListV, pfoClusterListW;
30  this->GetPfoClusterLists(pfoClusterListU, pfoClusterListV, pfoClusterListW);
31 
32  ClusterList daughterClusterListU, daughterClusterListV, daughterClusterListW;
33  this->GetDaughterClusterLists(daughterClusterListU, daughterClusterListV, daughterClusterListW);
34 
35  this->ClusterMopUp(pfoClusterListU, daughterClusterListU);
36  this->ClusterMopUp(pfoClusterListV, daughterClusterListV);
37  this->ClusterMopUp(pfoClusterListW, daughterClusterListW);
38 
39  return STATUS_CODE_SUCCESS;
40 }
virtual void GetPfoClusterLists(pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
Get the two dimensional clusters contained in the input pfo list, divided into three different views...
virtual void ClusterMopUp(const pandora::ClusterList &pfoClusters, const pandora::ClusterList &remnantClusters) const =0
Cluster mop up for a single view. This function is responsible for instructing pandora to make cluste...
virtual void GetDaughterClusterLists(pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
Get the two dimensional clusters contained in the input remant/daughter cluster lists, divided into three different views.

Member Data Documentation

bool lar_content::ClusterMopUpBaseAlgorithm::m_excludePfosContainingTracks
protected

Whether to exclude any pfos containing clusters flagged as fixed tracks.

Definition at line 84 of file ClusterMopUpBaseAlgorithm.h.

pandora::StringVector lar_content::ClusterMopUpBaseAlgorithm::m_pfoListNames
protected

The list of pfo list names.

Definition at line 83 of file ClusterMopUpBaseAlgorithm.h.


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