9 #include "Pandora/AlgorithmHeaders.h" 20 void PfoMopUpBaseAlgorithm::MergeAndDeletePfos(
const ParticleFlowObject *
const pPfoToEnlarge,
const ParticleFlowObject *
const pPfoToDelete)
const 22 if (pPfoToEnlarge == pPfoToDelete)
23 throw StatusCodeException(STATUS_CODE_NOT_ALLOWED);
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());
29 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete(*
this, pPfoToDelete, this->GetListName(pPfoToDelete)));
31 for (
const ParticleFlowObject *
const pDaughterPfo : daughterPfos)
33 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*
this, pPfoToEnlarge, pDaughterPfo));
36 for (
const Vertex *
const pDaughterVertex : daughterVertices)
38 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete(*
this, pDaughterVertex, this->GetListName(pDaughterVertex)));
41 for (
const Cluster *
const pDaughterCluster : daughterClusters)
43 const HitType daughterHitType(LArClusterHelper::GetClusterHitType(pDaughterCluster));
44 const Cluster *pParentCluster(PfoMopUpBaseAlgorithm::GetParentCluster(pPfoToEnlarge->GetClusterList(), daughterHitType));
48 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
49 PandoraContentApi::MergeAndDeleteClusters(
50 *
this, pParentCluster, pDaughterCluster, this->GetListName(pParentCluster), this->GetListName(pDaughterCluster)));
54 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo(*
this, pPfoToEnlarge, pDaughterCluster));
61 const Cluster *PfoMopUpBaseAlgorithm::GetParentCluster(
const ClusterList &clusterList,
const HitType hitType)
63 unsigned int mostHits(0);
64 const Cluster *pBestParentCluster(
nullptr);
66 for (
const Cluster *
const pParentCluster : clusterList)
68 if (hitType != LArClusterHelper::GetClusterHitType(pParentCluster))
71 const unsigned int nParentHits(pParentCluster->GetNCaloHits());
73 if (nParentHits > mostHits)
75 mostHits = nParentHits;
76 pBestParentCluster = pParentCluster;
80 return pBestParentCluster;
85 StatusCode PfoMopUpBaseAlgorithm::ReadSettings(
const TiXmlHandle xmlHandle)
87 return MopUpBaseAlgorithm::ReadSettings(xmlHandle);
Header file for the cluster helper class.
Header file for the pfo mop up algorithm base class.
std::vector< art::Ptr< recob::Vertex > > VertexVector
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
std::vector< art::Ptr< recob::Cluster > > ClusterVector