Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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
 
- Public Types inherited from lar_content::NViewMatchingAlgorithm< T >
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...
 
- Public Member Functions inherited from lar_content::NViewMatchingAlgorithm< T >
 NViewMatchingAlgorithm ()
 Default constructor. More...
 
virtual ~NViewMatchingAlgorithm ()
 Destructor. More...
 
void UpdateForNewCluster (const pandora::Cluster *const pNewCluster)
 Update to reflect addition of a new cluster to the problem space. More...
 
void UpdateUponDeletion (const pandora::Cluster *const pDeletedCluster)
 Update to reflect cluster deletion. More...
 
const std::stringGetClusterListName (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...
 
- Public Member Functions inherited from lar_content::MatchingBaseAlgorithm
 MatchingBaseAlgorithm ()
 Default constructor. More...
 
virtual ~MatchingBaseAlgorithm ()
 Destructor. 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)
 
- Protected Member Functions inherited from lar_content::NViewMatchingAlgorithm< T >
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...
 
- Protected Member Functions inherited from lar_content::MatchingBaseAlgorithm
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...
 
- Protected Attributes inherited from lar_content::NViewMatchingAlgorithm< T >
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.

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.

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.
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 813 of file NViewDeltaRayMatchingAlgorithm.cc.

814 {
815  this->UpdateUponDeletion(pClusterToEnlarge);
816 
817  for (const Cluster *const pCollectedCluster : collectedClusters)
818  {
819  this->UpdateUponDeletion(pCollectedCluster);
820 
821  std::string clusterListName(this->GetClusterListName(LArClusterHelper::GetClusterHitType(pClusterToEnlarge)));
822  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
823  PandoraContentApi::MergeAndDeleteClusters(*this, pClusterToEnlarge, pCollectedCluster, clusterListName, clusterListName));
824  }
825 
826  m_deltaRayMatchingContainers.AddClustersToContainers({pClusterToEnlarge}, {nullptr});
827 }
std::string string
Definition: nybbler.cc:12
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.
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
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 780 of file NViewDeltaRayMatchingAlgorithm.cc.

782 {
783  const HitType hitType(LArClusterHelper::GetClusterHitType(pClusterToEnlarge));
784  const ClusterList &strayClusterList((hitType == TPC_VIEW_U) ? m_strayClusterListU : (hitType == TPC_VIEW_V) ? m_strayClusterListV : m_strayClusterListW);
786  const DeltaRayMatchingContainers::ClusterProximityMap::const_iterator clusterProximityIter(clusterProximityMap.find(pClusterToEnlarge));
787 
788  if (clusterProximityIter == clusterProximityMap.end())
789  return;
790 
791  for (const Cluster *const pNearbyCluster : clusterProximityIter->second)
792  {
793  if (std::find(strayClusterList.begin(), strayClusterList.end(), pNearbyCluster) == strayClusterList.end())
794  continue;
795 
797  pNearbyCluster->GetClusterSpanX(xMin, xMax);
798 
799  if (!(((xMin > rangeMinX) && (xMin < rangeMaxX)) || ((xMax > rangeMinX) && (xMax < rangeMaxX))))
800  continue;
801 
802  if (LArClusterHelper::GetClosestDistance(pClusterToEnlarge, pNearbyCluster) > m_strayClusterSeparation)
803  continue;
804 
805  if (std::find(collectedClusters.begin(), collectedClusters.end(), pNearbyCluster) == collectedClusters.end())
806  collectedClusters.push_back(pNearbyCluster);
807  }
808 }
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.
enum cvn::HType HitType
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.
static int max(int a, int b)
std::map< const pandora::Cluster *, pandora::ClusterList > ClusterProximityMap
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 731 of file NViewDeltaRayMatchingAlgorithm.cc.

