LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
SlidingConePfoMopUpAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_SLIDING_CONE_PFO_MOP_UP_ALGORITHM_H
9 #define LAR_SLIDING_CONE_PFO_MOP_UP_ALGORITHM_H 1
10 
12 
13 #include <unordered_map>
14 
15 namespace lar_content
16 {
17 
22 {
23 public:
28 
29 private:
34  {
35  public:
43  ClusterMerge(const pandora::Cluster *const pParentCluster, const float boundedFraction1, const float boundedFraction2);
44 
50  const pandora::Cluster *GetParentCluster() const;
51 
57  float GetBoundedFraction1() const;
58 
64  float GetBoundedFraction2() const;
65 
73  bool operator<(const ClusterMerge &rhs) const;
74 
75  private:
76  const pandora::Cluster *m_pParentCluster;
79  };
80 
81  typedef std::vector<ClusterMerge> ClusterMergeList;
82 
83  pandora::StatusCode Run();
84 
90  void GetInteractionVertex(const pandora::Vertex *&pVertex) const;
91 
92  typedef std::unordered_map<const pandora::Cluster *, const pandora::ParticleFlowObject *> ClusterToPfoMap;
93 
100  void GetThreeDClusters(pandora::ClusterVector &clusters3D, ClusterToPfoMap &clusterToPfoMap) const;
101 
102  typedef std::unordered_map<const pandora::Cluster *, ClusterMergeList> ClusterMergeMap;
103 
112  void GetClusterMergeMap(const pandora::Vertex *const pVertex, const pandora::ClusterVector &clusters3D,
113  const ClusterToPfoMap &clusterToPfoMap, ClusterMergeMap &clusterMergeMap) const;
114 
115  typedef std::unordered_map<const pandora::Cluster *, bool> VertexAssociationMap;
116 
127  bool IsVertexAssociated(const pandora::Cluster *const pCluster, const pandora::Vertex *const pVertex,
128  VertexAssociationMap &vertexAssociationMap, const ThreeDSlidingFitResult *const pSlidingFitResult = nullptr) const;
129 
139  bool IsVertexAssociated(const pandora::Cluster *const pCluster, const pandora::CartesianVector &vertexPosition,
140  const ThreeDSlidingFitResult *const pSlidingFitResult = nullptr) const;
141 
150  bool MakePfoMerges(const ClusterToPfoMap &clusterToPfoMap, const ClusterMergeMap &clusterMergeMap) const;
151 
152  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
153 
154  typedef std::unordered_map<const pandora::Cluster *, const pandora::Cluster *> ClusterReplacementMap;
155 
156  pandora::StringVector m_inputPfoListNames;
157  bool m_useVertex;
158  unsigned int m_maxIterations;
161  unsigned int m_halfWindowLayers;
162  unsigned int m_nConeFitLayers;
163  unsigned int m_nConeFits;
172 };
173 
174 //------------------------------------------------------------------------------------------------------------------------------------------
175 
177  const pandora::Cluster *const pParentCluster, const float boundedFraction1, const float boundedFraction2) :
178  m_pParentCluster(pParentCluster),
179  m_boundedFraction1(boundedFraction1),
180  m_boundedFraction2(boundedFraction2)
181 {
182 }
183 
184 //------------------------------------------------------------------------------------------------------------------------------------------
185 
187 {
188  return m_pParentCluster;
189 }
190 
191 //------------------------------------------------------------------------------------------------------------------------------------------
192 
194 {
195  return m_boundedFraction1;
196 }
197 
198 //------------------------------------------------------------------------------------------------------------------------------------------
199 
201 {
202  return m_boundedFraction2;
203 }
204 
205 } // namespace lar_content
206 
207 #endif // #ifndef LAR_SLIDING_CONE_PFO_MOP_UP_ALGORITHM_H
std::unordered_map< const pandora::Cluster *, const pandora::Cluster * > ClusterReplacementMap
float GetBoundedFraction2() const
Get the bounded fraction for algorithm-specified cone angle 2.
void GetClusterMergeMap(const pandora::Vertex *const pVertex, const pandora::ClusterVector &clusters3D, const ClusterToPfoMap &clusterToPfoMap, ClusterMergeMap &clusterMergeMap) const
Get the cluster merge map describing all potential 3d cluster merges.
float m_coneBoundedFraction2
The minimum cluster bounded fraction for association 2.
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...
float m_boundedFraction1
The bounded fraction for algorithm-specified cone angle 1.
float m_maxConeLength
The maximum allowed cone length to use when calculating bounded cluster fractions.
float m_maxVertexTransverseDistance
Vertex association check: max transverse distance cut.
std::unordered_map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
ClusterMerge(const pandora::Cluster *const pParentCluster, const float boundedFraction1, const float boundedFraction2)
Constructor.
float m_boundedFraction2
The bounded fraction for algorithm-specified cone angle 2.
float m_coneLengthMultiplier
The cone length multiplier to use when calculating bounded cluster fractions.
bool MakePfoMerges(const ClusterToPfoMap &clusterToPfoMap, const ClusterMergeMap &clusterMergeMap) const
Make pfo merges based on the provided cluster merge map.
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...
bool m_useVertex
Whether to use the interaction vertex to select useful cone directions.
float GetBoundedFraction1() const
Get the bounded fraction for algorithm-specified cone angle 1.
bool IsVertexAssociated(const pandora::Cluster *const pCluster, const pandora::Vertex *const pVertex, VertexAssociationMap &vertexAssociationMap, const ThreeDSlidingFitResult *const pSlidingFitResult=nullptr) const
Whether a 3D cluster is nodally associated with a provided vertex.
float m_minVertexLongitudinalDistance
Vertex association check: min longitudinal distance cut.
unsigned int m_nConeFitLayers
The number of layers over which to sum fitted direction to obtain cone fit.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
const pandora::Cluster * m_pParentCluster
The address of the candidate parent (shower) cluster.
unsigned int m_maxHitsToConsider3DTrack
The maximum number of hits in a 3d track cluster to warrant inclusion in algorithm.
PfoMopUpBaseAlgorithm class.
float m_coneTanHalfAngle1
The cone tan half angle to use when calculating bounded cluster fractions 1.
pandora::StringVector m_inputPfoListNames
The input pfo list names.
float m_coneBoundedFraction1
The minimum cluster bounded fraction for association 1.
std::unordered_map< const pandora::Cluster *, bool > VertexAssociationMap
Header file for the pfo mop up algorithm base class.
unsigned int m_maxIterations
The maximum allowed number of algorithm iterations.
unsigned int m_minHitsToConsider3DShower
The minimum number of hits in a 3d shower cluster to attempt cone fits.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::vector< art::Ptr< recob::Cluster > > ClusterVector
bool operator<(const ClusterMerge &rhs) const
operator <
unsigned int m_nConeFits
The number of cone fits to perform, spread roughly uniformly along the shower length.
std::unordered_map< const pandora::Cluster *, ClusterMergeList > ClusterMergeMap
const pandora::Cluster * GetParentCluster() const
Get the address of the candidate parent (shower) cluster.
float m_coneTanHalfAngle2
The cone tan half angle to use when calculating bounded cluster fractions 2.
unsigned int m_halfWindowLayers
The number of layers to use for half-window of sliding fit.