ListChangingAlgorithm.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArUtility/ListChangingAlgorithm.cc
3  *
4  * @brief Implementation of the list changing 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 ListChangingAlgorithm::Run()
19 {
20  if (!m_caloHitListName.empty())
21  {
22  const StatusCode statusCode(PandoraContentApi::ReplaceCurrentList<CaloHit>(*this, m_caloHitListName));
23 
24  if ((STATUS_CODE_SUCCESS != statusCode) && (STATUS_CODE_NOT_FOUND != statusCode))
25  return statusCode;
26 
27  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo() && (STATUS_CODE_NOT_FOUND == statusCode))
28  std::cout << "ListChangingAlgorithm: calohit list not found " << m_caloHitListName << std::endl;
29  }
30 
31  if (!m_clusterListName.empty())
32  {
33  const StatusCode statusCode(PandoraContentApi::ReplaceCurrentList<Cluster>(*this, m_clusterListName));
34 
35  if ((STATUS_CODE_SUCCESS != statusCode) && (STATUS_CODE_NOT_FOUND != statusCode))
36  return statusCode;
37 
38  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo() && (STATUS_CODE_NOT_FOUND == statusCode))
39  std::cout << "ListChangingAlgorithm: cluster list not found " << m_clusterListName << std::endl;
40  }
41 
42  if (!m_vertexListName.empty())
43  {
44  const StatusCode statusCode(PandoraContentApi::ReplaceCurrentList<Vertex>(*this, m_vertexListName));
45 
46  if ((STATUS_CODE_SUCCESS != statusCode) && (STATUS_CODE_NOT_FOUND != statusCode))
47  return statusCode;
48 
49  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo() && (STATUS_CODE_NOT_FOUND == statusCode))
50  std::cout << "ListChangingAlgorithm: vertex list not found " << m_vertexListName << std::endl;
51  }
52 
53  if (!m_pfoListName.empty())
54  {
55  const StatusCode statusCode(PandoraContentApi::ReplaceCurrentList<Pfo>(*this, m_pfoListName));
56 
57  if ((STATUS_CODE_SUCCESS != statusCode) && (STATUS_CODE_NOT_FOUND != statusCode))
58  return statusCode;
59 
60  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo() && (STATUS_CODE_NOT_FOUND == statusCode))
61  std::cout << "ListChangingAlgorithm: pfo list not found " << m_pfoListName << std::endl;
62  }
63 
64  return STATUS_CODE_SUCCESS;
65 }
66 
67 //------------------------------------------------------------------------------------------------------------------------------------------
68 
69 StatusCode ListChangingAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
70 {
71  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "CaloHitListName", m_caloHitListName));
72  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ClusterListName", m_clusterListName));
73  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VertexListName", m_vertexListName));
74  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PfoListName", m_pfoListName));
75 
76  return STATUS_CODE_SUCCESS;
77 }
78 
79 } // namespace lar_content
Header file for the list changing algorithm class.
QTextStream & endl(QTextStream &s)