LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 343 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 344 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 202 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().

204 {
205  const HitType vertexHitType(LArClusterHelper::GetClusterHitType(pVertexCluster));
206  const CartesianVector vertexPosition2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), vertexHitType));
207 
208  const ConeParameters coneParameters(pVertexCluster, vertexPosition2D, m_coneAngleCentile, m_maxConeCosHalfAngle);
209  const float boundedFraction(coneParameters.GetBoundedFraction(pDaughterCluster, m_maxConeLengthMultiplier));
210 
211  const LArVertexHelper::ClusterDirection vertexClusterDirection(LArVertexHelper::GetClusterDirectionInZ(this->GetPandora(), pVertex,
212  pVertexCluster, m_directionTanAngle, m_directionApexShift));
213  const LArVertexHelper::ClusterDirection daughterClusterDirection(LArVertexHelper::GetClusterDirectionInZ(this->GetPandora(), pVertex,
214  pDaughterCluster, m_directionTanAngle, m_directionApexShift));
215  const bool isConsistentDirection(vertexClusterDirection == daughterClusterDirection);
216 
217  return ClusterAssociation(pVertexCluster, pDaughterCluster, boundedFraction, isConsistentDirection);
218 }
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.
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 99 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().

100 {
101  StringVector listNames;
102  listNames.push_back(m_trackPfoListName);
103  listNames.push_back(m_showerPfoListName);
104 
105  for (const std::string &listName : listNames)
106  {
107  const PfoList *pPfoList(nullptr);
108 
109  if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*this, listName, pPfoList))
110  continue;
111 
112  for (const Pfo *const pPfo : *pPfoList)
113  {
114  PfoList &pfoTargetList(this->IsVertexAssociated(pPfo, pVertex) ? vertexPfos : nonVertexPfos);
115  pfoTargetList.push_back(pPfo);
116  }
117  }
118 }
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 60 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().

61 {
62  unsigned int mostHits(0);
63  const Cluster *pBestParentCluster(nullptr);
64 
65  for (const Cluster *const pParentCluster : clusterList)
66  {
67  if (hitType != LArClusterHelper::GetClusterHitType(pParentCluster))
68  continue;
69 
70  const unsigned int nParentHits(pParentCluster->GetNCaloHits());
71 
72  if (nParentHits > mostHits)
73  {
74  mostHits = nParentHits;
75  pBestParentCluster = pParentCluster;
76  }
77  }
78 
79  return pBestParentCluster;
80 }
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 50 of file ShowerPfoMopUpAlgorithm.cc.

52 {
53  return PfoAssociation(pVertexPfo, pDaughterPfo, hitTypeToAssociationMap[TPC_VIEW_U], hitTypeToAssociationMap[TPC_VIEW_V], hitTypeToAssociationMap[TPC_VIEW_W]);
54 }
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 154 of file VertexBasedPfoMopUpAlgorithm.cc.

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

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

156 {
157  for (const Pfo *const pVertexPfo : vertexPfos)
158  {
159  for (const Pfo *const pDaughterPfo : nonVertexPfos)
160  {
161  try
162  {
163  const PfoAssociation pfoAssociation(this->GetPfoAssociation(pVertex, pVertexPfo, pDaughterPfo));
164  pfoAssociationList.push_back(pfoAssociation);
165  }
166  catch (StatusCodeException &) {}
167  }
168  }
169 }
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) ||
46 }
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, !=, PandoraContentApi::MergeAndDeleteClusters(*this, pParentCluster, pDaughterCluster,
49  this->GetListName(pParentCluster), this->GetListName(pDaughterCluster)));
50  }
51  else
52  {
53  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo(*this, pPfoToEnlarge, pDaughterCluster));
54  }
55  }
56 }
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::Cluster > > ClusterVector
std::vector< art::Ptr< recob::Vertex > > VertexVector
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 262 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().

