LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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::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::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(), max, min, lar_content::NEGATIVE_SHOWER_EDGE, lar_content::POSITIVE_SHOWER_EDGE, and TwoDSlidingShowerFitResult().

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

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