LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::TwoDSlidingShowerFitResult Class Reference

TwoDSlidingShowerFitResult class. More...

#include "LArTwoDSlidingShowerFitResult.h"

Public Member Functions

template<typename T >
 TwoDSlidingShowerFitResult (const T *const pT, const unsigned int slidingFitWindow, const float slidingFitLayerPitch, const float showerEdgeMultiplier=1.f)
 Constructor. More...
 
const TwoDSlidingFitResultGetShowerFitResult () const
 Get the sliding fit result for the full shower cluster. More...
 
const TwoDSlidingFitResultGetNegativeEdgeFitResult () const
 Get the sliding fit result for the negative shower edge. More...
 
const TwoDSlidingFitResultGetPositiveEdgeFitResult () const
 Get the sliding fit result for the positive shower edge. More...
 
void GetShowerEdges (const float x, const bool widenIfAmbiguity, pandora::FloatVector &edgePositions) const
 Get the most appropriate shower edges at a given x coordinate. More...
 

Private Types

typedef std::pair< float, float > FitCoordinate
 
typedef std::vector< FitCoordinateFitCoordinateList
 
typedef std::map< int, FitCoordinateListFitCoordinateMap
 

Static Private Member Functions

static TwoDSlidingFitResult LArTwoDShowerEdgeFit (const pandora::Cluster *const pCluster, const TwoDSlidingFitResult &fullShowerFit, const ShowerEdge showerEdge, const float showerEdgeMultiplier)
 Perform two dimensional sliding fit to shower edge, using specified primary axis. More...
 
static TwoDSlidingFitResult LArTwoDShowerEdgeFit (const pandora::CartesianPointVector *const pPointVector, const TwoDSlidingFitResult &fullShowerFit, const ShowerEdge showerEdge, const float showerEdgeMultiplier)
 Perform two dimensional sliding fit to shower edge, using specified primary axis. More...
 

Private Attributes

TwoDSlidingFitResult m_showerFitResult
 The sliding fit result for the full shower cluster. More...
 
TwoDSlidingFitResult m_negativeEdgeFitResult
 The sliding fit result for the negative shower edge. More...
 
TwoDSlidingFitResult m_positiveEdgeFitResult
 The sliding fit result for the positive shower edge. More...
 

Detailed Description

Member Typedef Documentation

typedef std::pair<float, float> lar_content::TwoDSlidingShowerFitResult::FitCoordinate
private

Definition at line 106 of file LArTwoDSlidingShowerFitResult.h.

Constructor & Destructor Documentation

template<typename T >
template lar_content::TwoDSlidingShowerFitResult::TwoDSlidingShowerFitResult ( const T *const  pT,
const unsigned int  slidingFitWindow,
const float  slidingFitLayerPitch,
const float  showerEdgeMultiplier = 1.f 
)

Constructor.

Parameters
pTdescribing the positions to be fitted
slidingFitWindowthe sliding fit window
slidingFitLayerPitchthe sliding fit z pitch, units cm
showerEdgeMultiplierartificially tune width of shower envelope so as to make it more/less inclusive

Definition at line 25 of file LArTwoDSlidingShowerFitResult.cc.

Referenced by GetShowerEdges().

26  :
27  m_showerFitResult(TwoDSlidingFitResult(pT, slidingFitWindow, slidingFitLayerPitch)),
30 {
31 }
static TwoDSlidingFitResult LArTwoDShowerEdgeFit(const pandora::Cluster *const pCluster, const TwoDSlidingFitResult &fullShowerFit, const ShowerEdge showerEdge, const float showerEdgeMultiplier)
Perform two dimensional sliding fit to shower edge, using specified primary axis. ...
TwoDSlidingFitResult m_showerFitResult
The sliding fit result for the full shower cluster.
TwoDSlidingFitResult m_negativeEdgeFitResult
The sliding fit result for the negative shower edge.
TwoDSlidingFitResult m_positiveEdgeFitResult
The sliding fit result for the positive shower edge.

Member Function Documentation

const TwoDSlidingFitResult & lar_content::TwoDSlidingShowerFitResult::GetNegativeEdgeFitResult ( ) const
inline

Get the sliding fit result for the negative shower edge.

Returns
the sliding fit result for the negative shower edge

Definition at line 174 of file LArTwoDSlidingShowerFitResult.h.

References m_negativeEdgeFitResult.

