LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::ShowerPfoMopUpAlgorithm Class Reference

ShowerPfoMopUpAlgorithm::Algorithm class. More...

#include "ShowerPfoMopUpAlgorithm.h"

Inheritance diagram for lar_content::ShowerPfoMopUpAlgorithm:
lar_content::VertexBasedPfoMopUpAlgorithm lar_content::PfoMopUpBaseAlgorithm lar_content::MopUpBaseAlgorithm

Public Member Functions

 ShowerPfoMopUpAlgorithm ()
 Default constructor. More...
 
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...
 
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 Types

typedef std::vector< PfoAssociationPfoAssociationList
 
typedef std::map< pandora::HitType, ClusterAssociationHitTypeToAssociationMap
 
typedef std::set< pandora::HitType > HitTypeSet
 
typedef std::map< pandora::HitType, const pandora::Cluster * > HitTypeToClusterMap
 

Protected Member Functions

pandora::StatusCode Run ()
 
bool IsVertexAssociated (const pandora::Pfo *const pPfo, const pandora::Vertex *const pVertex) const
 Whether a specified pfo is associated with a specified vertex. More...
 
PfoAssociation GetPfoAssociation (const pandora::Vertex *const pVertex, const pandora::Pfo *const pVertexPfo, const pandora::Pfo *const pDaughterPfo) const
 Get pfo association details between a vertex-associated pfo and a non-vertex associated daughter candidate pfo. More...
 
void GetInputPfos (const pandora::Vertex *const pVertex, pandora::PfoList &vertexPfos, pandora::PfoList &nonVertexPfos) const
 Get the list of input pfos and divide them into vertex-associated and non-vertex-associated lists. More...
 
void GetPfoAssociations (const pandora::Vertex *const pVertex, const pandora::PfoList &vertexPfos, const pandora::PfoList &nonVertexPfos, PfoAssociationList &pfoAssociationList) const
 Get the list of associations between vertex-associated pfos and non-vertex-associated pfos. More...
 
ClusterAssociation GetClusterAssociation (const pandora::Vertex *const pVertex, const pandora::Cluster *const pVertexCluster, const pandora::Cluster *const pDaughterCluster) const
 Get cluster association details between a vertex-associated cluster and a non-vertex associated daughter candidate cluster. More...
 
bool ProcessPfoAssociations (const PfoAssociationList &pfoAssociationList) const
 Process the list of pfo associations, merging the best-matching pfo. More...
 
void MergePfos (const PfoAssociation &pfoAssociation) const
 Merge the vertex and daughter pfos (deleting daughter pfo, merging clusters, etc.) described in the specified pfoAssociation. More...
 

Protected Attributes

std::string m_trackPfoListName
 The input track pfo list name. More...
 
std::string m_showerPfoListName
 The input shower pfo list name. More...
 
float m_minVertexLongitudinalDistance
 Vertex association check: min longitudinal distance cut. More...
 
float m_maxVertexTransverseDistance
 Vertex association check: max transverse distance cut. More...
 
unsigned int m_minVertexAssociatedHitTypes
 The min number of vertex associated hit types for a vertex associated pfo. More...
 
float m_coneAngleCentile
 Cluster cone angle is defined using specified centile of distribution of hit half angles. More...
 
float m_maxConeCosHalfAngle
 Maximum value for cosine of cone half angle. More...
 
float m_maxConeLengthMultiplier
 Consider hits as bound if inside cone, with projected distance less than N times cone length. More...
 
float m_directionTanAngle
 Direction determination, look for vertex inside triangle with apex shifted along the cluster length. More...
 
float m_directionApexShift
 Direction determination, look for vertex inside triangle with apex shifted along the cluster length. More...
 
float m_meanBoundedFractionCut
 Cut on association info (mean bounded fraction) for determining pfo merges. More...
 
float m_maxBoundedFractionCut
 Cut on association info (max bounded fraction) for determining pfo merges. More...
 
float m_minBoundedFractionCut
 Cut on association info (min bounded fraction) for determining pfo merges. More...
 
unsigned int m_minConsistentDirections
 The minimum number of consistent cluster directions to allow a pfo merge. More...
 
unsigned int m_minConsistentDirectionsTrack
 The minimum number of consistent cluster directions to allow a merge involving a track pfo. More...
 
pandora::StringVector m_daughterListNames
 The list of potential daughter object list names. More...
 

Private Member Functions

