30 m_axisIntercept(m_primaryAxis.GetPosition()),
31 m_axisDirection(m_primaryAxis.GetMomentum()),
32 m_firstOrthoDirection(
ThreeDSlidingFitResult::GetSeedDirection(m_axisDirection).GetCrossProduct(m_axisDirection).GetUnitVector()),
33 m_secondOrthoDirection(m_axisDirection.GetCrossProduct(m_firstOrthoDirection).GetUnitVector()),
34 m_firstFitResult(
TwoDSlidingFitResult(pT, layerWindow, layerPitch, m_axisIntercept, m_axisDirection, m_firstOrthoDirection)),
35 m_secondFitResult(
TwoDSlidingFitResult(pT, layerWindow, layerPitch, m_axisIntercept, m_axisDirection, m_secondOrthoDirection)),
36 m_minLayer(std::max(m_firstFitResult.GetMinLayer(), m_secondFitResult.GetMinLayer())),
37 m_maxLayer(std::min(m_firstFitResult.GetMaxLayer(), m_secondFitResult.GetMaxLayer())),
38 m_minLayerPosition(0.f, 0.f, 0.f),
39 m_maxLayerPosition(0.f, 0.f, 0.f),
40 m_minLayerDirection(0.f, 0.f, 0.f),
41 m_maxLayerDirection(0.f, 0.f, 0.f)
69 return std::min(firstLayer, secondLayer);
79 return std::max(firstLayer, secondLayer);
89 return std::sqrt(firstRms * firstRms + secondRms * secondRms);
99 return std::sqrt(firstRms * firstRms + secondRms * secondRms);
109 return std::sqrt(firstRms * firstRms + secondRms * secondRms);
128 return STATUS_CODE_INVALID_PARAMETER;
131 CartesianVector firstPosition(0.f, 0.f, 0.f), secondPosition(0.f, 0.f, 0.f);
134 if (STATUS_CODE_SUCCESS != statusCode1)
139 if (STATUS_CODE_SUCCESS != statusCode2)
142 float rL1(0.f), rT1(0.f), rL2(0.f), rT2(0.f);
149 return STATUS_CODE_SUCCESS;
161 return STATUS_CODE_INVALID_PARAMETER;
164 CartesianVector firstDirection(0.f, 0.f, 0.f), secondDirection(0.f, 0.f, 0.f);
167 if (STATUS_CODE_SUCCESS != statusCode1)
172 if (STATUS_CODE_SUCCESS != statusCode2)
175 float dTdL1(0.f), dTdL2(0.f);
182 return STATUS_CODE_SUCCESS;
196 const float pL(1.f / std::sqrt(1.f + dTdL1 * dTdL1 + dTdL2 * dTdL2));
197 const float pT1(dTdL1 / std::sqrt(1.f + dTdL1 * dTdL1 + dTdL2 * dTdL2));
198 const float pT2(dTdL2 / std::sqrt(1.f + dTdL1 * dTdL1 + dTdL2 * dTdL2));
218 if (pPointVector->size() < 2)
226 float minProjection(std::numeric_limits<float>::max());
231 if (fitDirection.
GetZ() < 0.f)
232 fitDirection *= -1.f;
235 minProjection = std::min(minProjection, fitDirection.
GetDotProduct(coordinate - centroid));
238 const float fitProjection(layerPitch * std::floor(minProjection / layerPitch));
240 return TrackState(centroid + (fitDirection * fitProjection), fitDirection);
247 const float px(std::fabs(axisDirection.
GetX()));
248 const float py(std::fabs(axisDirection.
GetY()));
249 const float pz(std::fabs(axisDirection.
GetZ()));
251 if (px < std::min(py, pz) + std::numeric_limits<float>::epsilon())
256 if (py < std::min(pz, px) + std::numeric_limits<float>::epsilon())
261 if (pz < std::min(px, py) + std::numeric_limits<float>::epsilon())
Header file for the cluster class.
Header file for the cluster fit helper class.
Header file for the cluster helper class.
Header file for the principal curve analysis helper class.
Header file for the lar three dimensional sliding fit result class.
#define PANDORA_THROW_RESULT_IF(StatusCode1, Operator, Command)
static void GetCoordinateVector(const pandora::Cluster *const pCluster, pandora::CartesianPointVector &coordinateVector)
Get vector of hit coordinates from an input cluster.
std::vector< pandora::CartesianVector > EigenVectors
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...
ThreeDSlidingFitResult class.
const TwoDSlidingFitResult m_firstFitResult
The first sliding fit result.
pandora::StatusCode GetGlobalFitPosition(const float rL, pandora::CartesianVector &position) const
Get global fit position for a given longitudinal coordinate.
float GetMinLayerRms() const
Get rms at minimum layer.
const TwoDSlidingFitResult m_secondFitResult
The second sliding fit result.
int GetMinLayer() const
Get the minimum occupied layer in the sliding fit.
pandora::CartesianVector m_minLayerDirection
The global direction at the minimum combined layer.
const int m_minLayer
The minimum combined layer.
pandora::CartesianVector m_maxLayerDirection
The global direction at the maximum combined layer.
const pandora::CartesianVector m_axisIntercept
The axis intercept position.
float GetFitRms(const float rL) const
Get fit rms for a given longitudinal coordinate.
int GetMaxLayer() const
Get the maximum occupied layer in the sliding fit.
float GetLongitudinalDisplacement(const pandora::CartesianVector &position) const
Get longitudinal projection onto primary axis.
const pandora::Cluster * GetCluster() const
Get the address of the cluster.
const int m_maxLayer
The maximum combined layer.
const pandora::CartesianVector m_secondOrthoDirection
The orthogonal direction vector.
pandora::CartesianVector m_minLayerPosition
The global position at the minimum combined layer.
pandora::StatusCode GetGlobalFitDirection(const float rL, pandora::CartesianVector &direction) const
Get global fit direction for a given longitudinal coordinate.
const pandora::CartesianVector m_axisDirection
The axis direction vector.
float GetMaxLayerRms() const
Get rms at maximum layer.
static pandora::TrackState GetPrimaryAxis(const pandora::Cluster *const pCluster, const float slidingFitLayerPitch)
Calculate the position and direction of the primary axis.
void GetGlobalDirection(const float dTdL1, const float dTdL2, pandora::CartesianVector &direction) const
Get global direction coordinates for a given pair of sliding linear fit gradients.
pandora::CartesianVector m_maxLayerPosition
The global position at the maximum combined layer.
const pandora::CartesianVector m_firstOrthoDirection
The orthogonal direction vector.
static pandora::CartesianVector GetSeedDirection(const pandora::CartesianVector &axisDirection)
Generate a seed vector to be used in calculating the orthogonal axes.
void GetGlobalPosition(const float rL, const float rT1, const float rT2, pandora::CartesianVector &position) const
Get global coordinates for a given pair of sliding linear fit coordinates.
ThreeDSlidingFitResult(const T *const pT, const unsigned int slidingFitWindow, const float slidingFitLayerPitch)
Constructor.
TwoDSlidingFitResult class.
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.
float GetL(const int layer) const
Get longitudinal coordinate for a given sliding linear fit layer number.
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
pandora::StatusCode GetGlobalFitPosition(const float rL, pandora::CartesianVector &position) const
Get global fit position for a given longitudinal coordinate.
float GetMinLayerRms() const
Get rms at minimum layer.
int GetMaxLayer() const
Get the maximum occupied layer in the sliding fit.
float GetFitRms(const float rL) const
Get fit rms for a given longitudinal coordinate.
pandora::StatusCode GetGlobalFitDirection(const float rL, pandora::CartesianVector &direction) const
Get global fit direction for a given longitudinal coordinate.
const pandora::Cluster * GetCluster() const
Get the address of the cluster, if originally provided.
int GetMinLayer() const
Get the minimum occupied layer in the sliding fit.
int GetLayer(const float rL) const
Get layer number for given sliding linear fit longitudinal coordinate.
float GetX() const
Get the cartesian x coordinate.
float GetZ() const
Get the cartesian z coordinate.
float GetDotProduct(const CartesianVector &rhs) const
Get the dot product of the cartesian vector with a second cartesian vector.
float GetY() const
Get the cartesian y coordinate.
StatusCodeException class.
std::vector< CartesianVector > CartesianPointVector
StatusCode
The StatusCode enum.