732 {
733  std::sort(protoParticleVector.begin(), protoParticleVector.end(), [](const ProtoParticle &a, const ProtoParticle &b) -> bool {
734  unsigned int aHitTotal(0);
735  for (const Cluster *const pCluster : a.m_clusterList)
736  aHitTotal += pCluster->GetNCaloHits();
737 
738  unsigned int bHitTotal(0);
739  for (const Cluster *const pCluster : b.m_clusterList)
740  bHitTotal += pCluster->GetNCaloHits();
741 
742  return (aHitTotal > bHitTotal);
743  });
744 
745  for (ProtoParticle protoParticle : protoParticleVector)
746  {
747  float longestSpan(-std::numeric_limits<float>::max()), spanMinX(0.f), spanMaxX(0.f);
748 
749  for (const Cluster *const pCluster : protoParticle.m_clusterList)
750  {
751  float minX(0.f), maxX(0.f);
752  pCluster->GetClusterSpanX(minX, maxX);
753 
754  const float span(maxX - minX);
755 
756  if (span > longestSpan)
757  {
758  longestSpan = span;
759  spanMinX = minX;
760  spanMaxX = maxX;
761  }
762  }
763 
764  for (const Cluster *const pCluster : protoParticle.m_clusterList)
765  {
766  ClusterList collectedClusters;
767  this->CollectStrayClusters(pCluster, spanMinX, spanMaxX, collectedClusters);
768 
769  if (!collectedClusters.empty())
770  this->AddInStrayClusters(pCluster, collectedClusters);
771  }
772  }
773 
774  return (this->CreateThreeDParticles(protoParticleVector));
775 }
span(IterB &&b, IterE &&e, Adaptor &&adaptor) -> span< decltype(adaptor(std::forward< IterB >(b))), decltype(adaptor(std::forward< IterE >(e))) >
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...
const double a
void AddInStrayClusters(const pandora::Cluster *const pClusterToEnlarge, const pandora::ClusterList &collectedClusters)
Merge in the collected stray clusters of a given delta ray cluster.
static int max(int a, int b)
static bool * b
Definition: config.cpp:1043
virtual bool CreateThreeDParticles(const ProtoParticleVector &protoParticleVector)
Create particles using findings from recent algorithm processing.
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.

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.

85 {
86  const ClusterList &inputClusterList(this->GetInputClusterList(hitType));
87  ClusterList &strayClusterList((hitType == TPC_VIEW_U) ? m_strayClusterListU : (hitType == TPC_VIEW_V) ? m_strayClusterListV : m_strayClusterListW);
88 
89  for (const Cluster *const pCluster : inputClusterList)
90  {
91  if ((pCluster->IsAvailable()) && (!this->DoesClusterPassTensorThreshold(pCluster)))
92  strayClusterList.push_back(pCluster);
93  }
94 }
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 397 of file NViewDeltaRayMatchingAlgorithm.cc.

398 {
401 
402  for (const CaloHit *const pCaloHit : caloHitList)
403  {
404  const float xCoordinate(pCaloHit->GetPositionVector().GetX());
405 
406  if (xCoordinate < xMin)
407  xMin = xCoordinate;
408 
409  if (xCoordinate > xMax)
410  xMax = xCoordinate;
411  }
412 }
static int max(int a, int b)
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 417 of file NViewDeltaRayMatchingAlgorithm.cc.

419 {
422 
423  bool found(false);
424  for (const CaloHit *const pCaloHit : caloHitList)
425  {
426  const float xCoordinate(pCaloHit->GetPositionVector().GetX());
427  const float zCoordinate(pCaloHit->GetPositionVector().GetZ());
428 
429  if ((xCoordinate < xMin) || (xCoordinate > xMax))
430  continue;
431 
432  found = true;
433 
434  if (zCoordinate < zMin)
435  zMin = zCoordinate;
436 
437  if (zCoordinate > zMax)
438  zMax = zCoordinate;
439  }
440 
441  if (!found)
442  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
443 
444  return STATUS_CODE_SUCCESS;
445 }
static int max(int a, int b)
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 99 of file NViewDeltaRayMatchingAlgorithm.cc.

