LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::LArClusterHelper Class Reference

LArClusterHelper class. More...

#include "LArClusterHelper.h"

Public Types

typedef std::set< unsigned int > UIntSet
 

Static Public Member Functions

static void GetAllHits (const pandora::Cluster *const pCluster, pandora::CaloHitList &caloHitList)
 Get all hits (ordered and isoltated) associated with a two dimensional cluster. More...
 
static pandora::HitType GetClusterHitType (const pandora::Cluster *const pCluster)
 Get the hit type associated with a two dimensional cluster. More...
 
static void GetClustersUVW (const pandora::ClusterList &inputClusters, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW)
 Divide an input cluster list into separate u, v and w lists (exception raised if alternative hit type encountered) More...
 
static void GetClustersByHitType (const pandora::ClusterList &inputClusters, const pandora::HitType hitType, pandora::ClusterList &clusterList)
 Get the subset of clusters, from a provided list, that match the specified hit type. More...
 
static float GetLengthSquared (const pandora::Cluster *const pCluster)
 Get length squared of cluster. More...
 
static float GetLength (const pandora::Cluster *const pCluster)
 Get length of cluster. More...
 
static float GetEnergyFromLength (const pandora::Cluster *const pCluster)
 Get energy of cluster, based on length. More...
 
static unsigned int GetLayerSpan (const pandora::Cluster *const pCluster)
 Get number of layers spanned by cluster (1+Last-First) More...
 
static float GetLayerOccupancy (const pandora::Cluster *const pCluster)
 Fraction of occupied layers in cluster. More...
 
static float GetLayerOccupancy (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2)
 Fraction of occupied layers in a pair of clusters. More...
 
