ListDeletionAlgorithm.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArUtility/ListDeletionAlgorithm.cc
3  *
4  * @brief Implementation of the list deletion algorithm class.
5  *
6  * $Log: $
7  */
8 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
13 using namespace pandora;
14 
15 namespace lar_content
16 {
17 
18 StatusCode ListDeletionAlgorithm::Run()
19 {
20  for (const std::string &listName : m_pfoListNames)
21  {
22  const PfoList *pList(nullptr);
23  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, listName, pList));
24 
25  if (pList && !pList->empty())
26  {
27  const PfoList listCopy(*pList);
28  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete(*this, &listCopy, listName));
29  }
30  }
31 
32  for (const std::string &listName : m_clusterListNames)
33  {
34  const ClusterList *pList(nullptr);
35  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, listName, pList));
36 
37  if (pList && !pList->empty())
38  {
39  const ClusterList listCopy(*pList);
40  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete(*this, &listCopy, listName));
41  }
42  }
43 
44  for (const std::string &listName : m_vertexListNames)
45  {
46  const VertexList *pList(nullptr);
47  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, listName, pList));
48 
49  if (pList && !pList->empty())
50  {
51  const VertexList listCopy(*pList);
52  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete(*this, &listCopy, listName));
53  }
54  }
55 
56  return STATUS_CODE_SUCCESS;
57 }
58 
59 //------------------------------------------------------------------------------------------------------------------------------------------
60 
61 StatusCode ListDeletionAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
62 {
63  PANDORA_RETURN_RESULT_IF_AND_IF(
64  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "PfoListNames", m_pfoListNames));
65 
66  PANDORA_RETURN_RESULT_IF_AND_IF(
67  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "ClusterListNames", m_clusterListNames));
68 
69  PANDORA_RETURN_RESULT_IF_AND_IF(
70  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "VertexListNames", m_vertexListNames));
71 
72  return STATUS_CODE_SUCCESS;
73 }
74 
75 } // namespace lar_content
std::string string
Definition: nybbler.cc:12
std::list< Vertex > VertexList
Definition: DCEL.h:182
Header file for the list deletion algorithm class.