100 {
101  if (commonMuonPfoList.size() != 1)
102  return STATUS_CODE_NOT_FOUND;
103 
104  ClusterList muonClusterList;
105  LArPfoHelper::GetClusters(commonMuonPfoList.front(), hitType, muonClusterList);
106 
107  if (muonClusterList.size() != 1)
108  return STATUS_CODE_NOT_FOUND;
109 
110  pMuonCluster = muonClusterList.front();
111 
112  return STATUS_CODE_SUCCESS;
113 }
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 118 of file NViewDeltaRayMatchingAlgorithm.cc.

119 {
120  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
123 
124  consideredClusters.push_back(pCluster);
125 
126  const DeltaRayMatchingContainers::ClusterProximityMap::const_iterator clusterProximityIter(clusterProximityMap.find(pCluster));
127 
128  if (clusterProximityIter == clusterProximityMap.end())
129  return;
130 
131  for (const Cluster *const pNearbyCluster : clusterProximityIter->second)
132  {
133  if (std::find(consideredClusters.begin(), consideredClusters.end(), pNearbyCluster) != consideredClusters.end())
134  continue;
135 
136  const DeltaRayMatchingContainers::ClusterToPfoMap::const_iterator pfoIter(clusterToPfoMap.find(pNearbyCluster));
137 
138  if (pfoIter != clusterToPfoMap.end())
139  {
140  if (std::find(nearbyMuonPfos.begin(), nearbyMuonPfos.end(), pfoIter->second) == nearbyMuonPfos.end())
141  nearbyMuonPfos.push_back(pfoIter->second);
142 
143  continue;
144  }
145 
146  this->GetNearbyMuonPfos(pNearbyCluster, consideredClusters, nearbyMuonPfos);
147  }
148 }
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.
enum cvn::HType HitType
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
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 471 of file NViewDeltaRayMatchingAlgorithm.cc.

473 {
474  float xMin1(0.f), xMax1(0.f), xMin2(0.f), xMax2(0.f);
475  pCluster1->GetClusterSpanX(xMin1, xMax1);
476  pCluster2->GetClusterSpanX(xMin2, xMax2);
477 
478  const float xPitch(0.5 * m_xOverlapWindow);
479  const float xMin(std::max(xMin1, xMin2) - xPitch);
480  const float xMax(std::min(xMax1, xMax2) + xPitch);
481  const float xOverlap(xMax - xMin);
482 
483  if (xOverlap < std::numeric_limits<float>::epsilon())
484  return STATUS_CODE_NOT_FOUND;
485 
486  const HitType hitType1(LArClusterHelper::GetClusterHitType(pCluster1));
487  const HitType hitType2(LArClusterHelper::GetClusterHitType(pCluster2));
488 
489  if (hitType1 == hitType2)
490  throw StatusCodeException(STATUS_CODE_FAILURE);
491 
492  const unsigned int nPoints(1 + static_cast<unsigned int>(xOverlap / xPitch));
493 
494  // Projection into third view
495  for (unsigned int n = 0; n < nPoints; ++n)
496  {
497  const float x(xMin + (xMax - xMin) * (static_cast<float>(n) + 0.5f) / static_cast<float>(nPoints));
498  const float xmin(x - xPitch);
499  const float xmax(x + xPitch);
500 
501  try
502  {
503  float zMin1(0.f), zMin2(0.f), zMax1(0.f), zMax2(0.f);
504  pCluster1->GetClusterSpanZ(xmin, xmax, zMin1, zMax1);
505  pCluster2->GetClusterSpanZ(xmin, xmax, zMin2, zMax2);
506 
507  const float z1(0.5f * (zMin1 + zMax1));
508  const float z2(0.5f * (zMin2 + zMax2));
509 
510  float chi2;
511  CartesianVector projection(0.f, 0.f, 0.f);
513  this->GetPandora(), hitType1, hitType2, CartesianVector(x, 0.f, z1), CartesianVector(x, 0.f, z2), projection, chi2);
514 
515  projectedPositions.push_back(projection);
516  }
517  catch (StatusCodeException &statusCodeException)
518  {
519  if (statusCodeException.GetStatusCode() != STATUS_CODE_NOT_FOUND)
520  throw statusCodeException.GetStatusCode();
521 
522  continue;
523  }
524  }
525 
526  // Reject if projection is not good
527  if (projectedPositions.size() < m_minProjectedPositions)
528  return STATUS_CODE_NOT_FOUND;
529 
530  return STATUS_CODE_SUCCESS;
531 }
unsigned int m_minProjectedPositions
The threshold number of projected points for a good projection.
enum cvn::HType HitType
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
float m_xOverlapWindow
The maximum allowed displacement in x position.
std::void_t< T > n
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).
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
list x
Definition: train.py:276
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
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>
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
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::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.

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 }
enum cvn::HType HitType
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.
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 450 of file NViewDeltaRayMatchingAlgorithm.cc.

