9 #include "Pandora/AlgorithmHeaders.h"
18 TwoDParticleCreationAlgorithm::TwoDParticleCreationAlgorithm() : m_minHitsInCluster(5), m_minClusterEnergy(0.f)
26 const PfoList *pPfoList =
nullptr;
27 std::string pfoListName;
28 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pPfoList, pfoListName));
32 const ClusterList *pClusterListU =
nullptr;
33 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_inputClusterListNameU, pClusterListU));
36 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->
CreatePFOs(pClusterListU));
41 const ClusterList *pClusterListV =
nullptr;
42 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_inputClusterListNameV, pClusterListV));
45 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->
CreatePFOs(pClusterListV));
50 const ClusterList *pClusterListW =
nullptr;
51 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_inputClusterListNameW, pClusterListW));
54 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->
CreatePFOs(pClusterListW));
57 if (!pPfoList->empty())
59 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*
this,
m_outputPfoListName));
60 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*
this,
m_outputPfoListName));
63 return STATUS_CODE_SUCCESS;
70 for (ClusterList::const_iterator iter = pClusterList->begin(), iterEnd = pClusterList->end(); iter != iterEnd; ++iter)
72 const Cluster *
const pCluster = *iter;
78 const float clusterEnergy(pCluster->GetElectromagneticEnergy());
86 const ParticleType particleType(PandoraContentApi::GetPlugins(*this)->GetParticleId()->IsMuon(pCluster) ? MU_MINUS : PHOTON);
88 const ClusterFitResult &fitToAllHitsResult(pCluster->GetFitToAllHitsResult());
90 if (!fitToAllHitsResult.IsFitSuccessful())
94 pfoParameters.m_particleId = particleType;
95 pfoParameters.m_charge = 0;
96 pfoParameters.m_mass = 0.;
97 pfoParameters.m_energy = clusterEnergy;
98 pfoParameters.m_momentum = CartesianVector(fitToAllHitsResult.GetDirection() * clusterEnergy);
99 pfoParameters.m_clusterList.push_back(pCluster);
101 const ParticleFlowObject *pPfo(NULL);
102 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*
this, pfoParameters, pPfo));
105 return STATUS_CODE_SUCCESS;
112 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"OutputPfoListName",
m_outputPfoListName));
114 PANDORA_RETURN_RESULT_IF_AND_IF(
115 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ClusterListNameU",
m_inputClusterListNameU));
117 PANDORA_RETURN_RESULT_IF_AND_IF(
118 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ClusterListNameV",
m_inputClusterListNameV));
120 PANDORA_RETURN_RESULT_IF_AND_IF(
121 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ClusterListNameW",
m_inputClusterListNameW));
123 PANDORA_RETURN_RESULT_IF_AND_IF(
124 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinHitsInCluster",
m_minHitsInCluster));
126 PANDORA_RETURN_RESULT_IF_AND_IF(
127 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinClusterEnergy",
m_minClusterEnergy));
129 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)
fhicl::Table< sbnd::crt::CRTDetSimParams > Parameters
std::string m_inputClusterListNameU
The input cluster list name for the U view.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
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.