LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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...
 
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...
 
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.

21  :
23 {
24 }
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.

Referenced by Run().

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 82 of file ClusterMopUpBaseAlgorithm.cc.

References lar_content::LArClusterHelper::GetClusterHitType(), and target.

Referenced by GetDaughterClusterLists(), and GetPfoClusterLists().

84 {
85  for (ClusterList::const_iterator cIter = inputClusterList.begin(), cIterEnd = inputClusterList.end(); cIter != cIterEnd; ++cIter)
86  {
87  const Cluster *const pCluster(*cIter);
88 
89  if (availabilityFlag != pCluster->IsAvailable())
90  continue;
91 
92  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
93 
94  if ((TPC_VIEW_U != hitType) && (TPC_VIEW_V != hitType) && (TPC_VIEW_W != hitType))
95  continue;
96 
97  ClusterList &target((TPC_VIEW_U == hitType) ? clusterListU : (TPC_VIEW_V == hitType) ? clusterListV : clusterListW);
98  target.push_back(pCluster);
99  }
100 }
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.
HitType
Definition: HitType.h:12
cout<< "-> Edep in the target
Definition: analysis.C:53
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 67 of file ClusterMopUpBaseAlgorithm.cc.

References GetClusterLists(), and lar_content::MopUpBaseAlgorithm::m_daughterListNames.

Referenced by Run().

68 {
69  for (const std::string &daughterListName : m_daughterListNames)
70  {
71  const ClusterList *pClusterList(nullptr);
72 
73  if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*this, daughterListName, pClusterList))
74  continue;
75 
76  this->GetClusterLists(*pClusterList, true, clusterListU, clusterListV, clusterListW);
77  }
78 }
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...
pandora::StringVector m_daughterListNames
The list of potential daughter object list names.
template<typename T >
template const std::string lar_content::MopUpBaseAlgorithm::GetListName ( const T *const  pT) const
inherited

Find the name of the list hosting a specific object.

Parameters
pTthe address of the object
Returns
the name of the list

Definition at line 19 of file MopUpBaseAlgorithm.cc.

Referenced by lar_content::IsolatedClusterMopUpAlgorithm::DissolveClustersToHits(), MakeClusterMerges(), and lar_content::SlidingConeClusterMopUpAlgorithm::MakeClusterMerges().

20 {
21  std::string currentListName;
22  const MANAGED_CONTAINER<const T *> *pCurrentList(nullptr);
23  (void)PandoraContentApi::GetCurrentList(*this, pCurrentList, currentListName);
24 
25  if (pCurrentList && (pCurrentList->end() != std::find(pCurrentList->begin(), pCurrentList->end(), pT)))
26  return currentListName;
27 
28  for (const std::string &listName : m_daughterListNames)
29  {
30  const MANAGED_CONTAINER<const T *> *pList(nullptr);
31  (void)PandoraContentApi::GetList(*this, listName, pList);
32 
33  if (pList && (pList->end() != std::find(pList->begin(), pList->end(), pT)))
34  return listName;
35  }
36 
37  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
38 }
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 45 of file ClusterMopUpBaseAlgorithm.cc.

References GetClusterLists(), lar_content::LArPfoHelper::IsTrack(), m_excludePfosContainingTracks, and m_pfoListNames.

Referenced by Run().

46 {
47  for (StringVector::const_iterator sIter = m_pfoListNames.begin(), sIterEnd = m_pfoListNames.end(); sIter != sIterEnd; ++sIter)
48  {
49  const PfoList *pPfoList = NULL;
50  if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*this, *sIter, pPfoList))
51  continue;
52 
53  for (PfoList::const_iterator pIter = pPfoList->begin(), pIterEnd = pPfoList->end(); pIter != pIterEnd; ++pIter)
54  {
55  const ParticleFlowObject *const pPfo = *pIter;
56 
58  continue;
59 
60  this->GetClusterLists(pPfo->GetClusterList(), false, clusterListU, clusterListV, clusterListW);
61  }
62  }
63 }
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 104 of file ClusterMopUpBaseAlgorithm.cc.

References lar_content::MopUpBaseAlgorithm::GetListName(), and lar_content::LArClusterHelper::SortByNHits().

