LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::NViewDeltaRayMatchingAlgorithm< T > Class Template Referenceabstract

NViewDeltaRayMatchingAlgorithm class. More...

#include "NViewDeltaRayMatchingAlgorithm.h"

Inheritance diagram for lar_content::NViewDeltaRayMatchingAlgorithm< T >:
lar_content::NViewMatchingAlgorithm< T > lar_content::MatchingBaseAlgorithm

Public Types

typedef std::map< const pandora::CaloHit *, const pandora::Cluster * > HitToClusterMap
 
typedef std::map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
 
typedef std::map< const pandora::Cluster *, pandora::ClusterList > ClusterProximityMap
 
typedef KDTreeLinkerAlgo< const pandora::CaloHit *, 2 > HitKDTree2D
 
typedef KDTreeNodeInfoT< const pandora::CaloHit *, 2 > HitKDNode2D
 
typedef std::vector< HitKDNode2DHitKDNode2DList
 
typedef std::vector< pandora::HitType > HitTypeVector
 
typedef T MatchingType
 

Public Member Functions

 NViewDeltaRayMatchingAlgorithm ()
 Default constructor. More...
 
pandora::StatusCode GetMuonCluster (const pandora::PfoList &commonMuonPfoList, const pandora::HitType hitType, const pandora::Cluster *&pMuonCluster) const
 Return the cluster of the common cosmic ray pfo in a given view (function demands there to be only one common CR pfo) More...
 
pandora::StatusCode PerformThreeViewMatching (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3, float &reducedChiSquared) const
 To determine how well three clusters (one in each view) map onto one another expressing this in terms of a chi-squared like parameter. More...
 
pandora::StatusCode PerformThreeViewMatching (const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW, float &chiSquaredSum, unsigned int &nSamplingPoints, unsigned int &nMatchedSamplingPoints, XOverlap &XOverlap) const
 To determine how well three clusters (one in each view) map onto one another expressing this in terms of a chi-squared like parameter. More...
 
pandora::StatusCode PerformThreeViewMatching (const pandora::CaloHitList &pCluster1, const pandora::CaloHitList &pCluster2, const pandora::CaloHitList &pCluster3, float &reducedChiSquared) const
 To determine how well three CaloHitLists (one in each view) map onto one another expressing this in terms of a chi-squared like parameter. More...
 
pandora::StatusCode PerformThreeViewMatching (const pandora::CaloHitList &clusterU, const pandora::CaloHitList &clusterV, const pandora::CaloHitList &clusterW, float &chiSquaredSum, unsigned int &nSamplingPoints, unsigned int &nMatchedSamplingPoints, XOverlap &XOverlap) const
 To determine how well three CaloHitLists (one for each view) map onto one another expressing this in terms of a chi-squared like parameter. More...
 
pandora::StatusCode ProjectMuonPositions (const pandora::HitType &thirdViewHitType, const pandora::ParticleFlowObject *const pParentMuon, pandora::CartesianPointVector &projectedPositions) const
 Use two views of a cosmic ray pfo to calculate projected positions in a given the third view. More...
 
pandora::StatusCode GetProjectedPositions (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, pandora::CartesianPointVector &projectedPositions) const
 Use two clusters from different views to calculate projected positions in the remaining third view. More...
 
pandora::StatusCode CollectHitsFromMuon (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pThirdViewCluster, const pandora::ParticleFlowObject *const pParentMuon, const float minDistanceFromMuon, const float maxDistanceToCollected, pandora::CaloHitList &collectedHits) const
 In one view, pull out any hits from a cosmic ray cluster that belong to the child delta ray cluster. More...
 
void CollectHitsFromMuon (const pandora::CartesianVector &positionOnMuon, const pandora::CartesianVector &muonDirection, const pandora::Cluster *const pMuonCluster, const pandora::CartesianPointVector &deltaRayProjectedPositions, const float &minDistanceFromMuon, const float maxDistanceToCollected, pandora::CaloHitList &collectedHits) const
 In one view, pull out any hits from a cosmic ray cluster that belong to the child delta ray cluster. More...
 
pandora::StatusCode ParameteriseMuon (const pandora::ParticleFlowObject *const pParentMuon, const pandora::Cluster *const pDeltaRayCluster, pandora::CartesianVector &positionOnMuon, pandora::CartesianVector &muonDirection) const
 Parameterise the projection of a cosmic ray track in order to avoid poor/sparse projections. More...
 
pandora::StatusCode ParameteriseMuon (const pandora::ParticleFlowObject *const pParentMuon, const pandora::CartesianPointVector &deltaRayProjectedPositions, const pandora::HitType hitType, pandora::CartesianVector &positionOnMuon, pandora::CartesianVector &muonDirection) const
 Parameterise the projection of a cosmic ray track in order to avoid poor/sparse projections. More...
 
void SplitMuonCluster (const std::string &clusterListName, const pandora::Cluster *const pMuonCluster, const pandora::CaloHitList &collectedHits, const pandora::Cluster *&pDeltaRayCluster) const
 Move a list of hits from a cosmic ray cluster into the given child delta ray cluster. More...
 
bool CreatePfos (ProtoParticleVector &protoParticleVector)
 Create delta ray pfos maxmising completeness by searching for and merging in any stray clusters. More...
 
void UpdateForNewClusters (const pandora::ClusterVector &newClusterVector, const pandora::PfoVector &pfoVector)
 Add a new cluster to algorithm ownership maps and, if it a delta ray cluster, to the underlying matches container (tensor/matrix) More...
 
void UpdateUponDeletion (const pandora::Cluster *const pDeletedCluster)
 Update to reflect cluster deletion. More...
 
