9 #include "Pandora/AlgorithmHeaders.h"
18 SimpleShowersTool::SimpleShowersTool() : m_minMatchedFraction(0.2f), m_minMatchedSamplingPoints(40), m_minXOverlapFraction(0.5f)
26 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
27 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() << std::endl;
43 for (
const Cluster *
const pKeyCluster : sortedKeyClusters)
45 if (!pKeyCluster->IsAvailable())
48 unsigned int nU(0), nV(0), nW(0);
52 if (elementList.empty())
55 TensorType::Element bestElement(elementList.back());
57 if (!bestElement.GetOverlapResult().IsInitialized())
60 if ((NULL == bestElement.GetClusterU()) || (NULL == bestElement.GetClusterV()) || (NULL == bestElement.GetClusterW()))
64 protoParticle.
m_clusterList.push_back(bestElement.GetClusterU());
65 protoParticle.
m_clusterList.push_back(bestElement.GetClusterV());
66 protoParticle.
m_clusterList.push_back(bestElement.GetClusterW());
67 protoParticleVector.push_back(protoParticle);
83 const XOverlap &xOverlap(eIter->GetOverlapResult().GetXOverlap());
85 if ((xOverlap.GetXSpanU() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanU() >
m_minXOverlapFraction) &&
86 (xOverlap.GetXSpanV() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanV() >
m_minXOverlapFraction) &&
87 (xOverlap.GetXSpanW() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanW() >
m_minXOverlapFraction))
99 PANDORA_RETURN_RESULT_IF_AND_IF(
100 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinMatchedFraction",
m_minMatchedFraction));
102 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
105 PANDORA_RETURN_RESULT_IF_AND_IF(
106 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinXOverlapFraction",
m_minXOverlapFraction));
108 return STATUS_CODE_SUCCESS;
std::vector< ProtoParticle > ProtoParticleVector
void FindBestShower(const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
Find best shower match as a simple way to (try to) resolve ambiguities in the tensor.
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
ThreeViewShowersAlgorithm class.
bool Run(ThreeViewShowersAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
std::vector< Element > ElementList
pandora::ClusterList m_clusterList
List of 2D clusters in a 3D proto particle.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
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.
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.
bool PassesElementCuts(TensorType::ElementList::const_iterator eIter) const
Whether a provided (iterator to a) tensor element passes the selection cuts for particle creation...
BEGIN_PROLOG could also be cout
TheTensor::const_iterator const_iterator