bool IsVertexAssociated (const pandora::CartesianVector &vertex2D, const LArPointingCluster &pointingCluster) const
 Whether a specified pfo is associated with a specified vertex. More...
 
PfoAssociation GetPfoAssociation (const pandora::Pfo *const pVertexPfo, const pandora::Pfo *const pDaughterPfo, HitTypeToAssociationMap &hitTypeToAssociationMap) const
 Get pfo association details between a vertex-associated pfo and a non-vertex associated daughter candidate pfo. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

float m_maxVertexLongitudinalDistance
 Vertex association check: max longitudinal distance cut. More...
 
float m_vertexAngularAllowance
 Vertex association check: pointing angular allowance in degrees. More...
 

Detailed Description

ShowerPfoMopUpAlgorithm::Algorithm class.

Definition at line 19 of file ShowerPfoMopUpAlgorithm.h.

Member Typedef Documentation

typedef std::set<pandora::HitType> lar_content::VertexBasedPfoMopUpAlgorithm::HitTypeSet
protectedinherited

Definition at line 344 of file VertexBasedPfoMopUpAlgorithm.h.

typedef std::map<pandora::HitType, ClusterAssociation> lar_content::VertexBasedPfoMopUpAlgorithm::HitTypeToAssociationMap
protectedinherited

Definition at line 258 of file VertexBasedPfoMopUpAlgorithm.h.

typedef std::map<pandora::HitType, const pandora::Cluster *> lar_content::VertexBasedPfoMopUpAlgorithm::HitTypeToClusterMap
protectedinherited

Definition at line 345 of file VertexBasedPfoMopUpAlgorithm.h.

Definition at line 186 of file VertexBasedPfoMopUpAlgorithm.h.

Constructor & Destructor Documentation

lar_content::ShowerPfoMopUpAlgorithm::ShowerPfoMopUpAlgorithm ( )

Default constructor.

Definition at line 24 of file ShowerPfoMopUpAlgorithm.cc.

References lar_content::VertexBasedPfoMopUpAlgorithm::m_maxBoundedFractionCut, lar_content::VertexBasedPfoMopUpAlgorithm::m_maxVertexTransverseDistance, lar_content::VertexBasedPfoMopUpAlgorithm::m_meanBoundedFractionCut, lar_content::VertexBasedPfoMopUpAlgorithm::m_minBoundedFractionCut, lar_content::VertexBasedPfoMopUpAlgorithm::m_minConsistentDirections, and lar_content::VertexBasedPfoMopUpAlgorithm::m_minConsistentDirectionsTrack.

24  :
28 {
29  // ATTN Some default values differ from base class
36 }
unsigned int m_minConsistentDirections
The minimum number of consistent cluster directions to allow a pfo merge.
float m_maxVertexLongitudinalDistance
Vertex association check: max longitudinal distance cut.
float m_maxVertexTransverseDistance
Vertex association check: max transverse distance cut.
float m_maxBoundedFractionCut
Cut on association info (max bounded fraction) for determining pfo merges.
TFile f
Definition: plotHisto.C:6
float m_meanBoundedFractionCut
Cut on association info (mean bounded fraction) for determining pfo merges.
unsigned int m_minConsistentDirectionsTrack
The minimum number of consistent cluster directions to allow a merge involving a track pfo...
float m_vertexAngularAllowance
Vertex association check: pointing angular allowance in degrees.
float m_minBoundedFractionCut
Cut on association info (min bounded fraction) for determining pfo merges.

Member Function Documentation

VertexBasedPfoMopUpAlgorithm::ClusterAssociation lar_content::VertexBasedPfoMopUpAlgorithm::GetClusterAssociation ( const pandora::Vertex *const  pVertex,
const pandora::Cluster *const  pVertexCluster,
const pandora::Cluster *const  pDaughterCluster 
) const
protectedinherited

Get cluster association details between a vertex-associated cluster and a non-vertex associated daughter candidate cluster.

Parameters
pVertexthe address of the vertex
pVertexClusterthe address of the vertex-associated cluster
pDaughterClusterthe address of the non-vertex-associated cluster
Returns
the cluster association details

Definition at line 208 of file VertexBasedPfoMopUpAlgorithm.cc.

References lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::GetBoundedFraction(), lar_content::LArVertexHelper::GetClusterDirectionInZ(), lar_content::LArClusterHelper::GetClusterHitType(), lar_content::VertexBasedPfoMopUpAlgorithm::m_coneAngleCentile, lar_content::VertexBasedPfoMopUpAlgorithm::m_directionApexShift, lar_content::VertexBasedPfoMopUpAlgorithm::m_directionTanAngle, lar_content::VertexBasedPfoMopUpAlgorithm::m_maxConeCosHalfAngle, lar_content::VertexBasedPfoMopUpAlgorithm::m_maxConeLengthMultiplier, and lar_content::LArGeometryHelper::ProjectPosition().

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::GetPfoAssociations().

210 {
211  const HitType vertexHitType(LArClusterHelper::GetClusterHitType(pVertexCluster));
212  const CartesianVector vertexPosition2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), vertexHitType));
213 
214  const ConeParameters coneParameters(pVertexCluster, vertexPosition2D, m_coneAngleCentile, m_maxConeCosHalfAngle);
215  const float boundedFraction(coneParameters.GetBoundedFraction(pDaughterCluster, m_maxConeLengthMultiplier));
216 
217  const LArVertexHelper::ClusterDirection vertexClusterDirection(
218  LArVertexHelper::GetClusterDirectionInZ(this->GetPandora(), pVertex, pVertexCluster, m_directionTanAngle, m_directionApexShift));
219  const LArVertexHelper::ClusterDirection daughterClusterDirection(
220  LArVertexHelper::GetClusterDirectionInZ(this->GetPandora(), pVertex, pDaughterCluster, m_directionTanAngle, m_directionApexShift));
221  const bool isConsistentDirection(vertexClusterDirection == daughterClusterDirection);
222 
223  return ClusterAssociation(pVertexCluster, pDaughterCluster, boundedFraction, isConsistentDirection);
224 }
float m_maxConeLengthMultiplier
Consider hits as bound if inside cone, with projected distance less than N times cone length...
float m_coneAngleCentile
Cluster cone angle is defined using specified centile of distribution of hit half angles...
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.
float m_directionApexShift
Direction determination, look for vertex inside triangle with apex shifted along the cluster length...
float m_directionTanAngle
Direction determination, look for vertex inside triangle with apex shifted along the cluster length...
float m_maxConeCosHalfAngle
Maximum value for cosine of cone half angle.
HitType
Definition: HitType.h:12
static ClusterDirection GetClusterDirectionInZ(const pandora::Pandora &pandora, const pandora::Vertex *const pVertex, const pandora::Cluster *const pCluster, const float tanAngle, const float apexShift)
Get the direction of the cluster in z, using a projection of the provided vertex. ...
void lar_content::VertexBasedPfoMopUpAlgorithm::GetInputPfos ( const pandora::Vertex *const  pVertex,
pandora::PfoList &  vertexPfos,
pandora::PfoList &  nonVertexPfos 
) const
protectedinherited

Get the list of input pfos and divide them into vertex-associated and non-vertex-associated lists.

Parameters
pVertexthe address of the 3d vertex
vertexPfosto receive the list of vertex-associated pfos
nonVertexPfosto receive the list of nonvertex-associated pfos

Definition at line 101 of file VertexBasedPfoMopUpAlgorithm.cc.

References lar_content::LArClusterHelper::GetClusterHitType(), lar_content::VertexBasedPfoMopUpAlgorithm::IsVertexAssociated(), lar_content::VertexBasedPfoMopUpAlgorithm::m_minVertexAssociatedHitTypes, lar_content::VertexBasedPfoMopUpAlgorithm::m_showerPfoListName, lar_content::VertexBasedPfoMopUpAlgorithm::m_trackPfoListName, and lar_content::LArGeometryHelper::ProjectPosition().

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::Run().

102 {
103  StringVector listNames;
104  listNames.push_back(m_trackPfoListName);
105  listNames.push_back(m_showerPfoListName);
106 
107  for (const std::string &listName : listNames)
108  {
109  const PfoList *pPfoList(nullptr);
110 
111  if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*this, listName, pPfoList))
112  continue;
113 
114  for (const Pfo *const pPfo : *pPfoList)
115  {
116  PfoList &pfoTargetList(this->IsVertexAssociated(pPfo, pVertex) ? vertexPfos : nonVertexPfos);
117  pfoTargetList.push_back(pPfo);
118  }
119  }
120 }
virtual bool IsVertexAssociated(const pandora::CartesianVector &vertex2D, const LArPointingCluster &pointingCluster) const
Whether a specified pfo is associated with a specified vertex.
std::string m_trackPfoListName
The input track pfo list name.
std::string m_showerPfoListName
The input shower pfo list name.
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(), lar_content::ClusterMopUpBaseAlgorithm::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.
const Cluster * lar_content::PfoMopUpBaseAlgorithm::GetParentCluster ( const pandora::ClusterList &  clusterList,
const pandora::HitType  hitType 
)
staticinherited

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.

