9 #include "Pandora/AlgorithmHeaders.h" 18 StatusCode ListMergingAlgorithm::Run()
21 if (m_sourceClusterListNames.size() != m_targetClusterListNames.size())
22 return STATUS_CODE_FAILURE;
24 for (
unsigned int iIndex = 0, iIndexEnd = m_sourceClusterListNames.size(); iIndex < iIndexEnd; ++iIndex)
26 const std::string &sourceListName(m_sourceClusterListNames.at(iIndex));
27 const std::string &targetListName(m_targetClusterListNames.at(iIndex));
29 const StatusCode statusCode(PandoraContentApi::SaveList<Cluster>(*
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: cluster list not found, source: " << sourceListName <<
", target: " << targetListName << std::endl;
38 else if (STATUS_CODE_NOT_INITIALIZED == statusCode)
40 if (this->GetPandora().GetSettings()->ShouldDisplayAlgorithmInfo())
41 std::cout <<
"ListMergingAlgorithm: no clusters to move, source: " << sourceListName <<
", target: " << targetListName << std::endl;
45 std::cout <<
"ListMergingAlgorithm: error in cluster merging, source: " << sourceListName <<
", target: " << targetListName << std::endl;
52 if (m_sourcePfoListNames.size() != m_targetPfoListNames.size())
53 return STATUS_CODE_FAILURE;
55 for (
unsigned int iIndex = 0, iIndexEnd = m_sourcePfoListNames.size(); iIndex < iIndexEnd; ++iIndex)
57 const std::string &sourceListName(m_sourcePfoListNames.at(iIndex));
58 const std::string &targetListName(m_targetPfoListNames.at(iIndex));
60 const StatusCode statusCode(PandoraContentApi::SaveList<Pfo>(*
this, sourceListName, targetListName));
62 if (STATUS_CODE_SUCCESS != statusCode)
64 if (STATUS_CODE_NOT_FOUND == statusCode)
66 if (this->GetPandora().GetSettings()->ShouldDisplayAlgorithmInfo())
67 std::cout <<
"ListMergingAlgorithm: pfo list not found, source: " << sourceListName <<
", target: " << targetListName << std::endl;
69 else if (STATUS_CODE_NOT_INITIALIZED == statusCode)
71 if (this->GetPandora().GetSettings()->ShouldDisplayAlgorithmInfo())
72 std::cout <<
"ListMergingAlgorithm: no pfos to move, source: " << sourceListName <<
", target: " << targetListName << std::endl;
76 std::cout <<
"ListMergingAlgorithm: error in pfo merging, source: " << sourceListName <<
", target: " << targetListName << std::endl;
82 return STATUS_CODE_SUCCESS;
87 StatusCode ListMergingAlgorithm::ReadSettings(
const TiXmlHandle xmlHandle)
89 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
90 "SourceClusterListNames", m_sourceClusterListNames));
92 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
93 "TargetClusterListNames", m_targetClusterListNames));
95 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
96 "SourcePfoListNames", m_sourcePfoListNames));
98 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
99 "TargetPfoListNames", m_targetPfoListNames));
101 if ((m_sourceClusterListNames.size() != m_targetClusterListNames.size()) || (m_sourcePfoListNames.size() != m_targetPfoListNames.size()))
103 std::cout <<
"ListMergingAlgorithm::ReadSettings: invalid list configuration " << std::endl;
104 return STATUS_CODE_INVALID_PARAMETER;
107 return STATUS_CODE_SUCCESS;
Header file for the list merging algorithm class.