Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
lar_content::PfoMopUpBaseAlgorithm Class Reference

PfoMopUpBaseAlgorithm class. More...

#include <PfoMopUpBaseAlgorithm.h>

Inheritance diagram for lar_content::PfoMopUpBaseAlgorithm:
lar_content::MopUpBaseAlgorithm lar_content::ShowerHierarchyMopUpAlgorithm lar_content::SlidingConeClusterMopUpAlgorithm lar_content::SlidingConePfoMopUpAlgorithm lar_content::VertexBasedPfoMopUpAlgorithm lar_content::ShowerPfoMopUpAlgorithm

Public Member Functions

virtual void MergeAndDeletePfos (const pandora::ParticleFlowObject *const pPfoToEnlarge, const pandora::ParticleFlowObject *const pPfoToDelete) const
 Merge and delete a pair of pfos, with a specific set of conventions for cluster merging, vertex use, etc. 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...
 

Static Public Member Functions

static const pandora::Cluster * GetParentCluster (const pandora::ClusterList &clusterList, const pandora::HitType hitType)
 Select the parent cluster (same hit type and most hits) using a provided cluster list and hit type. More...
 

Protected Member Functions

virtual pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Additional Inherited Members

- Protected Attributes inherited from lar_content::MopUpBaseAlgorithm
pandora::StringVector m_daughterListNames
 The list of potential daughter object list names. More...
 

Detailed Description

PfoMopUpBaseAlgorithm class.

Definition at line 19 of file PfoMopUpBaseAlgorithm.h.

Member Function Documentation

const Cluster * lar_content::PfoMopUpBaseAlgorithm::GetParentCluster ( const pandora::ClusterList &  clusterList,
const pandora::HitType  hitType 
)
static

Select the parent cluster (same hit type and most hits) using a provided cluster list and hit type.

Parameters
clusterListthe cluster list
hitTypethe hit type
Returns
the address of the parent cluster

Definition at line 61 of file PfoMopUpBaseAlgorithm.cc.

62 {
63  unsigned int mostHits(0);
64  const Cluster *pBestParentCluster(nullptr);
65 
66  for (const Cluster *const pParentCluster : clusterList)
67  {
68  if (hitType != LArClusterHelper::GetClusterHitType(pParentCluster))
69  continue;
70 
71  const unsigned int nParentHits(pParentCluster->GetNCaloHits());
72 
73  if (nParentHits > mostHits)
74  {
75  mostHits = nParentHits;
76  pBestParentCluster = pParentCluster;
77  }
78  }
79 
80  return pBestParentCluster;
81 }
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
void lar_content::PfoMopUpBaseAlgorithm::MergeAndDeletePfos ( const pandora::ParticleFlowObject *const  pPfoToEnlarge,
const pandora::ParticleFlowObject *const  pPfoToDelete 
) const
virtual

Merge and delete a pair of pfos, with a specific set of conventions for cluster merging, vertex use, etc.

Parameters
pPfoToEnlargethe address of the pfo to enlarge
pPfoToDeletethe address of the pfo to delete (will become a dangling pointer)

Definition at line 20 of file PfoMopUpBaseAlgorithm.cc.

21 {
22  if (pPfoToEnlarge == pPfoToDelete)
23  throw StatusCodeException(STATUS_CODE_NOT_ALLOWED);
24 
25  const PfoList daughterPfos(pPfoToDelete->GetDaughterPfoList());
26  const ClusterVector daughterClusters(pPfoToDelete->GetClusterList().begin(), pPfoToDelete->GetClusterList().end());
27  const VertexVector daughterVertices(pPfoToDelete->GetVertexList().begin(), pPfoToDelete->GetVertexList().end());
28 
29  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete(*this, pPfoToDelete, this->GetListName(pPfoToDelete)));
30 
31  for (const ParticleFlowObject *const pDaughterPfo : daughterPfos)
32  {
33  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*this, pPfoToEnlarge, pDaughterPfo));
34  }
35 
36  for (const Vertex *const pDaughterVertex : daughterVertices)
37  {
38  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete(*this, pDaughterVertex, this->GetListName(pDaughterVertex)));
39  }
40 
41  for (const Cluster *const pDaughterCluster : daughterClusters)
42  {
43  const HitType daughterHitType(LArClusterHelper::GetClusterHitType(pDaughterCluster));
44  const Cluster *pParentCluster(PfoMopUpBaseAlgorithm::GetParentCluster(pPfoToEnlarge->GetClusterList(), daughterHitType));
45 
46  if (pParentCluster)
47  {
48  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
49  PandoraContentApi::MergeAndDeleteClusters(
50  *this, pParentCluster, pDaughterCluster, this->GetListName(pParentCluster), this->GetListName(pDaughterCluster)));
51  }
52  else
53  {
54  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo(*this, pPfoToEnlarge, pDaughterCluster));
55  }
56  }
57 }
enum cvn::HType HitType
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
const std::string GetListName(const T *const pT) const
Find the name of the list hosting a specific object.
static const pandora::Cluster * GetParentCluster(const pandora::ClusterList &clusterList, const pandora::HitType hitType)
Select the parent cluster (same hit type and most hits) using a provided cluster list and hit type...
std::vector< art::Ptr< recob::Vertex > > VertexVector
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::vector< art::Ptr< recob::Cluster > > ClusterVector
StatusCode lar_content::PfoMopUpBaseAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedvirtual

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