Referenced by lar_content::SlidingConeClusterMopUpAlgorithm::MakeClusterMerges(), lar_content::SlidingConeClusterMopUpAlgorithm::ClusterMerge::operator<(), lar_content::SlidingConePfoMopUpAlgorithm::ClusterMerge::operator<(), and lar_content::MasterAlgorithm::StitchPfos().

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.
ShowerPfoMopUpAlgorithm::PfoAssociation lar_content::ShowerPfoMopUpAlgorithm::GetPfoAssociation ( const pandora::Pfo *const  pVertexPfo,
const pandora::Pfo *const  pDaughterPfo,
HitTypeToAssociationMap hitTypeToAssociationMap 
) const
privatevirtual

Get pfo association details between a vertex-associated pfo and a non-vertex associated daughter candidate pfo.

Parameters
pVertexPfothe address of the vertex-associated pfo
pDaughterPfothe address of the non-vertex-associated pfo
hitTypeToAssociationMapthe hit type to association map
Returns
the pfo association details

Reimplemented from lar_content::VertexBasedPfoMopUpAlgorithm.

Definition at line 52 of file ShowerPfoMopUpAlgorithm.cc.

54 {
55  return PfoAssociation(pVertexPfo, pDaughterPfo, hitTypeToAssociationMap[TPC_VIEW_U], hitTypeToAssociationMap[TPC_VIEW_V],
56  hitTypeToAssociationMap[TPC_VIEW_W]);
57 }
PfoAssociation lar_content::VertexBasedPfoMopUpAlgorithm::GetPfoAssociation ( const pandora::Vertex *const  pVertex,
const pandora::Pfo *const  pVertexPfo,
const pandora::Pfo *const  pDaughterPfo 
) const
protectedinherited

Get pfo association details between a vertex-associated pfo and a non-vertex associated daughter candidate pfo.

Parameters
pVertexthe address of the 3d vertex
pVertexPfothe address of the vertex-associated pfo
pDaughterPfothe address of the non-vertex-associated pfo
Returns
the pfo association details
void lar_content::VertexBasedPfoMopUpAlgorithm::GetPfoAssociations ( const pandora::Vertex *const  pVertex,
const pandora::PfoList &  vertexPfos,
const pandora::PfoList &  nonVertexPfos,
PfoAssociationList pfoAssociationList 
) const
protectedinherited

Get the list of associations between vertex-associated pfos and non-vertex-associated pfos.

Parameters
pVertexthe address of the 3d vertex
vertexPfosthe list of vertex-associated pfos
nonVertexPfosthe list of nonvertex-associated pfos
pfoAssociationListto receive the pfo association list

Definition at line 158 of file VertexBasedPfoMopUpAlgorithm.cc.

References lar_content::VertexBasedPfoMopUpAlgorithm::GetClusterAssociation(), lar_content::LArClusterHelper::GetClusterHitType(), and lar_content::VertexBasedPfoMopUpAlgorithm::GetPfoAssociation().

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::Run().

160 {
161  for (const Pfo *const pVertexPfo : vertexPfos)
162  {
163  for (const Pfo *const pDaughterPfo : nonVertexPfos)
164  {
165  try
166  {
167  const PfoAssociation pfoAssociation(this->GetPfoAssociation(pVertex, pVertexPfo, pDaughterPfo));
168  pfoAssociationList.push_back(pfoAssociation);
169  }
170  catch (StatusCodeException &)
171  {
172  }
173  }
174  }
175 }
virtual PfoAssociation GetPfoAssociation(const pandora::Pfo *const pVertexPfo, const pandora::Pfo *const pDaughterPfo, HitTypeToAssociationMap &hitTypeToAssociationMap) const
Get pfo association details between a vertex-associated pfo and a non-vertex associated daughter cand...
bool lar_content::ShowerPfoMopUpAlgorithm::IsVertexAssociated ( const pandora::CartesianVector &  vertex2D,
const LArPointingCluster pointingCluster 
) const
privatevirtual

