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

NearbyClusterMopUpAlgorithm class. More...

#include <NearbyClusterMopUpAlgorithm.h>

Inheritance diagram for lar_content::NearbyClusterMopUpAlgorithm:
lar_content::ClusterMopUpBaseAlgorithm lar_content::MopUpBaseAlgorithm

Public Member Functions

 NearbyClusterMopUpAlgorithm ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::ClusterMopUpBaseAlgorithm
 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...
 

Private Member Functions

void ClusterMopUp (const pandora::ClusterList &pfoClusters, const pandora::ClusterList &remnantClusters) const
 Cluster mop up for a single view. This function is responsible for instructing pandora to make cluster alterations. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

unsigned int m_minHitsInCluster
 Minimum number of hits in order to consider a cluster. More...
 
float m_vertexProximity
 Distance between cluster inner/outer centroid and vtx to declare cluster vtx associated. More...
 
float m_minClusterSeparation
 Minimum distance between parent and daughter clusters to declare clusters associated. More...
 
float m_touchingDistance
 Threshold (small) distance below which parent and daughter clusters are declated touching. More...
 

Additional Inherited Members

- Protected Types inherited from lar_content::ClusterMopUpBaseAlgorithm
typedef std::unordered_map
< const pandora::Cluster
*, float > 
AssociationDetails
 
typedef std::unordered_map
< const pandora::Cluster
*, AssociationDetails
ClusterAssociationMap
 
- Protected Member Functions inherited from lar_content::ClusterMopUpBaseAlgorithm
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 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...
 
- Protected Attributes inherited from lar_content::ClusterMopUpBaseAlgorithm
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

NearbyClusterMopUpAlgorithm class.

Definition at line 22 of file NearbyClusterMopUpAlgorithm.h.

Constructor & Destructor Documentation

lar_content::NearbyClusterMopUpAlgorithm::NearbyClusterMopUpAlgorithm ( )

Default constructor.

Definition at line 21 of file NearbyClusterMopUpAlgorithm.cc.

21  :
23  m_vertexProximity(5.f),
25  m_touchingDistance(0.001f)
26 {
27 }
float m_vertexProximity
Distance between cluster inner/outer centroid and vtx to declare cluster vtx associated.
unsigned int m_minHitsInCluster
Minimum number of hits in order to consider a cluster.
float m_touchingDistance
Threshold (small) distance below which parent and daughter clusters are declated touching.
float m_minClusterSeparation
Minimum distance between parent and daughter clusters to declare clusters associated.

Member Function Documentation

void lar_content::NearbyClusterMopUpAlgorithm::ClusterMopUp ( const pandora::ClusterList &  pfoClusters,
const pandora::ClusterList &  remnantClusters 
) const
privatevirtual

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

Implements lar_content::ClusterMopUpBaseAlgorithm.

Definition at line 31 of file NearbyClusterMopUpAlgorithm.cc.

