9 #include "Api/PandoraApi.h"
11 #include "Pandora/AlgorithmHeaders.h"
20 SlicingAlgorithm::SlicingAlgorithm() : m_pEventSlicingTool(nullptr)
32 if (sliceList.empty())
33 return STATUS_CODE_SUCCESS;
35 std::string clusterListName;
36 const ClusterList *pClusterList(
nullptr);
37 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pClusterList, clusterListName));
39 std::string pfoListName;
40 const PfoList *pPfoList(
nullptr);
41 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pPfoList, pfoListName));
43 for (
const Slice &slice : sliceList)
45 const Cluster *pClusterU(
nullptr), *pClusterV(
nullptr), *pClusterW(
nullptr);
47 clusterParametersU.m_caloHitList = slice.m_caloHitListU;
48 clusterParametersV.m_caloHitList = slice.m_caloHitListV;
49 clusterParametersW.m_caloHitList = slice.m_caloHitListW;
50 if (!clusterParametersU.m_caloHitList.empty())
51 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, clusterParametersU, pClusterU));
52 if (!clusterParametersV.m_caloHitList.empty())
53 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, clusterParametersV, pClusterV));
54 if (!clusterParametersW.m_caloHitList.empty())
55 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, clusterParametersW, pClusterW));
57 if (!pClusterU && !pClusterV && !pClusterW)
58 throw StatusCodeException(STATUS_CODE_FAILURE);
60 const Pfo *pSlicePfo(
nullptr);
63 pfoParameters.m_clusterList.push_back(pClusterU);
65 pfoParameters.m_clusterList.push_back(pClusterV);
67 pfoParameters.m_clusterList.push_back(pClusterW);
68 pfoParameters.m_charge = 0;
69 pfoParameters.m_energy = 0.f;
70 pfoParameters.m_mass = 0.f;
71 pfoParameters.m_momentum = CartesianVector(0.f, 0.f, 0.f);
72 pfoParameters.m_particleId = 0;
73 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*
this, pfoParameters, pSlicePfo));
76 if (!pClusterList->empty())
78 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Cluster>(*
this,
m_sliceClusterListName));
79 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*
this,
m_sliceClusterListName));
82 if (!pPfoList->empty())
84 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<ParticleFlowObject>(*
this,
m_slicePfoListName));
85 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<ParticleFlowObject>(*
this,
m_slicePfoListName));
88 return STATUS_CODE_SUCCESS;
95 AlgorithmTool *pAlgorithmTool(
nullptr);
96 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmTool(*
this, xmlHandle,
"SliceCreation", pAlgorithmTool));
100 return STATUS_CODE_INVALID_PARAMETER;
102 PANDORA_RETURN_RESULT_IF(
105 std::string caloHitListNameU, caloHitListNameV, caloHitListNameW;
106 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputCaloHitListNameU", caloHitListNameU));
107 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputCaloHitListNameV", caloHitListNameV));
108 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputCaloHitListNameW", caloHitListNameW));
113 std::string clusterListNameU, clusterListNameV, clusterListNameW;
114 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputClusterListNameU", clusterListNameU));
115 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputClusterListNameV", clusterListNameV));
116 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputClusterListNameW", clusterListNameW));
121 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"OutputClusterListName",
m_sliceClusterListName));
122 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"OutputPfoListName",
m_slicePfoListName));
124 return STATUS_CODE_SUCCESS;
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
HitTypeToNameMap m_caloHitListNames
The hit type to calo hit list name map.
EventSlicingBaseTool class.
pandora::StatusCode Run()
std::string m_slicingListDeletionAlgorithm
The name of the slicing list deletion algorithm.
virtual void RunSlicing(const pandora::Algorithm *const pAlgorithm, const SlicingAlgorithm::HitTypeToNameMap &caloHitListNames, const SlicingAlgorithm::HitTypeToNameMap &clusterListNames, SlicingAlgorithm::SliceList &sliceList)=0
Run the slicing tool.
std::string m_sliceClusterListName
The name of the output slice cluster list.
HitTypeToNameMap m_clusterListNames
The hit type to cluster list name map.
fhicl::Table< sbnd::crt::CRTDetSimParams > Parameters
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
std::vector< Slice > SliceList
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.