9 #include "Pandora/AlgorithmHeaders.h" 18 TwoDParticleCreationAlgorithm::TwoDParticleCreationAlgorithm() :
19 m_minHitsInCluster(5),
20 m_minClusterEnergy(0.
f)
28 const PfoList *pPfoList =
nullptr;
29 std::string pfoListName;
30 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pPfoList, pfoListName));
34 const ClusterList *pClusterListU =
nullptr;
35 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_inputClusterListNameU, pClusterListU));
38 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->
CreatePFOs(pClusterListU));
43 const ClusterList *pClusterListV =
nullptr;
44 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_inputClusterListNameV, pClusterListV));
47 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->
CreatePFOs(pClusterListV));
52 const ClusterList *pClusterListW =
nullptr;
53 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_inputClusterListNameW, pClusterListW));
56 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->
CreatePFOs(pClusterListW));
59 if (!pPfoList->empty())
61 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*
this,
m_outputPfoListName));
62 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*
this,
m_outputPfoListName));
65 return STATUS_CODE_SUCCESS;
74 const Cluster *
const pCluster = *iter;
80 const float clusterEnergy(pCluster->GetElectromagneticEnergy());
85 PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
88 const ParticleType particleType(PandoraContentApi::GetPlugins(*this)->GetParticleId()->IsMuon(pCluster) ? MU_MINUS : PHOTON);
90 const ClusterFitResult &fitToAllHitsResult(pCluster->GetFitToAllHitsResult());
92 if (!fitToAllHitsResult.IsFitSuccessful())
96 pfoParameters.m_particleId = particleType;
97 pfoParameters.m_charge = 0;
98 pfoParameters.m_mass = 0.;
99 pfoParameters.m_energy = clusterEnergy;
100 pfoParameters.m_momentum = CartesianVector(fitToAllHitsResult.GetDirection() * clusterEnergy);
101 pfoParameters.m_clusterList.push_back(pCluster);
103 const ParticleFlowObject *pPfo(NULL);
104 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*
this, pfoParameters, pPfo));
107 return STATUS_CODE_SUCCESS;
114 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"OutputPfoListName",
m_outputPfoListName));
116 PANDORA_RETURN_RESULT_IF_AND_IF(
117 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ClusterListNameU",
m_inputClusterListNameU));
119 PANDORA_RETURN_RESULT_IF_AND_IF(
120 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ClusterListNameV",
m_inputClusterListNameV));
122 PANDORA_RETURN_RESULT_IF_AND_IF(
123 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ClusterListNameW",
m_inputClusterListNameW));
125 PANDORA_RETURN_RESULT_IF_AND_IF(
126 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinHitsInCluster",
m_minHitsInCluster));
128 PANDORA_RETURN_RESULT_IF_AND_IF(
129 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinClusterEnergy",
m_minClusterEnergy));
131 return STATUS_CODE_SUCCESS;
float m_minClusterEnergy
Min energy for clusters to form pfos.
std::string m_inputClusterListNameW
The input cluster list name for the W view.
pandora::StatusCode CreatePFOs(const pandora::ClusterList *const pClusterList) const
Create pfos for provided clusters.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::string m_inputClusterListNameU
The input cluster list name for the U view.
std::string m_inputClusterListNameV
The input cluster list name for the V view.
std::string m_outputPfoListName
The output pfo list name.
pandora::StatusCode Run()
Header file for the two dimensional particle creation algorithm class.
unsigned int m_minHitsInCluster
Min number of hits for clusters to form pfos.