DeltaRayMatchingContainers.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArCosmicRay/DeltaRayMatchingContainers.h
3  *
4  * @brief Header file for the delta ray matching containers class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_DELTA_RAY_MATCHING_CONTAINERS_H
9 #define LAR_DELTA_RAY_MATCHING_CONTAINERS_H 1
10 
11 #include "Pandora/PandoraInternal.h"
12 
14 
15 namespace lar_content
16 {
17 
18 /**
19  * @brief DeltaRayMatchingContainers class
20  */
22 {
23 public:
24  typedef std::map<const pandora::Cluster *, const pandora::ParticleFlowObject *> ClusterToPfoMap;
25  typedef std::map<const pandora::Cluster *, pandora::ClusterList> ClusterProximityMap;
26 
27  /**
28  * @brief Default constructor
29  */
31 
32  /**
33  * @brief Get the mapping of clusters to the pfos to which they belong
34  *
35  * @return the cluster to pfo map
36  */
37  const ClusterToPfoMap &GetClusterToPfoMap(const pandora::HitType hitType) const;
38 
39  /**
40  * @brief Get the mapping of clusters to to their neighbouring clusters
41  *
42  * @return the cluster to nearby cluster map
43  */
44  const ClusterProximityMap &GetClusterProximityMap(const pandora::HitType hitType) const;
45 
46  /**
47  * @brief Fill the HitToClusterMap, the ClusterProximityMap and the ClusterToPfoMap in all input views
48  *
49  * @param inputPfoList the input list of pfos
50  * @param inputClusterList1 the input list of clusters in view 1
51  * @param inputClusterList2 the input list of clusters in view 2
52  * @param inputClusterList3 the input list of clusters in view 3
53  */
54  void FillContainers(const pandora::PfoList &inputPfoList, const pandora::ClusterList &inputClusterList1,
55  const pandora::ClusterList &inputClusterList2 = pandora::ClusterList(),
56  const pandora::ClusterList &inputClusterList3 = pandora::ClusterList());
57 
58  /**
59  * @brief Add the clusters of a cosmic ray/delta ray pfo to the cluster to pfo maps
60  *
61  * @param the address of the input cosmic ray/delta ray pfo
62  */
63  void AddClustersToPfoMaps(const pandora::ParticleFlowObject *const pPfo);
64 
65  /**
66  * @brief Add a list of clusters to the hit to cluster and cluster proximity maps and, if appropriate, to the cluster to pfo map
67  *
68  * @param newClusterVector the ordered cluster vector
69  * @param pfoVector the matching ordered vector of pfos to which the clusters belong (nullptr if not applicable)
70  */
71  void AddClustersToContainers(const pandora::ClusterVector &newClusterVector, const pandora::PfoVector &pfoVector);
72 
73  /**
74  * @brief Remove an input cluster's hits from the hit to cluster and cluster proximity maps and, if appropriate, from the cluster to pfo map
75  *
76  * @param pDeletedCluster the input cluster
77  */
78  void RemoveClusterFromContainers(const pandora::Cluster *const pDeletedCluster);
79 
80  /**
81  * @brief Empty all algorithm containers
82  */
83  void ClearContainers();
84 
85  float m_searchRegion1D; ///< Search region, applied to each dimension, for look-up from kd-tree
86 
87 private:
88  typedef std::map<const pandora::CaloHit *, const pandora::Cluster *> HitToClusterMap;
91  typedef std::vector<HitKDNode2D> HitKDNode2DList;
92 
93  /**
94  * @brief Populate the hit to cluster map from a list of clusters
95  *
96  * @param inputClusterList the input list of clusters
97  */
98  void FillHitToClusterMap(const pandora::ClusterList &inputClusterList);
99 
100  /**
101  * @brief Add the hits of a given cluster to the hit to cluster map
102  *
103  * @param pCluster the address of the input cluster
104  */
105  void AddToClusterMap(const pandora::Cluster *const pCluster);
106 
107  /**
108  * @brief Populate all cluster to pfo maps from a list of particle flow objects
109  *
110  * @param pfoList the input list of pfos
111  */
112  void FillClusterToPfoMaps(const pandora::PfoList &pfoList);
113 
114  /**
115  * @brief Populate the cluster proximity map from a list of clusters
116  *
117  * @param inputClusterList the input list of clusters
118  */
119  void FillClusterProximityMap(const pandora::ClusterList &inputClusterList);
120 
121  /**
122  * @brief Build the KD tree
123  *
124  * @param hitType the hit type of the KD tree to build
125  */
126  void BuildKDTree(const pandora::HitType hitType);
127 
128  /**
129  * @brief Add a cluster to the cluster proximity map
130  *
131  * @param pCluster the address of the input cluster
132  */
133  void AddToClusterProximityMap(const pandora::Cluster *const pCluster);
134 
135  HitToClusterMap m_hitToClusterMapU; ///< The mapping of hits to the clusters to which they belong (in the U view)
136  HitToClusterMap m_hitToClusterMapV; ///< The mapping of hits to the clusters to which they belong (in the V view)
137  HitToClusterMap m_hitToClusterMapW; ///< The mapping of hits to the clusters to which they belong (in the W view)
138  HitKDTree2D m_kdTreeU; ///< The KD tree (in the U view)
139  HitKDTree2D m_kdTreeV; ///< The KD tree (in the V view)
140  HitKDTree2D m_kdTreeW; ///< The KD tree (in the W view)
141  ClusterProximityMap m_clusterProximityMapU; ///< The mapping of clusters to their neighbouring clusters (in the U view)
142  ClusterProximityMap m_clusterProximityMapV; ///< The mapping of clusters to their neighbouring clusters (in the V view)
143  ClusterProximityMap m_clusterProximityMapW; ///< The mapping of clusters to their neighbouring clusters (in the W view)
144  ClusterToPfoMap m_clusterToPfoMapU; ///< The mapping of cosmic ray U clusters to the cosmic ray pfos to which they belong
145  ClusterToPfoMap m_clusterToPfoMapV; ///< The mapping of cosmic ray V clusters to the cosmic ray pfos to which they belong
146  ClusterToPfoMap m_clusterToPfoMapW; ///< The mapping of cosmic ray W clusters to the cosmic ray pfos to which they belong
147 };
148 
149 //------------------------------------------------------------------------------------------------------------------------------------------
150 //------------------------------------------------------------------------------------------------------------------------------------------
151 
153 {
154  return ((hitType == pandora::TPC_VIEW_U) ? m_clusterProximityMapU : (hitType == pandora::TPC_VIEW_V) ? m_clusterProximityMapV : m_clusterProximityMapW);
155 }
156 
157 //------------------------------------------------------------------------------------------------------------------------------------------
158 
160 {
161  return ((hitType == pandora::TPC_VIEW_U) ? m_clusterToPfoMapU : (hitType == pandora::TPC_VIEW_V) ? m_clusterToPfoMapV : m_clusterToPfoMapW);
162 }
163 
164 } // namespace lar_content
165 
166 #endif // #ifndef LAR_DELTA_RAY_MATCHING_CONTAINERS_H
KDTreeLinkerAlgo< const pandora::CaloHit *, 2 > HitKDTree2D
std::map< const pandora::CaloHit *, const pandora::Cluster * > HitToClusterMap
Header file for the kd tree linker algo template class.
HitKDTree2D m_kdTreeW
The KD tree (in the W view)
void FillHitToClusterMap(const pandora::ClusterList &inputClusterList)
Populate the hit to cluster map from a list of clusters.
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.
HitKDTree2D m_kdTreeV
The KD tree (in the V view)
enum cvn::HType HitType
HitToClusterMap m_hitToClusterMapW
The mapping of hits to the clusters to which they belong (in the W view)
void AddClustersToPfoMaps(const pandora::ParticleFlowObject *const pPfo)
Add the clusters of a cosmic ray/delta ray pfo to the cluster to pfo maps.
HitToClusterMap m_hitToClusterMapU
The mapping of hits to the clusters to which they belong (in the U view)
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...
ClusterProximityMap m_clusterProximityMapU
The mapping of clusters to their neighbouring clusters (in the U view)
Data stored in each KDTree node. The dim1/dim2 fields are usually the duplication of some PFRecHit va...
void FillClusterProximityMap(const pandora::ClusterList &inputClusterList)
Populate the cluster proximity map from a list of clusters.
KDTreeNodeInfoT< const pandora::CaloHit *, 2 > HitKDNode2D
ClusterProximityMap m_clusterProximityMapV
The mapping of clusters to their neighbouring clusters (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, to the cluster to pfo map.
ClusterToPfoMap m_clusterToPfoMapU
The mapping of cosmic ray U clusters to the cosmic ray pfos to which they belong. ...
const ClusterToPfoMap & GetClusterToPfoMap(const pandora::HitType hitType) const
Get the mapping of clusters to the pfos to which they belong.
void FillClusterToPfoMaps(const pandora::PfoList &pfoList)
Populate all cluster to pfo maps from a list of particle flow objects.
void AddToClusterMap(const pandora::Cluster *const pCluster)
Add the hits of a given cluster to the hit to cluster map.
void AddToClusterProximityMap(const pandora::Cluster *const pCluster)
Add a cluster to the cluster proximity map.
void BuildKDTree(const pandora::HitType hitType)
Build the KD tree.
ClusterToPfoMap m_clusterToPfoMapW
The mapping of cosmic ray W clusters to the cosmic ray pfos to which they belong. ...
HitKDTree2D m_kdTreeU
The KD tree (in the U view)
std::map< const pandora::Cluster *, pandora::ClusterList > ClusterProximityMap
HitToClusterMap m_hitToClusterMapV
The mapping of hits to the clusters to which they belong (in the V view)
ClusterProximityMap m_clusterProximityMapW
The mapping of clusters to their neighbouring clusters (in the W view)
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void ClearContainers()
Empty all algorithm containers.
void RemoveClusterFromContainers(const pandora::Cluster *const pDeletedCluster)
Remove an input cluster&#39;s hits from the hit to cluster and cluster proximity maps and...
float m_searchRegion1D
Search region, applied to each dimension, for look-up from kd-tree.
ClusterToPfoMap m_clusterToPfoMapV
The mapping of cosmic ray V clusters to the cosmic ray pfos to which they belong. ...