452 {
453  ClusterList muonClusterList1, muonClusterList2;
454 
455  HitTypeVector hitTypes({TPC_VIEW_U, TPC_VIEW_V, TPC_VIEW_W});
456 
457  hitTypes.erase(std::find(hitTypes.begin(), hitTypes.end(), thirdViewHitType));
458 
459  LArPfoHelper::GetClusters(pParentMuon, hitTypes[0], muonClusterList1);
460  LArPfoHelper::GetClusters(pParentMuon, hitTypes[1], muonClusterList2);
461 
462  if ((muonClusterList1.size() != 1) || (muonClusterList2.size() != 1))
463  return STATUS_CODE_NOT_FOUND;
464 
465  return (this->GetProjectedPositions(muonClusterList1.front(), muonClusterList2.front(), projectedPositions));
466 }
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 885 of file NViewDeltaRayMatchingAlgorithm.cc.

886 {
887  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "MuonPfoListName", m_muonPfoListName));
888 
889  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
890  XmlHelper::ReadValue(xmlHandle, "SearchRegion1D", m_deltaRayMatchingContainers.m_searchRegion1D));
891 
892  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PseudoChi2Cut", m_pseudoChi2Cut));
893 
894  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "OverlapWindow", m_xOverlapWindow));
895 
896  PANDORA_RETURN_RESULT_IF_AND_IF(
897  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchedFraction", m_minMatchedFraction));
898 
899  PANDORA_RETURN_RESULT_IF_AND_IF(
900  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchedPoints", m_minMatchedPoints));
901 
902  PANDORA_RETURN_RESULT_IF_AND_IF(
903  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinProjectedPositions", m_minProjectedPositions));
904 
905  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
906  XmlHelper::ReadValue(xmlHandle, "MaxCosmicRayHitFraction", m_maxCosmicRayHitFraction));
907 
908  PANDORA_RETURN_RESULT_IF_AND_IF(
909  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxDistanceToCluster", m_maxDistanceToCluster));
910 
911  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
912  XmlHelper::ReadValue(xmlHandle, "MaxDistanceToReferencePoint", m_maxDistanceToReferencePoint));
913 
914  PANDORA_RETURN_RESULT_IF_AND_IF(
915  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "StrayClusterSeparation", m_strayClusterSeparation));
916 
917  return NViewMatchingAlgorithm<T>::ReadSettings(xmlHandle);
918 }
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::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.

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...
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 691 of file NViewDeltaRayMatchingAlgorithm.cc.