Whether a specified pfo is associated with a specified vertex.

Parameters
vertex2Dthe 2d vertex position
pointingClusterthe pointing cluster
Returns
boolean

Reimplemented from lar_content::VertexBasedPfoMopUpAlgorithm.

Definition at line 40 of file ShowerPfoMopUpAlgorithm.cc.

References lar_content::LArPointingCluster::GetInnerVertex(), lar_content::LArPointingCluster::GetOuterVertex(), lar_content::LArPointingClusterHelper::IsEmission(), lar_content::LArPointingClusterHelper::IsNode(), m_maxVertexLongitudinalDistance, lar_content::VertexBasedPfoMopUpAlgorithm::m_maxVertexTransverseDistance, lar_content::VertexBasedPfoMopUpAlgorithm::m_minVertexLongitudinalDistance, and m_vertexAngularAllowance.

41 {
42  return (LArPointingClusterHelper::IsNode(vertex2D, pointingCluster.GetInnerVertex(), m_minVertexLongitudinalDistance, m_maxVertexTransverseDistance) ||
44  LArPointingClusterHelper::IsEmission(vertex2D, pointingCluster.GetInnerVertex(), m_minVertexLongitudinalDistance,
46  LArPointingClusterHelper::IsEmission(vertex2D, pointingCluster.GetOuterVertex(), m_minVertexLongitudinalDistance,
48 }
static bool IsEmission(const pandora::CartesianVector &parentVertex, const LArPointingCluster::Vertex &daughterVertex, const float minLongitudinalDistance, const float maxLongitudinalDistance, const float maxTransverseDistance, const float angularAllowance)
Whether pointing vertex is emitted from a given position.
float m_maxVertexLongitudinalDistance
Vertex association check: max longitudinal distance cut.
float m_maxVertexTransverseDistance
Vertex association check: max transverse distance cut.
float m_minVertexLongitudinalDistance
Vertex association check: min longitudinal distance cut.
float m_vertexAngularAllowance
Vertex association check: pointing angular allowance in degrees.
static bool IsNode(const pandora::CartesianVector &parentVertex, const LArPointingCluster::Vertex &daughterVertex, const float minLongitudinalDistance, const float maxTransverseDistance)
Whether pointing vertex is adjacent to a given position.
bool lar_content::VertexBasedPfoMopUpAlgorithm::IsVertexAssociated ( const pandora::Pfo *const  pPfo,
const pandora::Vertex *const  pVertex 
) const
protectedinherited

Whether a specified pfo is associated with a specified vertex.

Parameters
pPfothe address of the pfo
pVertexthe address of the 3d vertex
Returns
boolean
void lar_content::PfoMopUpBaseAlgorithm::MergeAndDeletePfos ( const pandora::ParticleFlowObject *const  pPfoToEnlarge,
const pandora::ParticleFlowObject *const  pPfoToDelete 
) const
virtualinherited

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.

Referenced by lar_content::SlidingConePfoMopUpAlgorithm::MakePfoMerges(), and lar_content::VertexBasedPfoMopUpAlgorithm::MergePfos().

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 }
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...
HitType
Definition: HitType.h:12
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
void lar_content::VertexBasedPfoMopUpAlgorithm::MergePfos ( const PfoAssociation pfoAssociation) const
protectedinherited

Merge the vertex and daughter pfos (deleting daughter pfo, merging clusters, etc.) described in the specified pfoAssociation.

Parameters
pfoAssociationthe pfo association details

Definition at line 267 of file VertexBasedPfoMopUpAlgorithm.cc.

References lar_content::VertexBasedPfoMopUpAlgorithm::PfoAssociation::GetDaughterPfo(), lar_content::VertexBasedPfoMopUpAlgorithm::PfoAssociation::GetVertexPfo(), lar_content::VertexBasedPfoMopUpAlgorithm::m_showerPfoListName, lar_content::VertexBasedPfoMopUpAlgorithm::m_trackPfoListName, and lar_content::PfoMopUpBaseAlgorithm::MergeAndDeletePfos().

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::ProcessPfoAssociations().

268 {
269  const PfoList *pTrackPfoList(nullptr), *pShowerPfoList(nullptr);
270  (void)PandoraContentApi::GetList(*this, m_trackPfoListName, pTrackPfoList);
271  (void)PandoraContentApi::GetList(*this, m_showerPfoListName, pShowerPfoList);
272 
273  if (!pTrackPfoList && !pShowerPfoList)
274  throw StatusCodeException(STATUS_CODE_FAILURE);
275 
276  const Pfo *const pVertexPfo(pfoAssociation.GetVertexPfo());
277  const bool isvertexTrack(pTrackPfoList && (pTrackPfoList->end() != std::find(pTrackPfoList->begin(), pTrackPfoList->end(), pVertexPfo)));
278  const Pfo *pDaughterPfo(pfoAssociation.GetDaughterPfo());
279  const bool isDaughterShower(pShowerPfoList && (pShowerPfoList->end() != std::find(pShowerPfoList->begin(), pShowerPfoList->end(), pDaughterPfo)));
280 
281  this->MergeAndDeletePfos(pVertexPfo, pDaughterPfo);
282 
283  if (isvertexTrack && isDaughterShower)
284  {
285  const PfoList vertexPfoList(1, pVertexPfo);
286 
287  PandoraContentApi::ParticleFlowObject::Metadata metadata;
288  metadata.m_particleId = E_MINUS;
289  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*this, pVertexPfo, metadata));
290 
291  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, m_trackPfoListName, m_showerPfoListName, vertexPfoList));
292  }
293 }
std::string m_trackPfoListName
The input track pfo list name.
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.
std::string m_showerPfoListName
The input shower pfo list name.
bool lar_content::VertexBasedPfoMopUpAlgorithm::ProcessPfoAssociations ( const PfoAssociationList pfoAssociationList) const
protectedinherited