void SelectInputClusters (const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const
 Select a subset of input clusters for processing in this algorithm. More...
 
void PrepareInputClusters (pandora::ClusterList &preparedClusterList)
 Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results. More...
 
void UpdateForNewCluster (const pandora::Cluster *const pNewCluster)
 Update to reflect addition of a new cluster to the problem space. More...
 
const std::string & GetClusterListName (const pandora::HitType hitType) const
 Get the cluster list name corresponding to a specified hit type. More...
 
const pandora::ClusterList & GetInputClusterList (const pandora::HitType hitType) const
 Get the input cluster list corresponding to a specified hit type. More...
 
const pandora::ClusterList & GetSelectedClusterList (const pandora::HitType hitType) const
 Get the selected cluster list corresponding to a specified hit type. More...
 
virtual void CalculateOverlapResult (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3=nullptr)=0
 Calculate cluster overlap result and store in container. More...
 
virtual bool MakeClusterMerges (const ClusterMergeMap &clusterMergeMap)
 Merge clusters together. More...
 
virtual bool CreateThreeDParticles (const ProtoParticleVector &protoParticleVector)
 Create particles using findings from recent algorithm processing. More...
 
virtual void SetPfoParameters (const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Set Pfo properties. More...
 
virtual void SetPfoParticleId (PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Set pfo particle id. More...
 

Protected Member Functions

virtual bool DoesClusterPassTensorThreshold (const pandora::Cluster *const pCluster) const =0
 To check whether a given cluster meets the requirements to be added into the matching container (tensor/matrix) More...
 
void FillStrayClusterList (const pandora::HitType hitType)
 Fill the stray cluster list with clusters that do not pass the tensor threshold requirement. More...
 
void GetNearbyMuonPfos (const pandora::Cluster *const pCluster, pandora::ClusterList &consideredClusters, pandora::PfoList &nearbyMuonPfos) const
 Use the cluster proximity map to travel along paths of nearby clusters finding the cosmic ray clusters on which they terminate. More...
 
void GetClusterSpanX (const pandora::CaloHitList &caloHitList, float &xMin, float &xMax) const
 Calculate the xSpan of a list of CaloHits. More...
 
pandora::StatusCode GetClusterSpanZ (const pandora::CaloHitList &caloHitList, const float xMin, const float xMax, float &zMin, float &zMax) const
 Calculate the zSpan of a list of CaloHits in a specified x range. More...
 
void CollectStrayClusters (const pandora::Cluster *const pClusterToEnlarge, const float rangeMinX, const float rangeMaxX, pandora::ClusterList &collectedClusters)
 Collect the stray clusters that are close to a specified cluster and that lie within a given x range. More...
 
void AddInStrayClusters (const pandora::Cluster *const pClusterToEnlarge, const pandora::ClusterList &collectedClusters)
 Merge in the collected stray clusters of a given delta ray cluster. More...
 
void TidyUp ()
 Tidy member variables in derived class. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
MatchingTypeGetMatchingControl ()
 Get the matching control. More...
 
virtual void SelectAllInputClusters ()
 Select a subset of input clusters for processing in this algorithm. More...
 
virtual void PrepareAllInputClusters ()
 Perform any preparatory steps required, e.g. caching expensive fit results for clusters. More...
 
virtual void PerformMainLoop ()
 Main loop over cluster combinations in order to populate the overlap container. Responsible for calling CalculateOverlapResult. More...
 
virtual void ExamineOverlapContainer ()=0
 Examine contents of overlap container, collect together best-matching 2D particles and modify clusters as required. More...
 

Protected Attributes

std::string m_muonPfoListName
 The list of reconstructed cosmic ray pfos. More...
 
pandora::ClusterList m_strayClusterListU
 The list of U clusters that do not pass the tensor threshold requirement. More...
 
pandora::ClusterList m_strayClusterListV
 The list of V clusters that do not pass the tensor threshold requirement. More...
 
pandora::ClusterList m_strayClusterListW
 The list of W clusters that do not pass the tensor threshold requirement. More...
 
DeltaRayMatchingContainers m_deltaRayMatchingContainers
 The class of hit, cluster and pfo ownership and proximity maps. More...
 
float m_pseudoChi2Cut
 Pseudo chi2 cut for three view matching. More...
 
float m_xOverlapWindow
 The maximum allowed displacement in x position. More...
 
float m_minMatchedFraction
 The threshold matched fraction of sampling points for a good match. More...
 
unsigned int m_minMatchedPoints
 The threshold number of matched sampling points for a good match. More...
 
unsigned int m_minProjectedPositions
 The threshold number of projected points for a good projection. More...
 
float m_maxCosmicRayHitFraction
 The maximum allowed fraction of hits to be removed from the cosmic ray track. More...
 
float m_maxDistanceToCluster
 the maximum distance of a projected point to the cosmic ray cluster used when parameterising the cosmic ray cluster More...
 
float m_maxDistanceToReferencePoint
 the maximum distance of a projected point to the cosmic ray vertex used when parameterising the cosmic ray cluster More...
 
float m_strayClusterSeparation
 The maximum allowed separation of a stray cluster and a delta ray cluster for merge. More...
 
MatchingType m_matchingControl
 The matching control. More...
 

Detailed Description

template<typename T>
class lar_content::NViewDeltaRayMatchingAlgorithm< T >

NViewDeltaRayMatchingAlgorithm class.

Definition at line 23 of file NViewDeltaRayMatchingAlgorithm.h.

Member Typedef Documentation

template<typename T>
typedef std::map<const pandora::Cluster *, pandora::ClusterList> lar_content::NViewDeltaRayMatchingAlgorithm< T >::ClusterProximityMap

Definition at line 28 of file NViewDeltaRayMatchingAlgorithm.h.

template<typename T>
typedef std::map<const pandora::Cluster *, const pandora::ParticleFlowObject *> lar_content::NViewDeltaRayMatchingAlgorithm< T >::ClusterToPfoMap

Definition at line 27 of file NViewDeltaRayMatchingAlgorithm.h.

template<typename T>
typedef KDTreeNodeInfoT<const pandora::CaloHit *, 2> lar_content::NViewDeltaRayMatchingAlgorithm< T >::HitKDNode2D

Definition at line 31 of file NViewDeltaRayMatchingAlgorithm.h.

template<typename T>
typedef std::vector<HitKDNode2D> lar_content::NViewDeltaRayMatchingAlgorithm< T >::HitKDNode2DList

Definition at line 32 of file NViewDeltaRayMatchingAlgorithm.h.

template<typename T>
typedef KDTreeLinkerAlgo<const pandora::CaloHit *, 2> lar_content::NViewDeltaRayMatchingAlgorithm< T >::HitKDTree2D

Definition at line 30 of file NViewDeltaRayMatchingAlgorithm.h.

template<typename T>
typedef std::map<const pandora::CaloHit *, const pandora::Cluster *> lar_content::NViewDeltaRayMatchingAlgorithm< T >::HitToClusterMap

Definition at line 26 of file NViewDeltaRayMatchingAlgorithm.h.

template<typename T>
typedef std::vector<pandora::HitType> lar_content::NViewDeltaRayMatchingAlgorithm< T >::HitTypeVector

Definition at line 34 of file NViewDeltaRayMatchingAlgorithm.h.

template<typename T>
typedef T lar_content::NViewMatchingAlgorithm< T >::MatchingType
inherited

Definition at line 23 of file NViewMatchingAlgorithm.h.

Constructor & Destructor Documentation

Default constructor.

Definition at line 33 of file NViewDeltaRayMatchingAlgorithm.cc.

33  :
34  m_pseudoChi2Cut(1.5f),
43 {
44 }
unsigned int m_minProjectedPositions
The threshold number of projected points for a good projection.
float m_pseudoChi2Cut
Pseudo chi2 cut for three view matching.
TFile f
Definition: plotHisto.C:6
float m_xOverlapWindow
The maximum allowed displacement in x position.
float m_strayClusterSeparation
The maximum allowed separation of a stray cluster and a delta ray cluster for merge.
float m_maxDistanceToReferencePoint
the maximum distance of a projected point to the cosmic ray vertex used when parameterising the cosmi...
float m_maxCosmicRayHitFraction
The maximum allowed fraction of hits to be removed from the cosmic ray track.
float m_minMatchedFraction
The threshold matched fraction of sampling points for a good match.
unsigned int m_minMatchedPoints
The threshold number of matched sampling points for a good match.
float m_maxDistanceToCluster
the maximum distance of a projected point to the cosmic ray cluster used when parameterising the cosm...

Member Function Documentation

template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::AddInStrayClusters ( const pandora::Cluster *const  pClusterToEnlarge,
const pandora::ClusterList &  collectedClusters 
)
protected

Merge in the collected stray clusters of a given delta ray cluster.

Parameters
pClusterToEnlargethe delta ray cluster to enlarge
collectedClustersthe list of collected stray clusters

Definition at line 827 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::DeltaRayMatchingContainers::AddClustersToContainers(), lar_content::LArClusterHelper::GetClusterHitType(), lar_content::NViewMatchingAlgorithm< T >::GetClusterListName(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_deltaRayMatchingContainers, and lar_content::NViewDeltaRayMatchingAlgorithm< T >::UpdateUponDeletion().

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::CreatePfos().

828 {
829  this->UpdateUponDeletion(pClusterToEnlarge);
830 
831  for (const Cluster *const pCollectedCluster : collectedClusters)
832  {
833  this->UpdateUponDeletion(pCollectedCluster);
834 
835  std::string clusterListName(this->GetClusterListName(LArClusterHelper::GetClusterHitType(pClusterToEnlarge)));
836  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
837  PandoraContentApi::MergeAndDeleteClusters(*this, pClusterToEnlarge, pCollectedCluster, clusterListName, clusterListName));
838  }
839 
840  m_deltaRayMatchingContainers.AddClustersToContainers({pClusterToEnlarge}, {nullptr});
841 }
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
void AddClustersToContainers(const pandora::ClusterVector &newClusterVector, const pandora::PfoVector &pfoVector)
Add a list of clusters to the hit to cluster and cluster proximity maps and, if appropriate, to the cluster to pfo map.
const std::string & GetClusterListName(const pandora::HitType hitType) const
Get the cluster list name corresponding to a specified hit type.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
virtual void lar_content::MatchingBaseAlgorithm::CalculateOverlapResult ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
const pandora::Cluster *const  pCluster3 = nullptr 
)
pure virtualinherited
template<typename T>
pandora::StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::CollectHitsFromMuon ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
const pandora::Cluster *const  pThirdViewCluster,
const pandora::ParticleFlowObject *const  pParentMuon,
const float  minDistanceFromMuon,
const float  maxDistanceToCollected,
pandora::CaloHitList &  collectedHits 
) const

In one view, pull out any hits from a cosmic ray cluster that belong to the child delta ray cluster.

Parameters
pCluster1the address of a delta ray cluster in a view that is to go unmodified
pCluster2the address of a delta ray cluster in the other view that is to unmodified
pThirdViewClusterthe address of the delta ray cluster in the view in which the hit removal process will run
pParentMuonthe address of the parent cosmic ray pfo
minDistanceFromMuonthe minimum distance of a hit from the cosmic ray track required for removal
maxDistanceToCollectedthe maximim distance of a hit from the projected delta ray hits required for removal
collectedHitsthe list of hits to be removed from the cosmic ray
Returns
a status code reflecting whether the procedure ran smoothly and if the outcome is good

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions(), and lar_content::DeltaRayRemovalTool::RemoveDeltaRayHits().

template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::CollectHitsFromMuon ( const pandora::CartesianVector &  positionOnMuon,
const pandora::CartesianVector &  muonDirection,
const pandora::Cluster *const  pMuonCluster,
const pandora::CartesianPointVector &  deltaRayProjectedPositions,
const float &  minDistanceFromMuon,
const float  maxDistanceToCollected,
pandora::CaloHitList &  collectedHits 
) const

In one view, pull out any hits from a cosmic ray cluster that belong to the child delta ray cluster.

Parameters
positionOnMuonthe parameterised cosmic ray position
muonDirectionthe parameterised cosmic ray direction
pMuonthe address of the parent cosmic ray pfo
deltaRayProjectedPositionsthe projected positions of the delta ray
minDistanceFromMuonthe minimum distance of a hit from the cosmic ray track required for removal
maxDistanceToCollectedthe maximim distance of a hit from the projected delta ray hits required for removal
collectedHitsthe list of hits to be removed from the cosmic ray
template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::CollectStrayClusters ( const pandora::Cluster *const  pClusterToEnlarge,
const float  rangeMinX,
const float  rangeMaxX,
pandora::ClusterList &  collectedClusters 
)
protected

Collect the stray clusters that are close to a specified cluster and that lie within a given x range.

Parameters
pClusterToEnlargethe specified cluster
rangeMinXthe minimum x coordinate of the region of interest
rangeMaxXthe maximum x coordinate of the region of interest
collectedClustersthe list of collected stray clusters

Definition at line 792 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::LArClusterHelper::GetClosestDistance(), lar_content::LArClusterHelper::GetClusterHitType(), lar_content::DeltaRayMatchingContainers::GetClusterProximityMap(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_deltaRayMatchingContainers, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListU, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListV, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListW, and lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterSeparation.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::CreatePfos().

794 {
795  const HitType hitType(LArClusterHelper::GetClusterHitType(pClusterToEnlarge));
796  const ClusterList &strayClusterList((hitType == TPC_VIEW_U) ? m_strayClusterListU
797  : (hitType == TPC_VIEW_V) ? m_strayClusterListV
800  const DeltaRayMatchingContainers::ClusterProximityMap::const_iterator clusterProximityIter(clusterProximityMap.find(pClusterToEnlarge));
801 
802  if (clusterProximityIter == clusterProximityMap.end())
803  return;
804 
805  for (const Cluster *const pNearbyCluster : clusterProximityIter->second)
806  {
807  if (std::find(strayClusterList.begin(), strayClusterList.end(), pNearbyCluster) == strayClusterList.end())
808  continue;
809 
810  float xMin(-std::numeric_limits<float>::max()), xMax(+std::numeric_limits<float>::max());
811  pNearbyCluster->GetClusterSpanX(xMin, xMax);
812 
813  if (!(((xMin > rangeMinX) && (xMin < rangeMaxX)) || ((xMax > rangeMinX) && (xMax < rangeMaxX))))
814  continue;
815 
816  if (LArClusterHelper::GetClosestDistance(pClusterToEnlarge, pNearbyCluster) > m_strayClusterSeparation)
817  continue;
818 
819  if (std::find(collectedClusters.begin(), collectedClusters.end(), pNearbyCluster) == collectedClusters.end())
820  collectedClusters.push_back(pNearbyCluster);
821  }
822 }
const ClusterProximityMap & GetClusterProximityMap(const pandora::HitType hitType) const
Get the mapping of clusters to to their neighbouring clusters.
pandora::ClusterList m_strayClusterListU
The list of U clusters that do not pass the tensor threshold requirement.
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.
pandora::ClusterList m_strayClusterListV
The list of V clusters that do not pass the tensor threshold requirement.
pandora::ClusterList m_strayClusterListW
The list of W clusters that do not pass the tensor threshold requirement.
float m_strayClusterSeparation
The maximum allowed separation of a stray cluster and a delta ray cluster for merge.
std::map< const pandora::Cluster *, pandora::ClusterList > ClusterProximityMap
HitType
Definition: HitType.h:12
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.
template<typename T >
bool lar_content::NViewDeltaRayMatchingAlgorithm< T >::CreatePfos ( ProtoParticleVector protoParticleVector)

Create delta ray pfos maxmising completeness by searching for and merging in any stray clusters.

Parameters
protoParticleVectorthe proto particle vector
Returns
whether any pfos were created

Definition at line 741 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::NViewDeltaRayMatchingAlgorithm< T >::AddInStrayClusters(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::CollectStrayClusters(), lar_content::MatchingBaseAlgorithm::CreateThreeDParticles(), f, lar_content::ProtoParticle::m_clusterList, and util::span().

Referenced by lar_content::AmbiguousDeltaRayTool::ExamineConnectedElements(), and lar_content::UnambiguousDeltaRayTool::ExamineUnambiguousElements().

742 {
743  std::sort(protoParticleVector.begin(), protoParticleVector.end(),
744  [](const ProtoParticle &a, const ProtoParticle &b) -> bool
745  {
746  unsigned int aHitTotal(0);
747  for (const Cluster *const pCluster : a.m_clusterList)
748  aHitTotal += pCluster->GetNCaloHits();
749 
750  unsigned int bHitTotal(0);
751  for (const Cluster *const pCluster : b.m_clusterList)
752  bHitTotal += pCluster->GetNCaloHits();
753 
754  return (aHitTotal > bHitTotal);
755  });
756 
757  for (ProtoParticle protoParticle : protoParticleVector)
758  {
759  float longestSpan(-std::numeric_limits<float>::max()), spanMinX(0.f), spanMaxX(0.f);
760 
761  for (const Cluster *const pCluster : protoParticle.m_clusterList)
762  {
763  float minX(0.f), maxX(0.f);
764  pCluster->GetClusterSpanX(minX, maxX);
765 
766  const float span(maxX - minX);
767 
768  if (span > longestSpan)
769  {
770  longestSpan = span;
771  spanMinX = minX;
772  spanMaxX = maxX;
773  }
774  }
775 
776  for (const Cluster *const pCluster : protoParticle.m_clusterList)
777  {
778  ClusterList collectedClusters;
779  this->CollectStrayClusters(pCluster, spanMinX, spanMaxX, collectedClusters);
780 
781  if (!collectedClusters.empty())
782  this->AddInStrayClusters(pCluster, collectedClusters);
783  }
784  }
785 
786  return (this->CreateThreeDParticles(protoParticleVector));
787 }
void CollectStrayClusters(const pandora::Cluster *const pClusterToEnlarge, const float rangeMinX, const float rangeMaxX, pandora::ClusterList &collectedClusters)
Collect the stray clusters that are close to a specified cluster and that lie within a given x range...
TFile f
Definition: plotHisto.C:6
void AddInStrayClusters(const pandora::Cluster *const pClusterToEnlarge, const pandora::ClusterList &collectedClusters)
Merge in the collected stray clusters of a given delta ray cluster.
span(IterB &&b, IterE &&e, Adaptor &&adaptor) -> span< decltype(adaptor(std::forward< IterB >(b))), decltype(adaptor(std::forward< IterE >(e))) >
virtual bool CreateThreeDParticles(const ProtoParticleVector &protoParticleVector)
Create particles using findings from recent algorithm processing.
bool lar_content::MatchingBaseAlgorithm::CreateThreeDParticles ( const ProtoParticleVector protoParticleVector)
virtualinherited

Create particles using findings from recent algorithm processing.

Parameters
protoParticleVectorthe proto particle vector
whetherparticles were created

Definition at line 88 of file MatchingBaseAlgorithm.cc.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::CreatePfos(), lar_content::ClearRemnantsTool::CreateThreeDParticles(), lar_content::ClearTracksTool::CreateThreeDParticles(), lar_content::TwoViewClearTracksTool::CreateThreeDParticles(), lar_content::ClearLongitudinalTracksTool::CreateThreeDParticles(), lar_content::ClearTrackFragmentsTool::FindTrackFragments(), lar_content::TwoViewSimpleTracksTool::Run(), lar_content::MissingTrackTool::Run(), lar_content::ConnectedRemnantsTool::Run(), lar_content::MopUpRemnantsTool::Run(), lar_content::MatchedEndPointsTool::Run(), lar_content::SimpleShowersTool::Run(), lar_content::TracksCrossingGapsTool::Run(), lar_content::MissingTrackSegmentTool::Run(), lar_content::LongTracksTool::Run(), lar_content::TwoViewLongTracksTool::Run(), and lar_content::ClearShowersTool::Run().

89 {
90  bool particlesMade(false);
91  const PfoList *pPfoList(nullptr);
92  std::string pfoListName;
93  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pPfoList, pfoListName));
94 
95  for (const ProtoParticle &protoParticle : protoParticleVector)
96  {
97  PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
98  this->SetPfoParameters(protoParticle, pfoParameters);
99 
100  const ParticleFlowObject *pPfo(nullptr);
101  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*this, pfoParameters, pPfo));
102  particlesMade = true;
103  }
104 
105  if (!pPfoList->empty())
106  {
107  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*this, m_outputPfoListName));
108  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*this, m_outputPfoListName));
109  }
110 
111  return particlesMade;
112 }
virtual void SetPfoParameters(const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
Set Pfo properties.
std::string m_outputPfoListName
The output pfo list name.
template<typename T>
virtual bool lar_content::NViewDeltaRayMatchingAlgorithm< T >::DoesClusterPassTensorThreshold ( const pandora::Cluster *const  pCluster) const
protectedpure virtual

To check whether a given cluster meets the requirements to be added into the matching container (tensor/matrix)

Parameters
pClusterthe address of the input cluster
Returns
whether the checks were met

Implemented in lar_content::TwoViewDeltaRayMatchingAlgorithm, and lar_content::ThreeViewDeltaRayMatchingAlgorithm.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::FillStrayClusterList(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::SelectInputClusters().

virtual void lar_content::MatchingBaseAlgorithm::ExamineOverlapContainer ( )
protectedpure virtualinherited
template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::FillStrayClusterList ( const pandora::HitType  hitType)
protected

Fill the stray cluster list with clusters that do not pass the tensor threshold requirement.

Parameters
hitTypethe hit type of the list to fill

Definition at line 84 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::NViewDeltaRayMatchingAlgorithm< T >::DoesClusterPassTensorThreshold(), lar_content::NViewMatchingAlgorithm< T >::GetInputClusterList(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListU, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListV, and lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListW.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::PrepareInputClusters().

85 {
86  const ClusterList &inputClusterList(this->GetInputClusterList(hitType));
87  ClusterList &strayClusterList((hitType == TPC_VIEW_U) ? m_strayClusterListU
88  : (hitType == TPC_VIEW_V) ? m_strayClusterListV
90 
91  for (const Cluster *const pCluster : inputClusterList)
92  {
93  if ((pCluster->IsAvailable()) && (!this->DoesClusterPassTensorThreshold(pCluster)))
94  strayClusterList.push_back(pCluster);
95  }
96 }
pandora::ClusterList m_strayClusterListU
The list of U clusters that do not pass the tensor threshold requirement.
virtual bool DoesClusterPassTensorThreshold(const pandora::Cluster *const pCluster) const =0
To check whether a given cluster meets the requirements to be added into the matching container (tens...
pandora::ClusterList m_strayClusterListV
The list of V clusters that do not pass the tensor threshold requirement.
pandora::ClusterList m_strayClusterListW
The list of W clusters that do not pass the tensor threshold requirement.
const pandora::ClusterList & GetInputClusterList(const pandora::HitType hitType) const
Get the input cluster list corresponding to a specified hit type.
template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetClusterSpanX ( const pandora::CaloHitList &  caloHitList,
float &  xMin,
float &  xMax 
) const
protected

Calculate the xSpan of a list of CaloHits.

Parameters
caloHitListthe input list of CaloHits
xMinthe output minimum x coordinate
xMaxthe output maximum x coordinate

Definition at line 407 of file NViewDeltaRayMatchingAlgorithm.cc.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetNearbyMuonPfos().

408 {
409  xMin = std::numeric_limits<float>::max();
410  xMax = -std::numeric_limits<float>::max();
411 
412  for (const CaloHit *const pCaloHit : caloHitList)
413  {
414  const float xCoordinate(pCaloHit->GetPositionVector().GetX());
415 
416  if (xCoordinate < xMin)
417  xMin = xCoordinate;
418 
419  if (xCoordinate > xMax)
420  xMax = xCoordinate;
421  }
422 }
template<typename T>
StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetClusterSpanZ ( const pandora::CaloHitList &  caloHitList,
const float  xMin,
const float  xMax,
float &  zMin,
float &  zMax 
) const
protected

Calculate the zSpan of a list of CaloHits in a specified x range.

Parameters
caloHitListthe input list of CaloHits
xMinthe minimum x coordinate of the region of interest
xMaxthe maximum x coordinate of the region of interest
zMinthe output minimum z coordinate
zMaxthe output maximum z coordinate

Definition at line 427 of file NViewDeltaRayMatchingAlgorithm.cc.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetNearbyMuonPfos().

429 {
430  zMin = std::numeric_limits<float>::max();
431  zMax = -std::numeric_limits<float>::max();
432 
433  bool found(false);
434  for (const CaloHit *const pCaloHit : caloHitList)
435  {
436  const float xCoordinate(pCaloHit->GetPositionVector().GetX());
437  const float zCoordinate(pCaloHit->GetPositionVector().GetZ());
438 
439  if ((xCoordinate < xMin) || (xCoordinate > xMax))
440  continue;
441 
442  found = true;
443 
444  if (zCoordinate < zMin)
445  zMin = zCoordinate;
446 
447  if (zCoordinate > zMax)
448  zMax = zCoordinate;
449  }
450 
451  if (!found)
452  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
453 
454  return STATUS_CODE_SUCCESS;
455 }
template<typename T>
const pandora::ClusterList & lar_content::NViewMatchingAlgorithm< T >::GetInputClusterList ( const pandora::HitType  hitType) const
virtualinherited
template<typename T >
T & lar_content::NViewMatchingAlgorithm< T >::GetMatchingControl ( )
inlineprotectedinherited

Get the matching control.

Definition at line 59 of file NViewMatchingAlgorithm.h.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl.

60 {
61  return m_matchingControl;
62 }
MatchingType m_matchingControl
The matching control.
template<typename T>
StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetMuonCluster ( const pandora::PfoList &  commonMuonPfoList,
const pandora::HitType  hitType,
const pandora::Cluster *&  pMuonCluster 
) const

Return the cluster of the common cosmic ray pfo in a given view (function demands there to be only one common CR pfo)

Parameters
commonMuonPfoListthe element's list of common muon pfos
hitTypethe specified view
pMuonClusterthe output address of the cluster
Returns
a status code reflecting if one and only one cosmic ray cluster was found

Definition at line 101 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::LArPfoHelper::GetClusters().

Referenced by lar_content::CosmicRayRemovalTool::GrowSeed(), lar_content::TwoViewCosmicRayRemovalTool::GrowSeed(), lar_content::DeltaRayRemovalTool::IsContaminated(), lar_content::CosmicRayRemovalTool::IsContaminated(), lar_content::TwoViewCosmicRayRemovalTool::IsContaminated(), lar_content::RemovalBaseTool::IsMuonEndpoint(), lar_content::TwoViewCosmicRayRemovalTool::IsMuonEndpoint(), lar_content::TwoViewCosmicRayRemovalTool::PassElementChecks(), lar_content::RemovalBaseTool::PassElementChecks(), lar_content::CosmicRayRemovalTool::SplitDeltaRayCluster(), lar_content::TwoViewCosmicRayRemovalTool::SplitDeltaRayCluster(), and lar_content::DeltaRayRemovalTool::SplitMuonCluster().

102 {
103  if (commonMuonPfoList.size() != 1)
104  return STATUS_CODE_NOT_FOUND;
105 
106  ClusterList muonClusterList;
107  LArPfoHelper::GetClusters(commonMuonPfoList.front(), hitType, muonClusterList);
108 
109  if (muonClusterList.size() != 1)
110  return STATUS_CODE_NOT_FOUND;
111 
112  pMuonCluster = muonClusterList.front();
113 
114  return STATUS_CODE_SUCCESS;
115 }
static void GetClusters(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::ClusterList &clusterList)
Get a list of clusters of a particular hit type from a list of pfos.
template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetNearbyMuonPfos ( const pandora::Cluster *const  pCluster,
pandora::ClusterList &  consideredClusters,
pandora::PfoList &  nearbyMuonPfos 
) const
protected

Use the cluster proximity map to travel along paths of nearby clusters finding the cosmic ray clusters on which they terminate.

Parameters
pClusterthe address of the input cluster
consideredClustersthe list of investigated clusters
nearbyMuonPfosthe output list of the cosmic ray pfos to which the nearby cosmic ray clusters belong

Definition at line 120 of file NViewDeltaRayMatchingAlgorithm.cc.

References f, lar_content::LArClusterHelper::GetClusterHitType(), lar_content::DeltaRayMatchingContainers::GetClusterProximityMap(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetClusterSpanX(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetClusterSpanZ(), lar_content::DeltaRayMatchingContainers::GetClusterToPfoMap(), lar_content::LArGeometryHelper::GetWirePitch(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_deltaRayMatchingContainers, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_minMatchedFraction, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_minMatchedPoints, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_pseudoChi2Cut, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_xOverlapWindow, lar_content::LArGeometryHelper::MergeTwoPositions(), n, lar_content::NViewDeltaRayMatchingAlgorithm< T >::PerformThreeViewMatching(), and x.

121 {
122  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
125 
126  consideredClusters.push_back(pCluster);
127 
128  const DeltaRayMatchingContainers::ClusterProximityMap::const_iterator clusterProximityIter(clusterProximityMap.find(pCluster));
129 
130  if (clusterProximityIter == clusterProximityMap.end())
131  return;
132 
133  for (const Cluster *const pNearbyCluster : clusterProximityIter->second)
134  {
135  if (std::find(consideredClusters.begin(), consideredClusters.end(), pNearbyCluster) != consideredClusters.end())
136  continue;
137 
138  const DeltaRayMatchingContainers::ClusterToPfoMap::const_iterator pfoIter(clusterToPfoMap.find(pNearbyCluster));
139 
140  if (pfoIter != clusterToPfoMap.end())
141  {
142  if (std::find(nearbyMuonPfos.begin(), nearbyMuonPfos.end(), pfoIter->second) == nearbyMuonPfos.end())
143  nearbyMuonPfos.push_back(pfoIter->second);
144 
145  continue;
146  }
147 
148  this->GetNearbyMuonPfos(pNearbyCluster, consideredClusters, nearbyMuonPfos);
149  }
150 }
std::map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
const ClusterProximityMap & GetClusterProximityMap(const pandora::HitType hitType) const
Get the mapping of clusters to to their neighbouring clusters.
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.
const ClusterToPfoMap & GetClusterToPfoMap(const pandora::HitType hitType) const
Get the mapping of clusters to the pfos to which they belong.
void GetNearbyMuonPfos(const pandora::Cluster *const pCluster, pandora::ClusterList &consideredClusters, pandora::PfoList &nearbyMuonPfos) const
Use the cluster proximity map to travel along paths of nearby clusters finding the cosmic ray cluster...
std::map< const pandora::Cluster *, pandora::ClusterList > ClusterProximityMap
HitType
Definition: HitType.h:12
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
template<typename T>
StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
pandora::CartesianPointVector &  projectedPositions 
) const

Use two clusters from different views to calculate projected positions in the remaining third view.

Parameters
pCluster1the address of the first cluster
pCluster2the address of the second cluster
projectedPositionsthe output projected positions
Returns
a status code reflecting whether the procedure ran smoothly and if the outcome is good

Definition at line 481 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::NViewDeltaRayMatchingAlgorithm< T >::CollectHitsFromMuon(), f, lar_content::LArClusterHelper::GetClosestDistance(), lar_content::LArMuonLeadingHelper::GetClosestDistance(), lar_content::LArMuonLeadingHelper::GetClosestPosition(), lar_content::LArMuonLeadingHelper::GetClosestPositions(), lar_content::LArClusterHelper::GetClusterHitType(), lar_content::LArPfoHelper::GetClusters(), lar_content::TwoDSlidingFitResult::GetGlobalFitDirection(), lar_content::TwoDSlidingFitResult::GetLocalPosition(), lar_content::LArGeometryHelper::GetWirePitch(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_maxCosmicRayHitFraction, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_maxDistanceToCluster, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_maxDistanceToReferencePoint, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_minProjectedPositions, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_xOverlapWindow, lar_content::LArGeometryHelper::MergeTwoPositions(), n, lar_content::NViewDeltaRayMatchingAlgorithm< T >::ParameteriseMuon(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::ProjectMuonPositions(), and x.

Referenced by lar_content::RemovalBaseTool::ProjectDeltaRayPositions(), lar_content::TwoViewCosmicRayRemovalTool::ProjectDeltaRayPositions(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::ProjectMuonPositions().

483 {
484  float xMin1(0.f), xMax1(0.f), xMin2(0.f), xMax2(0.f);
485  pCluster1->GetClusterSpanX(xMin1, xMax1);
486  pCluster2->GetClusterSpanX(xMin2, xMax2);
487 
488  const float xPitch(0.5 * m_xOverlapWindow);
489  const float xMin(std::max(xMin1, xMin2) - xPitch);
490  const float xMax(std::min(xMax1, xMax2) + xPitch);
491  const float xOverlap(xMax - xMin);
492 
493  if (xOverlap < std::numeric_limits<float>::epsilon())
494  return STATUS_CODE_NOT_FOUND;
495 
496  const HitType hitType1(LArClusterHelper::GetClusterHitType(pCluster1));
497  const HitType hitType2(LArClusterHelper::GetClusterHitType(pCluster2));
498 
499  if (hitType1 == hitType2)
500  throw StatusCodeException(STATUS_CODE_FAILURE);
501 
502  const unsigned int nPoints(1 + static_cast<unsigned int>(xOverlap / xPitch));
503 
504  // Projection into third view
505  for (unsigned int n = 0; n < nPoints; ++n)
506  {
507  const float x(xMin + (xMax - xMin) * (static_cast<float>(n) + 0.5f) / static_cast<float>(nPoints));
508  const float xmin(x - xPitch);
509  const float xmax(x + xPitch);
510 
511  try
512  {
513  float zMin1(0.f), zMin2(0.f), zMax1(0.f), zMax2(0.f);
514  pCluster1->GetClusterSpanZ(xmin, xmax, zMin1, zMax1);
515  pCluster2->GetClusterSpanZ(xmin, xmax, zMin2, zMax2);
516 
517  const float z1(0.5f * (zMin1 + zMax1));
518  const float z2(0.5f * (zMin2 + zMax2));
519 
520  float chi2;
521  CartesianVector projection(0.f, 0.f, 0.f);
523  this->GetPandora(), hitType1, hitType2, CartesianVector(x, 0.f, z1), CartesianVector(x, 0.f, z2), projection, chi2);
524 
525  projectedPositions.push_back(projection);
526  }
527  catch (StatusCodeException &statusCodeException)
528  {
529  if (statusCodeException.GetStatusCode() != STATUS_CODE_NOT_FOUND)
530  throw statusCodeException.GetStatusCode();
531 
532  continue;
533  }
534  }
535 
536  // Reject if projection is not good
537  if (projectedPositions.size() < m_minProjectedPositions)
538  return STATUS_CODE_NOT_FOUND;
539 
540  return STATUS_CODE_SUCCESS;
541 }
Float_t x
Definition: compare.C:6
unsigned int m_minProjectedPositions
The threshold number of projected points for a good projection.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
TFile f
Definition: plotHisto.C:6
float m_xOverlapWindow
The maximum allowed displacement in x position.
static float MergeTwoPositions(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const float position1, const float position2)
Merge two views (U,V) to give a third view (Z).
HitType
Definition: HitType.h:12
Char_t n[5]
template<typename T>
const pandora::ClusterList & lar_content::NViewMatchingAlgorithm< T >::GetSelectedClusterList ( const pandora::HitType  hitType) const
virtualinherited

Get the selected cluster list corresponding to a specified hit type.

Parameters
hitTypethe hit type
Returns
the selected cluster list

Implements lar_content::MatchingBaseAlgorithm.

Definition at line 74 of file NViewMatchingAlgorithm.cc.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl.

75 {
76  return m_matchingControl.GetSelectedClusterList(hitType);
77 }
MatchingType m_matchingControl
The matching control.
bool lar_content::MatchingBaseAlgorithm::MakeClusterMerges ( const ClusterMergeMap clusterMergeMap)
virtualinherited

Merge clusters together.

Parameters
clusterMergeMapthe cluster merge map
Returns
whether changes to the overlap container have been made

Definition at line 48 of file MatchingBaseAlgorithm.cc.

Referenced by lar_content::SplitShowersTool::ApplyChanges(), lar_content::ThreeDKinkBaseTool::ApplyChanges(), lar_content::TwoViewThreeDKinkTool::ApplyChanges(), lar_content::ConnectedRemnantsTool::Run(), and lar_content::MissingTrackSegmentTool::Run().

49 {
50  ClusterSet deletedClusters;
51 
52  ClusterList parentClusters;
53  for (const auto &mapEntry : clusterMergeMap)
54  parentClusters.push_back(mapEntry.first);
55  parentClusters.sort(LArClusterHelper::SortByNHits);
56 
57  for (const Cluster *const pParentCluster : parentClusters)
58  {
59  const HitType hitType(LArClusterHelper::GetClusterHitType(pParentCluster));
60  const std::string &clusterListName(this->GetClusterListName(hitType));
61 
62  if (!((TPC_VIEW_U == hitType) || (TPC_VIEW_V == hitType) || (TPC_VIEW_W == hitType)))
63  throw StatusCodeException(STATUS_CODE_FAILURE);
64 
65  ClusterList daughterClusters(clusterMergeMap.at(pParentCluster));
66  daughterClusters.sort(LArClusterHelper::SortByNHits);
67 
68  for (const Cluster *const pDaughterCluster : daughterClusters)
69  {
70  if (deletedClusters.count(pParentCluster) || deletedClusters.count(pDaughterCluster))
71  throw StatusCodeException(STATUS_CODE_FAILURE);
72 
73  this->UpdateUponDeletion(pDaughterCluster);
74  this->UpdateUponDeletion(pParentCluster);
75  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
76  PandoraContentApi::MergeAndDeleteClusters(*this, pParentCluster, pDaughterCluster, clusterListName, clusterListName));
77 
78  this->UpdateForNewCluster(pParentCluster);
79  deletedClusters.insert(pDaughterCluster);
80  }
81  }
82 
83  return !(deletedClusters.empty());
84 }
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.
virtual void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)=0
Update to reflect cluster deletion.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
virtual const std::string & GetClusterListName(const pandora::HitType hitType) const =0
Get the cluster list name corresponding to a specified hit type.
virtual void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)=0
Update to reflect addition of a new cluster to the problem space.
HitType
Definition: HitType.h:12
template<typename T>
pandora::StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::ParameteriseMuon ( const pandora::ParticleFlowObject *const  pParentMuon,
const pandora::Cluster *const  pDeltaRayCluster,
pandora::CartesianVector &  positionOnMuon,
pandora::CartesianVector &  muonDirection 
) const

Parameterise the projection of a cosmic ray track in order to avoid poor/sparse projections.

Parameters
pParentMuonthe address of the cosmic ray pfo
pDeltaRayClusterthe address of the delta ray cluster in the projected view
positionOnMuonthe output position to localise the parameterisation in space
muonDirectionthe output cosmic ray direction
Returns
a status code reflecting whether the procedure ran smoothly and if the outcome is good

Referenced by lar_content::CosmicRayRemovalTool::CreateSeed(), lar_content::TwoViewCosmicRayRemovalTool::CreateSeed(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions(), lar_content::CosmicRayRemovalTool::GrowSeed(), and lar_content::TwoViewCosmicRayRemovalTool::GrowSeed().

template<typename T>
pandora::StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::ParameteriseMuon ( const pandora::ParticleFlowObject *const  pParentMuon,
const pandora::CartesianPointVector &  deltaRayProjectedPositions,
const pandora::HitType  hitType,
pandora::CartesianVector &  positionOnMuon,
pandora::CartesianVector &  muonDirection 
) const

Parameterise the projection of a cosmic ray track in order to avoid poor/sparse projections.

Parameters
pParentMuonthe address of the cosmic ray pfo
deltaRayProjectedPositionsthe projected positions of the delta ray
hitTypethe view in which the projection is made
positionOnMuonthe output position to localise the parameterisation in space
muonDirectionthe output cosmic ray direction
Returns
a status code reflecting whether the procedure ran smoothly and if the outcome is good
template<typename T >
void lar_content::NViewMatchingAlgorithm< T >::PerformMainLoop ( )
protectedvirtualinherited

Main loop over cluster combinations in order to populate the overlap container. Responsible for calling CalculateOverlapResult.

Implements lar_content::MatchingBaseAlgorithm.

Reimplemented in lar_content::ThreeViewTrackFragmentsAlgorithm.

Definition at line 106 of file NViewMatchingAlgorithm.cc.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl.

107 {
108  m_matchingControl.PerformMainLoop();
109 }
MatchingType m_matchingControl
The matching control.
template<typename T>
pandora::StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::PerformThreeViewMatching ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
const pandora::Cluster *const  pCluster3,
float &  reducedChiSquared 
) const

To determine how well three clusters (one in each view) map onto one another expressing this in terms of a chi-squared like parameter.

Parameters
pCluster1the first cluster
pCluster2the second cluster
pCluster3the third cluster
reducedChiSquaredthe reduced chi squared
Returns
a status code reflecting whether the matching procedure ran smoothly and if the outcome is good

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetNearbyMuonPfos(), and lar_content::DeltaRayMergeTool::MakeOneCommonViewMerges().

template<typename T>
pandora::StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::PerformThreeViewMatching ( const pandora::Cluster *const  pClusterU,
const pandora::Cluster *const  pClusterV,
const pandora::Cluster *const  pClusterW,
float &  chiSquaredSum,
unsigned int &  nSamplingPoints,
unsigned int &  nMatchedSamplingPoints,
XOverlap XOverlap 
) const

To determine how well three clusters (one in each view) map onto one another expressing this in terms of a chi-squared like parameter.

Parameters
pClusterUthe U cluster (if the xOverlap object is to be retained this must be the u cluster - for labels to make sense)
pClusterVthe V cluster
pClusterWthe W cluster
chiSquaredSumthe sum of the chi-squared values of the sampled points
nSamplingPointsthe number of sampled points
nMatchedSamplingPointsthe number of matched sampled points
xOverlapthe xOverlap object
Returns
a status code reflecting whether the matching procedure ran smoothly and if the outcome is good
template<typename T>
pandora::StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::PerformThreeViewMatching ( const pandora::CaloHitList &  pCluster1,
const pandora::CaloHitList &  pCluster2,
const pandora::CaloHitList &  pCluster3,
float &  reducedChiSquared 
) const

To determine how well three CaloHitLists (one in each view) map onto one another expressing this in terms of a chi-squared like parameter.

Parameters
pCluster1the first CaloHitList
pCluster2the second CaloHitList
pCluster3the third CaloHitList
reducedChiSquaredthe reduced chi squared
Returns
a status code reflecting whether the matching procedure ran smoothly and if the outcome is good
template<typename T>
pandora::StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::PerformThreeViewMatching ( const pandora::CaloHitList &  clusterU,
const pandora::CaloHitList &  clusterV,
const pandora::CaloHitList &  clusterW,
float &  chiSquaredSum,
unsigned int &  nSamplingPoints,
unsigned int &  nMatchedSamplingPoints,
XOverlap XOverlap 
) const

To determine how well three CaloHitLists (one for each view) map onto one another expressing this in terms of a chi-squared like parameter.

Parameters
clusterUthe U CaloHitList (if the xOverlap object is to be retained this must be the u cluster - for labels to make sense)
clusterVthe V CaloHitList
clusterWthe W CaloHitList
chiSquaredSumthe sum of the chi-squared values of the sampled points
nSamplingPointsthe number of sampled points
nMatchedSamplingPointsthe number of matched sampled points
xOverlapthe xOverlap object
Returns
a status code reflecting whether the matching procedure ran smoothly and if the outcome is good
template<typename T >
void lar_content::NViewMatchingAlgorithm< T >::PrepareAllInputClusters ( )
protectedvirtualinherited

Perform any preparatory steps required, e.g. caching expensive fit results for clusters.

Implements lar_content::MatchingBaseAlgorithm.

Definition at line 90 of file NViewMatchingAlgorithm.cc.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl.

91 {
92  m_matchingControl.PrepareAllInputClusters();
93 }
MatchingType m_matchingControl
The matching control.
template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::PrepareInputClusters ( pandora::ClusterList &  preparedClusterList)
virtual

Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results.

Parameters
preparedClusterListto receive the prepared cluster list, non const so as to be able to modify input selected list

Reimplemented from lar_content::MatchingBaseAlgorithm.

Definition at line 61 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::DeltaRayMatchingContainers::FillContainers(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::FillStrayClusterList(), lar_content::LArClusterHelper::GetClusterHitType(), lar_content::NViewMatchingAlgorithm< T >::GetInputClusterList(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_deltaRayMatchingContainers, and lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_muonPfoListName.

62 {
63  if (preparedClusterList.empty())
64  return;
65 
66  const PfoList *pMuonPfoList(nullptr);
67 
68  PANDORA_THROW_RESULT_IF_AND_IF(
69  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, m_muonPfoListName, pMuonPfoList));
70 
71  if ((!pMuonPfoList) || pMuonPfoList->empty())
72  return;
73 
74  const HitType hitType(LArClusterHelper::GetClusterHitType(preparedClusterList.front()));
75 
77 
78  this->FillStrayClusterList(LArClusterHelper::GetClusterHitType(preparedClusterList.front()));
79 }
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
void FillContainers(const pandora::PfoList &inputPfoList, const pandora::ClusterList &inputClusterList1, const pandora::ClusterList &inputClusterList2=pandora::ClusterList(), const pandora::ClusterList &inputClusterList3=pandora::ClusterList())
Fill the HitToClusterMap, the ClusterProximityMap and the ClusterToPfoMap in all input views...
std::string m_muonPfoListName
The list of reconstructed cosmic ray pfos.
void FillStrayClusterList(const pandora::HitType hitType)
Fill the stray cluster list with clusters that do not pass the tensor threshold requirement.
const pandora::ClusterList & GetInputClusterList(const pandora::HitType hitType) const
Get the input cluster list corresponding to a specified hit type.
HitType
Definition: HitType.h:12
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
template<typename T>
StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::ProjectMuonPositions ( const pandora::HitType &  thirdViewHitType,
const pandora::ParticleFlowObject *const  pParentMuon,
pandora::CartesianPointVector &  projectedPositions 
) const

Use two views of a cosmic ray pfo to calculate projected positions in a given the third view.

Parameters
thirdViewHitTypethe view to be projected into
pParentMuonthe input cosmic ray pfo
projectedPositionsthe output projected positions
Returns
a status code reflecting whether the procedure ran smoothly and if the outcome is good

Definition at line 460 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::LArPfoHelper::GetClusters(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions().

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions().

462 {
463  ClusterList muonClusterList1, muonClusterList2;
464 
465  HitTypeVector hitTypes({TPC_VIEW_U, TPC_VIEW_V, TPC_VIEW_W});
466 
467  hitTypes.erase(std::find(hitTypes.begin(), hitTypes.end(), thirdViewHitType));
468 
469  LArPfoHelper::GetClusters(pParentMuon, hitTypes[0], muonClusterList1);
470  LArPfoHelper::GetClusters(pParentMuon, hitTypes[1], muonClusterList2);
471 
472  if ((muonClusterList1.size() != 1) || (muonClusterList2.size() != 1))
473  return STATUS_CODE_NOT_FOUND;
474 
475  return (this->GetProjectedPositions(muonClusterList1.front(), muonClusterList2.front(), projectedPositions));
476 }
pandora::StatusCode GetProjectedPositions(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, pandora::CartesianPointVector &projectedPositions) const
Use two clusters from different views to calculate projected positions in the remaining third view...
static void GetClusters(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::ClusterList &clusterList)
Get a list of clusters of a particular hit type from a list of pfos.
template<typename T>
StatusCode lar_content::NViewDeltaRayMatchingAlgorithm< T >::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedvirtual

Reimplemented from lar_content::NViewMatchingAlgorithm< T >.

Definition at line 901 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_deltaRayMatchingContainers, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_maxCosmicRayHitFraction, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_maxDistanceToCluster, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_maxDistanceToReferencePoint, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_minMatchedFraction, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_minMatchedPoints, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_minProjectedPositions, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_muonPfoListName, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_pseudoChi2Cut, lar_content::DeltaRayMatchingContainers::m_searchRegion1D, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterSeparation, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_xOverlapWindow, and lar_content::NViewMatchingAlgorithm< T >::ReadSettings().

902 {
903  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "MuonPfoListName", m_muonPfoListName));
904 
905  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
906  XmlHelper::ReadValue(xmlHandle, "SearchRegion1D", m_deltaRayMatchingContainers.m_searchRegion1D));
907 
908  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PseudoChi2Cut", m_pseudoChi2Cut));
909 
910  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "OverlapWindow", m_xOverlapWindow));
911 
912  PANDORA_RETURN_RESULT_IF_AND_IF(
913  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchedFraction", m_minMatchedFraction));
914 
915  PANDORA_RETURN_RESULT_IF_AND_IF(
916  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchedPoints", m_minMatchedPoints));
917 
918  PANDORA_RETURN_RESULT_IF_AND_IF(
919  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinProjectedPositions", m_minProjectedPositions));
920 
921  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
922  XmlHelper::ReadValue(xmlHandle, "MaxCosmicRayHitFraction", m_maxCosmicRayHitFraction));
923 
924  PANDORA_RETURN_RESULT_IF_AND_IF(
925  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxDistanceToCluster", m_maxDistanceToCluster));
926 
927  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
928  XmlHelper::ReadValue(xmlHandle, "MaxDistanceToReferencePoint", m_maxDistanceToReferencePoint));
929 
930  PANDORA_RETURN_RESULT_IF_AND_IF(
931  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "StrayClusterSeparation", m_strayClusterSeparation));
932 
933  return NViewMatchingAlgorithm<T>::ReadSettings(xmlHandle);
934 }
unsigned int m_minProjectedPositions
The threshold number of projected points for a good projection.
float m_pseudoChi2Cut
Pseudo chi2 cut for three view matching.
float m_xOverlapWindow
The maximum allowed displacement in x position.
std::string m_muonPfoListName
The list of reconstructed cosmic ray pfos.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_strayClusterSeparation
The maximum allowed separation of a stray cluster and a delta ray cluster for merge.
float m_maxDistanceToReferencePoint
the maximum distance of a projected point to the cosmic ray vertex used when parameterising the cosmi...
float m_maxCosmicRayHitFraction
The maximum allowed fraction of hits to be removed from the cosmic ray track.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
float m_minMatchedFraction
The threshold matched fraction of sampling points for a good match.
unsigned int m_minMatchedPoints
The threshold number of matched sampling points for a good match.
float m_maxDistanceToCluster
the maximum distance of a projected point to the cosmic ray cluster used when parameterising the cosm...
float m_searchRegion1D
Search region, applied to each dimension, for look-up from kd-tree.
template<typename T >
void lar_content::NViewMatchingAlgorithm< T >::SelectAllInputClusters ( )
protectedvirtualinherited

Select a subset of input clusters for processing in this algorithm.

Implements lar_content::MatchingBaseAlgorithm.

Definition at line 82 of file NViewMatchingAlgorithm.cc.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl.

83 {
84  m_matchingControl.SelectAllInputClusters();
85 }
MatchingType m_matchingControl
The matching control.
template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::SelectInputClusters ( const pandora::ClusterList *const  pInputClusterList,
pandora::ClusterList &  selectedClusterList 
) const
virtual

Select a subset of input clusters for processing in this algorithm.

Parameters
pInputClusterListaddress of an input cluster list
selectedClusterListto receive the selected cluster list

Reimplemented from lar_content::MatchingBaseAlgorithm.

Definition at line 49 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::NViewDeltaRayMatchingAlgorithm< T >::DoesClusterPassTensorThreshold().

50 {
51  for (const Cluster *const pCluster : *pInputClusterList)
52  {
53  if ((pCluster->IsAvailable()) && (this->DoesClusterPassTensorThreshold(pCluster)))
54  selectedClusterList.push_back(pCluster);
55  }
56 }
virtual bool DoesClusterPassTensorThreshold(const pandora::Cluster *const pCluster) const =0
To check whether a given cluster meets the requirements to be added into the matching container (tens...
void lar_content::MatchingBaseAlgorithm::SetPfoParameters ( const ProtoParticle protoParticle,
PandoraContentApi::ParticleFlowObject::Parameters &  pfoParameters 
) const
virtualinherited

Set Pfo properties.

Parameters
protoParticlethe input proto particle
pfoParametersthe output pfo parameters

Definition at line 116 of file MatchingBaseAlgorithm.cc.

References f, and lar_content::ProtoParticle::m_clusterList.

117 {
118  this->SetPfoParticleId(pfoParameters);
119  pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
120  pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
121  pfoParameters.m_energy = 0.f;
122  pfoParameters.m_momentum = CartesianVector(0.f, 0.f, 0.f);
123  pfoParameters.m_clusterList = protoParticle.m_clusterList;
124 }
TFile f
Definition: plotHisto.C:6
virtual void SetPfoParticleId(PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
Set pfo particle id.
void lar_content::MatchingBaseAlgorithm::SetPfoParticleId ( PandoraContentApi::ParticleFlowObject::Parameters &  pfoParameters) const
virtualinherited
template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::SplitMuonCluster ( const std::string &  clusterListName,
const pandora::Cluster *const  pMuonCluster,
const pandora::CaloHitList &  collectedHits,
const pandora::Cluster *&  pDeltaRayCluster 
) const

Move a list of hits from a cosmic ray cluster into the given child delta ray cluster.

Parameters
clusterListNamethe pandora list to which the cosmic ray and delta ray clusters belong
pMuonClusterthe address of the cosmic ray cluster
collectedHitsthe list of hits to reassign
pDeltaRayClusterthe address of the delta ray cluster (may be a nullptr if cluster is yet to be made)

Definition at line 701 of file NViewDeltaRayMatchingAlgorithm.cc.

Referenced by lar_content::DeltaRayRemovalTool::SplitMuonCluster().

703 {
704  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, clusterListName));
705 
706  CaloHitList muonCaloHitList;
707  pMuonCluster->GetOrderedCaloHitList().FillCaloHitList(muonCaloHitList);
708 
709  for (const CaloHit *const pCaloHit : muonCaloHitList)
710  {
711  if (std::find(collectedHits.begin(), collectedHits.end(), pCaloHit) != collectedHits.end())
712  {
713  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::RemoveFromCluster(*this, pMuonCluster, pCaloHit));
714 
715  if (!pDeltaRayCluster)
716  {
717  const ClusterList *pTemporaryList(nullptr);
718  std::string temporaryListName, currentListName;
719  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentListName<Cluster>(*this, currentListName));
720  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
721  PandoraContentApi::CreateTemporaryListAndSetCurrent<ClusterList>(*this, pTemporaryList, temporaryListName));
722 
723  PandoraContentApi::Cluster::Parameters parameters;
724  parameters.m_caloHitList.push_back(pCaloHit);
725 
726  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*this, parameters, pDeltaRayCluster));
727  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Cluster>(*this, temporaryListName, currentListName));
728  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, currentListName));
729  }
730  else
731  {
732  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToCluster(*this, pDeltaRayCluster, pCaloHit));
733  }
734  }
735  }
736 }
template<typename T >
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::TidyUp ( )
protectedvirtual

