All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VertexBasedPfoRecoveryAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArPfoRecovery/VertexBasedPfoRecoveryAlgorithm.h
3  *
4  * @brief Header file for the vertex-based particle recovery algorithm
5  *
6  * $Log: $
7  */
8 #ifndef LAR_VERTEX_BASED_PFO_RECOVERY_ALGORITHM_H
9 #define LAR_VERTEX_BASED_PFO_RECOVERY_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
15 
16 namespace lar_content
17 {
18 
19 /**
20  * @brief VertexBasedPfoRecoveryAlgorithm class
21  */
22 class VertexBasedPfoRecoveryAlgorithm : public pandora::Algorithm
23 {
24 public:
25  /**
26  * @brief Default constructor
27  */
29 
30 private:
31  pandora::StatusCode Run();
32 
33  /**
34  * @brief Particle class
35  */
36  class Particle
37  {
38  public:
39  /**
40  * @brief Constructor
41  *
42  * @param pClusterU the cluster in the U view
43  * @param pClusterV the cluster in the V view
44  * @param pClusterW the cluster in the W view
45  */
46  Particle(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW);
47 
48  const pandora::Cluster *m_pClusterU; ///< Address of cluster in U view
49  const pandora::Cluster *m_pClusterV; ///< Address of cluster in V view
50  const pandora::Cluster *m_pClusterW; ///< Address of cluster in W view
51  };
52 
53  typedef std::vector<Particle> ParticleList;
54 
55  /**
56  * @brief Get a vector of available clusters
57  *
58  * @param inputClusterListName the input vector of the cluster list names
59  * @param clusterVector the output vector of available clusters
60  */
61  pandora::StatusCode GetAvailableClusters(const pandora::StringVector inputClusterListName, pandora::ClusterVector &clusterVector) const;
62 
63  /**
64  * @brief Build the map of sliding fit results
65  *
66  * @param clusterVector the vector of selected clusters
67  * @param halfWindowLayers the half-window to use for the sliding fits
68  * @param slidingFitResultMap the sliding fit result map
69  */
70  void BuildSlidingFitResultMap(const pandora::ClusterVector &clusterVector, TwoDSlidingFitResultMap &slidingFitResultMap) const;
71 
72  /**
73  * @brief Select clusters in proximity to reconstructed vertex
74  *
75  * @param pVertex the input vertex
76  * @param slidingFitResultMap the mapping between clusters and sliding fit results
77  * @param inputClusters the input vector of clusters
78  * @param outputClusters the output vector of clusters
79  */
80  void SelectVertexClusters(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap,
81  const pandora::ClusterVector &inputClusters, pandora::ClusterVector &outputClusters) const;
82 
83  /**
84  * @brief Match clusters from three views
85  *
86  * @param pVertex the input vertex
87  * @param slidingFitResultMap the mapping between clusters and sliding fit results
88  * @param selectedClusters the input vertex clusters
89  * @param vetoList the list of matched clusters
90  * @param particleList the output list of matched clusters
91  */
92  void MatchThreeViews(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap,
93  const pandora::ClusterVector &selectedClusters, pandora::ClusterSet &vetoList, ParticleList &particleList) const;
94 
95  /**
96  * @brief Match clusters from two views
97  *
98  * @param pVertex the input vertex
99  * @param slidingFitResultMap the mapping between clusters and sliding fit results
100  * @param selectedClusters the input vertex clusters
101  * @param vetoList the list of matched clusters
102  * @param particleList the output list of matched clusters
103  */
104  void MatchTwoViews(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap,
105  const pandora::ClusterVector &selectedClusters, pandora::ClusterSet &vetoList, ParticleList &particleList) const;
106 
107  /**
108  * @brief Get best-matched triplet of clusters from a set of input cluster vectors
109  *
110  * @param pVertex the input vertex
111  * @param slidingFitResultMap the mapping between clusters and sliding fit results
112  * @param clusters1 the clusters in the first view
113  * @param clusters2 the clusters in the second view
114  * @param clusters3 the clusters in the third view
115  * @param pBestCluster1 the best-matched cluster from the first view
116  * @param pBestCluster2 the best-matched cluster from the second view
117  * @param pBestCluster3 the best-matched cluster from the third view
118  * @param chi2 the chi-squared metric from the best match
119  */
120  void GetBestChi2(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap,
121  const pandora::ClusterVector &clusters1, const pandora::ClusterVector &clusters2, const pandora::ClusterVector &clusters3,
122  const pandora::Cluster *&pBestCluster1, const pandora::Cluster *&pBestCluster2, const pandora::Cluster *&pBestCluster3, float &chi2) const;
123 
124  /**
125  * @brief Get best-matched pair of clusters from a set of input cluster vectors
126  *
127  * @param pVertex the input vertex
128  * @param slidingFitResultMap the mapping between clusters and sliding fit results
129  * @param clusters1 the clusters in the first view
130  * @param clusters2 the clusters in the second view
131  * @param pBestCluster1 the best-matched cluster from the first view
132  * @param pBestCluster2 the best-matched cluster from the second view
133  * @param chi2 the chi-squared metric from the best match
134  */
135  void GetBestChi2(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &clusters1,
136  const pandora::ClusterVector &clusters2, const pandora::Cluster *&pBestCluster1, const pandora::Cluster *&pBestCluster2, float &chi2) const;
137 
138  /**
139  * @brief Merge two pointing clusters and return chi-squared metric giving consistency of matching
140  *
141  * @param pVertex the input vertex
142  * @param pointingCluster1 the first pointing cluster
143  * @param pointingCluster2 the second pointing cluster
144  */
145  float GetChi2(const pandora::Vertex *const pVertex, const LArPointingCluster &pointingCluster1, const LArPointingCluster &pointingCluster2) const;
146 
147  /**
148  * @brief Merge three clusters between views and return chi-squared metric giving consistency of matching
149  *
150  * @param pVertex the input vertex
151  * @param pointingCluster1 the first pointing cluster
152  * @param pointingCluster2 the second pointing cluster
153  * @param pointingCluster3 the third pointing cluster
154  */
155  float GetChi2(const pandora::Vertex *const pVertex, const LArPointingCluster &pointingCluster1,
156  const LArPointingCluster &pointingCluster2, const LArPointingCluster &pointingCluster3) const;
157 
158  /**
159  * @brief Select cluster which haven't been vetoed
160  *
161  * @param vetoList the list of vetoed clusters
162  * @param inputVector the input vector of clusters
163  * @param outputVector the output vector of clusters
164  */
165  void SelectAvailableClusters(const pandora::ClusterSet &vetoList, const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const;
166 
167  /**
168  * @brief Select clusters of a specified hit type
169  *
170  * @param hitType the specified hit type
171  * @param inputVector the input vector of clusters
172  * @param outputVector the output vector of clusters
173  */
174  void SelectClusters(const pandora::HitType hitType, const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const;
175 
176  /**
177  * @brief Find nearest end of pointing cluster to a specified position vector
178  *
179  * @param vertex the input position
180  * @param cluster the input cluster
181  */
182  const LArPointingCluster::Vertex &GetInnerVertex(const pandora::CartesianVector &vertex, const LArPointingCluster &cluster) const;
183 
184  /**
185  * @brief Find furthest end of pointing cluster from a specified position vector
186  *
187  * @param vertex the input position
188  * @param cluster the input pointing cluster
189  */
190  const LArPointingCluster::Vertex &GetOuterVertex(const pandora::CartesianVector &vertex, const LArPointingCluster &cluster) const;
191 
192  /**
193  * @brief Build particle flow objects from matched clusters
194  *
195  * @param particleList the input list of matched clusters
196  */
197  void BuildParticles(const ParticleList &particleList);
198 
199  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
200 
201  pandora::StringVector m_inputClusterListNames; ///< The list of input cluster list names
202  std::string m_outputPfoListName; ///< The name of the output pfo list
203 
204  unsigned int m_slidingFitHalfWindow; ///<
207  float m_twoViewChi2Cut; ///<
208  float m_threeViewChi2Cut; ///<
209 };
210 
211 } // namespace lar_content
212 
213 #endif // #ifndef LAR_VERTEX_BASED_PFO_RECOVERY_ALGORITHM_H
process_name vertex
Definition: cheaterreco.fcl:51
std::string m_outputPfoListName
The name of the output pfo list.
const LArPointingCluster::Vertex & GetInnerVertex(const pandora::CartesianVector &vertex, const LArPointingCluster &cluster) const
Find nearest end of pointing cluster to a specified position vector.
void GetBestChi2(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &clusters1, const pandora::ClusterVector &clusters2, const pandora::ClusterVector &clusters3, const pandora::Cluster *&pBestCluster1, const pandora::Cluster *&pBestCluster2, const pandora::Cluster *&pBestCluster3, float &chi2) const
Get best-matched triplet of clusters from a set of input cluster vectors.
Header file for the lar pointing cluster class.
process_name cluster
Definition: cheaterreco.fcl:51
Particle(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)
Constructor.
void SelectVertexClusters(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &inputClusters, pandora::ClusterVector &outputClusters) const
Select clusters in proximity to reconstructed vertex.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void MatchTwoViews(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &selectedClusters, pandora::ClusterSet &vetoList, ParticleList &particleList) const
Match clusters from two views.
LArPointingCluster class.
void MatchThreeViews(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &selectedClusters, pandora::ClusterSet &vetoList, ParticleList &particleList) const
Match clusters from three views.
pandora::StringVector m_inputClusterListNames
The list of input cluster list names.
Header file for the lar two dimensional sliding fit result class.
float GetChi2(const pandora::Vertex *const pVertex, const LArPointingCluster &pointingCluster1, const LArPointingCluster &pointingCluster2) const
Merge two pointing clusters and return chi-squared metric giving consistency of matching.
pandora::StatusCode GetAvailableClusters(const pandora::StringVector inputClusterListName, pandora::ClusterVector &clusterVector) const
Get a vector of available clusters.
void BuildSlidingFitResultMap(const pandora::ClusterVector &clusterVector, TwoDSlidingFitResultMap &slidingFitResultMap) const
Build the map of sliding fit results.
std::unordered_map< const pandora::Cluster *, TwoDSlidingFitResult > TwoDSlidingFitResultMap
const LArPointingCluster::Vertex & GetOuterVertex(const pandora::CartesianVector &vertex, const LArPointingCluster &cluster) const
Find furthest end of pointing cluster from a specified position vector.
void SelectAvailableClusters(const pandora::ClusterSet &vetoList, const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const
Select cluster which haven&#39;t been vetoed.
const pandora::Cluster * m_pClusterV
Address of cluster in V view.
void SelectClusters(const pandora::HitType hitType, const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const
Select clusters of a specified hit type.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
const pandora::Cluster * m_pClusterW
Address of cluster in W view.
void BuildParticles(const ParticleList &particleList)
Build particle flow objects from matched clusters.
const pandora::Cluster * m_pClusterU
Address of cluster in U view.