Process the list of pfo associations, merging the best-matching pfo.

Parameters
pfoAssociationListthe pfo association list
Returns
whether a pfo merge was made

Definition at line 228 of file VertexBasedPfoMopUpAlgorithm.cc.

References lar_content::VertexBasedPfoMopUpAlgorithm::m_maxBoundedFractionCut, lar_content::VertexBasedPfoMopUpAlgorithm::m_meanBoundedFractionCut, lar_content::VertexBasedPfoMopUpAlgorithm::m_minBoundedFractionCut, lar_content::VertexBasedPfoMopUpAlgorithm::m_minConsistentDirections, lar_content::VertexBasedPfoMopUpAlgorithm::m_minConsistentDirectionsTrack, lar_content::VertexBasedPfoMopUpAlgorithm::m_trackPfoListName, and lar_content::VertexBasedPfoMopUpAlgorithm::MergePfos().

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::Run().

229 {
230  const PfoList *pTrackPfoList(nullptr);
231  (void)PandoraContentApi::GetList(*this, m_trackPfoListName, pTrackPfoList);
232 
233  for (const PfoAssociation &pfoAssociation : pfoAssociationList)
234  {
235  if ((pfoAssociation.GetMeanBoundedFraction() < m_meanBoundedFractionCut) ||
236  (pfoAssociation.GetMaxBoundedFraction() < m_maxBoundedFractionCut) || (pfoAssociation.GetMinBoundedFraction() < m_minBoundedFractionCut) ||
237  (pfoAssociation.GetNConsistentDirections() < m_minConsistentDirections))
238  {
239  continue;
240  }
241 
242  if (pTrackPfoList)
243  {
244  if ((pTrackPfoList->end() != std::find(pTrackPfoList->begin(), pTrackPfoList->end(), pfoAssociation.GetVertexPfo())) &&
245  (pTrackPfoList->end() != std::find(pTrackPfoList->begin(), pTrackPfoList->end(), pfoAssociation.GetDaughterPfo())))
246  {
247  continue;
248  }
249 
250  if (((pTrackPfoList->end() != std::find(pTrackPfoList->begin(), pTrackPfoList->end(), pfoAssociation.GetVertexPfo())) ||
251  (pTrackPfoList->end() != std::find(pTrackPfoList->begin(), pTrackPfoList->end(), pfoAssociation.GetDaughterPfo()))) &&
252  (pfoAssociation.GetNConsistentDirections() < m_minConsistentDirectionsTrack))
253  {
254  continue;
255  }
256  }
257 
258  this->MergePfos(pfoAssociation);
259  return true;
260  }
261 
262  return false;
263 }
unsigned int m_minConsistentDirections
The minimum number of consistent cluster directions to allow a pfo merge.
void MergePfos(const PfoAssociation &pfoAssociation) const
Merge the vertex and daughter pfos (deleting daughter pfo, merging clusters, etc.) described in the s...
float m_maxBoundedFractionCut
Cut on association info (max bounded fraction) for determining pfo merges.
float m_meanBoundedFractionCut
Cut on association info (mean bounded fraction) for determining pfo merges.
unsigned int m_minConsistentDirectionsTrack
The minimum number of consistent cluster directions to allow a merge involving a track pfo...
std::string m_trackPfoListName
The input track pfo list name.
float m_minBoundedFractionCut
Cut on association info (min bounded fraction) for determining pfo merges.
StatusCode lar_content::ShowerPfoMopUpAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::PfoMopUpBaseAlgorithm.