693 {
694  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, clusterListName));
695 
696  CaloHitList muonCaloHitList;
697  pMuonCluster->GetOrderedCaloHitList().FillCaloHitList(muonCaloHitList);
698 
699  for (const CaloHit *const pCaloHit : muonCaloHitList)
700  {
701  if (std::find(collectedHits.begin(), collectedHits.end(), pCaloHit) != collectedHits.end())
702  {
703  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::RemoveFromCluster(*this, pMuonCluster, pCaloHit));
704 
705  if (!pDeltaRayCluster)
706  {
707  const ClusterList *pTemporaryList(nullptr);
708  std::string temporaryListName, currentListName;
709  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentListName<Cluster>(*this, currentListName));
710  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
711  PandoraContentApi::CreateTemporaryListAndSetCurrent<ClusterList>(*this, pTemporaryList, temporaryListName));
712 
713  PandoraContentApi::Cluster::Parameters parameters;
714  parameters.m_caloHitList.push_back(pCaloHit);
715 
716  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*this, parameters, pDeltaRayCluster));
717  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Cluster>(*this, temporaryListName, currentListName));
718  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, currentListName));
719  }
720  else
721  {
722  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToCluster(*this, pDeltaRayCluster, pCaloHit));
723  }
724  }
725  }
726 }
std::string string
Definition: nybbler.cc:12
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 871 of file NViewDeltaRayMatchingAlgorithm.cc.

872 {
874 
875  m_strayClusterListU.clear();
876  m_strayClusterListV.clear();
877  m_strayClusterListW.clear();
878 
880 }
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 853 of file NViewDeltaRayMatchingAlgorithm.cc.

854 {
855  m_deltaRayMatchingContainers.AddClustersToContainers(newClusterVector, pfoVector);
856 
857  for (unsigned int i = 0; i < newClusterVector.size(); i++)
858  {
859  const Cluster *const pNewCluster(newClusterVector.at(i));
860  const ParticleFlowObject *const pMuonPfo(pfoVector.at(i));
861 
862  // ATTN: Only add delta ray clusters into the tensor
863  if (!pMuonPfo)
865  }
866 }
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 832 of file NViewDeltaRayMatchingAlgorithm.cc.

833 {
834  const HitType hitType(LArClusterHelper::GetClusterHitType(pDeletedCluster));
835  ClusterList &strayClusterList((hitType == TPC_VIEW_U) ? m_strayClusterListU : (hitType == TPC_VIEW_V) ? m_strayClusterListV : m_strayClusterListW);
836  const ClusterList::const_iterator strayClusterIter(std::find(strayClusterList.begin(), strayClusterList.end(), pDeletedCluster));
837 
838  if (strayClusterIter != strayClusterList.end())
839  strayClusterList.erase(strayClusterIter);
840 
842  const bool isMuonCluster(clusterToPfoMap.find(pDeletedCluster) != clusterToPfoMap.end());
843 
845 
846  if (!isMuonCluster)
848 }
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.
enum cvn::HType HitType
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.
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>
DeltaRayMatchingContainers lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_deltaRayMatchingContainers
protected

The class of hit, cluster and pfo ownership and proximity maps.

Definition at line 300 of file NViewDeltaRayMatchingAlgorithm.h.

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.

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.

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.

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.

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.

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.

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

The list of reconstructed cosmic ray pfos.

Definition at line 296 of file NViewDeltaRayMatchingAlgorithm.h.

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

Pseudo chi2 cut for three view matching.

Definition at line 301 of file NViewDeltaRayMatchingAlgorithm.h.

template<typename T>
pandora::ClusterList lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListU
protected

The list of U clusters that do not pass the tensor threshold requirement.

Definition at line 297 of file NViewDeltaRayMatchingAlgorithm.h.

template<typename T>
pandora::ClusterList lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListV
protected

The list of V clusters that do not pass the tensor threshold requirement.

Definition at line 298 of file NViewDeltaRayMatchingAlgorithm.h.

template<typename T>
pandora::ClusterList lar_content::NViewDeltaRayMatchingAlgorithm< T >::m_strayClusterListW
protected

The list of W clusters that do not pass the tensor threshold requirement.

Definition at line 299 of file NViewDeltaRayMatchingAlgorithm.h.

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.

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

The maximum allowed displacement in x position.

Definition at line 302 of file NViewDeltaRayMatchingAlgorithm.h.


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