263 {
264  const PfoList *pTrackPfoList(nullptr), *pShowerPfoList(nullptr);
265  (void) PandoraContentApi::GetList(*this, m_trackPfoListName, pTrackPfoList);
266  (void) PandoraContentApi::GetList(*this, m_showerPfoListName, pShowerPfoList);
267 
268  if (!pTrackPfoList && !pShowerPfoList)
269  throw StatusCodeException(STATUS_CODE_FAILURE);
270 
271  const Pfo *const pVertexPfo(pfoAssociation.GetVertexPfo());
272  const bool isvertexTrack(pTrackPfoList && (pTrackPfoList->end() != std::find(pTrackPfoList->begin(), pTrackPfoList->end(), pVertexPfo)));
273  const Pfo *pDaughterPfo(pfoAssociation.GetDaughterPfo());
274  const bool isDaughterShower(pShowerPfoList && (pShowerPfoList->end() != std::find(pShowerPfoList->begin(), pShowerPfoList->end(), pDaughterPfo)));
275 
276  this->MergeAndDeletePfos(pVertexPfo, pDaughterPfo);
277 
278  if (isvertexTrack && isDaughterShower)
279  {
280  const PfoList vertexPfoList(1, pVertexPfo);
281 
282  PandoraContentApi::ParticleFlowObject::Metadata metadata;
283  metadata.m_particleId = E_MINUS;
284  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*this, pVertexPfo, metadata));
285 
286  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, m_trackPfoListName, m_showerPfoListName, vertexPfoList));
287  }
288 }
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 222 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().

223 {
224  const PfoList *pTrackPfoList(nullptr);
225  (void) PandoraContentApi::GetList(*this, m_trackPfoListName, pTrackPfoList);
226 
227  for (const PfoAssociation &pfoAssociation : pfoAssociationList)
228  {
229  if ((pfoAssociation.GetMeanBoundedFraction() < m_meanBoundedFractionCut) ||
230  (pfoAssociation.GetMaxBoundedFraction() < m_maxBoundedFractionCut) ||
231  (pfoAssociation.GetMinBoundedFraction() < m_minBoundedFractionCut) ||
232  (pfoAssociation.GetNConsistentDirections() < m_minConsistentDirections))
233  {
234  continue;
235  }
236 
237  if (pTrackPfoList)
238  {
239  if ((pTrackPfoList->end() != std::find(pTrackPfoList->begin(), pTrackPfoList->end(), pfoAssociation.GetVertexPfo())) &&
240  (pTrackPfoList->end() != std::find(pTrackPfoList->begin(), pTrackPfoList->end(), pfoAssociation.GetDaughterPfo())))
241  {
242  continue;
243  }
244 
245  if (((pTrackPfoList->end() != std::find(pTrackPfoList->begin(), pTrackPfoList->end(), pfoAssociation.GetVertexPfo())) ||
246  (pTrackPfoList->end() != std::find(pTrackPfoList->begin(), pTrackPfoList->end(), pfoAssociation.GetDaughterPfo()))) &&
247  (pfoAssociation.GetNConsistentDirections() < m_minConsistentDirectionsTrack))
248  {
249  continue;
250  }
251  }
252 
253  this->MergePfos(pfoAssociation);
254  return true;
255  }
256 
257  return false;
258 }
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 58 of file ShowerPfoMopUpAlgorithm.cc.

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

59 {
60  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
61  "MaxVertexLongitudinalDistance", m_maxVertexLongitudinalDistance));
62 
63  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
64  "VertexAngularAllowance", m_vertexAngularAllowance));
65 
67 }
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((pVertexList && (pVertexList->size() == 1) && (VERTEX_3D == (*(pVertexList->begin()))->GetVertexType())) ? *(pVertexList->begin()) : nullptr);
51 
52  if (!pSelectedVertex)
53  {
54  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
55  std::cout << "VertexBasedPfoMopUp: unable to find vertex in current list " << std::endl;
56 
57  return STATUS_CODE_SUCCESS;
58  }
59 
60  while (true)
61  {
62  PfoList vertexPfos, nonVertexPfos;
63  this->GetInputPfos(pSelectedVertex, vertexPfos, nonVertexPfos);
64 
65  PfoAssociationList pfoAssociationList;
66  this->GetPfoAssociations(pSelectedVertex, vertexPfos, nonVertexPfos, pfoAssociationList);
67 
68  std::sort(pfoAssociationList.begin(), pfoAssociationList.end());
69  const bool pfoMergeMade(this->ProcessPfoAssociations(pfoAssociationList));
70 
71  if (!pfoMergeMade)
72  break;
73  }
74 
75  return STATUS_CODE_SUCCESS;
76 }
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...
std::list< Vertex > VertexList
Definition: DCEL.h:178

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 353 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 358 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 357 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 361 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 355 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 32 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 360 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 362 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 364 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 365 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 351 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 349 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 33 of file ShowerPfoMopUpAlgorithm.h.

Referenced by IsVertexAssociated(), and ReadSettings().


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