Definition at line 61 of file ShowerPfoMopUpAlgorithm.cc.

References m_maxVertexLongitudinalDistance, m_vertexAngularAllowance, and lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings().

62 {
63  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
64  XmlHelper::ReadValue(xmlHandle, "MaxVertexLongitudinalDistance", m_maxVertexLongitudinalDistance));
65 
66  PANDORA_RETURN_RESULT_IF_AND_IF(
67  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VertexAngularAllowance", m_vertexAngularAllowance));
68 
70 }
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_maxVertexLongitudinalDistance
Vertex association check: max longitudinal distance cut.
float m_vertexAngularAllowance
Vertex association check: pointing angular allowance in degrees.
StatusCode lar_content::VertexBasedPfoMopUpAlgorithm::Run ( )
protectedinherited

Definition at line 45 of file VertexBasedPfoMopUpAlgorithm.cc.

References lar_content::LArPointingCluster::GetInnerVertex(), lar_content::VertexBasedPfoMopUpAlgorithm::GetInputPfos(), lar_content::LArPointingCluster::GetOuterVertex(), lar_content::VertexBasedPfoMopUpAlgorithm::GetPfoAssociation(), lar_content::VertexBasedPfoMopUpAlgorithm::GetPfoAssociations(), lar_content::LArPointingClusterHelper::IsNode(), lar_content::VertexBasedPfoMopUpAlgorithm::IsVertexAssociated(), lar_content::VertexBasedPfoMopUpAlgorithm::m_maxVertexTransverseDistance, lar_content::VertexBasedPfoMopUpAlgorithm::m_minVertexLongitudinalDistance, and lar_content::VertexBasedPfoMopUpAlgorithm::ProcessPfoAssociations().

46 {
47  const VertexList *pVertexList = nullptr;
48  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetCurrentList(*this, pVertexList));
49 
50  const Vertex *const pSelectedVertex(
51  (pVertexList && (pVertexList->size() == 1) && (VERTEX_3D == (*(pVertexList->begin()))->GetVertexType())) ? *(pVertexList->begin()) : nullptr);
52 
53  if (!pSelectedVertex)
54  {
55  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
56  std::cout << "VertexBasedPfoMopUp: unable to find vertex in current list " << std::endl;
57 
58  return STATUS_CODE_SUCCESS;
59  }
60 
61  while (true)
62  {
63  PfoList vertexPfos, nonVertexPfos;
64  this->GetInputPfos(pSelectedVertex, vertexPfos, nonVertexPfos);
65 
66  PfoAssociationList pfoAssociationList;
67  this->GetPfoAssociations(pSelectedVertex, vertexPfos, nonVertexPfos, pfoAssociationList);
68 
69  std::sort(pfoAssociationList.begin(), pfoAssociationList.end());
70  const bool pfoMergeMade(this->ProcessPfoAssociations(pfoAssociationList));
71 
72  if (!pfoMergeMade)
73  break;
74  }
75 
76  return STATUS_CODE_SUCCESS;
77 }
void GetPfoAssociations(const pandora::Vertex *const pVertex, const pandora::PfoList &vertexPfos, const pandora::PfoList &nonVertexPfos, PfoAssociationList &pfoAssociationList) const
Get the list of associations between vertex-associated pfos and non-vertex-associated pfos...
bool ProcessPfoAssociations(const PfoAssociationList &pfoAssociationList) const
Process the list of pfo associations, merging the best-matching pfo.
void GetInputPfos(const pandora::Vertex *const pVertex, pandora::PfoList &vertexPfos, pandora::PfoList &nonVertexPfos) const
Get the list of input pfos and divide them into vertex-associated and non-vertex-associated lists...
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::list< Vertex > VertexList
Definition: DCEL.h:169

Member Data Documentation