static float GetClosestDistance (const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
 Get closest distance between clusters in a pair of cluster lists. More...
 
static float GetClosestDistance (const pandora::Cluster *const pCluster, const pandora::ClusterList &clusterList)
 Get closest distance between a specified cluster and list of clusters. More...
 
static float GetClosestDistance (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2)
 Get closest distance between a pair of clusters. More...
 
static float GetClosestDistance (const pandora::CartesianVector &position, const pandora::ClusterList &clusterList)
 Get closest distance between a specified position and list of clusters. More...
 
static float GetClosestDistance (const pandora::CartesianVector &position, const pandora::Cluster *const pCluster)
 Get closest distance between a specified position vector and the hits in a specified cluster. More...
 
static float GetClosestDistance (const pandora::CartesianVector &position, const pandora::CaloHitList &caloHitList)
 Get closest distance between a specified position vector and the hits in a specified calo hit list. More...
 
static pandora::CartesianVector GetClosestPosition (const pandora::CartesianVector &position, const pandora::ClusterList &clusterList)
 Get closest position in a list of clusters to a specified input position vector. More...
 
static pandora::CartesianVector GetClosestPosition (const pandora::CartesianVector &position, const pandora::Cluster *const pCluster)
 Get closest position on a cluster to a specified input position vector. More...
 
static pandora::CartesianVector GetClosestPosition (const pandora::CartesianVector &position, const pandora::CaloHitList &caloHitList)
 Get closest position of hits in a given calo hit list to a specified input position vector. More...
 
static pandora::CartesianVector GetClosestPosition (const pandora::CartesianVector &position, const pandora::OrderedCaloHitList &caloHitList)
 Get closest position of hits in a given calo hit list to a specified input position vector. More...
 
static void GetClosestPositions (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, pandora::CartesianVector &position1, pandora::CartesianVector &position2)
 Get pair of closest positions for a pair of clusters. More...
 
static void GetExtremalCoordinates (const pandora::ClusterList &clusterList, pandora::CartesianVector &innerCoordinate, pandora::CartesianVector &outerCoordinate)
 Get positions of the two most distant calo hits in a list of cluster (ordered by Z) More...
 
static void GetExtremalCoordinates (const pandora::Cluster *const pCluster, pandora::CartesianVector &innerCoordinate, pandora::CartesianVector &outerCoordinate)
 Get positions of the two most distant calo hits in a cluster (ordered by Z) More...
 
static void GetExtremalCoordinates (const pandora::OrderedCaloHitList &orderedCaloHitList, pandora::CartesianVector &innerCoordinate, pandora::CartesianVector &outerCoordinate)
 Get positions of the two most distant calo hits in an ordered calo hit list (ordered by Z) More...
 
static void GetExtremalCoordinates (const pandora::CartesianPointVector &coordinateVector, pandora::CartesianVector &innerCoordinate, pandora::CartesianVector &outerCoordinate)
 Get positions of the two most distant points in a provided list (ordered by Z) More...
 
static void GetClusterBoundingBox (const pandora::Cluster *const pCluster, pandora::CartesianVector &minimumCoordinate, pandora::CartesianVector &maximumCoordinate)
 Get minimum and maximum X, Y and Z positions of the calo hits in a cluster. More...
 
static void GetCoordinateVector (const pandora::Cluster *const pCluster, pandora::CartesianPointVector &coordinateVector)
 Get vector of hit coordinates from an input cluster. More...
 
static void GetCaloHitListInBoundingBox (const pandora::Cluster *const pCluster, const pandora::CartesianVector &lowerBound, const pandora::CartesianVector &upperBound, pandora::CaloHitList &caloHitList)
 Get list of Calo hits from an input cluster that are contained in a bounding box. The hits are sorted by position. More...
 
static void GetDaughterVolumeIDs (const pandora::Cluster *const pCluster, UIntSet &daughterVolumeIds)
 Get the set of the daughter volumes that contains the cluster. More...
 
static pandora::StatusCode GetAverageZ (const pandora::Cluster *const pCluster, const float xmin, const float xmax, float &averageZ)
 Get average Z positions of the calo hits in a cluster in range xmin to xmax. More...
 
static bool SortByNOccupiedLayers (const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
 Sort clusters by number of occupied layers, and by inner layer, then energy in event of a tie. More...
 
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. More...
 
static bool SortByLayerSpan (const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
 Sort clusters by layer span, then inner layer, then position, then pulse-height. More...
 
static bool SortByInnerLayer (const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
 Sort clusters by inner layer, then position, then pulse-height. More...
 
static bool SortByPosition (const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
 Sort clusters by position, then pulse-height. More...
 
static bool SortByPulseHeight (const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
 Sort clusters by pulse-height. More...
 
static bool SortHitsByPosition (const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
 Sort calo hits by their position (use Z, followed by X, followed by Y) More...
 
static bool SortHitsByPositionInX (const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
 Sort calo hits by their position (use X, followed by Z, followed by Y) More...
 
static bool SortHitsByPulseHeight (const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
 Sort calo hits by their pulse height. More...
 
static bool SortCoordinatesByPosition (const pandora::CartesianVector &lhs, const pandora::CartesianVector &rhs)
 Sort cartesian vectors by their position (use Z, followed by X, followed by Y) More...
 

Detailed Description

LArClusterHelper class.

Definition at line 19 of file LArClusterHelper.h.

Member Typedef Documentation

typedef std::set<unsigned int> lar_content::LArClusterHelper::UIntSet

Definition at line 22 of file LArClusterHelper.h.

Member Function Documentation

void lar_content::LArClusterHelper::GetAllHits ( const pandora::Cluster *const  pCluster,
pandora::CaloHitList &  caloHitList 
)
static

Get all hits (ordered and isoltated) associated with a two dimensional cluster.

Parameters
pClusterthe address of the cluster
caloHitListthe output list of hits

Definition at line 21 of file LArClusterHelper.cc.

22 {
23  pCluster->GetOrderedCaloHitList().FillCaloHitList(caloHitList);
24  const CaloHitList &isolatedHitList{pCluster->GetIsolatedCaloHitList()};
25  caloHitList.insert(caloHitList.end(), isolatedHitList.begin(), isolatedHitList.end());
26 }
StatusCode lar_content::LArClusterHelper::GetAverageZ ( const pandora::Cluster *const  pCluster,
const float  xmin,
const float  xmax,
float &  averageZ 
)
static

Get average Z positions of the calo hits in a cluster in range xmin to xmax.

Parameters
pClusteraddress of the cluster
xminfor range in x
xmaxfor range in x
averageZto receive the average Z position
Returns
status code, faster than throwing in regular use-cases

Definition at line 397 of file LArClusterHelper.cc.

References f.

Referenced by lar_content::ThreeViewRemnantsAlgorithm::CalculateOverlapResult(), lar_content::ParticleRecoveryAlgorithm::CheckConsistency(), and lar_content::CosmicRayShowerMatchingAlgorithm::CheckMatchedClusters3D().

398 {
399  averageZ = std::numeric_limits<float>::max();
400 
401  if (xmin > xmax)
402  return STATUS_CODE_INVALID_PARAMETER;
403 
404  const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
405 
406  float zsum(0.f);
407  int count(0);
408 
409  for (OrderedCaloHitList::const_iterator ochIter = orderedCaloHitList.begin(), ochIterEnd = orderedCaloHitList.end(); ochIter != ochIterEnd; ++ochIter)
410  {
411  for (CaloHitList::const_iterator hIter = ochIter->second->begin(), hIterEnd = ochIter->second->end(); hIter != hIterEnd; ++hIter)
412  {
413  const CaloHit *const pCaloHit = *hIter;
414  const CartesianVector &hit(pCaloHit->GetPositionVector());
415 
416  if (hit.GetX() < xmin || hit.GetX() > xmax)
417  continue;
418 
419  zsum += hit.GetZ();
420  ++count;
421  }
422  }
423 
424  if (count == 0)
425  return STATUS_CODE_NOT_FOUND;
426 
427  averageZ = zsum / static_cast<float>(count);
428  return STATUS_CODE_SUCCESS;
429 }
intermediate_table::const_iterator const_iterator
TFile f
Definition: plotHisto.C:6
Detector simulation of raw signals on wires.
void lar_content::LArClusterHelper::GetCaloHitListInBoundingBox ( const pandora::Cluster *const  pCluster,
const pandora::CartesianVector &  lowerBound,
const pandora::CartesianVector &  upperBound,
pandora::CaloHitList &  caloHitList 
)
static

Get list of Calo hits from an input cluster that are contained in a bounding box. The hits are sorted by position.

Parameters
pClusteraddress of the cluster
lowerBoundone opposing corner of the bounding box
upperBoundthe other opposing corner of the bounding box
caloHitListthe CaloHitList to be filled

Definition at line 595 of file LArClusterHelper.cc.

References maxY, and minY.

Referenced by lar_content::TwoViewTransverseTracksAlgorithm::TwoViewTransverseTracksAlgorithm().

597 {
598  const bool useX(std::fabs(upperBound.GetX() - lowerBound.GetX()) > std::numeric_limits<float>::epsilon());
599  const bool useY(std::fabs(upperBound.GetY() - lowerBound.GetY()) > std::numeric_limits<float>::epsilon());
600  const bool useZ(std::fabs(upperBound.GetZ() - lowerBound.GetZ()) > std::numeric_limits<float>::epsilon());
601  if (!useX && !useY && !useZ)
602  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
603 
604  const float minX(std::min(lowerBound.GetX(), upperBound.GetX()));
605  const float maxX(std::max(lowerBound.GetX(), upperBound.GetX()));
606  const float minY(std::min(lowerBound.GetY(), upperBound.GetY()));
607  const float maxY(std::max(lowerBound.GetY(), upperBound.GetY()));
608  const float minZ(std::min(lowerBound.GetZ(), upperBound.GetZ()));
609  const float maxZ(std::max(lowerBound.GetZ(), upperBound.GetZ()));
610 
611  for (const OrderedCaloHitList::value_type &layerEntry : pCluster->GetOrderedCaloHitList())
612  {
613  for (const CaloHit *const pCaloHit : *layerEntry.second)
614  {
615  const CartesianVector &hitPosition = pCaloHit->GetPositionVector();
616  if (useX &&
617  (hitPosition.GetX() < minX - std::numeric_limits<float>::epsilon() || hitPosition.GetX() > maxX + std::numeric_limits<float>::epsilon()))
618  continue;
619  else if (useY &&
620  (hitPosition.GetY() < minY - std::numeric_limits<float>::epsilon() || hitPosition.GetY() > maxY + std::numeric_limits<float>::epsilon()))
621  continue;
622  else if (useZ &&
623  (hitPosition.GetZ() < minZ - std::numeric_limits<float>::epsilon() || hitPosition.GetZ() > maxZ + std::numeric_limits<float>::epsilon()))
624  continue;
625 
626  caloHitList.push_back(pCaloHit);
627  }
628  }
629  caloHitList.sort(LArClusterHelper::SortHitsByPosition);
630 }
double minY
Definition: plot_hist.C:9
double maxY
Definition: plot_hist.C:10
static bool SortHitsByPosition(const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
Sort calo hits by their position (use Z, followed by X, followed by Y)
static float lar_content::LArClusterHelper::GetClosestDistance ( const pandora::ClusterList &  clusterList1,
const pandora::ClusterList &  clusterList2 
)
static

Get closest distance between clusters in a pair of cluster lists.

Parameters
clusterList1the first cluster list
clusterList2the second cluster list
Returns
the closest distance

Referenced by lar_content::LArMuonLeadingHelper::AddInPostBremsstrahlungHits(), lar_content::TrackRefinementBaseAlgorithm::AddToNearestCluster(), lar_content::BoundedRegionClusterMergingAlgorithm::AreClustersAssociated(), lar_content::ShowerGrowingAlgorithm::AreClustersAssociated(), lar_content::NeutrinoDaughterVerticesAlgorithm::BuildDaughterTrack(), lar_content::OvershootSplittingAlgorithm::BuildIntersectionMap(), lar_content::ThreeDReclusteringAlgorithm::BuildNewTwoDClusters(), lar_content::SplitShowersTool::CheckClusterProximities(), lar_content::CosmicRayTrackMatchingAlgorithm::CheckMatchedClusters3D(), lar_content::NearbyClusterMopUpAlgorithm::ClusterMopUp(), lar_content::CosmicRayRemovalTool::CollectHitsFromDeltaRay(), lar_content::TwoViewCosmicRayRemovalTool::CollectHitsFromDeltaRay(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::CollectStrayClusters(), lar_content::CosmicRaySplittingAlgorithm::ConfirmSplitPosition(), lar_content::CosmicRayRemovalTool::CreateSeed(), lar_content::TwoViewCosmicRayRemovalTool::CreateSeed(), lar_content::MuonLeadingEventValidationAlgorithm::FillContaminationHitsDistance(), lar_content::AmbiguousRegionFeatureTool::FindAmbiguousContinuousSpine(), lar_content::DeltaRaySplittingAlgorithm::FindBestSplitPosition(), lar_content::CrossedTrackSplittingAlgorithm::FindBestSplitPosition(), lar_content::ElectronInitialRegionRefinementAlgorithm::FindContinuousPath(), lar_content::DeltaRayMergeTool::FindVertices(), lar_content::TrackRefinementBaseAlgorithm::FragmentRemnantCluster(), lar_content::LocalAsymmetryFeatureTool::GetAsymmetryForView(), lar_content::GlobalAsymmetryFeatureTool::GetAsymmetryForView(), lar_content::DeltaRayIdentificationAlgorithm::GetClosestDistance(), lar_content::LArMuonLeadingHelper::GetClosestPosition(), lar_content::DeltaRayMatchingAlgorithm::GetDistanceSquaredToPfo(), lar_content::TransverseExtensionAlgorithm::GetListOfCleanClusters(), lar_content::DeltaRayGrowingAlgorithm::GetListOfSeedClusters(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions(), lar_content::DeltaRayParentAlgorithm::GetTwoDSeparation(), lar_content::CutClusterCharacterisationAlgorithm::GetVertexDistance(), lar_content::SimpleClusterMergingAlgorithm::IsAssociated(), lar_content::DeltaRayMergeTool::IsBrokenCluster(), lar_content::UnambiguousDeltaRayTool::IsConnected(), lar_content::ConnectedRemnantsTool::IsConnected(), lar_content::DeltaRayMergeTool::IsConnected(), lar_content::DeltaRayMergeTool::IsHiddenByTrack(), lar_content::TwoViewCosmicRayRemovalTool::PassElementChecks(), lar_content::RemovalBaseTool::PassElementChecks(), lar_content::OneViewDeltaRayMatchingAlgorithm::PerformOneViewMatching(), lar_content::ClusterGrowingAlgorithm::PopulateClusterMergeMap(), lar_content::CosmicRayRemovalTool::ReclusterRemnant(), lar_content::TwoViewCosmicRayRemovalTool::ReclusterRemnant(), lar_content::VertexRefinementAlgorithm::RefineVertexTwoD(), lar_content::BranchAssociatedPfosTool::Run(), lar_content::CosmicRayTrackMatchingAlgorithm::SelectCleanClusters(), and lar_content::ShowerAsymmetryFeatureTool::ShouldUseShowerCluster().

static float lar_content::LArClusterHelper::GetClosestDistance ( const pandora::Cluster *const  pCluster,
const pandora::ClusterList &  clusterList 
)
static

Get closest distance between a specified cluster and list of clusters.

Parameters
pClusteraddress of the input cluster
clusterListlist of input clusters
Returns
the closest distance
static float lar_content::LArClusterHelper::GetClosestDistance ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2 
)
static

Get closest distance between a pair of clusters.

Parameters
pCluster1address of the first cluster
pCluster2address of the second cluster
Returns
the closest distance
static float lar_content::LArClusterHelper::GetClosestDistance ( const pandora::CartesianVector &  position,
const pandora::ClusterList &  clusterList 
)
static

Get closest distance between a specified position and list of clusters.

Parameters
positionthe position vector
clusterListlist of input clusters
Returns
the closest distance
static float lar_content::LArClusterHelper::GetClosestDistance ( const pandora::CartesianVector &  position,
const pandora::Cluster *const  pCluster 
)
static

Get closest distance between a specified position vector and the hits in a specified cluster.

Parameters
positionthe position vector
pClusteraddress of the cluster
Returns
the closest distance
static float lar_content::LArClusterHelper::GetClosestDistance ( const pandora::CartesianVector &  position,
const pandora::CaloHitList &  caloHitList 
)
static

Get closest distance between a specified position vector and the hits in a specified calo hit list.

Parameters
positionthe position vector
caloHitListthe list of calo hits
Returns
the closest distance
static pandora::CartesianVector lar_content::LArClusterHelper::GetClosestPosition ( const pandora::CartesianVector &  position,
const pandora::Cluster *const  pCluster 
)
static

Get closest position on a cluster to a specified input position vector.

Parameters
positionthe position vector
pClusteraddress of the cluster
Returns
the closest position
static pandora::CartesianVector lar_content::LArClusterHelper::GetClosestPosition ( const pandora::CartesianVector &  position,
const pandora::CaloHitList &  caloHitList 
)
static

Get closest position of hits in a given calo hit list to a specified input position vector.

Parameters
positionthe position vector
caloHitListthe list of calo hits
Returns
the closest position
static pandora::CartesianVector lar_content::LArClusterHelper::GetClosestPosition ( const pandora::CartesianVector &  position,
const pandora::OrderedCaloHitList &  caloHitList 
)
static

Get closest position of hits in a given calo hit list to a specified input position vector.

Parameters
positionthe position vector
caloHitListthe list of calo hits
Returns
the closest position
void lar_content::LArClusterHelper::GetClosestPositions ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
pandora::CartesianVector &  position1,
pandora::CartesianVector &  position2 
)
static

Get pair of closest positions for a pair of clusters.

Parameters
pCluster1the address of the first cluster
pCluster2the address of the second cluster
theclosest position in the first cluster
theclosest position in the second cluster

Definition at line 316 of file LArClusterHelper.cc.

References f.

Referenced by lar_content::NeutrinoDaughterVerticesAlgorithm::BuildDaughterShower(), lar_content::EndAssociatedPfosTool::IsCloseToParentEndpoint(), lar_content::DeltaRayRemovalTool::IsContaminated(), lar_content::CosmicRayRemovalTool::IsContaminated(), and lar_content::TwoViewCosmicRayRemovalTool::IsContaminated().

318 {
319  bool distanceFound(false);
320  float minDistanceSquared(std::numeric_limits<float>::max());
321 
322  CartesianVector closestPosition1(0.f, 0.f, 0.f);
323  CartesianVector closestPosition2(0.f, 0.f, 0.f);
324 
325  const OrderedCaloHitList &orderedCaloHitList1(pCluster1->GetOrderedCaloHitList());
326  const OrderedCaloHitList &orderedCaloHitList2(pCluster2->GetOrderedCaloHitList());
327 
328  // Loop over hits in cluster 1
329  for (OrderedCaloHitList::const_iterator iter1 = orderedCaloHitList1.begin(), iter1End = orderedCaloHitList1.end(); iter1 != iter1End; ++iter1)
330  {
331  for (CaloHitList::const_iterator hitIter1 = iter1->second->begin(), hitIter1End = iter1->second->end(); hitIter1 != hitIter1End; ++hitIter1)
332  {
333  const CartesianVector &positionVector1((*hitIter1)->GetPositionVector());
334 
335  // Loop over hits in cluster 2
336  for (OrderedCaloHitList::const_iterator iter2 = orderedCaloHitList2.begin(), iter2End = orderedCaloHitList2.end(); iter2 != iter2End; ++iter2)
337  {
338  for (CaloHitList::const_iterator hitIter2 = iter2->second->begin(), hitIter2End = iter2->second->end(); hitIter2 != hitIter2End; ++hitIter2)
339  {
340  const CartesianVector &positionVector2((*hitIter2)->GetPositionVector());
341 
342  const float distanceSquared((positionVector1 - positionVector2).GetMagnitudeSquared());
343 
344  if (distanceSquared < minDistanceSquared)
345  {
346  minDistanceSquared = distanceSquared;
347  closestPosition1 = positionVector1;
348  closestPosition2 = positionVector2;
349  distanceFound = true;
350  }
351  }
352  }
353  }
354  }
355 
356  if (!distanceFound)
357  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
358 
359  outputPosition1 = closestPosition1;
360  outputPosition2 = closestPosition2;
361 }
intermediate_table::const_iterator const_iterator
TFile f
Definition: plotHisto.C:6
void lar_content::LArClusterHelper::GetClusterBoundingBox ( const pandora::Cluster *const  pCluster,
pandora::CartesianVector &  minimumCoordinate,
pandora::CartesianVector &  maximumCoordinate 
)
static

Get minimum and maximum X, Y and Z positions of the calo hits in a cluster.

Parameters
pClusteraddress of the cluster
theminimum positions (x,y,z)
themaximum positions (x,y,z)

Definition at line 365 of file LArClusterHelper.cc.

Referenced by lar_content::ThreeViewTrackFragmentsAlgorithm::CheckMatchedClusters(), lar_content::TrainedVertexSelectionAlgorithm::GetLegacyEventShapeFeatures(), lar_content::BoundedRegionClusterMergingAlgorithm::GetListOfBoundedRegionClusters(), and lar_content::CosmicRayTrackRecoveryAlgorithm::SelectCleanClusters().

366 {
367  const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
368 
369  float xmin(std::numeric_limits<float>::max());
370  float ymin(std::numeric_limits<float>::max());
371  float zmin(std::numeric_limits<float>::max());
372  float xmax(-std::numeric_limits<float>::max());
373  float ymax(-std::numeric_limits<float>::max());
374  float zmax(-std::numeric_limits<float>::max());
375 
376  for (OrderedCaloHitList::const_iterator ochIter = orderedCaloHitList.begin(), ochIterEnd = orderedCaloHitList.end(); ochIter != ochIterEnd; ++ochIter)
377  {
378  for (CaloHitList::const_iterator hIter = ochIter->second->begin(), hIterEnd = ochIter->second->end(); hIter != hIterEnd; ++hIter)
379  {
380  const CaloHit *const pCaloHit = *hIter;
381  const CartesianVector &hit(pCaloHit->GetPositionVector());
382  xmin = std::min(hit.GetX(), xmin);
383  xmax = std::max(hit.GetX(), xmax);
384  ymin = std::min(hit.GetY(), ymin);
385  ymax = std::max(hit.GetY(), ymax);
386  zmin = std::min(hit.GetZ(), zmin);
387  zmax = std::max(hit.GetZ(), zmax);
388  }
389  }
390 
391  minimumCoordinate.SetValues(xmin, ymin, zmin);
392  maximumCoordinate.SetValues(xmax, ymax, zmax);
393 }
intermediate_table::const_iterator const_iterator
Detector simulation of raw signals on wires.
HitType lar_content::LArClusterHelper::GetClusterHitType ( const pandora::Cluster *const  pCluster)
static

Get the hit type associated with a two dimensional cluster.

Parameters
pClusterthe address of the cluster
Returns
the cluster hit type

Definition at line 30 of file LArClusterHelper.cc.

Referenced by lar_content::ParticleRecoveryAlgorithm::SimpleOverlapTensor::AddAssociation(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::AddInStrayClusters(), lar_content::OneViewDeltaRayMatchingAlgorithm::AddIntoExistingDeltaRay(), lar_content::DeltaRayMatchingContainers::AddToClusterMap(), lar_content::DeltaRayMatchingContainers::AddToClusterProximityMap(), lar_content::DeltaRayMatchingAlgorithm::AddToDaughterPfo(), lar_content::NViewTrackMatchingAlgorithm< T >::AddToSlidingFitCache(), lar_content::ThreeViewShowersAlgorithm::AddToSlidingFitCache(), lar_content::DeltaRayMatchingAlgorithm::AreClustersMatched(), lar_content::EventSlicingTool::AssignRemainingHitsToSlices(), lar_content::ThreeDReclusteringAlgorithm::BuildNewTwoDClusters(), lar_content::CrossGapsExtensionAlgorithm::BuildPointingClusterList(), lar_content::TrackHitsBaseTool::BuildSlidingFitMap(), lar_content::CosmicRaySplittingAlgorithm::BuildSlidingFitResultMap(), lar_content::TwoDSlidingFitMultiSplitAlgorithm::BuildSlidingFitResultMap(), lar_content::CosmicRayTrackRecoveryAlgorithm::BuildSlidingFitResultMap(), lar_content::VertexBasedPfoRecoveryAlgorithm::BuildSlidingFitResultMap(), lar_content::TwoDSlidingFitSplittingAndSwitchingAlgorithm::BuildSlidingFitResultMap(), lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm::BuildSlidingFitResultMap(), lar_content::TwoDSlidingFitConsolidationAlgorithm::BuildSlidingLinearFits(), lar_content::ParticleRecoveryAlgorithm::CalculateEffectiveSpan(), lar_content::TwoDLinearFitFeatureTool::CalculateVariablesSlidingLinearFit(), lar_content::ThreeDLinearFitFeatureTool::CalculateVariablesSlidingLinearFit(), lar_content::SplitShowersTool::CheckClusterVertexRelations(), lar_content::CosmicRayShowerMatchingAlgorithm::CheckMatchedClusters3D(), lar_content::CosmicRayTrackMatchingAlgorithm::CheckMatchedClusters3D(), lar_content::TracksCrossingGapsTool::CheckXPositionInGap(), lar_content::ConeClusterMopUpAlgorithm::ClusterMopUp(), lar_content::NearbyClusterMopUpAlgorithm::ClusterMopUp(), lar_content::BoundedClusterMopUpAlgorithm::ClusterMopUp(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::CollectStrayClusters(), lar_content::EventSlicingTool::CopyPfoHitsToSlices(), lar_content::OneViewDeltaRayMatchingAlgorithm::CreateDeltaRay(), lar_content::CandidateVertexCreationAlgorithm::CreateEndpointCandidates(), lar_content::CandidateVertexCreationAlgorithm::CreateEndpointVertex(), lar_content::EventSlicingTool::CreateSlices(), lar_content::CutPfoCharacterisationAlgorithm::CutPfoCharacterisationAlgorithm(), lar_content::MvaLowEClusterMergingAlgorithm< T >::EdgeHitComparer(), lar_content::CrossGapsExtensionAlgorithm::FillClusterAssociationMatrix(), lar_content::DeltaRayMatchingContainers::FillClusterProximityMap(), lar_content::TransverseAssociationAlgorithm::FillTransverseClusterList(), lar_content::VertexSplittingAlgorithm::FindBestSplitPosition(), lar_content::DeltaRayMergeTool::FindVertices(), lar_content::TwoViewDeltaRayMatchingAlgorithm::FormThirdViewCluster(), lar_content::ShowerGrowingAlgorithm::GetAllVertexSeedCandidates(), lar_content::VertexBasedPfoRecoveryAlgorithm::GetAvailableClusters(), lar_content::TwoViewDeltaRayMatchingAlgorithm::GetBestMatchedCluster(), lar_content::VertexBasedPfoMopUpAlgorithm::GetClusterAssociation(), lar_content::VertexRefinementAlgorithm::GetClusterLists(), lar_content::ClusterMopUpBaseAlgorithm::GetClusterLists(), lar_content::VertexSelectionBaseAlgorithm::GetClusterLists(), lar_content::SlidingConePfoMopUpAlgorithm::GetClusterMergeMap(), lar_content::SlidingConeClusterMopUpAlgorithm::GetClusterMergeMap(), lar_content::ParticleRecoveryAlgorithm::SimpleOverlapTensor::GetConnectedElements(), lar_content::DeltaRayMatchingAlgorithm::GetDistanceSquaredToPfo(), lar_content::ShowerGrowingAlgorithm::GetFigureOfMerit(), lar_content::ParticleRecoveryAlgorithm::GetInputClusters(), lar_content::VertexBasedPfoMopUpAlgorithm::GetInputPfos(), lar_content::TransverseExtensionAlgorithm::GetListOfCleanClusters(), lar_content::LongitudinalAssociationAlgorithm::GetListOfCleanClusters(), lar_content::DeltaRayGrowingAlgorithm::GetListOfSeedClusters(), lar_content::OneViewDeltaRayMatchingAlgorithm::GetNearbyAvailableClusters(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetNearbyMuonPfos(), lar_content::CheatingPfoCreationAlgorithm::GetNHitTypesAboveThreshold(), lar_content::NeutrinoPropertiesAlgorithm::GetNTwoDHitsInPfoChain(), lar_pandora::LArPandoraOutput::GetPandoraToArtHitMap(), lar_content::VertexBasedPfoMopUpAlgorithm::GetPfoAssociations(), lar_content::ThreeViewTrackFragmentsAlgorithm::GetProjectedPositions(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions(), lar_content::MissingTrackSegmentTool::GetSlidingFitResultMap(), lar_content::CutClusterCharacterisationAlgorithm::GetVertexDistance(), lar_content::TrackRefinementBaseAlgorithm::InitialiseContainers(), lar_content::CrossGapsAssociationAlgorithm::IsAssociated(), lar_content::CrossGapsExtensionAlgorithm::IsAssociated(), lar_content::PfoCharacterisationBaseAlgorithm::IsClearTrack3x2D(), lar_content::DeltaRayMergeTool::IsConnected(), lar_content::OneViewDeltaRayMatchingAlgorithm::IsDeltaRayPfo(), lar_content::OneViewDeltaRayMatchingAlgorithm::IsMuonPfo(), lar_content::CrossGapsAssociationAlgorithm::IsNearCluster(), lar_content::ParticleRecoveryAlgorithm::IsOverlap(), lar_content::UndershootTracksTool::IsThreeDKink(), lar_content::OvershootTracksTool::IsThreeDKink(), lar_content::TwoViewThreeDKinkTool::IsThreeDKink(), lar_content::TransverseAssociationAlgorithm::IsTransverseAssociated(), lar_content::SlidingConeClusterMopUpAlgorithm::MakeClusterMerges(), lar_content::NViewTrackMatchingAlgorithm< T >::MakeClusterSplits(), lar_content::CosmicRayTrackRecoveryAlgorithm::MatchClusters(), lar_content::VertexBasedPfoRecoveryAlgorithm::MatchThreeViews(), lar_content::VertexBasedPfoRecoveryAlgorithm::MatchTwoViews(), lar_content::OneViewDeltaRayMatchingAlgorithm::MergeClusterGroup(), lar_content::ThreeDChargeFeatureTool::OrderCaloHitsByDistanceToVertex(), lar_content::CosmicRayBaseMatchingAlgorithm::Particle::Particle(), lar_content::MissingTrackSegmentTool::Particle::Particle(), lar_content::VertexBasedPfoRecoveryAlgorithm::Particle::Particle(), lar_content::DeltaRayMatchingAlgorithm::Particle::Particle(), lar_content::TrackSplittingTool::PassesChecks(), lar_content::CrossGapsAssociationAlgorithm::PopulateClusterAssociationMap(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::PrepareInputClusters(), lar_content::DeltaRayMatchingContainers::RemoveClusterFromContainers(), lar_content::TwoViewMatchingControl< T >::SelectAllInputClusters(), lar_content::CandidateVertexCreationAlgorithm::SelectClusters(), lar_content::VertexBasedPfoRecoveryAlgorithm::SelectClusters(), lar_content::VertexBasedPfoRecoveryAlgorithm::SelectVertexClusters(), lar_content::ThreeDHitCreationAlgorithm::SeparateTwoDHits(), lar_content::OvershootTracksTool::SetSplitPosition(), lar_content::MasterAlgorithm::StitchPfos(), lar_content::TrackConsolidationAlgorithm::TrackConsolidationAlgorithm(), lar_content::TwoDSlidingFitSplittingAlgorithm::TwoDSlidingFitSplittingAlgorithm(), lar_content::ThreeViewTrackFragmentsAlgorithm::UpdateForNewCluster(), lar_content::ThreeViewMatchingControl< T >::UpdateForNewCluster(), lar_content::TwoViewMatchingControl< T >::UpdateForNewCluster(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::UpdateUponDeletion().

31 {
32  if (0 == pCluster->GetNCaloHits())
33  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
34 
35  // TODO Find a way of confirming single hit-type clustering mode; currently only checked in ListPreparation algorithm
36  // if (!pandora->GetSettings()->SingleHitTypeClusteringMode())
37  // throw StatusCodeException(STATUS_CODE_FAILURE);
38 
39  return (*(pCluster->GetOrderedCaloHitList().begin()->second->begin()))->GetHitType();
40 }
void lar_content::LArClusterHelper::GetClustersByHitType ( const pandora::ClusterList &  inputClusters,
const pandora::HitType  hitType,
pandora::ClusterList &  clusterList 
)
static

Get the subset of clusters, from a provided list, that match the specified hit type.

Parameters
inputClustersthe input cluster list
hitTypethe specified hit type
clusterListto receive the clusters

Definition at line 63 of file LArClusterHelper.cc.

Referenced by lar_content::CosmicRayTrackRecoveryAlgorithm::MergeClusters().

64 {
65  for (ClusterList::const_iterator iter = inputClusters.begin(), iterEnd = inputClusters.end(); iter != iterEnd; ++iter)
66  {
67  if (hitType == LArClusterHelper::GetClusterHitType(*iter))
68  clusterList.push_back(*iter);
69  }
70 }
intermediate_table::const_iterator const_iterator
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
void lar_content::LArClusterHelper::GetClustersUVW ( const pandora::ClusterList &  inputClusters,
pandora::ClusterList &  clusterListU,
pandora::ClusterList &  clusterListV,
pandora::ClusterList &  clusterListW 
)
static

Divide an input cluster list into separate u, v and w lists (exception raised if alternative hit type encountered)

Parameters
inputClustersthe input cluster list
clusterListUto receive the u clusters
clusterListVto receive the v clusters
clusterListWto receive the w clusters

Definition at line 44 of file LArClusterHelper.cc.

45 {
46  for (ClusterList::const_iterator iter = inputClusters.begin(), iterEnd = inputClusters.end(); iter != iterEnd; ++iter)
47  {
48  const HitType hitType(LArClusterHelper::GetClusterHitType(*iter));
49 
50  if (TPC_VIEW_U == hitType)
51  clusterListU.push_back(*iter);
52  else if (TPC_VIEW_V == hitType)
53  clusterListV.push_back(*iter);
54  else if (TPC_VIEW_W == hitType)
55  clusterListW.push_back(*iter);
56  else
57  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
58  }
59 }
intermediate_table::const_iterator const_iterator
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
HitType
Definition: HitType.h:12
void lar_content::LArClusterHelper::GetCoordinateVector ( const pandora::Cluster *const  pCluster,
pandora::CartesianPointVector &  coordinateVector 
)
static

Get vector of hit coordinates from an input cluster.

Parameters
pClusteraddress of the cluster
coordinateVector

Definition at line 582 of file LArClusterHelper.cc.

Referenced by lar_content::VertexSelectionBaseAlgorithm::ShowerCluster::GetClusterListCoordinateVector(), lar_content::ThreeDSlidingFitResult::GetGlobalDirection(), lar_content::TwoViewTransverseTracksAlgorithm::GetPrimaryAxisDotDriftAxis(), lar_content::TwoDSlidingShowerFitResult::GetShowerEdges(), lar_content::CandidateVertexCreationAlgorithm::GetSpacepoints(), lar_content::VertexRefinementAlgorithm::RefineVertexTwoD(), and lar_content::TwoDSlidingFitResult::TwoDSlidingFitResult().

583 {
584  for (const OrderedCaloHitList::value_type &layerEntry : pCluster->GetOrderedCaloHitList())
585  {
586  for (const CaloHit *const pCaloHit : *layerEntry.second)
587  coordinateVector.push_back(pCaloHit->GetPositionVector());
588  }
589 
590  std::sort(coordinateVector.begin(), coordinateVector.end(), LArClusterHelper::SortCoordinatesByPosition);
591 }
static bool SortCoordinatesByPosition(const pandora::CartesianVector &lhs, const pandora::CartesianVector &rhs)
Sort cartesian vectors by their position (use Z, followed by X, followed by Y)
void lar_content::LArClusterHelper::GetDaughterVolumeIDs ( const pandora::Cluster *const  pCluster,
UIntSet daughterVolumeIds 
)
static

Get the set of the daughter volumes that contains the cluster.

Parameters
pClusteraddress of the cluster
daughterVolumeIdsoutput variable

Definition at line 634 of file LArClusterHelper.cc.

References lar_content::LArCaloHit::GetDaughterVolumeId().

635 {
636  const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
637 
638  for (OrderedCaloHitList::const_iterator ochIter = orderedCaloHitList.begin(), ochIterEnd = orderedCaloHitList.end(); ochIter != ochIterEnd; ++ochIter)
639  {
640  for (CaloHitList::const_iterator hIter = ochIter->second->begin(), hIterEnd = ochIter->second->end(); hIter != hIterEnd; ++hIter)
641  {
642  const CaloHit *const pCaloHit(*hIter);
643  const LArCaloHit *const pLArCaloHit(dynamic_cast<const LArCaloHit *>(pCaloHit));
644 
645  if (pLArCaloHit)
646  daughterVolumeIds.insert(pLArCaloHit->GetDaughterVolumeId());
647  }
648  }
649 }
intermediate_table::const_iterator const_iterator
float lar_content::LArClusterHelper::GetEnergyFromLength ( const pandora::Cluster *const  pCluster)
static

Get energy of cluster, based on length.

Parameters
pClusteraddress of the cluster
Returns
the energy

Definition at line 113 of file LArClusterHelper.cc.

References f.

114 {
115  const float dEdX(0.002f); // approximately 2 MeV/cm
116  return (dEdX * LArClusterHelper::GetLength(pCluster));
117 }
TFile f
Definition: plotHisto.C:6
static float GetLength(const pandora::Cluster *const pCluster)
Get length of cluster.
static void lar_content::LArClusterHelper::GetExtremalCoordinates ( const pandora::Cluster *const  pCluster,
pandora::CartesianVector &  innerCoordinate,
pandora::CartesianVector &  outerCoordinate 
)
static

Get positions of the two most distant calo hits in a cluster (ordered by Z)

Parameters
pClusterthe input cluster
theinner extremal position
theouter extremal position
static void lar_content::LArClusterHelper::GetExtremalCoordinates ( const pandora::OrderedCaloHitList &  orderedCaloHitList,
pandora::CartesianVector &  innerCoordinate,
pandora::CartesianVector &  outerCoordinate 
)
static

Get positions of the two most distant calo hits in an ordered calo hit list (ordered by Z)

Parameters
orderedCaloHitListthe ordered calo hit list
theinner extremal position
theouter extremal position
static void lar_content::LArClusterHelper::GetExtremalCoordinates ( const pandora::CartesianPointVector &  coordinateVector,
pandora::CartesianVector &  innerCoordinate,
pandora::CartesianVector &  outerCoordinate 
)
static

Get positions of the two most distant points in a provided list (ordered by Z)

Parameters
coordinateVectorthe hit list
theinner extremal position
theouter extremal position
static float lar_content::LArClusterHelper::GetLayerOccupancy ( const pandora::Cluster *const  pCluster)
static
static float lar_content::LArClusterHelper::GetLayerOccupancy ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2 
)
static

Fraction of occupied layers in a pair of clusters.

Parameters
pCluster1address of the first cluster
pCluster2address of the second cluster
Returns
float
unsigned int lar_content::LArClusterHelper::GetLayerSpan ( const pandora::Cluster *const  pCluster)
static

Get number of layers spanned by cluster (1+Last-First)

Parameters
pClusteraddress of the cluster
Returns
the layer span

Definition at line 121 of file LArClusterHelper.cc.

References f.

122 {
123  return (1 + pCluster->GetOuterPseudoLayer() - pCluster->GetInnerPseudoLayer());
124 }
float lar_content::LArClusterHelper::GetLength ( const pandora::Cluster *const  pCluster)
static

Get length of cluster.

Parameters
pClusteraddress of the cluster
Returns
the length

Definition at line 106 of file LArClusterHelper.cc.

Referenced by lar_content::TrackMergeRefinementAlgorithm::FindBestClusterAssociation(), and lar_content::TrainedVertexSelectionAlgorithm::IsClusterShowerLike().

107 {
108  return std::sqrt(LArClusterHelper::GetLengthSquared(pCluster));
109 }
static float GetLengthSquared(const pandora::Cluster *const pCluster)
Get length squared of cluster.
float lar_content::LArClusterHelper::GetLengthSquared ( const pandora::Cluster *const  pCluster)
static

Get length squared of cluster.

Parameters
pClusteraddress of the cluster
Returns
the length squared

Definition at line 74 of file LArClusterHelper.cc.

References maxY, and minY.

Referenced by lar_content::TrackRefinementBaseAlgorithm::AddHitsToMainTrack(), lar_content::CrossGapsExtensionAlgorithm::FillClusterAssociationMatrix(), lar_content::DeltaRayMatchingAlgorithm::FindBestParentPfo(), lar_content::OvershootSplittingAlgorithm::GetListOfCleanClusters(), lar_content::LongitudinalExtensionAlgorithm::GetListOfCleanClusters(), lar_content::DeltaRayExtensionAlgorithm::GetListOfCleanClusters(), lar_content::CrossGapsExtensionAlgorithm::GetListOfCleanClusters(), lar_content::CosmicRayExtensionAlgorithm::GetListOfCleanClusters(), lar_content::TransverseExtensionAlgorithm::GetListOfCleanClusters(), lar_content::CosmicRaySplittingAlgorithm::GetListOfCleanClusters(), lar_content::TwoDSlidingFitSplittingAndSwitchingAlgorithm::GetListOfCleanClusters(), lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm::GetListOfCleanClusters(), lar_content::DeltaRayGrowingAlgorithm::GetListOfSeedClusters(), lar_content::TrackRefinementBaseAlgorithm::InitialiseContainers(), lar_content::CosmicRayTrackMatchingAlgorithm::SelectCleanClusters(), lar_content::CosmicRayTrackRecoveryAlgorithm::SelectCleanClusters(), lar_content::CandidateVertexCreationAlgorithm::SelectClusters(), lar_content::ThreeViewShowersAlgorithm::SelectInputClusters(), lar_content::NViewTrackMatchingAlgorithm< T >::SelectInputClusters(), lar_content::TwoDSlidingFitConsolidationAlgorithm::SortInputClusters(), lar_content::ParticleRecoveryAlgorithm::StandardClusterSelection(), lar_content::TrackConsolidationAlgorithm::TrackConsolidationAlgorithm(), and lar_content::TwoDSlidingFitSplittingAlgorithm::TwoDSlidingFitSplittingAlgorithm().

75 {
76  const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
77 
78  if (orderedCaloHitList.empty())
79  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
80 
81  // ATTN In 2D case, we will actually calculate the quadrature sum of deltaX and deltaU/V/W
82  float minX(std::numeric_limits<float>::max()), maxX(-std::numeric_limits<float>::max());
83  float minY(std::numeric_limits<float>::max()), maxY(-std::numeric_limits<float>::max());
84  float minZ(std::numeric_limits<float>::max()), maxZ(-std::numeric_limits<float>::max());
85 
86  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
87  {
88  for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
89  {
90  const CartesianVector &hitPosition((*hitIter)->GetPositionVector());
91  minX = std::min(hitPosition.GetX(), minX);
92  maxX = std::max(hitPosition.GetX(), maxX);
93  minY = std::min(hitPosition.GetY(), minY);
94  maxY = std::max(hitPosition.GetY(), maxY);
95  minZ = std::min(hitPosition.GetZ(), minZ);
96  maxZ = std::max(hitPosition.GetZ(), maxZ);
97  }
98  }
99 
100  const float deltaX(maxX - minX), deltaY(maxY - minY), deltaZ(maxZ - minZ);
101  return (deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
102 }
double minY
Definition: plot_hist.C:9
double maxY
Definition: plot_hist.C:10
intermediate_table::const_iterator const_iterator
bool lar_content::LArClusterHelper::SortByInnerLayer ( const pandora::Cluster *const  pLhs,
const pandora::Cluster *const  pRhs 
)
static

Sort clusters by inner layer, then position, then pulse-height.

Parameters
pLhsaddress of first cluster
pRhsaddress of second cluster

Definition at line 691 of file LArClusterHelper.cc.

Referenced by lar_content::CrossGapsAssociationAlgorithm::GetListOfCleanClusters(), and lar_content::LongitudinalAssociationAlgorithm::GetListOfCleanClusters().

692 {
693  const unsigned int innerLayerLhs(pLhs->GetInnerPseudoLayer());
694  const unsigned int innerLayerRhs(pRhs->GetInnerPseudoLayer());
695 
696  if (innerLayerLhs != innerLayerRhs)
697  return (innerLayerLhs < innerLayerRhs);
698 
699  return SortByPosition(pLhs, pRhs);
700 }
static bool SortByPosition(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by position, then pulse-height.
bool lar_content::LArClusterHelper::SortByLayerSpan ( const pandora::Cluster *const  pLhs,
const pandora::Cluster *const  pRhs 
)
static

Sort clusters by layer span, then inner layer, then position, then pulse-height.

Parameters
pLhsaddress of first cluster
pRhsaddress of second cluster

Definition at line 678 of file LArClusterHelper.cc.

679 {
680  const unsigned int layerSpanLhs(pLhs->GetOuterPseudoLayer() - pLhs->GetInnerPseudoLayer());
681  const unsigned int layerSpanRhs(pRhs->GetOuterPseudoLayer() - pRhs->GetInnerPseudoLayer());
682 
683  if (layerSpanLhs != layerSpanRhs)
684  return (layerSpanLhs > layerSpanRhs);
685 
686  return SortByInnerLayer(pLhs, pRhs);
687 }
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::LArClusterHelper::SortByNHits ( const pandora::Cluster *const  pLhs,
const pandora::Cluster *const  pRhs 
)
static

Sort clusters by number of hits, then layer span, then inner layer, then position, then pulse-height.

Parameters
pLhsaddress of first cluster
pRhsaddress of second cluster

Definition at line 665 of file LArClusterHelper.cc.

Referenced by lar_content::TwoDSlidingFitConsolidationAlgorithm::AddHitsToClusters(), lar_content::NeutrinoHierarchyAlgorithm::AdjustVertexAndPfoInfo(), lar_content::ClusterAssociationAlgorithm::AmbiguousPropagation(), lar_content::SplitShowersTool::ApplyChanges(), lar_content::ThreeDKinkBaseTool::ApplyChanges(), lar_content::TwoViewThreeDKinkTool::ApplyChanges(), lar_content::EventSlicingTool::AssignRemainingHitsToSlices(), lar_content::OvershootSplittingAlgorithm::BuildIntersectionMap(), lar_content::TrackHitsBaseTool::BuildSlidingFitMap(), lar_content::OvershootSplittingAlgorithm::BuildSortedIntersectionMap(), lar_content::VertexSelectionBaseAlgorithm::CalculateClusterSlidingFits(), lar_content::ConeClusterMopUpAlgorithm::ClusterMopUp(), lar_content::NearbyClusterMopUpAlgorithm::ClusterMopUp(), lar_content::BoundedClusterMopUpAlgorithm::ClusterMopUp(), lar_pandora::LArPandoraOutput::CollectClusters(), lar_content::EventSlicingTool::CopyPfoHitsToSlices(), lar_content::TrackMergeRefinementAlgorithm::CreateMainTrack(), lar_content::ParticleRecoveryAlgorithm::ExamineTensor(), lar_content::CrossGapsExtensionAlgorithm::FillClusterMergeMap(), lar_content::DeltaRayExtensionAlgorithm::FillClusterMergeMap(), lar_content::LongitudinalExtensionAlgorithm::FillClusterMergeMap(), lar_content::CosmicRayExtensionAlgorithm::FillClusterMergeMap(), lar_content::TransverseExtensionAlgorithm::FillClusterMergeMap(), lar_content::TransverseAssociationAlgorithm::FillReducedAssociationMap(), lar_content::TransverseAssociationAlgorithm::FillSymmetricAssociationMap(), lar_content::ClearTrackFragmentsTool::GetAffectedKeyClusters(), lar_content::TransverseAssociationAlgorithm::GetAssociatedClusters(), lar_content::CosmicRayTrackRecoveryAlgorithm::GetAvailableClusters(), lar_content::VertexBasedPfoRecoveryAlgorithm::GetAvailableClusters(), lar_content::SlidingConeClusterMopUpAlgorithm::GetAvailableTwoDClusters(), lar_content::DeltaRayMatchingAlgorithm::GetClusters(), lar_content::EventSlicingTool::GetClusterSliceList(), lar_content::ShowerGrowingAlgorithm::GetFigureOfMerit(), lar_content::EventSlicingTool::GetKDTreeEntries3D(), lar_content::BoundedRegionClusterMergingAlgorithm::GetListOfBoundedRegionClusters(), lar_content::OvershootSplittingAlgorithm::GetListOfCleanClusters(), lar_content::DeltaRayExtensionAlgorithm::GetListOfCleanClusters(), lar_content::CrossGapsExtensionAlgorithm::GetListOfCleanClusters(), lar_content::DeltaRayGrowingAlgorithm::GetListOfCleanClusters(), lar_content::LongitudinalExtensionAlgorithm::GetListOfCleanClusters(), lar_content::SimpleClusterGrowingAlgorithm::GetListOfCleanClusters(), lar_content::SimpleClusterMergingAlgorithm::GetListOfCleanClusters(), lar_content::CosmicRayExtensionAlgorithm::GetListOfCleanClusters(), lar_content::TransverseExtensionAlgorithm::GetListOfCleanClusters(), lar_content::CosmicRaySplittingAlgorithm::GetListOfCleanClusters(), lar_content::TwoDSlidingFitSplittingAndSwitchingAlgorithm::GetListOfCleanClusters(), lar_content::TransverseAssociationAlgorithm::GetListOfCleanClusters(), lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm::GetListOfCleanClusters(), lar_content::ClusterGrowingAlgorithm::GetListOfNonSeedClusters(), lar_content::DeltaRayGrowingAlgorithm::GetListOfSeedClusters(), lar_content::SimpleClusterGrowingAlgorithm::GetListOfSeedClusters(), lar_content::ThreeViewTrackFragmentsAlgorithm::GetMatchedClusters(), lar_content::MissingTrackSegmentTool::GetSegmentOverlapMap(), lar_content::SlidingConePfoMopUpAlgorithm::GetThreeDClusters(), lar_content::SlidingConeClusterMopUpAlgorithm::GetThreeDClusters(), lar_content::HitWidthClusterMergingAlgorithm::IsExtremalCluster(), lar_content::CrossGapsAssociationAlgorithm::IsExtremalCluster(), lar_content::LongitudinalAssociationAlgorithm::IsExtremalCluster(), lar_content::TransverseAssociationAlgorithm::IsExtremalCluster(), lar_content::ClusterMopUpBaseAlgorithm::MakeClusterMerges(), lar_content::SlidingConeClusterMopUpAlgorithm::MakeClusterMerges(), lar_content::NViewTrackMatchingAlgorithm< T >::MakeClusterSplits(), lar_content::MissingTrackSegmentTool::MakeDecisions(), lar_content::SlidingConePfoMopUpAlgorithm::MakePfoMerges(), lar_content::ClusterGrowingAlgorithm::MergeClusters(), lar_content::SlidingConeClusterMopUpAlgorithm::ClusterMerge::operator<(), lar_content::SlidingConePfoMopUpAlgorithm::ClusterMerge::operator<(), lar_content::ThreeViewTrackFragmentsAlgorithm::PerformMainLoop(), lar_content::ThreeViewMatchingControl< T >::PerformMainLoop(), lar_content::TwoViewMatchingControl< T >::PerformMainLoop(), lar_content::OneViewDeltaRayMatchingAlgorithm::PerformOneViewMatching(), lar_content::OvershootSplittingAlgorithm::PopulateSplitPositionMap(), lar_content::ShowerGrowingAlgorithm::ProcessSeedAssociationDetails(), lar_content::ClearTrackFragmentsTool::ProcessTensorElement(), lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm::PruneClusterExtensionList(), lar_content::TwoDSlidingFitConsolidationAlgorithm::RebuildClusters(), lar_content::TwoDSlidingFitConsolidationAlgorithm::RemoveHitsFromClusters(), lar_content::HitWidthClusterMergingAlgorithm::RemoveShortcutAssociations(), lar_content::TrackMergeRefinementAlgorithm::Run(), lar_content::CandidateVertexCreationAlgorithm::SelectClusters(), lar_content::TwoDSlidingFitConsolidationAlgorithm::SortInputClusters(), lar_content::TransverseAssociationAlgorithm::SortInputClusters(), lar_content::TwoDSlidingFitMultiSplitAlgorithm::SplitClusters(), lar_content::ThreeViewTrackFragmentsAlgorithm::UpdateForNewCluster(), lar_content::ThreeViewMatchingControl< T >::UpdateForNewCluster(), and lar_content::TwoViewMatchingControl< T >::UpdateForNewCluster().

666 {
667  const unsigned int nHitsLhs(pLhs->GetNCaloHits());
668  const unsigned int nHitsRhs(pRhs->GetNCaloHits());
669 
670  if (nHitsLhs != nHitsRhs)
671  return (nHitsLhs > nHitsRhs);
672 
673  return SortByLayerSpan(pLhs, pRhs);
674 }
static bool SortByLayerSpan(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by layer span, then inner layer, then position, then pulse-height.
bool lar_content::LArClusterHelper::SortByNOccupiedLayers ( const pandora::Cluster *const  pLhs,
const pandora::Cluster *const  pRhs 
)
static

Sort clusters by number of occupied layers, and by inner layer, then energy in event of a tie.

Parameters
pLhsaddress of first cluster
pRhsaddress of second cluster

Definition at line 652 of file LArClusterHelper.cc.

653 {
654  const unsigned int nOccupiedLayersLhs(pLhs->GetOrderedCaloHitList().size());
655  const unsigned int nOccupiedLayersRhs(pRhs->GetOrderedCaloHitList().size());
656 
657  if (nOccupiedLayersLhs != nOccupiedLayersRhs)
658  return (nOccupiedLayersLhs > nOccupiedLayersRhs);
659 
660  return SortByNHits(pLhs, pRhs);
661 }
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.
bool lar_content::LArClusterHelper::SortByPosition ( const pandora::Cluster *const  pLhs,
const pandora::Cluster *const  pRhs 
)
static

Sort clusters by position, then pulse-height.

Parameters
pLhsaddress of first cluster
pRhsaddress of second cluster

Definition at line 704 of file LArClusterHelper.cc.

Referenced by lar_content::TrackMergeRefinementAlgorithm::FindBestClusterAssociation().

705 {
706  const CartesianVector deltaPositionIL(pRhs->GetCentroid(pRhs->GetInnerPseudoLayer()) - pLhs->GetCentroid(pLhs->GetInnerPseudoLayer()));
707 
708  if (std::fabs(deltaPositionIL.GetZ()) > std::numeric_limits<float>::epsilon())
709  return (deltaPositionIL.GetZ() > std::numeric_limits<float>::epsilon());
710 
711  if (std::fabs(deltaPositionIL.GetX()) > std::numeric_limits<float>::epsilon())
712  return (deltaPositionIL.GetX() > std::numeric_limits<float>::epsilon());
713 
714  if (std::fabs(deltaPositionIL.GetY()) > std::numeric_limits<float>::epsilon())
715  return (deltaPositionIL.GetY() > std::numeric_limits<float>::epsilon());
716 
717  const CartesianVector deltaPositionOL(pRhs->GetCentroid(pRhs->GetOuterPseudoLayer()) - pLhs->GetCentroid(pLhs->GetOuterPseudoLayer()));
718 
719  if (std::fabs(deltaPositionOL.GetZ()) > std::numeric_limits<float>::epsilon())
720  return (deltaPositionOL.GetZ() > std::numeric_limits<float>::epsilon());
721 
722  if (std::fabs(deltaPositionOL.GetX()) > std::numeric_limits<float>::epsilon())
723  return (deltaPositionOL.GetX() > std::numeric_limits<float>::epsilon());
724 
725  if (std::fabs(deltaPositionOL.GetY()) > std::numeric_limits<float>::epsilon())
726  return (deltaPositionOL.GetY() > std::numeric_limits<float>::epsilon());
727 
728  // Use pulse height to resolve ties
729  return SortByPulseHeight(pLhs, pRhs);
730 }
static bool SortByPulseHeight(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by pulse-height.
bool lar_content::LArClusterHelper::SortByPulseHeight ( const pandora::Cluster *const  pLhs,
const pandora::Cluster *const  pRhs 
)
static

Sort clusters by pulse-height.

Parameters
pLhsaddress of first cluster
pRhsaddress of second cluster

Definition at line 734 of file LArClusterHelper.cc.

735 {
736  return (pLhs->GetHadronicEnergy() > pRhs->GetHadronicEnergy());
737 }
bool lar_content::LArClusterHelper::SortCoordinatesByPosition ( const pandora::CartesianVector &  lhs,
const pandora::CartesianVector &  rhs 
)
static

Sort cartesian vectors by their position (use Z, followed by X, followed by Y)

Parameters
lhsfirst point
rhssecond point

Definition at line 780 of file LArClusterHelper.cc.

Referenced by lar_content::CandidateVertexCreationAlgorithm::GetSpacepoints(), and lar_content::ClusterAssociation::operator<().

781 {
782  const CartesianVector deltaPosition(rhs - lhs);
783 
784  if (std::fabs(deltaPosition.GetZ()) > std::numeric_limits<float>::epsilon())
785  return (deltaPosition.GetZ() > std::numeric_limits<float>::epsilon());
786 
787  if (std::fabs(deltaPosition.GetX()) > std::numeric_limits<float>::epsilon())
788  return (deltaPosition.GetX() > std::numeric_limits<float>::epsilon());
789 
790  return (deltaPosition.GetY() > std::numeric_limits<float>::epsilon());
791 }
bool lar_content::LArClusterHelper::SortHitsByPosition ( const pandora::CaloHit *const  pLhs,
const pandora::CaloHit *const  pRhs 
)
static

Sort calo hits by their position (use Z, followed by X, followed by Y)

Parameters
pLhsaddress of first calo hit
pRhsaddress of second calo hit

Definition at line 741 of file LArClusterHelper.cc.

Referenced by lar_content::TrackClusterCreationAlgorithm::AddFilteredCaloHits(), lar_content::EnergyDepositionAsymmetryFeatureTool::CalculateAsymmetry(), lar_content::AsymmetryFeatureBaseTool::CalculateAsymmetry(), lar_content::IsolatedClusterMopUpAlgorithm::ClusterMopUp(), lar_pandora::LArPandoraOutput::Collect3DHits(), lar_content::SimpleClusterCreationAlgorithm::CollectAssociatedHits(), lar_content::SimpleClusterCreationAlgorithm::CreateClusters(), lar_content::TrackClusterCreationAlgorithm::CreateClusters(), lar_content::CosmicRayRemovalTool::CreateSeed(), lar_content::TwoViewCosmicRayRemovalTool::CreateSeed(), lar_content::TrackClusterCreationAlgorithm::FilterCaloHits(), lar_content::CrossedTrackSplittingAlgorithm::FindCandidateSplitPositions(), lar_content::ThreeViewTrackFragmentsAlgorithm::GetFragmentOverlapResult(), lar_pandora::LArPandoraOutput::GetHitsInCluster(), lar_content::ThreeViewTrackFragmentsAlgorithm::GetMatchedHits(), lar_content::TrainedVertexSelectionAlgorithm::GetShowerLikeClusterEndPoints(), lar_content::TrackClusterCreationAlgorithm::IdentifyJoins(), lar_content::TrackClusterCreationAlgorithm::MakePrimaryAssociations(), lar_content::TrackClusterCreationAlgorithm::MakeSecondaryAssociations(), and lar_content::ThreeDHitCreationAlgorithm::SeparateTwoDHits().

742 {
743  const CartesianVector deltaPosition(pRhs->GetPositionVector() - pLhs->GetPositionVector());
744 
745  if (std::fabs(deltaPosition.GetZ()) > std::numeric_limits<float>::epsilon())
746  return (deltaPosition.GetZ() > std::numeric_limits<float>::epsilon());
747 
748  if (std::fabs(deltaPosition.GetX()) > std::numeric_limits<float>::epsilon())
749  return (deltaPosition.GetX() > std::numeric_limits<float>::epsilon());
750 
751  if (std::fabs(deltaPosition.GetY()) > std::numeric_limits<float>::epsilon())
752  return (deltaPosition.GetY() > std::numeric_limits<float>::epsilon());
753 
754  // Use pulse height to resolve ties
755  return SortHitsByPulseHeight(pLhs, pRhs);
756 }
static bool SortHitsByPulseHeight(const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
Sort calo hits by their pulse height.
bool lar_content::LArClusterHelper::SortHitsByPositionInX ( const pandora::CaloHit *const  pLhs,
const pandora::CaloHit *const  pRhs 
)
static

Sort calo hits by their position (use X, followed by Z, followed by Y)

Parameters
pLhsaddress of first calo hit
pRhsaddress of second calo hit

Definition at line 760 of file LArClusterHelper.cc.

761 {
762  const CartesianVector deltaPosition(pRhs->GetPositionVector() - pLhs->GetPositionVector());
763 
764  if (std::fabs(deltaPosition.GetX()) > std::numeric_limits<float>::epsilon())
765  return (deltaPosition.GetX() > std::numeric_limits<float>::epsilon());
766 
767  return SortHitsByPosition(pLhs, pRhs);
768 }
static bool SortHitsByPosition(const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
Sort calo hits by their position (use Z, followed by X, followed by Y)
bool lar_content::LArClusterHelper::SortHitsByPulseHeight ( const pandora::CaloHit *const  pLhs,
const pandora::CaloHit *const  pRhs 
)
static

Sort calo hits by their pulse height.

Parameters
pLhsaddress of first calo hit
pRhsaddress of second calo hit

Definition at line 772 of file LArClusterHelper.cc.

Referenced by lar_content::TrackRefinementBaseAlgorithm::SortByDistanceAlongLine::operator()().

773 {
774  // TODO: Think about the correct energy to use here (should they ever be different)
775  return (pLhs->GetHadronicEnergy() > pRhs->GetHadronicEnergy());
776 }

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