9 #include "Pandora/AlgorithmHeaders.h" 18 SimpleShowersTool::SimpleShowersTool() :
19 m_minMatchedFraction(0.2
f),
20 m_minMatchedSamplingPoints(40),
21 m_minXOverlapFraction(0.5
f)
29 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
30 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() << std::endl;
46 for (
const Cluster *
const pKeyCluster : sortedKeyClusters)
48 if (!pKeyCluster->IsAvailable())
51 unsigned int nU(0), nV(0), nW(0);
55 if (elementList.empty())
58 TensorType::Element bestElement(elementList.back());
60 if (!bestElement.GetOverlapResult().IsInitialized())
63 if ((NULL == bestElement.GetClusterU()) || (NULL == bestElement.GetClusterV()) || (NULL == bestElement.GetClusterW()))
67 protoParticle.
m_clusterList.push_back(bestElement.GetClusterU());
68 protoParticle.
m_clusterList.push_back(bestElement.GetClusterV());
69 protoParticle.
m_clusterList.push_back(bestElement.GetClusterW());
70 protoParticleVector.push_back(protoParticle);
86 const XOverlap &xOverlap(eIter->GetOverlapResult().GetXOverlap());
88 if ((xOverlap.GetXSpanU() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanU() >
m_minXOverlapFraction) &&
89 (xOverlap.GetXSpanV() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanV() >
m_minXOverlapFraction) &&
90 (xOverlap.GetXSpanW() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanW() >
m_minXOverlapFraction))
102 PANDORA_RETURN_RESULT_IF_AND_IF(
103 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinMatchedFraction",
m_minMatchedFraction));
105 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
108 PANDORA_RETURN_RESULT_IF_AND_IF(
109 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinXOverlapFraction",
m_minXOverlapFraction));
111 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)
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...
TheTensor::const_iterator const_iterator