Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::LongitudinalAssociationAlgorithm Class Reference

LongitudinalAssociationAlgorithm class. More...

#include <LongitudinalAssociationAlgorithm.h>

Inheritance diagram for lar_content::LongitudinalAssociationAlgorithm:
lar_content::ClusterAssociationAlgorithm

Public Member Functions

 LongitudinalAssociationAlgorithm ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::ClusterAssociationAlgorithm
 ClusterAssociationAlgorithm ()
 Default constructor. More...
 

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
void GetListOfCleanClusters (const pandora::ClusterList *const pClusterList, pandora::ClusterVector &clusterVector) const
 Populate cluster vector with subset of cluster list, containing clusters judged to be clean. More...
 
void PopulateClusterAssociationMap (const pandora::ClusterVector &clusterVector, ClusterAssociationMap &clusterAssociationMap) const
 Populate the cluster association map. More...
 
bool IsExtremalCluster (const bool isForward, const pandora::Cluster *const pCurrentCluster, const pandora::Cluster *const pTestCluster) const
 Determine which of two clusters is extremal. More...
 
bool AreClustersAssociated (const pandora::Cluster *const pInnerCluster, const pandora::Cluster *const pOuterCluster) const
 Determine whether two clusters are associated. More...
 
bool AreClustersAssociated (const pandora::CartesianVector &innerClusterEnd, const pandora::CartesianVector &outerClusterStart, const pandora::ClusterFitResult &innerFit, const pandora::ClusterFitResult &outerFit) const
 Determine whether two clusters are associated. More...
 

Private Attributes

unsigned int m_minClusterLayers
 minimum allowed number of layers for a clean cluster More...
 
unsigned int m_maxGapLayers
 maximum allowed number of layers between associated clusters More...
 
unsigned int m_fitLayers
 number of layers to fit at start and end of cluster More...
 
float m_maxGapDistanceSquared
 maximum allowed distance (squared) between associated clusters More...
 
float m_minCosRelativeAngle
 maximum allowed relative angle between associated clusters More...
 
float m_maxTransverseDisplacement
 maximum allowed transverse displacement after extrapolation (normalised to cell size) More...
 
float m_maxLongitudinalDisplacement
 maximum allowed longitudinal displacement after extrapolation (normalised to cell size) More...
 
float m_hitSizeZ
 estimated hit size in z (wire number) dimension, units cm More...
 
float m_hitSizeX
 estimated hit size in x (drift time) dimension, units cm More...
 

Additional Inherited Members

- Protected Types inherited from lar_content::ClusterAssociationAlgorithm
typedef std::unordered_map< const pandora::Cluster *, ClusterAssociationClusterAssociationMap
 
- Protected Member Functions inherited from lar_content::ClusterAssociationAlgorithm
virtual pandora::StatusCode Run ()
 

Detailed Description

LongitudinalAssociationAlgorithm class.

Definition at line 23 of file LongitudinalAssociationAlgorithm.h.

Constructor & Destructor Documentation

lar_content::LongitudinalAssociationAlgorithm::LongitudinalAssociationAlgorithm ( )

Default constructor.

Definition at line 20 of file LongitudinalAssociationAlgorithm.cc.

20  :
22  m_maxGapLayers(7),
23  m_fitLayers(30),
28  m_hitSizeZ(0.3f),
29  m_hitSizeX(0.5f)
30 {
31 }
float m_maxLongitudinalDisplacement
maximum allowed longitudinal displacement after extrapolation (normalised to cell size) ...
float m_minCosRelativeAngle
maximum allowed relative angle between associated clusters
unsigned int m_minClusterLayers
minimum allowed number of layers for a clean cluster
float m_hitSizeX
estimated hit size in x (drift time) dimension, units cm
float m_maxGapDistanceSquared
maximum allowed distance (squared) between associated clusters
unsigned int m_maxGapLayers
maximum allowed number of layers between associated clusters
float m_hitSizeZ
estimated hit size in z (wire number) dimension, units cm
unsigned int m_fitLayers
number of layers to fit at start and end of cluster
float m_maxTransverseDisplacement
maximum allowed transverse displacement after extrapolation (normalised to cell size) ...

Member Function Documentation

bool lar_content::LongitudinalAssociationAlgorithm::AreClustersAssociated ( const pandora::Cluster *const  pInnerCluster,
const pandora::Cluster *const  pOuterCluster 
) const
private

Determine whether two clusters are associated.

