9 #include "Pandora/AlgorithmHeaders.h" 22 NeutrinoCreationAlgorithm::NeutrinoCreationAlgorithm() :
23 m_forceSingleEmptyNeutrino(false)
35 PANDORA_RETURN_RESULT_IF_AND_IF(
36 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*
this,
m_vertexListName, pVertexList));
38 if (!pVertexList || pVertexList->empty())
40 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
41 std::cout <<
"NeutrinoCreationAlgorithm: unable to find vertex list " <<
m_vertexListName << std::endl;
43 return STATUS_CODE_SUCCESS;
46 std::string neutrinoPfoListName;
47 const PfoList *pNeutrinoPfoList(
nullptr);
48 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pNeutrinoPfoList, neutrinoPfoListName));
52 const Vertex *
const pVertex = *vIter;
54 if (VERTEX_3D != pVertex->GetVertexType())
55 throw StatusCodeException(STATUS_CODE_FAILURE);
58 PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
60 pfoParameters.m_vertexList.push_back(pVertex);
62 const ParticleFlowObject *pNeutrinoPfo(
nullptr);
63 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*
this, pfoParameters, pNeutrinoPfo));
66 if ((!pNeutrinoPfoList) || pNeutrinoPfoList->empty())
67 throw StatusCodeException(STATUS_CODE_FAILURE);
69 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*
this,
m_neutrinoPfoListName));
70 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*
this,
m_neutrinoPfoListName));
72 return STATUS_CODE_SUCCESS;
79 std::string neutrinoPfoListName;
80 const PfoList *pNeutrinoPfoList(
nullptr);
81 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pNeutrinoPfoList, neutrinoPfoListName));
83 PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
86 const ParticleFlowObject *pNeutrinoPfo(
nullptr);
87 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*
this, pfoParameters, pNeutrinoPfo));
89 if ((!pNeutrinoPfoList) || pNeutrinoPfoList->empty())
90 throw StatusCodeException(STATUS_CODE_FAILURE);
92 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*
this,
m_neutrinoPfoListName));
93 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*
this,
m_neutrinoPfoListName));
95 return STATUS_CODE_SUCCESS;
102 pfoParameters.m_particleId = NU_MU;
103 pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
104 pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
105 pfoParameters.m_energy = 0.f;
106 pfoParameters.m_momentum = CartesianVector(0.
f, 0.
f, 0.
f);
107 pfoParameters.m_propertiesToAdd[
"IsNeutrino"] = 1.f;
114 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"InputVertexListName",
m_vertexListName));
116 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"NeutrinoPfoListName",
m_neutrinoPfoListName));
118 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
121 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...