Tidy member variables in derived class.

Reimplemented from lar_content::NViewMatchingAlgorithm< T >.

Definition at line 887 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::DeltaRayMatchingContainers::ClearContainers(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_deltaRayMatchingContainers, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListU, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListV, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListW, and lar_content::NViewMatchingAlgorithm< T >::TidyUp().

888 {
890 
891  m_strayClusterListU.clear();
892  m_strayClusterListV.clear();
893  m_strayClusterListW.clear();
894 
896 }
pandora::ClusterList m_strayClusterListU
The list of U clusters that do not pass the tensor threshold requirement.
virtual void TidyUp()
Tidy member variables in derived class.
pandora::ClusterList m_strayClusterListV
The list of V clusters that do not pass the tensor threshold requirement.
pandora::ClusterList m_strayClusterListW
The list of W clusters that do not pass the tensor threshold requirement.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
void ClearContainers()
Empty all algorithm containers.
template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::UpdateForNewClusters ( const pandora::ClusterVector &  newClusterVector,
const pandora::PfoVector &  pfoVector 
)

Add a new cluster to algorithm ownership maps and, if it a delta ray cluster, to the underlying matches container (tensor/matrix)

Parameters
newClusterVectorthe vector of clusters to add - the order must match the pfoVector
pfoVectorthe vector of cosmic ray pfos to which the new clusters belong (nullptr for delta ray cluster)

Definition at line 869 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::DeltaRayMatchingContainers::AddClustersToContainers(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_deltaRayMatchingContainers, and lar_content::NViewMatchingAlgorithm< T >::UpdateForNewCluster().

Referenced by lar_content::DeltaRayMergeTool::MakeOneCommonViewMerges(), lar_content::DeltaRayMergeTool::MakeTwoCommonViewMerges(), lar_content::CosmicRayRemovalTool::SplitDeltaRayCluster(), lar_content::TwoViewCosmicRayRemovalTool::SplitDeltaRayCluster(), and lar_content::DeltaRayRemovalTool::SplitMuonCluster().

870 {
871  m_deltaRayMatchingContainers.AddClustersToContainers(newClusterVector, pfoVector);
872 
873  for (unsigned int i = 0; i < newClusterVector.size(); i++)
874  {
875  const Cluster *const pNewCluster(newClusterVector.at(i));
876  const ParticleFlowObject *const pMuonPfo(pfoVector.at(i));
877 
878  // ATTN: Only add delta ray clusters into the tensor
879  if (!pMuonPfo)
881  }
882 }
void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)
Update to reflect addition of a new cluster to the problem space.
void AddClustersToContainers(const pandora::ClusterVector &newClusterVector, const pandora::PfoVector &pfoVector)
Add a list of clusters to the hit to cluster and cluster proximity maps and, if appropriate, to the cluster to pfo map.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
template<typename T>
void lar_content::NViewDeltaRayMatchingAlgorithm< T >::UpdateUponDeletion ( const pandora::Cluster *const  pDeletedCluster)
virtual

Update to reflect cluster deletion.

Parameters
pDeletedClusteraddress of the deleted cluster

Implements lar_content::MatchingBaseAlgorithm.

Definition at line 846 of file NViewDeltaRayMatchingAlgorithm.cc.

References lar_content::LArClusterHelper::GetClusterHitType(), lar_content::DeltaRayMatchingContainers::GetClusterToPfoMap(), lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_deltaRayMatchingContainers, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListU, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListV, lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListW, lar_content::DeltaRayMatchingContainers::RemoveClusterFromContainers(), and lar_content::NViewMatchingAlgorithm< T >::UpdateUponDeletion().

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::AddInStrayClusters(), lar_content::DeltaRayMergeTool::MakeOneCommonViewMerges(), lar_content::DeltaRayMergeTool::MakeTwoCommonViewMerges(), lar_content::CosmicRayRemovalTool::SplitDeltaRayCluster(), lar_content::TwoViewCosmicRayRemovalTool::SplitDeltaRayCluster(), and lar_content::DeltaRayRemovalTool::SplitMuonCluster().

847 {
848  const HitType hitType(LArClusterHelper::GetClusterHitType(pDeletedCluster));
849  ClusterList &strayClusterList((hitType == TPC_VIEW_U) ? m_strayClusterListU
850  : (hitType == TPC_VIEW_V) ? m_strayClusterListV
852  const ClusterList::const_iterator strayClusterIter(std::find(strayClusterList.begin(), strayClusterList.end(), pDeletedCluster));
853 
854  if (strayClusterIter != strayClusterList.end())
855  strayClusterList.erase(strayClusterIter);
856 
858  const bool isMuonCluster(clusterToPfoMap.find(pDeletedCluster) != clusterToPfoMap.end());
859 
861 
862  if (!isMuonCluster)
864 }
std::map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
pandora::ClusterList m_strayClusterListU
The list of U clusters that do not pass the tensor threshold requirement.
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 UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
pandora::ClusterList m_strayClusterListV
The list of V clusters that do not pass the tensor threshold requirement.
pandora::ClusterList m_strayClusterListW
The list of W clusters that do not pass the tensor threshold requirement.
const ClusterToPfoMap & GetClusterToPfoMap(const pandora::HitType hitType) const
Get the mapping of clusters to the pfos to which they belong.
HitType
Definition: HitType.h:12
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
void RemoveClusterFromContainers(const pandora::Cluster *const pDeletedCluster)
Remove an input cluster&#39;s hits from the hit to cluster and cluster proximity maps and...

Member Data Documentation

template<typename T>
float lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_maxCosmicRayHitFraction
protected

The maximum allowed fraction of hits to be removed from the cosmic ray track.

Definition at line 306 of file NViewDeltaRayMatchingAlgorithm.h.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::ReadSettings().

template<typename T>
float lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_maxDistanceToCluster
protected

the maximum distance of a projected point to the cosmic ray cluster used when parameterising the cosmic ray cluster

Definition at line 307 of file NViewDeltaRayMatchingAlgorithm.h.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::ReadSettings().

template<typename T>
float lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_maxDistanceToReferencePoint
protected

the maximum distance of a projected point to the cosmic ray vertex used when parameterising the cosmic ray cluster

Definition at line 308 of file NViewDeltaRayMatchingAlgorithm.h.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::ReadSettings().

template<typename T>
float lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_minMatchedFraction
protected

The threshold matched fraction of sampling points for a good match.

Definition at line 303 of file NViewDeltaRayMatchingAlgorithm.h.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetNearbyMuonPfos(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::ReadSettings().

template<typename T>
unsigned int lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_minMatchedPoints
protected

The threshold number of matched sampling points for a good match.

Definition at line 304 of file NViewDeltaRayMatchingAlgorithm.h.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetNearbyMuonPfos(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::ReadSettings().

template<typename T>
unsigned int lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_minProjectedPositions
protected

The threshold number of projected points for a good projection.

Definition at line 305 of file NViewDeltaRayMatchingAlgorithm.h.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::GetProjectedPositions(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::ReadSettings().

template<typename T>
std::string lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_muonPfoListName
protected
template<typename T>
float lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_pseudoChi2Cut
protected
template<typename T>
float lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterSeparation
protected

The maximum allowed separation of a stray cluster and a delta ray cluster for merge.

Definition at line 309 of file NViewDeltaRayMatchingAlgorithm.h.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::CollectStrayClusters(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::ReadSettings().


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