SlidingConeClusterMopUpAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTwoDReco/LArClusterMopUp/SlidingConeClusterMopUpAlgorithm.h
3  *
4  * @brief Header file for the sliding cone cluster mop up algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_SLIDING_CONE_CLUSTER_MOP_UP_ALGORITHM_H
9 #define LAR_SLIDING_CONE_CLUSTER_MOP_UP_ALGORITHM_H 1
10 
12 
13 #include <unordered_map>
14 
15 namespace lar_content
16 {
17 
18 /**
19  * @brief SlidingConeClusterMopUpAlgorithm class
20  */
22 {
23 public:
24  /**
25  * @brief Default constructor
26  */
28 
29 private:
30  /**
31  * @brief ClusterMerge class
32  */
34  {
35  public:
36  /**
37  * @brief Constructor
38  *
39  * @param pParentCluster the address of the candidate parent (shower) cluster
40  * @param boundedFraction1 the bounded fraction for algorithm-specified cone angle
41  * @param meanRT the mean transverse distance of all hits (whether contained or not)
42  */
43  ClusterMerge(const pandora::Cluster *const pParentCluster, const float boundedFraction, const float meanRT);
44 
45  /**
46  * @brief Get the address of the candidate parent (shower) cluster
47  *
48  * @return the address of the candidate parent (shower) cluster
49  */
50  const pandora::Cluster *GetParentCluster() const;
51 
52  /**
53  * @brief Get the bounded fraction for algorithm-specified cone angle
54  *
55  * @return the bounded fraction for algorithm-specified cone angle
56  */
57  float GetBoundedFraction() const;
58 
59  /**
60  * @brief Get the mean transverse distance of all hits (whether contained or not)
61  *
62  * @return the mean transverse distance of all hits (whether contained or not)
63  */
64  float GetMeanRT() const;
65 
66  /**
67  * @brief operator <
68  *
69  * @param rhs object for comparison
70  *
71  * @return boolean
72  */
73  bool operator<(const ClusterMerge &rhs) const;
74 
75  private:
76  const pandora::Cluster *m_pParentCluster; ///< The address of the candidate parent (shower) cluster
77  float m_boundedFraction; ///< The bounded fraction for algorithm-specified cone angle
78  float m_meanRT; ///< The mean transverse distance of all hits (whether contained or not)
79  };
80 
81  typedef std::vector<ClusterMerge> ClusterMergeList;
82 
83  pandora::StatusCode Run();
84 
85  /**
86  * @brief Get the neutrino interaction vertex if it is available and if the algorithm is configured to do so
87  *
88  * @param pVertex to receive the neutrino interaction vertex
89  */
90  void GetInteractionVertex(const pandora::Vertex *&pVertex) const;
91 
92  typedef std::unordered_map<const pandora::Cluster *, const pandora::ParticleFlowObject *> ClusterToPfoMap;
93 
94  /**
95  * @brief Get all 3d clusters contained in the input pfo lists and a mapping from clusters to pfos
96  *
97  * @param clusters3D to receive the sorted list of 3d clusters
98  * @param clusterToPfoMap to receive the mapping from 3d cluster to pfo
99  */
100  void GetThreeDClusters(pandora::ClusterVector &clusters3D, ClusterToPfoMap &clusterToPfoMap) const;
101 
102  /**
103  * @brief Get all available 2d clusters contained in the input cluster lists
104  *
105  * @param availableClusters2D to receive the sorted list of available 2d clusters
106  */
107  void GetAvailableTwoDClusters(pandora::ClusterVector &availableClusters2D) const;
108 
109  typedef std::unordered_map<const pandora::Cluster *, ClusterMergeList> ClusterMergeMap;
110 
111  /**
112  * @brief Get the cluster merge map describing all potential 3d cluster merges
113  *
114  * @param pVertex the neutrino interaction vertex, if available
115  * @param clusters3D the sorted list of 3d clusters
116  * @param availableClusters2D the sorted list of available 2d clusters
117  * @param clusterMergeMap to receive the populated cluster merge map
118  */
119  void GetClusterMergeMap(const pandora::Vertex *const pVertex, const pandora::ClusterVector &clusters3D,
120  const pandora::ClusterVector &availableClusters2D, ClusterMergeMap &clusterMergeMap) const;
121 
122  /**
123  * @brief Make cluster merges based on the provided cluster merge map
124  *
125  * @param clusterToPfoMap the mapping from 3d cluster to pfo
126  * @param clusterMergeMap the populated cluster merge map
127  */
128  void MakeClusterMerges(const ClusterToPfoMap &clusterToPfoMap, const ClusterMergeMap &clusterMergeMap) const;
129 
130  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
131 
132  pandora::StringVector m_inputPfoListNames; ///< The input pfo list names
133  bool m_useVertex; ///< Whether to use the interaction vertex to select useful cone directions
134  unsigned int m_maxIterations; ///< The maximum allowed number of algorithm iterations
135  unsigned int m_maxHitsToConsider3DTrack; ///< The maximum number of hits in a 3d track cluster to warrant inclusion in algorithm
136  unsigned int m_minHitsToConsider3DShower; ///< The minimum number of hits in a 3d shower cluster to attempt cone fits
137  unsigned int m_maxHitsToConsider2DCluster; ///< The maximum number of hits in a 2d cluster to allow pick-up via sliding cone fits
138  unsigned int m_halfWindowLayers; ///< The number of layers to use for half-window of sliding fit
139  unsigned int m_nConeFitLayers; ///< The number of layers over which to sum fitted direction to obtain cone fit
140  unsigned int m_nConeFits; ///< The number of cone fits to perform, spread roughly uniformly along the shower length
141  float m_coneLengthMultiplier; ///< The cone length multiplier to use when calculating bounded cluster fractions
142  float m_maxConeLength; ///< The maximum allowed cone length to use when calculating bounded cluster fractions
143  float m_coneTanHalfAngle; ///< The cone tan half angle to use when calculating bounded cluster fractions
144  float m_coneBoundedFraction; ///< The minimum cluster bounded fraction for association
145 };
146 
147 //------------------------------------------------------------------------------------------------------------------------------------------
148 
150  const pandora::Cluster *const pParentCluster, const float boundedFraction, const float meanRT) :
151  m_pParentCluster(pParentCluster),
152  m_boundedFraction(boundedFraction),
153  m_meanRT(meanRT)
154 {
155 }
156 
157 //------------------------------------------------------------------------------------------------------------------------------------------
158 
160 {
161  return m_pParentCluster;
162 }
163 
164 //------------------------------------------------------------------------------------------------------------------------------------------
165 
167 {
168  return m_boundedFraction;
169 }
170 
171 //------------------------------------------------------------------------------------------------------------------------------------------
172 
174 {
175  return m_meanRT;
176 }
177 
178 } // namespace lar_content
179 
180 #endif // #ifndef LAR_SLIDING_CONE_CLUSTER_MOP_UP_ALGORITHM_H
bool m_useVertex
Whether to use the interaction vertex to select useful cone directions.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_boundedFraction
The bounded fraction for algorithm-specified cone angle.
void GetThreeDClusters(pandora::ClusterVector &clusters3D, ClusterToPfoMap &clusterToPfoMap) const
Get all 3d clusters contained in the input pfo lists and a mapping from clusters to pfos...
unsigned int m_nConeFits
The number of cone fits to perform, spread roughly uniformly along the shower length.
const pandora::Cluster * GetParentCluster() const
Get the address of the candidate parent (shower) cluster.
unsigned int m_maxIterations
The maximum allowed number of algorithm iterations.
float GetMeanRT() const
Get the mean transverse distance of all hits (whether contained or not)
float GetBoundedFraction() const
Get the bounded fraction for algorithm-specified cone angle.
unsigned int m_nConeFitLayers
The number of layers over which to sum fitted direction to obtain cone fit.
std::unordered_map< const pandora::Cluster *, ClusterMergeList > ClusterMergeMap
unsigned int m_maxHitsToConsider2DCluster
The maximum number of hits in a 2d cluster to allow pick-up via sliding cone fits.
float m_meanRT
The mean transverse distance of all hits (whether contained or not)
void GetClusterMergeMap(const pandora::Vertex *const pVertex, const pandora::ClusterVector &clusters3D, const pandora::ClusterVector &availableClusters2D, ClusterMergeMap &clusterMergeMap) const
Get the cluster merge map describing all potential 3d cluster merges.
float m_coneLengthMultiplier
The cone length multiplier to use when calculating bounded cluster fractions.
unsigned int m_halfWindowLayers
The number of layers to use for half-window of sliding fit.
unsigned int m_minHitsToConsider3DShower
The minimum number of hits in a 3d shower cluster to attempt cone fits.
PfoMopUpBaseAlgorithm class.
unsigned int m_maxHitsToConsider3DTrack
The maximum number of hits in a 3d track cluster to warrant inclusion in algorithm.
void MakeClusterMerges(const ClusterToPfoMap &clusterToPfoMap, const ClusterMergeMap &clusterMergeMap) const
Make cluster merges based on the provided cluster merge map.
ClusterMerge(const pandora::Cluster *const pParentCluster, const float boundedFraction, const float meanRT)
Constructor.
const pandora::Cluster * m_pParentCluster
The address of the candidate parent (shower) cluster.
float m_coneBoundedFraction
The minimum cluster bounded fraction for association.
pandora::StringVector m_inputPfoListNames
The input pfo list names.
std::vector< string > StringVector
Definition: fcldump.cxx:29
Header file for the pfo mop up algorithm base class.
std::unordered_map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
float m_coneTanHalfAngle
The cone tan half angle to use when calculating bounded cluster fractions.
void GetAvailableTwoDClusters(pandora::ClusterVector &availableClusters2D) const
Get all available 2d clusters contained in the input cluster lists.
void GetInteractionVertex(const pandora::Vertex *&pVertex) const
Get the neutrino interaction vertex if it is available and if the algorithm is configured to do so...
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::vector< art::Ptr< recob::Cluster > > ClusterVector
float m_maxConeLength
The maximum allowed cone length to use when calculating bounded cluster fractions.