9 #include "Pandora/AlgorithmHeaders.h" 18 ListPruningAlgorithm::ListPruningAlgorithm() : m_warnIfObjectsUnavailable(true)
30 const PfoList *pPfoList(
nullptr);
31 const StatusCode statusCode(PandoraContentApi::GetList(*
this, listName, pPfoList));
33 if (STATUS_CODE_SUCCESS != statusCode)
34 throw StatusCodeException(statusCode);
36 const PfoList pfoList(*pPfoList);
38 for (
const ParticleFlowObject *
const pPfo : pfoList)
40 if (STATUS_CODE_SUCCESS != PandoraContentApi::Delete(*
this, pPfo, listName))
41 std::cout <<
"ListPruningAlgorithm: Could not delete Pfo." <<
std::endl;
44 catch (StatusCodeException &)
46 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
47 std::cout <<
"ListPruningAlgorithm: pfo list " << listName <<
" unavailable." <<
std::endl;
55 const ClusterList *pClusterList(
nullptr);
56 const StatusCode statusCode(PandoraContentApi::GetList(*
this, listName, pClusterList));
58 if (STATUS_CODE_SUCCESS != statusCode)
59 throw StatusCodeException(statusCode);
61 const ClusterList clusterList(*pClusterList);
63 for (
const Cluster *
const pCluster : clusterList)
69 std::cout <<
"ListPruningAlgorithm: Could not delete Cluster." <<
std::endl;
72 catch (StatusCodeException &)
74 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
75 std::cout <<
"ListPruningAlgorithm: cluster list " << listName <<
" unavailable." <<
std::endl;
84 const StatusCode statusCode(PandoraContentApi::GetList(*
this, listName, pVertexList));
86 if (STATUS_CODE_SUCCESS != statusCode)
87 throw StatusCodeException(statusCode);
91 for (
const Vertex *
const pVertex : vertexList)
97 std::cout <<
"ListPruningAlgorithm: Could not delete Vertex." <<
std::endl;
100 catch (StatusCodeException &)
102 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
103 std::cout <<
"ListPruningAlgorithm: vertex list " << listName <<
" unavailable." <<
std::endl;
107 return STATUS_CODE_SUCCESS;
114 PANDORA_RETURN_RESULT_IF_AND_IF(
115 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"PfoListNames",
m_pfoListNames));
117 PANDORA_RETURN_RESULT_IF_AND_IF(
118 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"ClusterListNames",
m_clusterListNames));
120 PANDORA_RETURN_RESULT_IF_AND_IF(
121 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"VertexListNames",
m_vertexListNames));
123 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
126 return STATUS_CODE_SUCCESS;
pandora::StringVector m_clusterListNames
The cluster list names.
pandora::StringVector m_pfoListNames
The pfo list names.
Header file for the list pruning algorithm class.
pandora::StatusCode Run()
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
bool m_warnIfObjectsUnavailable
Whether to print warning if attempt made to delete unavailable objects.
std::list< Vertex > VertexList
pandora::StringVector m_vertexListNames
The vertex list names.
QTextStream & endl(QTextStream &s)