9 #include "Pandora/AlgorithmHeaders.h" 21 CheatingVertexCreationAlgorithm::CheatingVertexCreationAlgorithm() :
22 m_replaceCurrentVertexList(true),
23 m_vertexXCorrection(0.
f)
31 const MCParticleList *pMCParticleList(
nullptr);
32 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*
this, pMCParticleList));
35 std::string temporaryListName;
36 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pVertexList, temporaryListName));
38 for (
const MCParticle *
const pMCParticle : *pMCParticleList)
43 PandoraContentApi::Vertex::Parameters parameters;
44 parameters.m_position = CartesianVector(
45 pMCParticle->GetEndpoint().GetX() +
m_vertexXCorrection, pMCParticle->GetEndpoint().GetY(), pMCParticle->GetEndpoint().GetZ());
46 parameters.m_vertexLabel = VERTEX_INTERACTION;
47 parameters.m_vertexType = VERTEX_3D;
49 const Vertex *pVertex(
nullptr);
50 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Vertex::Create(*
this, parameters, pVertex));
53 if (!pVertexList->empty())
55 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Vertex>(*
this,
m_outputVertexListName));
58 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Vertex>(*
this,
m_outputVertexListName));
61 return STATUS_CODE_SUCCESS;
68 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"OutputVertexListName",
m_outputVertexListName));
70 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
73 PANDORA_RETURN_RESULT_IF_AND_IF(
74 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"VertexXCorrection",
m_vertexXCorrection));
76 return STATUS_CODE_SUCCESS;
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_vertexXCorrection
The vertex x correction, added to reported mc neutrino endpoint x value, in cm.
pandora::StatusCode Run()
Header file for the geometry helper class.
Header file for the cheating vertex creation algorithm class.
Header file for the lar monte carlo particle helper helper class.
bool m_replaceCurrentVertexList
Whether to replace the current vertex list with the output list.
std::string m_outputVertexListName
The name under which to save the output vertex list.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
std::list< Vertex > VertexList
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.