Referenced by lar_content::ShowerStartFinderTool::BuildShowerRegion(), lar_content::ShowerStartFinderTool::CharacteriseShowerTopology(), lar_content::ConeClusterMopUpAlgorithm::ClusterMopUp(), GetShowerEdges(), and lar_content::CutClusterCharacterisationAlgorithm::GetShowerFitWidth().

175 {
177 }
TwoDSlidingFitResult m_negativeEdgeFitResult
The sliding fit result for the negative shower edge.
const TwoDSlidingFitResult & lar_content::TwoDSlidingShowerFitResult::GetPositiveEdgeFitResult ( ) const
inline

Get the sliding fit result for the positive shower edge.

Returns
the sliding fit result for the positive shower edge

Definition at line 181 of file LArTwoDSlidingShowerFitResult.h.

References m_positiveEdgeFitResult.

Referenced by lar_content::ShowerStartFinderTool::BuildShowerRegion(), lar_content::ShowerStartFinderTool::CharacteriseShowerTopology(), lar_content::ConeClusterMopUpAlgorithm::ClusterMopUp(), GetShowerEdges(), and lar_content::CutClusterCharacterisationAlgorithm::GetShowerFitWidth().

182 {
184 }
TwoDSlidingFitResult m_positiveEdgeFitResult
The sliding fit result for the positive shower edge.
void lar_content::TwoDSlidingShowerFitResult::GetShowerEdges ( const float  x,
const bool  widenIfAmbiguity,
pandora::FloatVector &  edgePositions 
) const

Get the most appropriate shower edges at a given x coordinate.

Parameters
xthe x coordinate
widenIfAmbiguitywhether to widen the shower edges in cases of ambiguities (i.e. be generous)
edgePositionsto receive the list of intersections of the shower fit at the given x coordinate

Definition at line 35 of file LArTwoDSlidingShowerFitResult.cc.

References f, lar_content::TwoDSlidingFitResult::GetAxisDirection(), lar_content::TwoDSlidingFitResult::GetAxisIntercept(), lar_content::LArClusterHelper::GetCoordinateVector(), lar_content::TwoDSlidingFitResult::GetGlobalFitPosition(), lar_content::TwoDSlidingFitResult::GetLayer(), lar_content::TwoDSlidingFitResult::GetLayerFitHalfWindow(), lar_content::TwoDSlidingFitResult::GetLayerPitch(), lar_content::TwoDSlidingFitResult::GetLocalPosition(), lar_content::TwoDSlidingFitResult::GetMinAndMaxX(), lar_content::TwoDSlidingFitResult::GetMinAndMaxZ(), GetNegativeEdgeFitResult(), lar_content::TwoDSlidingFitResult::GetOrthoDirection(), GetPositiveEdgeFitResult(), LArTwoDShowerEdgeFit(), lar_content::NEGATIVE_SHOWER_EDGE, lar_content::POSITIVE_SHOWER_EDGE, and TwoDSlidingShowerFitResult().

Referenced by lar_content::BoundedClusterMopUpAlgorithm::GetShowerPositionMap(), and lar_content::ThreeViewShowersAlgorithm::GetShowerPositionMaps().

