9 #include "Pandora/AlgorithmHeaders.h" 22 NeutrinoCreationAlgorithm::NeutrinoCreationAlgorithm() : m_forceSingleEmptyNeutrino(false)
34 PANDORA_RETURN_RESULT_IF_AND_IF(
35 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*
this,
m_vertexListName, pVertexList));
37 if (!pVertexList || pVertexList->empty())
39 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
42 return STATUS_CODE_SUCCESS;
46 const PfoList *pNeutrinoPfoList(
nullptr);
47 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pNeutrinoPfoList, neutrinoPfoListName));
51 const Vertex *
const pVertex = *vIter;
53 if (VERTEX_3D != pVertex->GetVertexType())
54 throw StatusCodeException(STATUS_CODE_FAILURE);
57 PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
59 pfoParameters.m_vertexList.push_back(pVertex);
61 const ParticleFlowObject *pNeutrinoPfo(
nullptr);
62 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*
this, pfoParameters, pNeutrinoPfo));
65 if ((!pNeutrinoPfoList) || pNeutrinoPfoList->empty())
66 throw StatusCodeException(STATUS_CODE_FAILURE);
68 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*
this,
m_neutrinoPfoListName));
69 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*
this,
m_neutrinoPfoListName));
71 return STATUS_CODE_SUCCESS;
79 const PfoList *pNeutrinoPfoList(
nullptr);
80 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pNeutrinoPfoList, neutrinoPfoListName));
82 PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
85 const ParticleFlowObject *pNeutrinoPfo(
nullptr);
86 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*
this, pfoParameters, pNeutrinoPfo));
88 if ((!pNeutrinoPfoList) || pNeutrinoPfoList->empty())
89 throw StatusCodeException(STATUS_CODE_FAILURE);
91 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*
this,
m_neutrinoPfoListName));
92 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*
this,
m_neutrinoPfoListName));
94 return STATUS_CODE_SUCCESS;
101 pfoParameters.m_particleId = NU_MU;
102 pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
103 pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
104 pfoParameters.m_energy = 0.f;
105 pfoParameters.m_momentum = CartesianVector(0.
f, 0.
f, 0.
f);
106 pfoParameters.m_propertiesToAdd[
"IsNeutrino"] = 1.f;
113 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputVertexListName",
m_vertexListName));
115 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"NeutrinoPfoListName",
m_neutrinoPfoListName));
117 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
120 return STATUS_CODE_SUCCESS;
std::string m_vertexListName
The name of the neutrino vertex list.
bool m_forceSingleEmptyNeutrino
Whether to force creation of a single neutrino, with no vertex, regardless of number of input vertice...
pandora::StatusCode Run()
Header file for the neutrino creation algorithm class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Header file for the cluster helper class.
void FillDefaultNeutrinoParameters(PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
Fill provided pfo parameters with default/dummy values for later refinement.
std::string m_neutrinoPfoListName
The name of the neutrino pfo list.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
std::list< Vertex > VertexList
pandora::StatusCode ForceSingleEmptyNeutrino() const
Force creation of a single neutrino, with no vertex, regardless of number of input vertices...
QTextStream & endl(QTextStream &s)