LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
LArHitWidthHelper.h
Go to the documentation of this file.
1 
8 #ifndef LAR_HIT_WIDTH_HELPER_H
9 #define LAR_HIT_WIDTH_HELPER_H 1
10 
11 #include "Objects/Cluster.h"
12 
13 namespace lar_content
14 {
15 
20 {
21 public:
26  {
27  public:
35  ConstituentHit(const pandora::CartesianVector &positionVector, const float hitWidth, const pandora::Cluster *const pParentClusterAddress);
36 
40  const pandora::CartesianVector &GetPositionVector() const;
41 
45  float GetHitWidth() const;
46 
50  const pandora::Cluster *GetParentClusterAddress() const;
51 
56  {
57  public:
63  SortByDistanceToPoint(const pandora::CartesianVector referencePoint) :
64  m_referencePoint(referencePoint)
65  {
66  }
67 
76  bool operator()(const ConstituentHit &lhs, const ConstituentHit &rhs);
77 
78  private:
79  const pandora::CartesianVector m_referencePoint;
80  };
81 
82  private:
83  pandora::CartesianVector m_positionVector;
84  float m_hitWidth;
85  const pandora::Cluster *m_pParentClusterAddress;
86  };
87 
88  typedef std::vector<ConstituentHit> ConstituentHitVector;
89 
94  {
95  public:
105  ClusterParameters(const pandora::Cluster *const pCluster, const float maxConsituentHitWidth, const bool isUniformHits,
106  const float hitWidthScalingFactor);
107 
118  ClusterParameters(const pandora::Cluster *const pCluster, const unsigned int numCaloHits, const float totalWeight,
119  const ConstituentHitVector &constituentHitVector, const pandora::CartesianVector &lowerXExtrema,
120  const pandora::CartesianVector &higherXExtrema);
121 
125  const pandora::Cluster *GetClusterAddress() const;
126 
130  unsigned int GetNumCaloHits() const;
131 
135  float GetTotalWeight() const;
136 
140  const ConstituentHitVector &GetConstituentHitVector() const;
141 
145  const pandora::CartesianVector &GetLowerXExtrema() const;
146 
150  const pandora::CartesianVector &GetHigherXExtrema() const;
151 
152  private:
153  const pandora::Cluster *m_pCluster;
154  const unsigned int m_numCaloHits;
155  const ConstituentHitVector m_constituentHitVector;
156  const float m_totalWeight;
157  const pandora::CartesianVector m_lowerXExtrema;
158  const pandora::CartesianVector m_higherXExtrema;
159  };
160 
161  typedef std::unordered_map<const pandora::Cluster *, const ClusterParameters> ClusterToParametersMap;
162 
167  {
168  public:
174  SortByHigherXExtrema(const ClusterToParametersMap &clusterToParametersMap);
175 
184  bool operator()(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs);
185 
186  private:
187  const ClusterToParametersMap &m_clusterToParametersMap;
188  };
189 
198  static const ClusterParameters &GetClusterParameters(const pandora::Cluster *const pCluster, const ClusterToParametersMap &clusterToParametersMap);
199 
209  static unsigned int GetNProposedConstituentHits(
210  const pandora::Cluster *const pCluster, const float maxConstituentHitWidth, const float hitWidthScalingFactor);
211 
223  static ConstituentHitVector GetConstituentHits(
224  const pandora::Cluster *const pCluster, const float maxConstituentHitWidth, const float hitWidthScalingFactor, const bool isUniform);
225 
236  static void SplitHitIntoConstituents(const pandora::CaloHit *const pCaloHit, const pandora::Cluster *const pCluster,
237  const unsigned int numberOfConstituentHits, const float constituentHitWidth, ConstituentHitVector &constituentHitVector);
238 
246  static pandora::CartesianPointVector GetConstituentHitPositionVector(const ConstituentHitVector &constituentHitVector);
247 
255  static float GetTotalClusterWeight(const ConstituentHitVector &constituentHitVector);
256 
264  static float GetOriginalTotalClusterWeight(const pandora::Cluster *const pCluster);
265 
273  static pandora::CartesianVector GetExtremalCoordinatesLowerX(const ConstituentHitVector &constituentHitVector);
274 
282  static pandora::CartesianVector GetExtremalCoordinatesHigherX(const ConstituentHitVector &constituentHitVector);
283 
291  static void GetExtremalCoordinatesX(const ConstituentHitVector &constituentHitVector, pandora::CartesianVector &lowerXCoordinate,
292  pandora::CartesianVector &higherXCoordinate);
293 
303  static pandora::CartesianVector GetClosestPointToLine2D(
304  const pandora::CartesianVector &lineStart, const pandora::CartesianVector &lineDirection, const pandora::CaloHit *const pCaloHit);
305 
314  static float GetClosestDistanceToPoint2D(const pandora::CaloHit *const pCaloHit, const pandora::CartesianVector &point2D);
315 
324  static float GetClosestDistance(const pandora::CaloHit *const pThisCaloHit, const pandora::CaloHitList &caloHitList);
325 
334  static float GetClosestDistance(const pandora::CaloHit *const pCaloHit1, const pandora::CaloHit *const pCaloHit2);
335 };
336 
337 //------------------------------------------------------------------------------------------------------------------------------------------
338 
339 inline const pandora::CartesianVector &LArHitWidthHelper::ConstituentHit::GetPositionVector() const
340 {
341  return m_positionVector;
342 }
343 
344 //------------------------------------------------------------------------------------------------------------------------------------------
345 
347 {
348  return m_hitWidth;
349 }
350 
351 //------------------------------------------------------------------------------------------------------------------------------------------
352 
354 {
356 }
357 
358 //------------------------------------------------------------------------------------------------------------------------------------------
359 //------------------------------------------------------------------------------------------------------------------------------------------
360 
361 inline const pandora::Cluster *LArHitWidthHelper::ClusterParameters::GetClusterAddress() const
362 {
363  return m_pCluster;
364 }
365 
366 //------------------------------------------------------------------------------------------------------------------------------------------
367 
369 {
370  return m_numCaloHits;
371 }
372 
373 //------------------------------------------------------------------------------------------------------------------------------------------
374 
376 {
377  return m_totalWeight;
378 }
379 
380 //------------------------------------------------------------------------------------------------------------------------------------------
381 
383 {
384  return m_constituentHitVector;
385 }
386 
387 //------------------------------------------------------------------------------------------------------------------------------------------
388 
389 inline const pandora::CartesianVector &LArHitWidthHelper::ClusterParameters::GetLowerXExtrema() const
390 {
391  return m_lowerXExtrema;
392 }
393 
394 //------------------------------------------------------------------------------------------------------------------------------------------
395 
396 inline const pandora::CartesianVector &LArHitWidthHelper::ClusterParameters::GetHigherXExtrema() const
397 {
398  return m_higherXExtrema;
399 }
400 
401 //------------------------------------------------------------------------------------------------------------------------------------------
402 //------------------------------------------------------------------------------------------------------------------------------------------
403 
405  m_clusterToParametersMap(clusterToParametersMap)
406 {
407 }
408 
409 } // namespace lar_content
410 
411 #endif // #ifndef LAR_HIT_WIDTH_HELPER_H
const float m_totalWeight
The total hit weight of the contituent hits.
const pandora::CartesianVector & GetLowerXExtrema() const
Returns the lower x extremal point of the constituent hits.
static float GetOriginalTotalClusterWeight(const pandora::Cluster *const pCluster)
Sum the widths of the original, unscaled hits contained within a cluster.
const pandora::CartesianVector m_higherXExtrema
The higher x extremal point of the constituent hits.
static const ClusterParameters & GetClusterParameters(const pandora::Cluster *const pCluster, const ClusterToParametersMap &clusterToParametersMap)
Return the cluster parameters of a given cluster, exception thrown if not found in map [cluster -> cl...
const pandora::Cluster * GetClusterAddress() const
Returns the address of the cluster.
LArHitWidthHelper class.
static void SplitHitIntoConstituents(const pandora::CaloHit *const pCaloHit, const pandora::Cluster *const pCluster, const unsigned int numberOfConstituentHits, const float constituentHitWidth, ConstituentHitVector &constituentHitVector)
Break up the calo hit into constituent hits.
const pandora::CartesianVector m_lowerXExtrema
The lower x extremal point of the constituent hits.
SortByHigherXExtrema(const ClusterToParametersMap &clusterToParametersMap)
Constructor.
static void GetExtremalCoordinatesX(const ConstituentHitVector &constituentHitVector, pandora::CartesianVector &lowerXCoordinate, pandora::CartesianVector &higherXCoordinate)
Calculate the higher and lower x extremal points of the constituent hits.
const pandora::Cluster * GetParentClusterAddress() const
Returns the address of the parent cluster.
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.
static pandora::CartesianVector GetClosestPointToLine2D(const pandora::CartesianVector &lineStart, const pandora::CartesianVector &lineDirection, const pandora::CaloHit *const pCaloHit)
Consider the hit width to find the closest position of a calo hit to a specified line.
float m_hitWidth
The width of the constituent hit.
SortByDistanceToPoint(const pandora::CartesianVector referencePoint)
Constructor.
pandora::CartesianVector m_positionVector
The central position of the consituent hit.
unsigned int GetNumCaloHits() const
Returns the number of calo hits within the cluster.
const ClusterToParametersMap & m_clusterToParametersMap
The map [cluster -> cluster parameters].
const pandora::CartesianVector & GetPositionVector() const
Returns the constituent hit central position.
const pandora::CartesianVector & GetHigherXExtrema() const
Returns the higher x extremal point of the constituent hits.
std::vector< ConstituentHit > ConstituentHitVector
static unsigned int GetNProposedConstituentHits(const pandora::Cluster *const pCluster, const float maxConstituentHitWidth, const float hitWidthScalingFactor)
Return the number of constituent hits that a given cluster would be broken into.
static pandora::CartesianPointVector GetConstituentHitPositionVector(const ConstituentHitVector &constituentHitVector)
Obtain a vector of the contituent hit central positions.
float GetTotalWeight() const
Returns the total weight of the constituent hits.
static pandora::CartesianVector GetExtremalCoordinatesLowerX(const ConstituentHitVector &constituentHitVector)
Return the lower x extremal point of the constituent hits.
static float GetTotalClusterWeight(const ConstituentHitVector &constituentHitVector)
Sum the widths of constituent hits.
static float GetClosestDistanceToPoint2D(const pandora::CaloHit *const pCaloHit, const pandora::CartesianVector &point2D)
Consider the hit width to find the smallest distance between a calo hit and a given point...
ConstituentHit(const pandora::CartesianVector &positionVector, const float hitWidth, const pandora::Cluster *const pParentClusterAddress)
Constructor.
static pandora::CartesianVector GetExtremalCoordinatesHigherX(const ConstituentHitVector &constituentHitVector)
Return the higher x extremal point of the constituent hits.
const pandora::CartesianVector m_referencePoint
The point relative to which constituent hits are ordered.
bool operator()(const ConstituentHit &lhs, const ConstituentHit &rhs)
Sort constituent hits by their position relative to a referencePoint.
const unsigned int m_numCaloHits
The number of calo hits within the cluster.
const pandora::Cluster * m_pCluster
The address of the cluster.
const ConstituentHitVector m_constituentHitVector
The vector of constituent hits.
std::unordered_map< const pandora::Cluster *, const ClusterParameters > ClusterToParametersMap
static float GetClosestDistance(const pandora::CaloHit *const pThisCaloHit, const pandora::CaloHitList &caloHitList)
Find the smallest separation between a hit and a list of hits, with the consideration of their hit wi...
const ConstituentHitVector & GetConstituentHitVector() const
Returns the vector of constituent hits.
float GetHitWidth() const
Returns the constituent hit width.
const pandora::Cluster * m_pParentClusterAddress
The address of the cluster the constituent hit belongs to.