9 #include "Pandora/AlgorithmHeaders.h" 18 LongTracksTool::LongTracksTool() :
19 m_minMatchedFraction(0.9
f),
20 m_minMatchedSamplingPoints(20),
21 m_minXOverlapFraction(0.9
f),
22 m_minMatchedSamplingPointRatio(2)
35 if (((*iIter)->GetClusterU() == (*iIter2)->GetClusterU()) || ((*iIter)->GetClusterV() == (*iIter2)->GetClusterV()) || ((*iIter)->GetClusterW() == (*iIter2)->GetClusterW()) )
45 const unsigned int minMatchedSamplingPointRatio,
const pandora::ClusterSet &usedClusters)
47 const unsigned int nMatchedSamplingPoints((*iIter)->GetOverlapResult().GetNMatchedSamplingPoints());
51 if ((*iIter) == eIter)
54 if (usedClusters.count(eIter->GetClusterU()) || usedClusters.count(eIter->GetClusterV()) || usedClusters.count(eIter->GetClusterW()))
57 if (((*iIter)->GetClusterU() != eIter->GetClusterU()) && ((*iIter)->GetClusterV() != eIter->GetClusterV()) && ((*iIter)->GetClusterW() != eIter->GetClusterW()))
60 if (nMatchedSamplingPoints < minMatchedSamplingPointRatio * eIter->GetOverlapResult().GetNMatchedSamplingPoints())
71 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
72 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() << std::endl;
85 ClusterSet usedClusters;
89 for (
const Cluster *
const pKeyCluster : sortedKeyClusters)
91 if (!pKeyCluster->IsAvailable())
94 unsigned int nU(0), nV(0), nW(0);
114 protoParticleVector.push_back(protoParticle);
116 usedClusters.insert((*iIter)->GetClusterU());
117 usedClusters.insert((*iIter)->GetClusterV());
118 usedClusters.insert((*iIter)->GetClusterW());
130 if (usedClusters.count(eIter->GetClusterU()) || usedClusters.count(eIter->GetClusterV()) || usedClusters.count(eIter->GetClusterW()))
139 const XOverlap &xOverlap(eIter->GetOverlapResult().GetXOverlap());
141 if ((xOverlap.GetXSpanU() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanU() >
m_minXOverlapFraction) &&
142 (xOverlap.GetXSpanV() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanV() >
m_minXOverlapFraction) &&
143 (xOverlap.GetXSpanW() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanW() >
m_minXOverlapFraction))
145 iteratorList.push_back(eIter);
154 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
157 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
160 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
163 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
166 return STATUS_CODE_SUCCESS;
std::vector< ProtoParticle > ProtoParticleVector
std::vector< TensorType::ElementList::const_iterator > IteratorList
virtual bool CreateThreeDParticles(const ProtoParticleVector &protoParticleVector)
Create particles using findings from recent algorithm processing.
static bool IsLongerThanDirectConnections(IteratorList::const_iterator iIter, const TensorType::ElementList &elementList, const unsigned int minMatchedSamplingPointRatio, const pandora::ClusterSet &usedClusters)
Whether a long element is significantly longer that other elements with which it shares a cluster...
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
unsigned int m_minMatchedSamplingPointRatio
The min ratio between 1st and 2nd highest msps for simple ambiguity resolution.
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.
pandora::ClusterList m_clusterListW
List of 2D W clusters in a 3D proto particle.
void FindLongTracks(const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
Find long tracks, hidden by simple ambiguities in the tensor.
std::vector< Element > ElementList
void SelectLongElements(const TensorType::ElementList &elementList, const pandora::ClusterSet &usedClusters, IteratorList &iteratorList) const
Select a list of long track-like elements from a set of connected tensor elements.
pandora::ClusterList m_clusterListV
List of 2D V clusters in a 3D proto particle.
pandora::ClusterList m_clusterListU
List of 2D U clusters in a 3D proto particle.
void GetSortedKeyClusters(pandora::ClusterVector &sortedKeyClusters) const
Get a sorted vector of key clusters (U clusters with current implementation)
std::vector< art::Ptr< recob::Cluster > > ClusterVector
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
static bool HasLongDirectConnections(IteratorList::const_iterator iIter, const IteratorList &iteratorList)
Whether a long element shares clusters with any other long elements.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
ThreeDTransverseTracksAlgorithm class.
TheTensor::const_iterator const_iterator
bool Run(ThreeDTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.