float lar_content::VertexBasedPfoMopUpAlgorithm::m_coneAngleCentile
protectedinherited

Cluster cone angle is defined using specified centile of distribution of hit half angles.

Definition at line 354 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::GetClusterAssociation(), and lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings().

pandora::StringVector lar_content::MopUpBaseAlgorithm::m_daughterListNames
protectedinherited
float lar_content::VertexBasedPfoMopUpAlgorithm::m_directionApexShift
protectedinherited

Direction determination, look for vertex inside triangle with apex shifted along the cluster length.

Definition at line 359 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::GetClusterAssociation(), and lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings().

float lar_content::VertexBasedPfoMopUpAlgorithm::m_directionTanAngle
protectedinherited

Direction determination, look for vertex inside triangle with apex shifted along the cluster length.

Definition at line 358 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::GetClusterAssociation(), and lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings().

float lar_content::VertexBasedPfoMopUpAlgorithm::m_maxBoundedFractionCut
protectedinherited

Cut on association info (max bounded fraction) for determining pfo merges.

Definition at line 362 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::ProcessPfoAssociations(), lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings(), and ShowerPfoMopUpAlgorithm().

float lar_content::VertexBasedPfoMopUpAlgorithm::m_maxConeCosHalfAngle
protectedinherited
float lar_content::VertexBasedPfoMopUpAlgorithm::m_maxConeLengthMultiplier
protectedinherited

Consider hits as bound if inside cone, with projected distance less than N times cone length.

Definition at line 356 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::GetClusterAssociation(), and lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings().

float lar_content::ShowerPfoMopUpAlgorithm::m_maxVertexLongitudinalDistance
private

Vertex association check: max longitudinal distance cut.

Definition at line 33 of file ShowerPfoMopUpAlgorithm.h.

Referenced by IsVertexAssociated(), and ReadSettings().

float lar_content::VertexBasedPfoMopUpAlgorithm::m_maxVertexTransverseDistance
protectedinherited
float lar_content::VertexBasedPfoMopUpAlgorithm::m_meanBoundedFractionCut
protectedinherited

Cut on association info (mean bounded fraction) for determining pfo merges.

Definition at line 361 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::ProcessPfoAssociations(), lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings(), and ShowerPfoMopUpAlgorithm().

float lar_content::VertexBasedPfoMopUpAlgorithm::m_minBoundedFractionCut
protectedinherited

Cut on association info (min bounded fraction) for determining pfo merges.

Definition at line 363 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::ProcessPfoAssociations(), lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings(), and ShowerPfoMopUpAlgorithm().

unsigned int lar_content::VertexBasedPfoMopUpAlgorithm::m_minConsistentDirections
protectedinherited

The minimum number of consistent cluster directions to allow a pfo merge.

Definition at line 365 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::ProcessPfoAssociations(), lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings(), and ShowerPfoMopUpAlgorithm().

unsigned int lar_content::VertexBasedPfoMopUpAlgorithm::m_minConsistentDirectionsTrack
protectedinherited

The minimum number of consistent cluster directions to allow a merge involving a track pfo.

Definition at line 366 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::ProcessPfoAssociations(), lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings(), and ShowerPfoMopUpAlgorithm().

unsigned int lar_content::VertexBasedPfoMopUpAlgorithm::m_minVertexAssociatedHitTypes
protectedinherited

The min number of vertex associated hit types for a vertex associated pfo.

Definition at line 352 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::GetInputPfos(), and lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings().

float lar_content::VertexBasedPfoMopUpAlgorithm::m_minVertexLongitudinalDistance
protectedinherited

Vertex association check: min longitudinal distance cut.

Definition at line 350 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by IsVertexAssociated(), lar_content::VertexBasedPfoMopUpAlgorithm::ReadSettings(), and lar_content::VertexBasedPfoMopUpAlgorithm::Run().

std::string lar_content::VertexBasedPfoMopUpAlgorithm::m_showerPfoListName
protectedinherited
std::string lar_content::VertexBasedPfoMopUpAlgorithm::m_trackPfoListName
protectedinherited
float lar_content::ShowerPfoMopUpAlgorithm::m_vertexAngularAllowance
private

Vertex association check: pointing angular allowance in degrees.

Definition at line 34 of file ShowerPfoMopUpAlgorithm.h.

Referenced by IsVertexAssociated(), and ReadSettings().


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