9 #include "Pandora/AlgorithmHeaders.h"
27 BranchAssociatedPfosTool::BranchAssociatedPfosTool() :
28 m_minNeutrinoVertexDistance(5.f),
29 m_trackBranchAdditionFraction(0.4f),
30 m_maxParentClusterDistance(3.5f)
38 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
39 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() << std::endl;
41 bool associationsMade(
true);
43 while (associationsMade)
45 associationsMade =
false;
46 PfoVector assignedPfos, unassignedPfos;
47 pAlgorithm->
SeparatePfos(pfoInfoMap, assignedPfos, unassignedPfos);
49 if (unassignedPfos.empty())
53 PfoSet recentlyAssigned;
55 for (
const ParticleFlowObject *
const pParentPfo : assignedPfos)
57 PfoInfo *
const pParentPfoInfo(pfoInfoMap.at(pParentPfo));
58 const Cluster *
const pParentCluster3D(pParentPfoInfo->GetCluster3D());
64 const CartesianVector &parentVertexPosition(pParentPfoInfo->IsInnerLayerAssociated() ? parentFitResult.
GetGlobalMinLayerPosition()
67 for (
const ParticleFlowObject *
const pPfo : unassignedPfos)
69 if (recentlyAssigned.count(pPfo))
72 PfoInfo *
const pPfoInfo(pfoInfoMap.at(pPfo));
75 const float dNeutrinoVertex(std::min((pointingCluster.GetInnerVertex().GetPosition() - pNeutrinoVertex->GetPosition()).GetMagnitude(),
76 (pointingCluster.GetOuterVertex().GetPosition() - pNeutrinoVertex->GetPosition()).GetMagnitude()));
81 const float dParentVertex(std::min((pointingCluster.GetInnerVertex().GetPosition() - parentVertexPosition).GetMagnitude(),
82 (pointingCluster.GetOuterVertex().GetPosition() - parentVertexPosition).GetMagnitude()));
92 associationsMade =
true;
93 pParentPfoInfo->AddDaughterPfo(pPfoInfo->GetThisPfo());
94 pPfoInfo->SetParentPfo(pParentPfoInfo->GetThisPfo());
95 pPfoInfo->SetInnerLayerAssociation(dInnerVertex < dOuterVertex);
96 recentlyAssigned.insert(pPfoInfo->GetThisPfo());
107 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
110 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
113 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
116 return STATUS_CODE_SUCCESS;
void Run(const NeutrinoHierarchyAlgorithm *const pAlgorithm, const pandora::Vertex *const pNeutrinoVertex, NeutrinoHierarchyAlgorithm::PfoInfoMap &pfoInfoMap)
Run the algorithm tool.
Header file for the pfo helper class.
Header file for the lar pointing cluster class.
NeutrinoHierarchyAlgorithm::PfoInfoMap PfoInfoMap
float m_maxParentClusterDistance
Branch association: max distance from branch vertex to a hit in parent 3D cluster.
void SeparatePfos(const NeutrinoHierarchyAlgorithm::PfoInfoMap &pfoInfoMap, pandora::PfoVector &assignedPfos, pandora::PfoVector &unassignedPfos) const
Query the pfo info map and separate/extract pfos currently either acting as parents or associated wit...
LArPointingCluster class.
static bool IsTrack(const pandora::ParticleFlowObject *const pPfo)
Return track flag based on Pfo Particle ID.
float m_minNeutrinoVertexDistance
Branch association: min distance from branch vertex to neutrino vertex.
NeutrinoHierarchyAlgorithm class.
Header file for the cluster helper class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::unordered_map< const pandora::ParticleFlowObject *, PfoInfo * > PfoInfoMap
const pandora::CartesianVector & GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
Header file for the lar three dimensional sliding fit result class.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
ThreeDSlidingFitResult class.
float m_trackBranchAdditionFraction
Branch association: min fraction of length along parent track before association allowed.
NeutrinoHierarchyAlgorithm::PfoInfo PfoInfo
BEGIN_PROLOG could also be cout
const pandora::CartesianVector & GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.