36 {
37  edgePositions.clear();
38  CartesianPointVector fitPositionVector;
39  PANDORA_THROW_RESULT_IF_AND_IF(
40  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, this->GetNegativeEdgeFitResult().GetGlobalFitPositionListAtX(x, fitPositionVector));
41  PANDORA_THROW_RESULT_IF_AND_IF(
42  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, this->GetPositiveEdgeFitResult().GetGlobalFitPositionListAtX(x, fitPositionVector));
43 
44  if (fitPositionVector.size() < 2)
45  {
46  float minXn(0.f), maxXn(0.f), minXp(0.f), maxXp(0.f);
47  this->GetNegativeEdgeFitResult().GetMinAndMaxX(minXn, maxXn);
48  this->GetPositiveEdgeFitResult().GetMinAndMaxX(minXp, maxXp);
49  const float minX(std::min(minXn, minXp)), maxX(std::max(maxXn, maxXp));
50 
51  if ((x < minX) || (x > maxX))
52  return;
53 
54  float minZn(0.f), maxZn(0.f), minZp(0.f), maxZp(0.f);
55  this->GetNegativeEdgeFitResult().GetMinAndMaxZ(minZn, maxZn);
56  this->GetPositiveEdgeFitResult().GetMinAndMaxZ(minZp, maxZp);
57  const float minZ(std::min(minZn, minZp)), maxZ(std::max(maxZn, maxZp));
58 
59  if (!widenIfAmbiguity)
60  {
61  return;
62  }
63  else if (fitPositionVector.empty())
64  {
65  fitPositionVector.push_back(CartesianVector(x, 0.f, minZ));
66  fitPositionVector.push_back(CartesianVector(x, 0.f, maxZ));
67  }
68  else if (1 == fitPositionVector.size())
69  {
70  // ATTN Could improve sophistication of choice of second bounding edge
71  const float existingEdge(fitPositionVector.front().GetZ());
72  const float secondEdge((std::fabs(existingEdge - minZ) < std::fabs(existingEdge - maxZ)) ? minZ : maxZ);
73  fitPositionVector.push_back(CartesianVector(x, 0.f, secondEdge));
74  }
75  }
76 
77  FloatVector localEdgePositions;
78  for (const CartesianVector &fitPosition : fitPositionVector)
79  localEdgePositions.push_back(fitPosition.GetZ());
80 
81  if (localEdgePositions.size() < 2)
82  throw StatusCodeException(STATUS_CODE_FAILURE);
83 
84  std::sort(localEdgePositions.begin(), localEdgePositions.end());
85  edgePositions.push_back(localEdgePositions.front());
86  edgePositions.push_back(localEdgePositions.back());
87 }
Float_t x
Definition: compare.C:6
void GetMinAndMaxX(float &minX, float &maxX) const
Get the minimum and maximum x coordinates associated with the sliding fit.
TFile f
Definition: plotHisto.C:6
void GetMinAndMaxZ(float &minZ, float &maxZ) const
Get the minimum and maximum z coordinates associated with the sliding fit.
const TwoDSlidingFitResult & GetPositiveEdgeFitResult() const
Get the sliding fit result for the positive shower edge.
const TwoDSlidingFitResult & GetNegativeEdgeFitResult() const
Get the sliding fit result for the negative shower edge.
static TwoDSlidingFitResult lar_content::TwoDSlidingShowerFitResult::LArTwoDShowerEdgeFit ( const pandora::Cluster *const  pCluster,
const TwoDSlidingFitResult fullShowerFit,
const ShowerEdge  showerEdge,
const float  showerEdgeMultiplier 
)
staticprivate

Perform two dimensional sliding fit to shower edge, using specified primary axis.

Parameters
pClusterthe address of the input cluster
fullShowerFitthe result of fitting the full shower
showerEdgethe shower edge
showerEdgeMultiplierartificially tune width of shower envelope so as to make it more/less inclusive
Returns
the shower edge fit result

Referenced by GetShowerEdges().

static TwoDSlidingFitResult lar_content::TwoDSlidingShowerFitResult::LArTwoDShowerEdgeFit ( const pandora::CartesianPointVector *const  pPointVector,
const TwoDSlidingFitResult fullShowerFit,
const ShowerEdge  showerEdge,
const float  showerEdgeMultiplier 
)
staticprivate

Perform two dimensional sliding fit to shower edge, using specified primary axis.

Parameters
pPointVectorthe address of the input point vector
fullShowerFitthe result of fitting the full shower
showerEdgethe shower edge
showerEdgeMultiplierartificially tune width of shower envelope so as to make it more/less inclusive
Returns
the shower edge fit result

Member Data Documentation

TwoDSlidingFitResult lar_content::TwoDSlidingShowerFitResult::m_negativeEdgeFitResult
private

The sliding fit result for the negative shower edge.

Definition at line 111 of file LArTwoDSlidingShowerFitResult.h.

Referenced by GetNegativeEdgeFitResult().

TwoDSlidingFitResult lar_content::TwoDSlidingShowerFitResult::m_positiveEdgeFitResult
private

The sliding fit result for the positive shower edge.

Definition at line 112 of file LArTwoDSlidingShowerFitResult.h.

Referenced by GetPositiveEdgeFitResult().

TwoDSlidingFitResult lar_content::TwoDSlidingShowerFitResult::m_showerFitResult
private

The sliding fit result for the full shower cluster.

Definition at line 110 of file LArTwoDSlidingShowerFitResult.h.

Referenced by GetShowerFitResult().


The documentation for this class was generated from the following files: