9 #include "Pandora/AlgorithmHeaders.h"
18 MatchedEndPointsTool::MatchedEndPointsTool() : m_minMatchedFraction(0.8f), m_maxEndPointChi2(3.f)
26 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
27 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() << std::endl;
40 ClusterSet usedClusters;
44 for (
const Cluster *
const pKeyCluster : sortedKeyClusters)
46 if (!pKeyCluster->IsAvailable())
49 unsigned int nU(0), nV(0), nW(0);
53 if (nU * nV * nW == 0)
60 if (usedClusters.count(iter->GetClusterU()) || usedClusters.count(iter->GetClusterV()) || usedClusters.count(iter->GetClusterW()))
66 if (std::max(iter->GetOverlapResult().GetInnerChi2(), iter->GetOverlapResult().GetOuterChi2()) >
m_maxEndPointChi2)
73 protoParticleVector.push_back(protoParticle);
75 usedClusters.insert(iter->GetClusterU());
76 usedClusters.insert(iter->GetClusterV());
77 usedClusters.insert(iter->GetClusterW());
86 return (lhs.GetOverlapResult().GetInnerChi2() + lhs.GetOverlapResult().GetOuterChi2() <
87 rhs.GetOverlapResult().GetInnerChi2() + rhs.GetOverlapResult().GetOuterChi2());
94 PANDORA_RETURN_RESULT_IF_AND_IF(
95 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinMatchedFraction",
m_minMatchedFraction));
97 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxEndPointChi2",
m_maxEndPointChi2));
99 return STATUS_CODE_SUCCESS;
std::vector< ProtoParticle > ProtoParticleVector
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
ThreeViewLongitudinalTracksAlgorithm class.
float m_maxEndPointChi2
The max chi2 of matched vertex and end points for particle creation.
std::vector< Element > ElementList
void FindMatchedTracks(const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
Find matched tracks, hidden by ambiguities in the tensor.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
pandora::ClusterList m_clusterList
List of 2D clusters in a 3D proto particle.
bool Run(ThreeViewLongitudinalTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
static bool SortByChiSquared(const TensorType::Element &lhs, const TensorType::Element &rhs)
Sort tensor elements by chi-squared.
void GetSortedKeyClusters(pandora::ClusterVector &sortedKeyClusters) const
Get a sorted vector of key clusters (U clusters with current implementation)
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
virtual bool CreateThreeDParticles(const ProtoParticleVector &protoParticleVector)
Create particles using findings from recent algorithm processing.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
BEGIN_PROLOG could also be cout
TheTensor::const_iterator const_iterator
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)