9 #include "Pandora/AlgorithmHeaders.h" 18 StatusCode ListMergingAlgorithm::Run()
21 if (m_sourceVertexListNames.size() != m_targetVertexListNames.size())
22 return STATUS_CODE_FAILURE;
24 for (
unsigned int iIndex = 0, iIndexEnd = m_sourceVertexListNames.size(); iIndex < iIndexEnd; ++iIndex)
26 const std::string &sourceListName(m_sourceVertexListNames.at(iIndex));
27 const std::string &targetListName(m_targetVertexListNames.at(iIndex));
29 const StatusCode statusCode(PandoraContentApi::SaveList<Vertex>(*
this, sourceListName, targetListName));
31 if (STATUS_CODE_SUCCESS != statusCode)
33 if (STATUS_CODE_NOT_FOUND == statusCode)
35 if (this->GetPandora().GetSettings()->ShouldDisplayAlgorithmInfo())
36 std::cout <<
"ListMergingAlgorithm: vertex list not found, source: " << sourceListName <<
", target: " << targetListName
39 else if (STATUS_CODE_NOT_INITIALIZED == statusCode)
41 if (this->GetPandora().GetSettings()->ShouldDisplayAlgorithmInfo())
42 std::cout <<
"ListMergingAlgorithm: no vertexs to move, source: " << sourceListName <<
", target: " << targetListName << std::endl;
46 std::cout <<
"ListMergingAlgorithm: error in vertex merging, source: " << sourceListName <<
", target: " << targetListName << std::endl;
53 if (m_sourceClusterListNames.size() != m_targetClusterListNames.size())
54 return STATUS_CODE_FAILURE;
56 for (
unsigned int iIndex = 0, iIndexEnd = m_sourceClusterListNames.size(); iIndex < iIndexEnd; ++iIndex)
58 const std::string &sourceListName(m_sourceClusterListNames.at(iIndex));
59 const std::string &targetListName(m_targetClusterListNames.at(iIndex));
61 const StatusCode statusCode(PandoraContentApi::SaveList<Cluster>(*
this, sourceListName, targetListName));
63 if (STATUS_CODE_SUCCESS != statusCode)
65 if (STATUS_CODE_NOT_FOUND == statusCode)
67 if (this->GetPandora().GetSettings()->ShouldDisplayAlgorithmInfo())
68 std::cout <<
"ListMergingAlgorithm: cluster list not found, source: " << sourceListName
69 <<
", target: " << targetListName << std::endl;
71 else if (STATUS_CODE_NOT_INITIALIZED == statusCode)
73 if (this->GetPandora().GetSettings()->ShouldDisplayAlgorithmInfo())
74 std::cout <<
"ListMergingAlgorithm: no clusters to move, source: " << sourceListName <<
", target: " << targetListName << std::endl;
78 std::cout <<
"ListMergingAlgorithm: error in cluster merging, source: " << sourceListName <<
", target: " << targetListName
86 if (m_sourcePfoListNames.size() != m_targetPfoListNames.size())
87 return STATUS_CODE_FAILURE;
89 for (
unsigned int iIndex = 0, iIndexEnd = m_sourcePfoListNames.size(); iIndex < iIndexEnd; ++iIndex)
91 const std::string &sourceListName(m_sourcePfoListNames.at(iIndex));
92 const std::string &targetListName(m_targetPfoListNames.at(iIndex));
94 const StatusCode statusCode(PandoraContentApi::SaveList<Pfo>(*
this, sourceListName, targetListName));
96 if (STATUS_CODE_SUCCESS != statusCode)
98 if (STATUS_CODE_NOT_FOUND == statusCode)
100 if (this->GetPandora().GetSettings()->ShouldDisplayAlgorithmInfo())
101 std::cout <<
"ListMergingAlgorithm: pfo list not found, source: " << sourceListName <<
", target: " << targetListName << std::endl;
103 else if (STATUS_CODE_NOT_INITIALIZED == statusCode)
105 if (this->GetPandora().GetSettings()->ShouldDisplayAlgorithmInfo())
106 std::cout <<
"ListMergingAlgorithm: no pfos to move, source: " << sourceListName <<
", target: " << targetListName << std::endl;
110 std::cout <<
"ListMergingAlgorithm: error in pfo merging, source: " << sourceListName <<
", target: " << targetListName << std::endl;
116 return STATUS_CODE_SUCCESS;
121 StatusCode ListMergingAlgorithm::ReadSettings(
const TiXmlHandle xmlHandle)
123 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
124 XmlHelper::ReadVectorOfValues(xmlHandle,
"SourceVertexListNames", m_sourceVertexListNames));
126 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
127 XmlHelper::ReadVectorOfValues(xmlHandle,
"TargetVertexListNames", m_targetVertexListNames));
129 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
130 XmlHelper::ReadVectorOfValues(xmlHandle,
"SourceClusterListNames", m_sourceClusterListNames));
132 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
133 XmlHelper::ReadVectorOfValues(xmlHandle,
"TargetClusterListNames", m_targetClusterListNames));
135 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
136 XmlHelper::ReadVectorOfValues(xmlHandle,
"SourcePfoListNames", m_sourcePfoListNames));
138 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
139 XmlHelper::ReadVectorOfValues(xmlHandle,
"TargetPfoListNames", m_targetPfoListNames));
141 if ((m_sourceClusterListNames.size() != m_targetClusterListNames.size()) || (m_sourcePfoListNames.size() != m_targetPfoListNames.size()))
143 std::cout <<
"ListMergingAlgorithm::ReadSettings: invalid list configuration " << std::endl;
144 return STATUS_CODE_INVALID_PARAMETER;
147 return STATUS_CODE_SUCCESS;
Header file for the list merging algorithm class.