32 {
33  ClusterAssociationMap clusterAssociationMap;
34 
35  const VertexList *pVertexList(NULL);
36  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pVertexList));
37  const Vertex *const pVertex(
38  ((pVertexList->size() == 1) && (VERTEX_3D == (*(pVertexList->begin()))->GetVertexType())) ? *(pVertexList->begin()) : NULL);
39 
40  ClusterVector sortedPfoClusters(pfoClusters.begin(), pfoClusters.end());
41  std::sort(sortedPfoClusters.begin(), sortedPfoClusters.end(), LArClusterHelper::SortByNHits);
42 
43  ClusterVector sortedRemnantClusters(remnantClusters.begin(), remnantClusters.end());
44  std::sort(sortedRemnantClusters.begin(), sortedRemnantClusters.end(), LArClusterHelper::SortByNHits);
45 
46  for (const Cluster *const pClusterP : sortedPfoClusters)
47  {
48  const HitType hitType(LArClusterHelper::GetClusterHitType(pClusterP));
49  const CartesianVector vertexPosition2D(
50  !pVertex ? CartesianVector(0.f, 0.f, 0.f) : LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), hitType));
51 
52  const float innerPV((vertexPosition2D - pClusterP->GetCentroid(pClusterP->GetInnerPseudoLayer())).GetMagnitude());
53  const float outerPV((vertexPosition2D - pClusterP->GetCentroid(pClusterP->GetOuterPseudoLayer())).GetMagnitude());
54 
55  for (const Cluster *const pClusterR : sortedRemnantClusters)
56  {
57  if (pClusterR->GetNCaloHits() < m_minHitsInCluster)
58  continue;
59 
60  const float innerRV((vertexPosition2D - pClusterR->GetCentroid(pClusterR->GetInnerPseudoLayer())).GetMagnitude());
61  const float outerRV((vertexPosition2D - pClusterR->GetCentroid(pClusterR->GetOuterPseudoLayer())).GetMagnitude());
62 
63  // ATTN Could use pointing clusters here, for consistency with other vertex association mechanics
64  if (pVertex && (((innerPV < m_vertexProximity) || (outerPV < m_vertexProximity)) &&
65  ((innerRV < m_vertexProximity) || (outerRV < m_vertexProximity))))
66  continue;
67 
68  const float innerRP(LArClusterHelper::GetClosestDistance(pClusterR->GetCentroid(pClusterR->GetInnerPseudoLayer()), pClusterP));
69  const float outerRP(LArClusterHelper::GetClosestDistance(pClusterR->GetCentroid(pClusterR->GetOuterPseudoLayer()), pClusterP));
70 
71  const float minSeparation(std::min(innerRP, outerRP));
72 
73  if (minSeparation > m_minClusterSeparation)
74  continue;
75 
76  // ATTN Use of ClusterMopUp base algorithm assumes bigger figure of merit means better association
77  if (m_touchingDistance < std::numeric_limits<float>::epsilon())
78  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
79 
80  AssociationDetails &associationDetails(clusterAssociationMap[pClusterR]);
81  const float figureOfMerit((minSeparation < m_touchingDistance) ? 1.f / m_touchingDistance : 1.f / minSeparation);
82 
83  if (!associationDetails.insert(AssociationDetails::value_type(pClusterP, figureOfMerit)).second)
84  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
85  }
86  }
87 
88  this->MakeClusterMerges(clusterAssociationMap);
89 }
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.
virtual void MakeClusterMerges(const ClusterAssociationMap &clusterAssociationMap) const
Make the cluster merges specified in the cluster association map, using list name information in the ...
float m_vertexProximity
Distance between cluster inner/outer centroid and vtx to declare cluster vtx associated.
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
std::unordered_map< const pandora::Cluster *, AssociationDetails > ClusterAssociationMap
unsigned int m_minHitsInCluster
Minimum number of hits in order to consider a cluster.
float m_touchingDistance
Threshold (small) distance below which parent and daughter clusters are declated touching.
float m_minClusterSeparation
Minimum distance between parent and daughter clusters to declare clusters associated.
std::unordered_map< const pandora::Cluster *, float > AssociationDetails
std::vector< art::Ptr< recob::Cluster > > ClusterVector
std::list< Vertex > VertexList
Definition: DCEL.h:182
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.
StatusCode lar_content::NearbyClusterMopUpAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::ClusterMopUpBaseAlgorithm.

Definition at line 93 of file NearbyClusterMopUpAlgorithm.cc.

94 {
95  PANDORA_RETURN_RESULT_IF_AND_IF(
96  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinHitsInCluster", m_minHitsInCluster));
97 
98  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VertexProximity", m_vertexProximity));
99 
100  PANDORA_RETURN_RESULT_IF_AND_IF(
101  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterSeparation", m_minClusterSeparation));
102 
103  PANDORA_RETURN_RESULT_IF_AND_IF(
104  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "TouchingDistance", m_touchingDistance));
105 
106  return ClusterMopUpBaseAlgorithm::ReadSettings(xmlHandle);
107 }
float m_vertexProximity
Distance between cluster inner/outer centroid and vtx to declare cluster vtx associated.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_minHitsInCluster
Minimum number of hits in order to consider a cluster.
float m_touchingDistance
Threshold (small) distance below which parent and daughter clusters are declated touching.
float m_minClusterSeparation
Minimum distance between parent and daughter clusters to declare clusters associated.

Member Data Documentation

float lar_content::NearbyClusterMopUpAlgorithm::m_minClusterSeparation
private

Minimum distance between parent and daughter clusters to declare clusters associated.

Definition at line 37 of file NearbyClusterMopUpAlgorithm.h.

unsigned int lar_content::NearbyClusterMopUpAlgorithm::m_minHitsInCluster
private

Minimum number of hits in order to consider a cluster.

Definition at line 35 of file NearbyClusterMopUpAlgorithm.h.

float lar_content::NearbyClusterMopUpAlgorithm::m_touchingDistance
private

Threshold (small) distance below which parent and daughter clusters are declated touching.

Definition at line 38 of file NearbyClusterMopUpAlgorithm.h.

float lar_content::NearbyClusterMopUpAlgorithm::m_vertexProximity
private

Distance between cluster inner/outer centroid and vtx to declare cluster vtx associated.

Definition at line 36 of file NearbyClusterMopUpAlgorithm.h.


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