26 TwoDSlidingFitResult::TwoDSlidingFitResult(
const Cluster *
const pCluster,
const unsigned int layerFitHalfWindow,
const float layerPitch,
27 const float axisDeviationLimitForHitDivision) :
29 m_layerFitHalfWindow(layerFitHalfWindow),
30 m_layerPitch(layerPitch),
31 m_axisIntercept(0.
f, 0.
f, 0.
f),
32 m_axisDirection(0.
f, 0.
f, 0.
f),
33 m_orthoDirection(0.
f, 0.
f, 0.
f)
35 CartesianPointVector pointVector;
40 const CartesianVector xAxis(1.
f, 0.
f, 0.
f);
43 if (std::fabs(cosOpeningAngle) < axisDeviationLimitForHitDivision)
61 const float layerPitch,
const float ) :
79 const CartesianVector &axisIntercept,
const CartesianVector &axisDirection,
const CartesianVector &orthoDirection,
80 const float axisDeviationLimitForHitDivision) :
88 const CartesianVector xAxis(1.
f, 0.
f, 0.
f);
91 if (std::fabs(cosOpeningAngle) < axisDeviationLimitForHitDivision)
93 CartesianPointVector pointVector;
111 const float layerPitch,
const CartesianVector &axisIntercept,
const CartesianVector &axisDirection,
112 const CartesianVector &orthoDirection,
const float ) :
128 const CartesianVector &axisDirection,
const CartesianVector &orthoDirection,
const LayerFitContributionMap &layerFitContributionMap) :
146 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
163 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
173 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
182 if (
m_layerPitch < std::numeric_limits<float>::epsilon())
183 throw StatusCodeException(STATUS_CODE_FAILURE);
209 float pL(0.
f), pT(0.
f);
212 if (std::fabs(pL) < std::numeric_limits<float>::epsilon())
213 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
229 const float pL(1.
f / std::sqrt(1.
f + dTdL * dTdL));
230 const float pT(dTdL / std::sqrt(1.
f + dTdL * dTdL));
232 CartesianVector globalCoordinates(0.
f, 0.
f, 0.
f);
242 throw StatusCodeException(STATUS_CODE_FAILURE);
255 throw StatusCodeException(STATUS_CODE_FAILURE);
268 throw StatusCodeException(STATUS_CODE_FAILURE);
281 throw StatusCodeException(STATUS_CODE_FAILURE);
294 throw StatusCodeException(STATUS_CODE_FAILURE);
297 return iter->second.GetRms();
305 throw StatusCodeException(STATUS_CODE_FAILURE);
308 return iter->second.GetRms();
318 if (STATUS_CODE_SUCCESS != statusCode)
319 throw StatusCodeException(statusCode);
321 return this->
GetFitRms(layerInterpolation);
330 CartesianVector firstDirection(0.
f, 0.
f, 0.
f);
331 CartesianVector secondDirection(0.
f, 0.
f, 0.
f);
333 const StatusCode firstStatusCode(this->
GetGlobalFitDirection(rL - halfWindowLength, firstDirection));
334 const StatusCode secondStatusCode(this->
GetGlobalFitDirection(rL + halfWindowLength, secondDirection));
336 if (STATUS_CODE_SUCCESS != firstStatusCode)
337 throw StatusCodeException(firstStatusCode);
339 if (STATUS_CODE_SUCCESS != secondStatusCode)
340 throw StatusCodeException(secondStatusCode);
342 return firstDirection.GetDotProduct(secondDirection);
352 if (STATUS_CODE_SUCCESS != statusCode)
356 return STATUS_CODE_SUCCESS;
366 if (STATUS_CODE_SUCCESS != statusCode)
370 return STATUS_CODE_SUCCESS;
380 if (STATUS_CODE_SUCCESS != statusCode)
383 if (layerInterpolationList.size() != 1)
384 return STATUS_CODE_NOT_FOUND;
387 return STATUS_CODE_SUCCESS;
397 if (STATUS_CODE_SUCCESS != statusCode)
400 if (layerInterpolationList.size() != 1)
401 return STATUS_CODE_NOT_FOUND;
404 return STATUS_CODE_SUCCESS;
411 float rL(0.
f), rT(0.
f);
423 if (STATUS_CODE_SUCCESS != statusCode)
431 return STATUS_CODE_SUCCESS;
441 if (STATUS_CODE_SUCCESS != statusCode)
445 return STATUS_CODE_SUCCESS;
451 const float x,
const FitSegment &fitSegment, CartesianVector &position, CartesianVector &direction)
const 456 if (STATUS_CODE_SUCCESS != statusCode)
461 return STATUS_CODE_SUCCESS;
470 if (STATUS_CODE_NOT_FOUND != statusCode)
473 const int thisLayer(this->
GetLayer(rL));
477 if (thisLayer <= minLayer)
481 else if (thisLayer >= maxLayer)
487 return STATUS_CODE_FAILURE;
490 return STATUS_CODE_SUCCESS;
499 if (STATUS_CODE_NOT_FOUND != statusCode)
502 const int thisLayer(this->
GetLayer(rL));
506 if (thisLayer <= minLayer)
510 else if (thisLayer >= maxLayer)
516 return STATUS_CODE_FAILURE;
519 return STATUS_CODE_SUCCESS;
528 if (STATUS_CODE_NOT_FOUND != statusCode)
537 const int innerLayer((minLayerX < maxLayerX) ? minLayer : maxLayer);
538 const int outerLayer((minLayerX < maxLayerX) ? maxLayer : minLayer);
546 if (innerDirection.GetX() > -std::numeric_limits<float>::epsilon() || outerDirection.GetX() < +std::numeric_limits<float>::epsilon() ||
547 outerVertex.GetX() - innerVertex.GetX() < +std::numeric_limits<float>::epsilon())
549 return STATUS_CODE_NOT_FOUND;
551 else if (x >= outerVertex.GetX())
553 position = outerVertex + outerDirection * ((x - outerVertex.GetX()) / outerDirection.GetX());
555 else if (x <= innerVertex.GetX())
557 position = innerVertex + innerDirection * ((x - innerVertex.GetX()) / innerDirection.GetX());
561 return STATUS_CODE_NOT_FOUND;
565 return STATUS_CODE_SUCCESS;
582 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
590 if (coordinateVector.size() < 2)
591 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
593 CartesianVector centroid(0.
f, 0.
f, 0.
f);
599 CartesianVector fitDirection(eigenVecs.at(0));
602 if (fitDirection.GetZ() < 0.f)
603 fitDirection *= -1.
f;
605 for (
const CartesianVector &coordinate : coordinateVector)
606 minProjection =
std::min(minProjection, fitDirection.GetDotProduct(coordinate - centroid));
609 const float fitProjection(layerPitch * std::floor(minProjection / layerPitch));
615 CartesianVector yAxis(0.
f, 1.
f, 0.
f);
623 if (
m_layerPitch < std::numeric_limits<float>::epsilon())
624 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
626 if ((
m_axisDirection.GetMagnitudeSquared() < std::numeric_limits<float>::epsilon()) ||
627 (
m_orthoDirection.GetMagnitudeSquared() < std::numeric_limits<float>::epsilon()))
628 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
631 throw StatusCodeException(STATUS_CODE_FAILURE);
635 float rL(0.
f), rT(0.
f);
646 throw StatusCodeException(STATUS_CODE_FAILURE);
649 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
651 unsigned int slidingNPoints(0);
652 double slidingSumT(0.), slidingSumL(0.), slidingSumTT(0.), slidingSumLT(0.), slidingSumLL(0.);
655 const int innerLayer(layerFitContributionMap.begin()->first);
658 for (
int iLayer = innerLayer; iLayer < innerLayer + layerFitHalfWindow; ++iLayer)
662 if (layerFitContributionMap.end() != lyrIter)
664 slidingSumT += lyrIter->second.GetSumT();
665 slidingSumL += lyrIter->second.GetSumL();
666 slidingSumTT += lyrIter->second.GetSumTT();
667 slidingSumLT += lyrIter->second.GetSumLT();
668 slidingSumLL += lyrIter->second.GetSumLL();
669 slidingNPoints += lyrIter->second.GetNPoints();
673 const int outerLayer(layerFitContributionMap.rbegin()->first);
675 for (
int iLayer = innerLayer; iLayer <= outerLayer; ++iLayer)
677 const int fwdLayer(iLayer + layerFitHalfWindow);
680 if (layerFitContributionMap.end() != fwdIter)
682 slidingSumT += fwdIter->second.GetSumT();
683 slidingSumL += fwdIter->second.GetSumL();
684 slidingSumTT += fwdIter->second.GetSumTT();
685 slidingSumLT += fwdIter->second.GetSumLT();
686 slidingSumLL += fwdIter->second.GetSumLL();
687 slidingNPoints += fwdIter->second.GetNPoints();
690 const int bwdLayer(iLayer - layerFitHalfWindow - 1);
693 if (layerFitContributionMap.end() != bwdIter)
695 slidingSumT -= bwdIter->second.GetSumT();
696 slidingSumL -= bwdIter->second.GetSumL();
697 slidingSumTT -= bwdIter->second.GetSumTT();
698 slidingSumLT -= bwdIter->second.GetSumLT();
699 slidingSumLL -= bwdIter->second.GetSumLL();
700 slidingNPoints -= bwdIter->second.GetNPoints();
704 if (slidingNPoints <= 2)
708 if (layerFitContributionMap.end() == layerFitContributionMap.find(iLayer))
711 const double denominator(slidingSumLL - slidingSumL * slidingSumL / static_cast<double>(slidingNPoints));
713 if (std::fabs(denominator) < std::numeric_limits<float>::epsilon())
716 const double gradient((slidingSumLT - slidingSumL * slidingSumT / static_cast<double>(slidingNPoints)) / denominator);
717 const double intercept(
718 (slidingSumLL * slidingSumT / static_cast<double>(slidingNPoints) - slidingSumL * slidingSumLT / static_cast<double>(slidingNPoints)) / denominator);
719 double variance((slidingSumTT - 2. * intercept * slidingSumT - 2. * gradient * slidingSumLT +
720 intercept * intercept * static_cast<double>(slidingNPoints) + 2. * gradient * intercept * slidingSumL +
721 gradient * gradient * slidingSumLL) /
722 (1. + gradient * gradient));
724 if (variance < -std::numeric_limits<float>::epsilon())
727 if (variance < std::numeric_limits<float>::epsilon())
730 const double rms(std::sqrt(variance / static_cast<double>(slidingNPoints)));
731 const double l(this->
GetL(iLayer));
732 const double fitT(intercept + gradient * l);
739 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
747 throw StatusCodeException(STATUS_CODE_FAILURE);
749 unsigned int nSustainedSteps(0);
750 float sustainedDirectionStartX(0.
f), sustainedDirectionEndX(0.
f);
752 CartesianVector previousPosition(0.
f, 0.
f, 0.
f);
766 if (previousDirection == currentDirection)
770 if (nSustainedSteps > 2)
772 sustainedDirection = currentDirection;
773 sustainedDirectionEndIter = iter;
774 sustainedDirectionEndX = position.GetX();
779 if ((
POSITIVE_IN_X == sustainedDirection) || (NEGATIVE_IN_X == sustainedDirection))
781 sustainedDirectionStartIter->first, sustainedDirectionEndIter->first, sustainedDirectionStartX, sustainedDirectionEndX));
785 sustainedDirectionStartIter = iter;
786 sustainedDirectionStartX = position.GetX();
790 previousDirection = currentDirection;
795 FitSegment(sustainedDirectionStartIter->first, sustainedDirectionEndIter->first, sustainedDirectionStartX, sustainedDirectionEndX));
803 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
810 CartesianVector globalPosition(0.
f, 0.
f, 0.
f);
811 this->
GetGlobalPosition(iter->second.GetL(), iter->second.GetFitT(), globalPosition);
812 const float coordinate(isX ? globalPosition.GetX() : globalPosition.GetZ());
829 throw StatusCodeException(STATUS_CODE_FAILURE);
831 CartesianVector firstLayerPosition(0.
f, 0.
f, 0.
f);
832 this->
GetGlobalPosition(firstLayerIter->second.GetL(), firstLayerIter->second.GetFitT(), firstLayerPosition);
834 if (firstLayerIter == secondLayerIter)
835 return firstLayerPosition;
837 CartesianVector secondLayerPosition(0.
f, 0.
f, 0.
f);
838 this->
GetGlobalPosition(secondLayerIter->second.GetL(), secondLayerIter->second.GetFitT(), secondLayerPosition);
840 if (firstWeight + secondWeight < std::numeric_limits<float>::epsilon())
841 throw StatusCodeException(STATUS_CODE_FAILURE);
843 return ((firstLayerPosition * firstWeight + secondLayerPosition * secondWeight) * (1.f / (firstWeight + secondWeight)));
857 throw StatusCodeException(STATUS_CODE_FAILURE);
859 CartesianVector firstLayerDirection(0.
f, 0.
f, 0.
f);
862 if (firstLayerIter == secondLayerIter)
863 return firstLayerDirection;
865 CartesianVector secondLayerDirection(0.
f, 0.
f, 0.
f);
866 this->
GetGlobalDirection(secondLayerIter->second.GetGradient(), secondLayerDirection);
868 if (firstWeight + secondWeight < std::numeric_limits<float>::epsilon())
869 throw StatusCodeException(STATUS_CODE_FAILURE);
871 return ((firstLayerDirection * firstWeight + secondLayerDirection * secondWeight).GetUnitVector());
885 throw StatusCodeException(STATUS_CODE_FAILURE);
887 const float firstLayerRms(firstLayerIter->second.GetRms());
889 if (firstLayerIter == secondLayerIter)
890 return firstLayerRms;
892 const float secondLayerRms(secondLayerIter->second.GetRms());
894 if (firstWeight + secondWeight < std::numeric_limits<float>::epsilon())
895 throw StatusCodeException(STATUS_CODE_FAILURE);
897 return ((firstLayerRms * firstWeight + secondLayerRms * secondWeight) / (firstWeight + secondWeight));
904 double firstWeight(0.), secondWeight(0.);
909 if (STATUS_CODE_SUCCESS != statusCode)
913 layerInterpolation =
LayerInterpolation(firstLayerIter, secondLayerIter, firstWeight, secondWeight);
915 return STATUS_CODE_SUCCESS;
922 double firstWeight(0.), secondWeight(0.);
925 const StatusCode statusCode(
928 if (STATUS_CODE_SUCCESS != statusCode)
932 layerInterpolation =
LayerInterpolation(firstLayerIter, secondLayerIter, firstWeight, secondWeight);
934 return STATUS_CODE_SUCCESS;
946 if (STATUS_CODE_SUCCESS == statusCode)
948 layerInterpolationList.push_back(layerInterpolation);
950 else if (STATUS_CODE_NOT_FOUND != statusCode)
956 return STATUS_CODE_SUCCESS;
965 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
969 const int thisLayer(this->
GetLayer(rL));
972 if (minLayer == thisLayer && thisLayer == maxLayer)
976 return STATUS_CODE_SUCCESS;
980 const int startLayer((thisLayer >= maxLayer) ? thisLayer - 1 : thisLayer);
982 if ((startLayer < minLayer) || (startLayer >= maxLayer))
983 return STATUS_CODE_NOT_FOUND;
988 for (
int iLayer = startLayer; iLayer >= minLayer; --iLayer)
997 return STATUS_CODE_NOT_FOUND;
1002 for (
int iLayer = startLayer + 1; iLayer <= maxLayer; ++iLayer)
1011 return STATUS_CODE_NOT_FOUND;
1013 return STATUS_CODE_SUCCESS;
1022 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
1026 throw StatusCodeException(STATUS_CODE_FAILURE);
1030 throw StatusCodeException(STATUS_CODE_FAILURE);
1032 CartesianVector minPosition(0.
f, 0.
f, 0.
f), maxPosition(0.
f, 0.
f, 0.
f);
1033 this->
GetGlobalPosition(minLayerIter->second.GetL(), minLayerIter->second.GetFitT(), minPosition);
1034 this->
GetGlobalPosition(maxLayerIter->second.GetL(), maxLayerIter->second.GetFitT(), maxPosition);
1036 if ((std::fabs(maxPosition.GetX() - minPosition.GetX()) < std::numeric_limits<float>::epsilon()))
1037 return STATUS_CODE_NOT_FOUND;
1040 const float minL(minLayerIter->second.GetL());
1041 const float maxL(maxLayerIter->second.GetL());
1042 const float startL(minL + (maxL - minL) * (x - minPosition.GetX()) / (maxPosition.GetX() - minPosition.GetX()));
1047 CartesianVector startLayerPosition(0.
f, 0.
f, 0.
f);
1049 for (
int iLayer = startLayer; iLayer <= maxLayer; ++iLayer)
1058 return STATUS_CODE_NOT_FOUND;
1060 this->
GetGlobalPosition(startLayerIter->second.GetL(), startLayerIter->second.GetFitT(), startLayerPosition);
1062 const bool startIsAhead((startLayerPosition.GetX() -
x) > std::numeric_limits<float>::epsilon());
1063 const bool increasesWithLayers(maxPosition.GetX() > minPosition.GetX());
1064 const int increment = ((startIsAhead == increasesWithLayers) ? -1 : +1);
1072 CartesianVector firstLayerPosition(0.
f, 0.
f, 0.
f);
1073 CartesianVector secondLayerPosition(0.
f, 0.
f, 0.
f);
1075 for (
int iLayer = startLayerIter->first; (iLayer >= minLayer) && (iLayer <= maxLayer); iLayer += increment)
1081 firstLayerIter = secondLayerIter;
1082 firstLayerPosition = secondLayerPosition;
1083 secondLayerIter = tempIter;
1085 this->
GetGlobalPosition(secondLayerIter->second.GetL(), secondLayerIter->second.GetFitT(), secondLayerPosition);
1086 const bool isAhead(secondLayerPosition.GetX() >
x);
1088 if (startIsAhead != isAhead)
1095 return STATUS_CODE_NOT_FOUND;
1097 return STATUS_CODE_SUCCESS;
1106 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
1108 const double deltaL(rL - firstLayerIter->second.GetL());
1109 const double deltaLLayers(secondLayerIter->second.GetL() - firstLayerIter->second.GetL());
1111 if (std::fabs(deltaLLayers) > std::numeric_limits<float>::epsilon())
1113 firstWeight = 1. - deltaL / deltaLLayers;
1114 secondWeight = deltaL / deltaLLayers;
1129 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
1131 CartesianVector firstLayerPosition(0.
f, 0.
f, 0.
f);
1132 CartesianVector secondLayerPosition(0.
f, 0.
f, 0.
f);
1134 this->
GetGlobalPosition(firstLayerIter->second.GetL(), firstLayerIter->second.GetFitT(), firstLayerPosition);
1135 this->
GetGlobalPosition(secondLayerIter->second.GetL(), secondLayerIter->second.GetFitT(), secondLayerPosition);
1137 const double deltaP(x - firstLayerPosition.GetX());
1138 const double deltaPLayers(secondLayerPosition.GetX() - firstLayerPosition.GetX());
1140 if (std::fabs(deltaPLayers) > std::numeric_limits<float>::epsilon())
1142 firstWeight = 1. - deltaP / deltaPLayers;
1143 secondWeight = deltaP / deltaPLayers;
void FillLayerFitContributionMap(const pandora::CartesianPointVector &coordinateVector)
Fill the layer fit contribution map.
unsigned int GetLayerFitHalfWindow() const
Get the layer fit half window.
void GetMinAndMaxCoordinate(const bool isX, float &min, float &max) const
Get the minimum and maximum x or z coordinates associated with the sliding fit.
TwoDSlidingFitResult(const T *const pT, const unsigned int layerFitHalfWindow, const float layerPitch, const float axisDeviationLimitForHitDivision=0.95f)
Constructor using internal definition of primary axis.
pandora::CartesianVector m_axisIntercept
The axis intercept position.
int GetStartLayer() const
Get start layer.
void GetTransverseInterpolationWeights(const float x, const LayerFitResultMap::const_iterator &firstLayerIter, const LayerFitResultMap::const_iterator &secondLayerIter, double &firstWeight, double &secondWeight) const
Get interpolation weights for layers surrounding a specified transverse position. ...
pandora::StatusCode GetTransverseSurroundingLayers(const float x, const int minLayer, const int maxLayer, LayerFitResultMap::const_iterator &firstLayerIter, LayerFitResultMap::const_iterator &secondLayerIter) const
Get iterators for layers surrounding a specified transverse position.
Header file for the lar hit width helper class.
const pandora::Cluster * m_pCluster
The address of the cluster.
double GetEndLayerWeight() const
Get the end layer weight.
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
TransverseDirection
TransverseDirection enum.
void FindSlidingFitSegments()
Find sliding fit segments; sections with tramsverse direction.
pandora::StatusCode GetExtrapolatedPositionAtX(const float x, pandora::CartesianVector &position) const
Get extrapolated position (beyond span) for a given input x coordinate.
pandora::CartesianVector EigenValues
void GetLocalDirection(const pandora::CartesianVector &direction, float &dTdL) const
Get local sliding fit gradient for a given global direction.
float GetMaxLayerRms() const
Get rms at maximum layer.
pandora::CartesianVector m_axisDirection
The axis direction vector.
void GetLongitudinalInterpolationWeights(const float rL, const LayerFitResultMap::const_iterator &firstLayerIter, const LayerFitResultMap::const_iterator &secondLayerIter, double &firstWeight, double &secondWeight) const
Get interpolation weights for layers surrounding a specified longitudinal position.
static ConstituentHitVector GetConstituentHits(const pandora::Cluster *const pCluster, const float maxConstituentHitWidth, const float hitWidthScalingFactor, const bool isUniform)
Break up the cluster hits into constituent hits.
float GetLayerFitHalfWindowLength() const
Get the layer fit half window length.
Header file for the principal curve analysis helper class.
pandora::StatusCode LongitudinalInterpolation(const float rL, LayerInterpolation &layerInterpolation) const
Get the pair of layers surrounding a specified longitudinal position.
pandora::CartesianVector GetGlobalMinLayerDirection() const
Get global direction corresponding to the fit result in minimum fit layer.
pandora::StatusCode GetLongitudinalSurroundingLayers(const float rL, LayerFitResultMap::const_iterator &firstLayerIter, LayerFitResultMap::const_iterator &secondLayerIter) const
Get iterators for layers surrounding the specified longitudinal position.
std::map< int, LayerFitContribution > LayerFitContributionMap
float GetCosScatteringAngle(const float rL) const
Get scattering angle for a given longitudinal coordinate.
Header file for the geometry helper class.
unsigned int m_layerFitHalfWindow
The layer fit half window.
int GetMaxLayer() const
Get the maximum occupied layer in the sliding fit.
LayerFitResultMap::const_iterator GetEndLayerIter() const
Get the end layer iterator.
int GetMinLayer() const
Get the minimum occupied layer in the sliding fit.
Header file for the cluster helper class.
float GetFitRms(const float rL) const
Get fit rms for a given longitudinal coordinate.
pandora::StatusCode GetGlobalFitPosition(const float rL, pandora::CartesianVector &position) const
Get global fit position for a given longitudinal coordinate.
double GetStartLayerWeight() const
Get the start layer weight.
std::vector< ConstituentHit > ConstituentHitVector
Header file for the lar two dimensional sliding fit result class.
pandora::StatusCode TransverseInterpolation(const float x, const FitSegment &fitSegment, LayerInterpolation &layerInterpolation) const
Get the surrounding pair of layers for a specified transverse position and fit segment.
pandora::StatusCode GetExtrapolatedPosition(const float rL, pandora::CartesianVector &position) const
Get extrapolated position (beyond span) for a given input coordinate.
std::map< int, LayerFitResult > LayerFitResultMap
static pandora::CartesianPointVector GetConstituentHitPositionVector(const ConstituentHitVector &constituentHitVector)
Obtain a vector of the contituent hit central positions.
void CalculateAxes(const pandora::CartesianPointVector &coordinateVector, const float layerPitch)
Calculate the longitudinal and transverse axes.
const FitSegment & GetFitSegment(const float rL) const
Get fit segment for a given longitudinal coordinate.
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
static int max(int a, int b)
pandora::StatusCode GetExtrapolatedDirection(const float rL, pandora::CartesianVector &direction) const
Get extrapolated direction (beyond span) for a given input coordinate.
std::vector< LayerInterpolation > LayerInterpolationList
void GetGlobalDirection(const float dTdL, pandora::CartesianVector &direction) const
Get global direction coordinates for given sliding linear fit gradient.
const LayerFitResultMap & GetLayerFitResultMap() const
Get the layer fit result map.
float GetMinLayerRms() const
Get rms at minimum layer.
static void RunPca(const T &t, pandora::CartesianVector ¢roid, EigenValues &outputEigenValues, EigenVectors &outputEigenVectors)
Run principal component analysis using input calo hits (TPC_VIEW_U,V,W or TPC_3D; all treated as 3D p...
const pandora::Cluster * GetCluster() const
Get the address of the cluster, if originally provided.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
pandora::StatusCode GetGlobalFitPositionAtX(const float x, pandora::CartesianVector &position) const
Get global fit position for a given input x coordinate.
pandora::StatusCode GetGlobalFitDirection(const float rL, pandora::CartesianVector &direction) const
Get global fit direction for a given longitudinal coordinate.
std::vector< pandora::CartesianVector > EigenVectors
LayerInterpolation class.
pandora::StatusCode GetGlobalFitProjection(const pandora::CartesianVector &inputPosition, pandora::CartesianVector &projectedPosition) const
Get projected position on global fit for a given position vector.
void PerformSlidingLinearFit()
Perform the sliding linear fit.
void GetGlobalPosition(const float rL, const float rT, pandora::CartesianVector &position) const
Get global coordinates for given sliding linear fit coordinates.
FitSegmentList m_fitSegmentList
The fit segment list.
pandora::CartesianVector GetGlobalMaxLayerDirection() const
Get global direction corresponding to the fit result in maximum fit layer.
float GetL(const int layer) const
Get longitudinal coordinate for a given sliding linear fit layer number.
LayerFitContributionMap m_layerFitContributionMap
The layer fit contribution map.
pandora::StatusCode GetGlobalFitDirectionAtX(const float x, pandora::CartesianVector &direction) const
Get global fit direction for a given input x coordinate.
pandora::StatusCode GetTransverseProjection(const float x, const FitSegment &fitSegment, pandora::CartesianVector &position) const
Get projected position for a given input x coordinate and fit segment.
static void GetCoordinateVector(const pandora::Cluster *const pCluster, pandora::CartesianPointVector &coordinateVector)
Get vector of hit coordinates from an input cluster.
LayerFitResultMap::const_iterator GetStartLayerIter() const
Get the start layer iterator.
float m_layerPitch
The layer pitch, units cm.
pandora::StatusCode GetGlobalFitPositionListAtX(const float x, pandora::CartesianPointVector &positionList) const
Get a list of projected positions for a given input x coordinate.
const LayerFitContributionMap & GetLayerFitContributionMap() const
Get the layer fit contribution map.
LayerFitResultMap m_layerFitResultMap
The layer fit result map.
int GetEndLayer() const
Get end layer.
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
pandora::CartesianVector m_orthoDirection
The orthogonal direction vector.
pandora::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
int GetLayer(const float rL) const
Get layer number for given sliding linear fit longitudinal coordinate.