Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
LArTwoDSlidingFitResult.h
Go to the documentation of this file.
1
8#ifndef LAR_TWO_D_SLIDING_FIT_RESULT_H
9#define LAR_TWO_D_SLIDING_FIT_RESULT_H 1
10
11#include "Api/PandoraApi.h"
12
14
15#include <unordered_map>
16
17namespace lar_content
18{
19
24{
25public:
35 template <typename T>
36 TwoDSlidingFitResult(const T *const pT, const unsigned int layerFitHalfWindow, const float layerPitch,
37 const float axisDeviationLimitForHitDivision = 0.95f);
38
51 template <typename T>
52 TwoDSlidingFitResult(const T *const pT, const unsigned int layerFitHalfWindow, const float layerPitch,
53 const pandora::CartesianVector &axisIntercept, const pandora::CartesianVector &axisDirection,
54 const pandora::CartesianVector &orthoDirection, const float axisDeviationLimitForHitDivision = 0.95f);
55
68 TwoDSlidingFitResult(const unsigned int layerFitHalfWindow, const float layerPitch, const pandora::CartesianVector &axisIntercept,
69 const pandora::CartesianVector &axisDirection, const pandora::CartesianVector &orthoDirection,
70 const LayerFitContributionMap &layerFitContributionMap);
71
79 const pandora::Cluster *GetCluster() const;
80
86 unsigned int GetLayerFitHalfWindow() const;
87
93 float GetLayerPitch() const;
94
101
108
115
122
129
135 const FitSegmentList &GetFitSegmentList() const;
136
142 float GetLayerFitHalfWindowLength() const;
143
149 int GetMinLayer() const;
150
156 int GetMaxLayer() const;
157
164 void GetMinAndMaxX(float &minX, float &maxX) const;
165
172 void GetMinAndMaxZ(float &minZ, float &maxZ) const;
173
179 int GetLayer(const float rL) const;
180
186 float GetL(const int layer) const;
187
195 void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const;
196
203 void GetLocalDirection(const pandora::CartesianVector &direction, float &dTdL) const;
204
212 void GetGlobalPosition(const float rL, const float rT, pandora::CartesianVector &position) const;
213
220 void GetGlobalDirection(const float dTdL, pandora::CartesianVector &direction) const;
221
228
235
242
249
255 float GetMinLayerRms() const;
256
262 float GetMaxLayerRms() const;
263
271 float GetFitRms(const float rL) const;
272
278 float GetCosScatteringAngle(const float rL) const;
279
289
299
309
319
329
339
349 pandora::StatusCode GetTransverseProjection(const float x, const FitSegment &fitSegment, pandora::CartesianVector &position) const;
350
362 const float x, const FitSegment &fitSegment, pandora::CartesianVector &position, pandora::CartesianVector &direction) const;
363
373
383
393
399 const FitSegment &GetFitSegment(const float rL) const;
400
401private:
405 void CalculateAxes(const pandora::CartesianPointVector &coordinateVector, const float layerPitch);
406
411
416
421
429 void GetMinAndMaxCoordinate(const bool isX, float &min, float &max) const;
430
439
448
456 float GetFitRms(const LayerInterpolation &layerInterpolation) const;
457
466 pandora::StatusCode LongitudinalInterpolation(const float rL, LayerInterpolation &layerInterpolation) const;
467
477 pandora::StatusCode TransverseInterpolation(const float x, const FitSegment &fitSegment, LayerInterpolation &layerInterpolation) const;
478
487 pandora::StatusCode TransverseInterpolation(const float x, LayerInterpolationList &layerInterpolationList) const;
488
499 const float rL, LayerFitResultMap::const_iterator &firstLayerIter, LayerFitResultMap::const_iterator &secondLayerIter) const;
500
512 pandora::StatusCode GetTransverseSurroundingLayers(const float x, const int minLayer, const int maxLayer,
513 LayerFitResultMap::const_iterator &firstLayerIter, LayerFitResultMap::const_iterator &secondLayerIter) const;
514
524 void GetLongitudinalInterpolationWeights(const float rL, const LayerFitResultMap::const_iterator &firstLayerIter,
525 const LayerFitResultMap::const_iterator &secondLayerIter, double &firstWeight, double &secondWeight) const;
526
536 void GetTransverseInterpolationWeights(const float x, const LayerFitResultMap::const_iterator &firstLayerIter,
537 const LayerFitResultMap::const_iterator &secondLayerIter, double &firstWeight, double &secondWeight) const;
538
540 unsigned int m_layerFitHalfWindow;
548};
549
550typedef std::vector<TwoDSlidingFitResult> TwoDSlidingFitResultList;
551typedef std::unordered_map<const pandora::Cluster *, TwoDSlidingFitResult> TwoDSlidingFitResultMap;
552
553//------------------------------------------------------------------------------------------------------------------------------------------
554//------------------------------------------------------------------------------------------------------------------------------------------
555
557{
559}
560
561//------------------------------------------------------------------------------------------------------------------------------------------
562
564{
565 return m_layerPitch;
566}
567
568//------------------------------------------------------------------------------------------------------------------------------------------
569
574
575//------------------------------------------------------------------------------------------------------------------------------------------
576
581
582//------------------------------------------------------------------------------------------------------------------------------------------
583
588
589//------------------------------------------------------------------------------------------------------------------------------------------
590
595
596//------------------------------------------------------------------------------------------------------------------------------------------
597
602
603//------------------------------------------------------------------------------------------------------------------------------------------
604
609
610//------------------------------------------------------------------------------------------------------------------------------------------
611
612inline void TwoDSlidingFitResult::GetMinAndMaxX(float &minX, float &maxX) const
613{
614 return this->GetMinAndMaxCoordinate(true, minX, maxX);
615}
616
617//------------------------------------------------------------------------------------------------------------------------------------------
618
619inline void TwoDSlidingFitResult::GetMinAndMaxZ(float &minZ, float &maxZ) const
620{
621 return this->GetMinAndMaxCoordinate(false, minZ, maxZ);
622}
623
624} // namespace lar_content
625
626#endif // #ifndef LAR_TWO_D_SLIDING_FIT_RESULT_H
Header file for the lar two dimensional sliding fit objects.
Header file for the pandora api class.
const pandora::Cluster * m_pCluster
The address of the cluster.
pandora::StatusCode GetExtrapolatedDirection(const float rL, pandora::CartesianVector &direction) const
Get extrapolated direction (beyond span) for a given input coordinate.
unsigned int m_layerFitHalfWindow
The layer fit half window.
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.
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
void PerformSlidingLinearFit()
Perform the sliding linear fit.
pandora::CartesianVector m_axisIntercept
The axis intercept position.
void CalculateAxes(const pandora::CartesianPointVector &coordinateVector, const float layerPitch)
Calculate the longitudinal and transverse axes.
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
const LayerFitResultMap & GetLayerFitResultMap() const
Get the layer fit result map.
const FitSegmentList & GetFitSegmentList() const
Get the fit segment list.
TwoDSlidingFitResult(const T *const pT, const unsigned int layerFitHalfWindow, const float layerPitch, const pandora::CartesianVector &axisIntercept, const pandora::CartesianVector &axisDirection, const pandora::CartesianVector &orthoDirection, const float axisDeviationLimitForHitDivision=0.95f)
Constructor using specified primary axis. The orthogonal axis must be perpendicular to the primary ax...
pandora::StatusCode GetGlobalFitPosition(const float rL, pandora::CartesianVector &position) const
Get global fit position for a given longitudinal coordinate.
const pandora::CartesianVector & GetAxisIntercept() const
Get the axis intercept position.
LayerFitResultMap m_layerFitResultMap
The layer fit result map.
float GetMinLayerRms() const
Get rms at minimum layer.
float m_layerPitch
The layer pitch, units cm.
float GetLayerPitch() const
Get the layer pitch, units cm.
pandora::CartesianVector GetGlobalMinLayerDirection() const
Get global direction corresponding to the fit result in minimum fit layer.
unsigned int GetLayerFitHalfWindow() const
Get the layer fit half window.
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.
void GetGlobalPosition(const float rL, const float rT, pandora::CartesianVector &position) const
Get global coordinates for given sliding linear fit coordinates.
pandora::StatusCode GetGlobalFitPositionListAtX(const float x, pandora::CartesianPointVector &positionList) const
Get a list of projected positions for a given input x coordinate.
TwoDSlidingFitResult(const T *const pT, const unsigned int layerFitHalfWindow, const float layerPitch, const float axisDeviationLimitForHitDivision=0.95f)
Constructor using internal definition of primary axis.
const pandora::CartesianVector & GetOrthoDirection() const
Get the orthogonal direction vector.
int GetMaxLayer() const
Get the maximum occupied layer in the sliding fit.
LayerFitContributionMap m_layerFitContributionMap
The layer fit contribution map.
pandora::CartesianVector m_orthoDirection
The orthogonal direction vector.
pandora::StatusCode GetLongitudinalSurroundingLayers(const float rL, LayerFitResultMap::const_iterator &firstLayerIter, LayerFitResultMap::const_iterator &secondLayerIter) const
Get iterators for layers surrounding the specified longitudinal position.
float GetCosScatteringAngle(const float rL) const
Get scattering angle for a given longitudinal coordinate.
pandora::StatusCode GetExtrapolatedPositionAtX(const float x, pandora::CartesianVector &position) const
Get extrapolated position (beyond span) for a given input x coordinate.
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::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
pandora::CartesianVector m_axisDirection
The axis direction vector.
float GetFitRms(const float rL) const
Get fit rms for a given longitudinal coordinate.
float GetLayerFitHalfWindowLength() const
Get the layer fit half window length.
pandora::StatusCode GetExtrapolatedPosition(const float rL, pandora::CartesianVector &position) const
Get extrapolated position (beyond span) for a given input coordinate.
pandora::StatusCode GetGlobalFitDirection(const float rL, pandora::CartesianVector &direction) const
Get global fit direction for a given longitudinal coordinate.
const LayerFitContributionMap & GetLayerFitContributionMap() const
Get the layer fit contribution map.
void FillLayerFitContributionMap(const pandora::CartesianPointVector &coordinateVector)
Fill the layer fit contribution map.
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.
void GetMinAndMaxCoordinate(const bool isX, float &min, float &max) const
Get the minimum and maximum x or z coordinates associated with the sliding fit.
int GetLayer(const float rL) const
Get layer number for given sliding linear fit longitudinal coordinate.
const pandora::CartesianVector & GetAxisDirection() const
Get the axis direction vector.
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.
void GetGlobalDirection(const float dTdL, pandora::CartesianVector &direction) const
Get global direction coordinates for given sliding linear fit gradient.
pandora::CartesianVector GetGlobalMaxLayerDirection() const
Get global direction corresponding to the fit result in maximum fit layer.
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.
pandora::StatusCode GetGlobalFitPositionAtX(const float x, pandora::CartesianVector &position) const
Get global fit position for a given input x coordinate.
pandora::StatusCode GetGlobalFitDirectionAtX(const float x, pandora::CartesianVector &direction) const
Get global fit direction for a given input x coordinate.
const FitSegment & GetFitSegment(const float rL) const
Get fit segment for a given longitudinal coordinate.
pandora::StatusCode GetGlobalFitProjection(const pandora::CartesianVector &inputPosition, pandora::CartesianVector &projectedPosition) const
Get projected position on global fit for a given position vector.
void GetMinAndMaxX(float &minX, float &maxX) const
Get the minimum and maximum x coordinates associated with the sliding fit.
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.
void FindSlidingFitSegments()
Find sliding fit segments; sections with tramsverse direction.
FitSegmentList m_fitSegmentList
The fit segment list.
void GetMinAndMaxZ(float &minZ, float &maxZ) const
Get the minimum and maximum z coordinates associated with the sliding fit.
pandora::StatusCode LongitudinalInterpolation(const float rL, LayerInterpolation &layerInterpolation) const
Get the pair of layers surrounding a specified longitudinal position.
CartesianVector class.
Cluster class.
Definition Cluster.h:31
std::vector< FitSegment > FitSegmentList
std::vector< TwoDSlidingFitResult > TwoDSlidingFitResultList
std::unordered_map< const pandora::Cluster *, TwoDSlidingFitResult > TwoDSlidingFitResultMap
std::map< int, LayerFitResult > LayerFitResultMap
std::vector< LayerInterpolation > LayerInterpolationList
std::map< int, LayerFitContribution > LayerFitContributionMap
std::vector< CartesianVector > CartesianPointVector
StatusCode
The StatusCode enum.