Parameters
pInnerClusteraddress of the inner cluster
pOuterClusteraddress of the outer cluster
Returns
whether the clusters are associated
bool lar_content::LongitudinalAssociationAlgorithm::AreClustersAssociated ( const pandora::CartesianVector &  innerClusterEnd,
const pandora::CartesianVector &  outerClusterStart,
const pandora::ClusterFitResult &  innerFit,
const pandora::ClusterFitResult &  outerFit 
) const
private

Determine whether two clusters are associated.

Parameters
innerClusterEndinner cluster end position
outerClusterStartouter cluster start position
innerFitinner cluster fit result
outerFitouter cluster fit result
Returns
whether the clusters are associated
void lar_content::LongitudinalAssociationAlgorithm::GetListOfCleanClusters ( const pandora::ClusterList *const  pClusterList,
pandora::ClusterVector &  clusterVector 
) const
privatevirtual

Populate cluster vector with subset of cluster list, containing clusters judged to be clean.

Parameters
pClusterListaddress of the cluster list
clusterVectorto receive the populated cluster vector

Implements lar_content::ClusterAssociationAlgorithm.

Definition at line 35 of file LongitudinalAssociationAlgorithm.cc.

36 {
37  for (ClusterList::const_iterator iter = pClusterList->begin(), iterEnd = pClusterList->end(); iter != iterEnd; ++iter)
38  {
39  const Cluster *const pCluster = *iter;
40 
41  if (1 + pCluster->GetOuterPseudoLayer() - pCluster->GetInnerPseudoLayer() < m_minClusterLayers)
42  continue;
43 
44  clusterVector.push_back(pCluster);
45  }
46 
47  std::sort(clusterVector.begin(), clusterVector.end(), LArClusterHelper::SortByInnerLayer);
48 }
intermediate_table::const_iterator const_iterator
unsigned int m_minClusterLayers
minimum allowed number of layers for a clean cluster
static bool SortByInnerLayer(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by inner layer, then position, then pulse-height.
bool lar_content::LongitudinalAssociationAlgorithm::IsExtremalCluster ( const bool  isForward,
const pandora::Cluster *const  pCurrentCluster,
const pandora::Cluster *const  pTestCluster 
) const
privatevirtual

Determine which of two clusters is extremal.

Parameters
isForwardwhether propagation direction is forward
pCurrentClustercurrent extremal cluster
pTestClusterpotential extremal cluster
Returns
boolean

Implements lar_content::ClusterAssociationAlgorithm.

Definition at line 77 of file LongitudinalAssociationAlgorithm.cc.

78 {
79  const unsigned int currentLayer(isForward ? pCurrentCluster->GetOuterPseudoLayer() : pCurrentCluster->GetInnerPseudoLayer());
80  const unsigned int testLayer(isForward ? pTestCluster->GetOuterPseudoLayer() : pTestCluster->GetInnerPseudoLayer());
81 
82  if (isForward && ((testLayer > currentLayer) || ((testLayer == currentLayer) && LArClusterHelper::SortByNHits(pTestCluster, pCurrentCluster))))
83  return true;
84 
85  if (!isForward && ((testLayer < currentLayer) || ((testLayer == currentLayer) && LArClusterHelper::SortByNHits(pTestCluster, pCurrentCluster))))
86  return true;
87 
88  return false;
89 }
static bool SortByNHits(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by number of hits, then layer span, then inner layer, then position, then pulse-height.
void lar_content::LongitudinalAssociationAlgorithm::PopulateClusterAssociationMap ( const pandora::ClusterVector &  clusterVector,
ClusterAssociationMap clusterAssociationMap 
) const
privatevirtual

Populate the cluster association map.

Parameters
clusterVectorthe cluster vector
clusterAssociationMapto receive the populated cluster association map

Implements lar_content::ClusterAssociationAlgorithm.

Definition at line 52 of file LongitudinalAssociationAlgorithm.cc.

53 {
54  // ATTN This method assumes that clusters have been sorted by layer
55  for (ClusterVector::const_iterator iterI = clusterVector.begin(), iterIEnd = clusterVector.end(); iterI != iterIEnd; ++iterI)
56  {
57  const Cluster *const pInnerCluster = *iterI;
58 
59  for (ClusterVector::const_iterator iterJ = iterI, iterJEnd = clusterVector.end(); iterJ != iterJEnd; ++iterJ)
60  {
61  const Cluster *const pOuterCluster = *iterJ;
62 
63  if (pInnerCluster == pOuterCluster)
64  continue;
65 
66  if (!this->AreClustersAssociated(pInnerCluster, pOuterCluster))
67  continue;
68 
69  clusterAssociationMap[pInnerCluster].m_forwardAssociations.insert(pOuterCluster);
70  clusterAssociationMap[pOuterCluster].m_backwardAssociations.insert(pInnerCluster);
71  }
72  }
73 }
intermediate_table::const_iterator const_iterator
bool AreClustersAssociated(const pandora::Cluster *const pInnerCluster, const pandora::Cluster *const pOuterCluster) const
Determine whether two clusters are associated.
StatusCode lar_content::LongitudinalAssociationAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::ClusterAssociationAlgorithm.

Definition at line 183 of file LongitudinalAssociationAlgorithm.cc.

184 {
185  PANDORA_RETURN_RESULT_IF_AND_IF(
186  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterLayers", m_minClusterLayers));
187 
188  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxGapLayers", m_maxGapLayers));
189 
190  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "FitLayers", m_fitLayers));
191 
192  float maxGapDistance = std::sqrt(m_maxGapDistanceSquared);
193  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxGapDistance", maxGapDistance));
194  m_maxGapDistanceSquared = maxGapDistance * maxGapDistance;
195 
196  PANDORA_RETURN_RESULT_IF_AND_IF(
197  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinCosRelativeAngle", m_minCosRelativeAngle));
198 
199  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
200  XmlHelper::ReadValue(xmlHandle, "MaxTransverseDisplacement", m_maxTransverseDisplacement));
201 
202  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
203  XmlHelper::ReadValue(xmlHandle, "MaxLongitudinalDisplacement", m_maxLongitudinalDisplacement));
204 
205  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "HitSizeZ", m_hitSizeZ));
206 
207  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "HitSizeX", m_hitSizeX));
208 
210 }
float m_maxLongitudinalDisplacement
maximum allowed longitudinal displacement after extrapolation (normalised to cell size) ...
float m_minCosRelativeAngle
maximum allowed relative angle between associated clusters
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_minClusterLayers
minimum allowed number of layers for a clean cluster
float m_hitSizeX
estimated hit size in x (drift time) dimension, units cm
float m_maxGapDistanceSquared
maximum allowed distance (squared) between associated clusters
unsigned int m_maxGapLayers
maximum allowed number of layers between associated clusters
float m_hitSizeZ
estimated hit size in z (wire number) dimension, units cm
unsigned int m_fitLayers
number of layers to fit at start and end of cluster
float m_maxTransverseDisplacement
maximum allowed transverse displacement after extrapolation (normalised to cell size) ...

