9 #include "Pandora/AlgorithmHeaders.h" 20 CheatingNeutrinoDaughterVerticesAlgorithm::CheatingNeutrinoDaughterVerticesAlgorithm() :
21 m_collapseToPrimaryMCParticles(false)
29 const PfoList *pPfoList(
nullptr);
30 PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*
this,
m_neutrinoListName, pPfoList));
34 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
35 std::cout <<
"CheatingNeutrinoDaughterVerticesAlgorithm: pfo list unavailable." << std::endl;
37 return STATUS_CODE_SUCCESS;
48 return STATUS_CODE_SUCCESS;
57 const MCParticleList *pMCParticleList(
nullptr);
58 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_mcParticleListName, pMCParticleList));
68 for (
const ParticleFlowObject *
const pNeutrinoPfo : neutrinoPfos)
73 PfoList::iterator neutrinoIter(std::find(daughterPfos.begin(), daughterPfos.end(), pNeutrinoPfo));
75 if (daughterPfos.end() != neutrinoIter)
76 daughterPfos.erase(neutrinoIter);
78 for (
const ParticleFlowObject *
const pDaughterPfo : daughterPfos)
84 catch (
const StatusCodeException &)
102 if (mcPrimaryMap.end() == primaryIter)
103 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
105 pMCParticle = primaryIter->second;
109 std::string vertexListName;
110 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*
this, pVertexList, vertexListName));
112 PandoraContentApi::Vertex::Parameters parameters;
113 parameters.m_position = pMCParticle->GetVertex();
114 parameters.m_vertexLabel = VERTEX_INTERACTION;
115 parameters.m_vertexType = VERTEX_3D;
117 const Vertex *pVertex(
nullptr);
118 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Vertex::Create(*
this, parameters, pVertex));
120 if (!pVertexList->empty())
122 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Vertex>(*
this,
m_vertexListName));
123 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo<Vertex>(*
this, pDaughterPfo, pVertex));
131 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
136 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MCParticleListName",
m_mcParticleListName));
139 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"NeutrinoPfoListName",
m_neutrinoListName));
141 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"OutputVertexListName",
m_vertexListName));
143 return STATUS_CODE_SUCCESS;
std::string m_mcParticleListName
The mc particle list name, required if want to collapse mc particle hierarchy.
Header file for the pfo helper class.
std::string m_vertexListName
The name of the output cosmic-ray vertex list.
static void GetRecoNeutrinos(const pandora::PfoList *const pPfoList, pandora::PfoList &recoNeutrinos)
Get neutrino pfos from an input pfo list.
pandora::StatusCode Run()
static void GetMCPrimaryMap(const pandora::MCParticleList *const pMCParticleList, MCRelationMap &mcPrimaryMap)
Get mapping from individual mc particles (in a provided list) and their primary parent mc particles...
static const pandora::MCParticle * GetMainMCParticle(const pandora::ParticleFlowObject *const pPfo)
Find the mc particle making the largest contribution to 2D clusters in a specified pfo...
void GetMCPrimaryMap(LArMCParticleHelper::MCRelationMap &mcPrimaryMap) const
Get the mapping from mc particle to primary, only required if collapsed mc particle hierarchy specifi...
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Header file for the cheating neutrino daughter vertices algorithm class.
void ProcessRecoNeutrinos(const pandora::PfoList &neutrinoPfos, const LArMCParticleHelper::MCRelationMap &mcPrimaryMap) const
Process the list of reconstructed neutrinos.
void ProcessDaughterPfo(const pandora::ParticleFlowObject *const pDaughterPfo, const LArMCParticleHelper::MCRelationMap &mcPrimaryMap) const
Process a daughter pfo.
bool m_collapseToPrimaryMCParticles
Whether to collapse mc particle hierarchies to primary particles.
std::string m_neutrinoListName
The input list of pfo list names.
static void GetAllDownstreamPfos(const pandora::PfoList &inputPfoList, pandora::PfoList &outputPfoList)
Get a flat list of all pfos, recursively, of all daughters associated with those pfos in an input lis...
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
std::unordered_map< const pandora::MCParticle *, const pandora::MCParticle * > MCRelationMap
std::list< Vertex > VertexList