9 #include "Api/PandoraApi.h" 11 #include "Pandora/AlgorithmHeaders.h" 20 SlicingAlgorithm::SlicingAlgorithm() :
21 m_pEventSlicingTool(nullptr)
33 if (sliceList.empty())
34 return STATUS_CODE_SUCCESS;
36 std::string clusterListName;
37 const ClusterList *pClusterList(
nullptr);
38 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pClusterList, clusterListName));
40 std::string pfoListName;
41 const PfoList *pPfoList(
nullptr);
42 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pPfoList, pfoListName));
44 for (
const Slice &slice : sliceList)
46 const Cluster *pClusterU(
nullptr), *pClusterV(
nullptr), *pClusterW(
nullptr);
47 PandoraContentApi::Cluster::Parameters clusterParametersU, clusterParametersV, clusterParametersW;
48 clusterParametersU.m_caloHitList = slice.m_caloHitListU;
49 clusterParametersV.m_caloHitList = slice.m_caloHitListV;
50 clusterParametersW.m_caloHitList = slice.m_caloHitListW;
51 if (!clusterParametersU.m_caloHitList.empty())
52 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, clusterParametersU, pClusterU));
53 if (!clusterParametersV.m_caloHitList.empty())
54 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, clusterParametersV, pClusterV));
55 if (!clusterParametersW.m_caloHitList.empty())
56 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, clusterParametersW, pClusterW));
58 if (!pClusterU && !pClusterV && !pClusterW)
59 throw StatusCodeException(STATUS_CODE_FAILURE);
61 const Pfo *pSlicePfo(
nullptr);
62 PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
64 pfoParameters.m_clusterList.push_back(pClusterU);
66 pfoParameters.m_clusterList.push_back(pClusterV);
68 pfoParameters.m_clusterList.push_back(pClusterW);
69 pfoParameters.m_charge = 0;
70 pfoParameters.m_energy = 0.f;
71 pfoParameters.m_mass = 0.f;
72 pfoParameters.m_momentum = CartesianVector(0.
f, 0.
f, 0.
f);
73 pfoParameters.m_particleId = 0;
74 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*
this, pfoParameters, pSlicePfo));
77 if (!pClusterList->empty())
79 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Cluster>(*
this,
m_sliceClusterListName));
80 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*
this,
m_sliceClusterListName));
83 if (!pPfoList->empty())
85 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<ParticleFlowObject>(*
this,
m_slicePfoListName));
86 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<ParticleFlowObject>(*
this,
m_slicePfoListName));
89 return STATUS_CODE_SUCCESS;
96 AlgorithmTool *pAlgorithmTool(
nullptr);
97 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmTool(*
this, xmlHandle,
"SliceCreation", pAlgorithmTool));
101 return STATUS_CODE_INVALID_PARAMETER;
103 PANDORA_RETURN_RESULT_IF(
106 std::string caloHitListNameU, caloHitListNameV, caloHitListNameW;
107 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputCaloHitListNameU", caloHitListNameU));
108 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputCaloHitListNameV", caloHitListNameV));
109 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputCaloHitListNameW", caloHitListNameW));
114 std::string clusterListNameU, clusterListNameV, clusterListNameW;
115 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputClusterListNameU", clusterListNameU));
116 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputClusterListNameV", clusterListNameV));
117 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputClusterListNameW", clusterListNameW));
122 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"OutputClusterListName",
m_sliceClusterListName));
123 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"OutputPfoListName",
m_slicePfoListName));
125 return STATUS_CODE_SUCCESS;
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
HitTypeToNameMap m_caloHitListNames
The hit type to calo hit list name map.
std::vector< Slice > SliceList
EventSlicingBaseTool class.
pandora::StatusCode Run()
virtual void RunSlicing(const pandora::Algorithm *const pAlgorithm, const HitTypeToNameMap &caloHitListNames, const HitTypeToNameMap &clusterListNames, SliceList &sliceList)=0
Run the slicing tool.
std::string m_slicingListDeletionAlgorithm
The name of the slicing list deletion algorithm.
std::string m_sliceClusterListName
The name of the output slice cluster list.
HitTypeToNameMap m_clusterListNames
The hit type to cluster list name map.
std::string m_slicePfoListName
The name of the output slice pfo list.
Header file for the master algorithm class.
EventSlicingBaseTool * m_pEventSlicingTool
The address of the event slicing tool.