Member Data Documentation

unsigned int lar_content::LongitudinalAssociationAlgorithm::m_fitLayers
private

number of layers to fit at start and end of cluster

Definition at line 62 of file LongitudinalAssociationAlgorithm.h.

float lar_content::LongitudinalAssociationAlgorithm::m_hitSizeX
private

estimated hit size in x (drift time) dimension, units cm

Definition at line 68 of file LongitudinalAssociationAlgorithm.h.

float lar_content::LongitudinalAssociationAlgorithm::m_hitSizeZ
private

estimated hit size in z (wire number) dimension, units cm

Definition at line 67 of file LongitudinalAssociationAlgorithm.h.

float lar_content::LongitudinalAssociationAlgorithm::m_maxGapDistanceSquared
private

maximum allowed distance (squared) between associated clusters

Definition at line 63 of file LongitudinalAssociationAlgorithm.h.

unsigned int lar_content::LongitudinalAssociationAlgorithm::m_maxGapLayers
private

maximum allowed number of layers between associated clusters

Definition at line 61 of file LongitudinalAssociationAlgorithm.h.

float lar_content::LongitudinalAssociationAlgorithm::m_maxLongitudinalDisplacement
private

maximum allowed longitudinal displacement after extrapolation (normalised to cell size)

Definition at line 66 of file LongitudinalAssociationAlgorithm.h.

float lar_content::LongitudinalAssociationAlgorithm::m_maxTransverseDisplacement
private

maximum allowed transverse displacement after extrapolation (normalised to cell size)

Definition at line 65 of file LongitudinalAssociationAlgorithm.h.

unsigned int lar_content::LongitudinalAssociationAlgorithm::m_minClusterLayers
private

minimum allowed number of layers for a clean cluster

Definition at line 60 of file LongitudinalAssociationAlgorithm.h.

float lar_content::LongitudinalAssociationAlgorithm::m_minCosRelativeAngle
private

maximum allowed relative angle between associated clusters

Definition at line 64 of file LongitudinalAssociationAlgorithm.h.


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