Whether a provided tensor element can be used to construct a pfo.
139 const Particle particle(
element);
141 if (usedClusters.count(particle.m_pLongCluster) || usedClusters.count(particle.m_pCluster1) || usedClusters.count(particle.m_pCluster2))
144 const float longXSpan(particle.m_longMaxX - particle.m_longMinX);
146 if (longXSpan < std::numeric_limits<float>::epsilon())
149 const float splitX(isMinX ? (0.5f * (particle.m_short1MinX + particle.m_short2MinX)) : (0.5f * (particle.m_short1MaxX + particle.m_short2MaxX)));
150 const float shortDeltaX(
151 isMinX ? std::fabs(particle.m_short1MinX - particle.m_short2MinX) : std::fabs(particle.m_short1MaxX - particle.m_short2MaxX));
152 const float longDeltaX(isMinX ? (splitX - particle.m_longMinX) : (particle.m_longMaxX - splitX));
160 const LArPointingCluster pointingCluster1(pAlgorithm->GetCachedSlidingFitResult(particle.m_pCluster1));
161 const LArPointingCluster pointingCluster2(pAlgorithm->GetCachedSlidingFitResult(particle.m_pCluster2));
162 const LArPointingCluster longPointingCluster(pAlgorithm->GetCachedSlidingFitResult(particle.m_pLongCluster));
164 const CartesianVector &minPos1{
165 pointingCluster1.GetInnerVertex().GetPosition().GetX() < pointingCluster1.GetOuterVertex().GetPosition().GetX()
166 ? pointingCluster1.GetInnerVertex().GetPosition()
167 : pointingCluster1.GetOuterVertex().GetPosition()};
168 const CartesianVector &minPos2{
169 pointingCluster2.GetInnerVertex().GetPosition().GetX() < pointingCluster2.GetOuterVertex().GetPosition().GetX()
170 ? pointingCluster2.GetInnerVertex().GetPosition()
171 : pointingCluster2.GetOuterVertex().GetPosition()};
172 const CartesianVector &maxPos1{
173 pointingCluster1.GetInnerVertex().GetPosition().GetX() > pointingCluster1.GetOuterVertex().GetPosition().GetX()
174 ? pointingCluster1.GetInnerVertex().GetPosition()
175 : pointingCluster1.GetOuterVertex().GetPosition()};
176 const CartesianVector &maxPos2{
177 pointingCluster2.GetInnerVertex().GetPosition().GetX() > pointingCluster2.GetOuterVertex().GetPosition().GetX()
178 ? pointingCluster2.GetInnerVertex().GetPosition()
179 : pointingCluster2.GetOuterVertex().GetPosition()};
180 const CartesianVector position1(isMinX ? minPos1 : maxPos1);
181 const CartesianVector position2(isMinX ? minPos2 : maxPos2);
183 CartesianVector splitPosition(0.f, 0.f, 0.f);
184 float chiSquared(std::numeric_limits<float>::max());
188 if (!this->
CheckSplitPosition(splitPosition, splitX, pAlgorithm->GetCachedSlidingFitResult(particle.m_pLongCluster)))
191 const CartesianVector splitToInnerVertex(splitPosition - longPointingCluster.GetInnerVertex().GetPosition());
192 const CartesianVector outerVertexToSplit(longPointingCluster.GetOuterVertex().GetPosition() - splitPosition);
193 const CartesianVector outerToInnerUnitVector(
194 (longPointingCluster.GetOuterVertex().GetPosition() - longPointingCluster.GetInnerVertex().GetPosition()).GetUnitVector());
199 splitPositionMap[particle.m_pLongCluster].push_back(splitPosition);
203 catch (StatusCodeException &)
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...
float m_minSplitToVertexProjection
Min projected distance between split position and either inner or outer vertex of long cluster...
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
float m_maxAbsoluteShortDeltaX
Max x distance between ends of two short clusters (measured as an absolute distance) ...
float m_minAbsoluteLongDeltaX
Min x distance between ends of short and long clusters (measured as an absolute distance) ...
float m_maxShortDeltaXFraction
Max x distance between ends of two short clusters (measured as fraction of long cluster x length) ...
float m_minLongDeltaXFraction
Min x distance between ends of short and long clusters (measured as fraction of long cluster x length...
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).