24 m_minMatchedFraction(0.75f),
25 m_minMatchedSamplingPoints(10),
26 m_minXOverlapFraction(0.75f),
27 m_minMatchedSamplingPointRatio(2),
28 m_maxShortDeltaXFraction(0.2f),
29 m_maxAbsoluteShortDeltaX(5.f),
30 m_minLongDeltaXFraction(0.2f),
31 m_minAbsoluteLongDeltaX(1.f),
32 m_minSplitToVertexProjection(1.f),
33 m_maxSplitVsFitPositionDistance(1.5f)
42 std::cout <<
"----> Running Algorithm Tool: " << this->
GetInstanceName() <<
", " << this->
GetType() << std::endl;
45 this->
FindTracks(pAlgorithm, overlapTensor, splitPositionMap);
58 overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
60 for (
const Cluster *
const pKeyCluster : sortedKeyClusters)
62 if (!pKeyCluster->IsAvailable())
65 unsigned int nU(0), nV(0), nW(0);
66 TensorType::ElementList elementList;
67 overlapTensor.GetConnectedElements(pKeyCluster,
true, elementList, nU, nV, nW);
72 for (IteratorList::const_iterator iIter = iteratorList.begin(), iIterEnd = iteratorList.end(); iIter != iIterEnd; ++iIter)
80 if (!this->
PassesChecks(pAlgorithm, *(*iIter),
true, usedClusters, splitPositionMap) &&
81 !this->
PassesChecks(pAlgorithm, *(*iIter),
false, usedClusters, splitPositionMap))
86 usedClusters.insert((*iIter)->GetClusterU());
87 usedClusters.insert((*iIter)->GetClusterV());
88 usedClusters.insert((*iIter)->GetClusterW());
97 for (TensorType::ElementList::const_iterator eIter = elementList.begin(); eIter != elementList.end(); ++eIter)
99 if (usedClusters.count(eIter->GetClusterU()) || usedClusters.count(eIter->GetClusterV()) || usedClusters.count(eIter->GetClusterW()))
108 const XOverlap &xOverlap(eIter->GetOverlapResult().GetXOverlap());
111 const float shortSpan2(
116 if ((shortSpan1 < std::numeric_limits<float>::epsilon()) || (longSpan < std::numeric_limits<float>::epsilon()))
128 iteratorList.push_back(eIter);
146 if (longXSpan < std::numeric_limits<float>::epsilon())
150 const float shortDeltaX(
152 const float longDeltaX(isMinX ? (splitX - particle.
m_longMinX) : (particle.
m_longMaxX - splitX));
184 float chiSquared(std::numeric_limits<float>::max());
199 splitPositionMap[particle.
m_pLongCluster].push_back(splitPosition);
218 for (CartesianPointVector::const_iterator iter = fitPositionList.begin(), iterEnd = fitPositionList.end(); iter != iterEnd; ++iter)
232 const XOverlap &xOverlap(element.GetOverlapResult().GetXOverlap());
245 (
TPC_VIEW_U == longHitType) ? element.GetClusterU() : (
TPC_VIEW_V == longHitType) ? element.GetClusterV() : element.GetClusterW();
291 return STATUS_CODE_SUCCESS;
Header file for the cluster helper class.
Header file for the geometry helper class.
Header file for the lar pointing cluster class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
static const pandora::PandoraSettings * GetSettings(const pandora::Algorithm &algorithm)
Get the pandora settings instance.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static float MergeTwoPositions(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const float position1, const float position2)
Merge two views (U,V) to give a third view (Z).
const pandora::CartesianVector & GetPosition() const
Get the vertex position.
LArPointingCluster class.
const Vertex & GetInnerVertex() const
Get the inner vertex.
const Vertex & GetOuterVertex() const
Get the outer vertex.
static bool HasLongDirectConnections(IteratorList::const_iterator iIter, const IteratorList &iteratorList)
Whether a long element shares clusters with any other long elements.
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.
virtual bool MakeClusterSplits(const SplitPositionMap &splitPositionMap)
Make cluster splits.
const TwoDSlidingFitResult & GetCachedSlidingFitResult(const pandora::Cluster *const pCluster) const
Get a sliding fit result from the algorithm cache.
ThreeViewTransverseTracksAlgorithm class.
const pandora::Cluster * m_pCluster1
Address of short cluster in view 1.
const pandora::Cluster * m_pCluster2
Address of short cluster in view 2.
float m_short2MinX
The min x coordinate of short cluster 2.
float m_short2MaxX
The max x coordinate of short cluster 2.
float m_short1MaxX
The max x coordinate of short cluster 1.
float m_short1MinX
The min x coordinate of short cluster 1.
float m_longMaxX
The max x coordinate of the long cluster.
float m_longMinX
The min x coordinate of the long cluster.
const pandora::Cluster * m_pLongCluster
Address of the long cluster.
Particle(const TensorType::Element &element)
Constructor.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
unsigned int m_minMatchedSamplingPointRatio
The min ratio between 1st and 2nd highest msps for simple ambiguity resolution.
float m_maxShortDeltaXFraction
Max x distance between ends of two short clusters (measured as fraction of long cluster x length)
float m_minXOverlapFraction
The min x overlap fraction (between long clusters and short cluster vs. shared overlap)
void FindTracks(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const TensorType &overlapTensor, SplitPositionMap &splitPositionMap) const
Find remaining tracks, hidden by spurious track segments (and maybe other ambiguities) in the tensor.
float m_minAbsoluteLongDeltaX
Min x distance between ends of short and long clusters (measured as an absolute distance)
float m_minSplitToVertexProjection
Min projected distance between split position and either inner or outer vertex of long cluster.
float m_minLongDeltaXFraction
Min x distance between ends of short and long clusters (measured as fraction of long cluster x length...
float m_maxAbsoluteShortDeltaX
Max x distance between ends of two short clusters (measured as an absolute distance)
bool PassesChecks(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const TensorType::Element &element, const bool isMinX, pandora::ClusterSet &usedClusters, SplitPositionMap &splitPositionMap) const
Whether a provided tensor element can be used to construct a pfo.
float m_maxSplitVsFitPositionDistance
Max allowed distance between split position and sliding linear fit position at the split x coordinate...
bool CheckSplitPosition(const pandora::CartesianVector &splitPosition, const float splitX, const TwoDSlidingFitResult &longFitResult) const
Check a candidate split position for consistency with the associated track cluster sliding linear fit...
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
bool Run(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
void SelectElements(const TensorType::ElementList &elementList, const pandora::ClusterSet &usedClusters, IteratorList &iteratorList) const
Select a list of the relevant elements from a set of connected tensor elements.
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
TrackSplittingTool()
Default constructor.
ThreeViewTransverseTracksAlgorithm::MatchingType::TensorType TensorType
std::vector< TensorType::ElementList::const_iterator > IteratorList
TwoDSlidingFitResult class.
pandora::StatusCode GetGlobalFitPositionListAtX(const float x, pandora::CartesianPointVector &positionList) const
Get a list of projected positions for a given input x coordinate.
float GetUMinX() const
Get the min x value in the u view.
float GetXSpanV() const
Get the x span in the v view.
float GetWMaxX() const
Get the max x value in the w view.
float GetXOverlapSpan() const
Get the x overlap span.
float GetWMinX() const
Get the min x value in the w view.
float GetVMinX() const
Get the min x value in the v view.
float GetXSpanW() const
Get the x span in the w view.
float GetUMaxX() const
Get the max x value in the u view.
float GetVMaxX() const
Get the max x value in the v view.
float GetXSpanU() const
Get the x span in the u view.
float GetX() const
Get the cartesian x coordinate.
float GetDotProduct(const CartesianVector &rhs) const
Get the dot product of the cartesian vector with a second cartesian vector.
bool ShouldDisplayAlgorithmInfo() const
Whether to display algorithm information during processing.
const std::string & GetType() const
Get the type.
const Pandora & GetPandora() const
Get the associated pandora instance.
const std::string & GetInstanceName() const
Get the instance name.
StatusCodeException class.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
std::unordered_map< const pandora::Cluster *, pandora::CartesianPointVector > SplitPositionMap
HitType
Calorimeter hit type enum.
std::vector< const Cluster * > ClusterVector
std::vector< CartesianVector > CartesianPointVector
std::unordered_set< const Cluster * > ClusterSet
StatusCode
The StatusCode enum.