Referenced by lar_content::ConeClusterMopUpAlgorithm::ClusterMopUp(), lar_content::NearbyClusterMopUpAlgorithm::ClusterMopUp(), and lar_content::BoundedClusterMopUpAlgorithm::ClusterMopUp().

105 {
106  ClusterVector sortedRemnantClusters;
107  for (const auto &remnantMapEntry : clusterAssociationMap)
108  sortedRemnantClusters.push_back(remnantMapEntry.first);
109  std::sort(sortedRemnantClusters.begin(), sortedRemnantClusters.end(), LArClusterHelper::SortByNHits);
110 
111  for (const Cluster *const pRemnantCluster : sortedRemnantClusters)
112  {
113  const AssociationDetails &associationDetails(clusterAssociationMap.at(pRemnantCluster));
114  const Cluster *pBestPfoCluster(nullptr);
115  float bestFigureOfMerit(-std::numeric_limits<float>::max());
116 
117  ClusterVector sortedPfoClusters;
118  for (const auto &pfoMapEntry : associationDetails)
119  sortedPfoClusters.push_back(pfoMapEntry.first);
120  std::sort(sortedPfoClusters.begin(), sortedPfoClusters.end(), LArClusterHelper::SortByNHits);
121 
122  for (const Cluster *const pPfoCluster : sortedPfoClusters)
123  {
124  const float figureOfMerit(associationDetails.at(pPfoCluster));
125 
126  if (figureOfMerit > bestFigureOfMerit)
127  {
128  pBestPfoCluster = pPfoCluster;
129  bestFigureOfMerit = figureOfMerit;
130  }
131  }
132 
133  if (!pBestPfoCluster)
134  continue;
135 
136  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
137  PandoraContentApi::MergeAndDeleteClusters(
138  *this, pBestPfoCluster, pRemnantCluster, this->GetListName(pBestPfoCluster), this->GetListName(pRemnantCluster)));
139  }
140 }
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
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 144 of file ClusterMopUpBaseAlgorithm.cc.

References m_excludePfosContainingTracks, m_pfoListNames, and lar_content::MopUpBaseAlgorithm::ReadSettings().

Referenced by lar_content::NearbyClusterMopUpAlgorithm::ReadSettings(), lar_content::ConeClusterMopUpAlgorithm::ReadSettings(), lar_content::IsolatedClusterMopUpAlgorithm::ReadSettings(), and lar_content::BoundedClusterMopUpAlgorithm::ReadSettings().

145 {
146  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "PfoListNames", m_pfoListNames));
147 
148  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
149  XmlHelper::ReadValue(xmlHandle, "ExcludePfosContainingTracks", m_excludePfosContainingTracks));
150 
151  return MopUpBaseAlgorithm::ReadSettings(xmlHandle);
152 }
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 28 of file ClusterMopUpBaseAlgorithm.cc.

References ClusterMopUp(), GetDaughterClusterLists(), and GetPfoClusterLists().

29 {
30  ClusterList pfoClusterListU, pfoClusterListV, pfoClusterListW;
31  this->GetPfoClusterLists(pfoClusterListU, pfoClusterListV, pfoClusterListW);
32 
33  ClusterList daughterClusterListU, daughterClusterListV, daughterClusterListW;
34  this->GetDaughterClusterLists(daughterClusterListU, daughterClusterListV, daughterClusterListW);
35 
36  this->ClusterMopUp(pfoClusterListU, daughterClusterListU);
37  this->ClusterMopUp(pfoClusterListV, daughterClusterListV);
38  this->ClusterMopUp(pfoClusterListW, daughterClusterListW);
39 
40  return STATUS_CODE_SUCCESS;
41 }
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

pandora::StringVector lar_content::MopUpBaseAlgorithm::m_daughterListNames
protectedinherited
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.

Referenced by GetPfoClusterLists(), lar_content::IsolatedClusterMopUpAlgorithm::IsolatedClusterMopUpAlgorithm(), and ReadSettings().

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

The list of pfo list names.

Definition at line 83 of file ClusterMopUpBaseAlgorithm.h.

Referenced by GetPfoClusterLists(), and ReadSettings().


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