47 for (
const Cluster *
const pCluster : inputClusterList)
61 for (
const CaloHit *
const pCaloHit : caloHitList)
62 hitToClusterMap[pCaloHit] = pCluster;
69 if (inputClusterList.empty())
76 for (
const Cluster *
const pCluster : inputClusterList)
89 for (
auto &entry : hitToClusterMap)
90 allCaloHits.push_back(entry.first);
95 kdTree.build(hitKDNode2DList, hitsBoundingRegion2D);
111 for (
const CaloHit *
const pCaloHit : caloHitList)
116 kdTree.search(searchRegionHits, found);
118 for (
const auto &hit : found)
120 const Cluster *
const pNearbyCluster(hitToClusterMap.at(hit.data));
122 if (pNearbyCluster == pCluster)
125 ClusterList &nearbyClusterList(clusterProximityMap[pCluster]);
127 if (std::find(nearbyClusterList.begin(), nearbyClusterList.end(), pNearbyCluster) == nearbyClusterList.end())
128 nearbyClusterList.push_back(pNearbyCluster);
130 ClusterList &invertedNearbyClusterList(clusterProximityMap[pNearbyCluster]);
132 if (std::find(invertedNearbyClusterList.begin(), invertedNearbyClusterList.end(), pCluster) == invertedNearbyClusterList.end())
133 invertedNearbyClusterList.push_back(pCluster);
157 for (
const Cluster *
const pCluster : pfoClusters)
159 if (clusterToPfoMap.find(pCluster) != clusterToPfoMap.end())
162 clusterToPfoMap[pCluster] = pPfo;
171 for (
const Cluster *
const pNewCluster : newClusterVector)
174 for (
unsigned int i = 0; i < newClusterVector.size(); i++)
176 const Cluster *
const pNewCluster(newClusterVector.at(i));
199 for (
const CaloHit *
const pCaloHit : caloHitList)
201 const HitToClusterMap::const_iterator iter(hitToClusterMap.find(pCaloHit));
203 if (iter == hitToClusterMap.end())
206 hitToClusterMap.erase(iter);
209 const ClusterProximityMap::const_iterator clusterProximityIter(clusterProximityMap.find(pDeletedCluster));
211 if (clusterProximityIter != clusterProximityMap.end())
213 const ClusterList &nearbyClusterList(clusterProximityIter->second);
215 for (
const Cluster *
const pNearbyCluster : nearbyClusterList)
217 const ClusterProximityMap::iterator iter(clusterProximityMap.find(pNearbyCluster));
219 if (iter == clusterProximityMap.end())
224 ClusterList::iterator invertedIter(std::find(invertedCloseClusters.begin(), invertedCloseClusters.end(), pDeletedCluster));
225 invertedCloseClusters.erase(invertedIter);
228 clusterProximityMap.erase(clusterProximityIter);
231 const DeltaRayMatchingContainers::ClusterToPfoMap::const_iterator clusterToPfoIter(clusterToPfoMap.find(pDeletedCluster));
233 if (clusterToPfoIter != clusterToPfoMap.end())
234 clusterToPfoMap.erase(clusterToPfoIter);
Header file for the cluster class.
Header file for the delta ray matching containers class.
Header file for the cluster helper class.
Header file for the pfo helper class.
Header file for pandora enumerated types.
float m_searchRegion1D
Search region, applied to each dimension, for look-up from kd-tree.
DeltaRayMatchingContainers()
Default constructor.
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.
void BuildKDTree(const pandora::HitType hitType)
Build the KD tree.
void ClearContainers()
Empty all algorithm containers.
HitToClusterMap m_hitToClusterMapU
The mapping of hits to the clusters to which they belong (in the U view)
void FillHitToClusterMap(const pandora::ClusterList &inputClusterList)
Populate the hit to cluster map from a list of clusters.
HitToClusterMap m_hitToClusterMapW
The mapping of hits to the clusters to which they belong (in the W view)
ClusterToPfoMap m_clusterToPfoMapU
The mapping of cosmic ray U clusters to the cosmic ray pfos to which they belong.
void FillClusterProximityMap(const pandora::ClusterList &inputClusterList)
Populate the cluster proximity map from a list of clusters.
HitKDTree2D m_kdTreeU
The KD tree (in the U view)
void AddToClusterMap(const pandora::Cluster *const pCluster)
Add the hits of a given cluster to the hit to cluster map.
std::map< const pandora::Cluster *, pandora::ClusterList > ClusterProximityMap
void AddClustersToPfoMaps(const pandora::ParticleFlowObject *const pPfo)
Add the clusters of a cosmic ray/delta ray pfo to the cluster to pfo maps.
ClusterToPfoMap m_clusterToPfoMapW
The mapping of cosmic ray W clusters to the cosmic ray pfos to which they belong.
ClusterToPfoMap m_clusterToPfoMapV
The mapping of cosmic ray V clusters to the cosmic ray pfos to which they belong.
std::map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
void AddToClusterProximityMap(const pandora::Cluster *const pCluster)
Add a cluster to the cluster proximity map.
ClusterProximityMap m_clusterProximityMapU
The mapping of clusters to their neighbouring clusters (in the U view)
HitKDTree2D m_kdTreeV
The KD tree (in the V view)
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,...
void RemoveClusterFromContainers(const pandora::Cluster *const pDeletedCluster)
Remove an input cluster's hits from the hit to cluster and cluster proximity maps and,...
ClusterProximityMap m_clusterProximityMapV
The mapping of clusters to their neighbouring clusters (in the V view)
std::map< const pandora::CaloHit *, const pandora::Cluster * > HitToClusterMap
ClusterProximityMap m_clusterProximityMapW
The mapping of clusters to their neighbouring clusters (in the W view)
HitToClusterMap m_hitToClusterMapV
The mapping of hits to the clusters to which they belong (in the V view)
HitKDTree2D m_kdTreeW
The KD tree (in the W view)
void FillClusterToPfoMaps(const pandora::PfoList &pfoList)
Populate all cluster to pfo maps from a list of particle flow objects.
std::vector< HitKDNode2D > HitKDNode2DList
Box structure used to define 2D field. It's used in KDTree building step to divide the detector space...
void clear()
Clear all allocated structures.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
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.
const OrderedCaloHitList & GetOrderedCaloHitList() const
Get the ordered calo hit list.
void FillCaloHitList(CaloHitList &caloHitList) const
Fill a provided calo hit list with all the calo hits in the ordered calo hit list.
ParticleFlowObject class.
StatusCodeException class.
KDTreeBox fill_and_bound_2d_kd_tree(const MANAGED_CONTAINER< const T * > &points, std::vector< KDTreeNodeInfoT< const T *, 2 > > &nodes)
fill_and_bound_2d_kd_tree
KDTreeBox build_2d_kd_search_region(const pandora::CaloHit *const point, const float x_span, const float z_span)
build_2d_kd_search_region
HitType
Calorimeter hit type enum.
std::vector< const Cluster * > ClusterVector
MANAGED_CONTAINER< const Cluster * > ClusterList
std::vector< const ParticleFlowObject * > PfoVector
MANAGED_CONTAINER< const CaloHit * > CaloHitList
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList