23 const PfoList *pPfoList(NULL);
25 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this,
m_pfoListName, pPfoList))
27 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
28 std::cout <<
"CustomParticleCreationAlgorithm: cannot find pfo list " <<
m_pfoListName << std::endl;
30 return STATUS_CODE_SUCCESS;
36 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this,
m_vertexListName, pVertexList))
38 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
39 std::cout <<
"CustomParticleCreationAlgorithm: cannot find vertex list " <<
m_vertexListName << std::endl;
41 return STATUS_CODE_SUCCESS;
45 const PfoList *pTempPfoList = NULL; std::string tempPfoListName;
46 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pTempPfoList,
49 const VertexList *pTempVertexList = NULL; std::string tempVertexListName;
50 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pTempVertexList,
54 PfoList pfoList(pPfoList->begin(), pPfoList->end());
55 VertexList vertexList(pVertexList->begin(), pVertexList->end());
59 const ParticleFlowObject *
const pInputPfo = *iter;
61 if (pInputPfo->GetVertexList().empty())
66 if (vertexList.end() == std::find(vertexList.begin(), vertexList.end(), pInputVertex))
67 throw StatusCodeException(STATUS_CODE_FAILURE);
70 const ParticleFlowObject *pOutputPfo(NULL);
74 if (NULL == pOutputPfo)
77 if (pOutputPfo->GetVertexList().empty())
78 throw StatusCodeException(STATUS_CODE_FAILURE);
81 ClusterList clusterList(pInputPfo->GetClusterList().begin(), pInputPfo->GetClusterList().end());
82 PfoList parentList(pInputPfo->GetParentPfoList().begin(), pInputPfo->GetParentPfoList().end());
83 PfoList daughterList(pInputPfo->GetDaughterPfoList().begin(), pInputPfo->GetDaughterPfoList().end());
85 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete<Pfo>(*
this, pInputPfo,
m_pfoListName));
86 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete<Vertex>(*
this, pInputVertex,
m_vertexListName));
90 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo<Cluster>(*
this, pOutputPfo, *cIter));
93 for (
PfoList::const_iterator pIter = parentList.begin(), pIterEnd = parentList.end(); pIter != pIterEnd; ++pIter)
95 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*
this, *pIter, pOutputPfo));
98 for (
PfoList::const_iterator dIter = daughterList.begin(), dIterEnd = daughterList.end(); dIter != dIterEnd; ++dIter)
100 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*
this, pOutputPfo, *dIter));
104 if (!pTempPfoList->empty())
106 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*
this,
m_pfoListName));
107 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*
this,
m_pfoListName));
110 if (!pTempVertexList->empty())
112 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Vertex>(*
this,
m_vertexListName));
113 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Vertex>(*
this,
m_vertexListName));
116 return STATUS_CODE_SUCCESS;
std::string m_vertexListName
The name of the input vertex list.
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
std::string m_pfoListName
The name of the input pfo list.
std::list< Vertex > VertexList
virtual void CreatePfo(const pandora::ParticleFlowObject *const pInputPfo, const pandora::ParticleFlowObject *&pOutputPfo) const =0
Create specialised Pfo from an generic input Pfo.