ShowerGrowingAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTrackShowerId/ShowerGrowingAlgorithm.h
3  *
4  * @brief Header file for the shower growing algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_SHOWER_GROWING_ALGORITHM_H
9 #define LAR_SHOWER_GROWING_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
14 
16 
18 
19 #include <unordered_map>
20 
21 namespace lar_content
22 {
23 
24 /**
25  * @brief ShowerGrowingAlgorithm class
26  */
28 {
29 public:
30  /**
31  * @brief Default constructor
32  */
34 
35 protected:
36  /**
37  * @brief Whether a pointing cluster is assciated with a provided 2D vertex projection
38  *
39  * @param pointingCluster the pointing cluster
40  * @param vertexPosition2D the projected vertex position
41  *
42  * @return boolean
43  */
44  bool IsVertexAssociated(const LArPointingCluster &pointingCluster, const pandora::CartesianVector &vertexPosition2D) const;
45 
46  /**
47  * @brief Sorting for clusters to determine order in which seeds are considered
48  *
49  * @param pLhs address of first cluster
50  * @param pRhs address of second cluster
51  */
52  static bool SortClusters(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs);
53 
54  typedef std::unordered_map<const pandora::Cluster *, LArVertexHelper::ClusterDirection> ClusterDirectionMap;
55  mutable ClusterDirectionMap m_clusterDirectionMap; ///< The cluster direction map
56 
57 private:
58  pandora::StatusCode Run();
59 
60  /**
61  * @brief Simple single-pass shower growing mode
62  *
63  * @param pClusterList the list of clusters
64  * @param clusterListName the cluster list name
65  */
66  void SimpleModeShowerGrowing(const pandora::ClusterList *const pClusterList, const std::string &clusterListName) const;
67 
68  /**
69  * @brief Get the next seed candidate, using a list of available candidates and a list of those already used
70  *
71  * @param pClusterList the list of available seed candidates
72  * @param usedClusters the list of candidates already considered
73  * @param pSeedCluster to receive the address of the next seed candidate
74  *
75  * @return whether a seed candidate has been found
76  */
77  bool GetNextSeedCandidate(const pandora::ClusterList *const pClusterList, const pandora::ClusterSet &usedClusters,
78  const pandora::Cluster *&pSeedCluster) const;
79 
80  /**
81  * @brief Get all seed candidates associated with a provided vertex
82  *
83  * @param pClusterList the list of available seed candidates
84  * @param pVertex the address of the vertex
85  * @param seedClusters to receive the list of vertex seed candidates
86  */
88  const pandora::ClusterList *const pClusterList, const pandora::Vertex *const pVertex, pandora::ClusterVector &seedClusters) const;
89 
90  /**
91  * @brief Get the seed association list for a given vector of particle seed candidates
92  *
93  * @param particleSeedVector the particle seed vector
94  * @param pClusterList the address of the input cluster list
95  * @param seedAssociationList to receive the populated seed association list
96  */
97  void GetSeedAssociationList(const pandora::ClusterVector &particleSeedVector, const pandora::ClusterList *const pClusterList,
98  SeedAssociationList &seedAssociationList) const;
99 
100  /**
101  * @brief Process the details stored in a specified seed association list
102  *
103  * @param seedAssociationList the seed association list
104  * @param clusterListName the cluster list name
105  * @param pfoList the pfo list
106  * @param usedClusters the list of candidates already considered
107  */
109  const SeedAssociationList &seedAssociationList, const std::string &clusterListName, pandora::ClusterSet &usedClusters) const;
110 
111  /**
112  * @brief Process the list of branch clusters, merging with specified parent cluster, dealing with any existing pfos as required
113  *
114  * @param pParentCluster the address of the parent cluster
115  * @param branchClusters the list of branch clusters for the specified seed cluster
116  * @param listName the cluster list name
117  * @param pfoList the input pfo list
118  */
120  const pandora::Cluster *const pParentCluster, const pandora::ClusterVector &branchClusters, const std::string &listName) const;
121 
122  AssociationType AreClustersAssociated(const pandora::Cluster *const pClusterSeed, const pandora::Cluster *const pCluster) const;
123 
124  /**
125  * @brief Get a figure of merit representing the consistency of the provided seed associated list
126  *
127  * @param seedAssociationList the seed association list
128  *
129  * @return the figure of merit
130  */
131  float GetFigureOfMerit(const SeedAssociationList &seedAssociationList) const;
132 
133  /**
134  * @brief Get the number of clusters associated with the vertex
135  *
136  * @param vertexPosition2D the projected vertex position
137  * @param pointingClusterList the list of relevant pointing clusters
138  *
139  * @return the number of clusters associated with the vertex
140  */
141  unsigned int GetNVertexConnections(const pandora::CartesianVector &vertexPosition2D, const LArPointingClusterList &pointingClusterList) const;
142 
143  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
144 
145  pandora::StringVector m_inputClusterListNames; ///< The names of the input cluster lists
146 
147  unsigned int m_minCaloHitsPerCluster; ///< The minimum number of calo hits per (seed or branch) cluster
148  float m_nearbyClusterDistance; ///< The nearby cluster distance, used for determining cluster associations
149  float m_remoteClusterDistance; ///< The remote cluster distance, used for determining cluster associations
150 
151  float m_directionTanAngle; ///< Direction determination, look for vertex inside triangle with apex shifted along the cluster length
152  float m_directionApexShift; ///< Direction determination, look for vertex inside triangle with apex shifted along the cluster length
153 
154  float m_minVertexLongitudinalDistance; ///< Vertex association check: min longitudinal distance cut
155  float m_maxVertexLongitudinalDistance; ///< Vertex association check: max longitudinal distance cut
156  float m_maxVertexTransverseDistance; ///< Vertex association check: max transverse distance cut
157  float m_vertexAngularAllowance; ///< Vertex association check: pointing angular allowance in degrees
158 };
159 
160 } // namespace lar_content
161 
162 #endif // #ifndef LAR_SHOWER_GROWING_ALGORITHM_H
pandora::StringVector m_inputClusterListNames
The names of the input cluster lists.
std::unordered_map< const pandora::Cluster *, LArVertexHelper::ClusterDirection > ClusterDirectionMap
BranchGrowingAlgorithm class.
Header file for the lar pointing cluster class.
std::string string
Definition: nybbler.cc:12
std::vector< LArPointingCluster > LArPointingClusterList
float m_directionApexShift
Direction determination, look for vertex inside triangle with apex shifted along the cluster length...
float m_maxVertexLongitudinalDistance
Vertex association check: max longitudinal distance cut.
LArPointingCluster class.
void GetSeedAssociationList(const pandora::ClusterVector &particleSeedVector, const pandora::ClusterList *const pClusterList, SeedAssociationList &seedAssociationList) const
Get the seed association list for a given vector of particle seed candidates.
void GetAllVertexSeedCandidates(const pandora::ClusterList *const pClusterList, const pandora::Vertex *const pVertex, pandora::ClusterVector &seedClusters) const
Get all seed candidates associated with a provided vertex.
bool GetNextSeedCandidate(const pandora::ClusterList *const pClusterList, const pandora::ClusterSet &usedClusters, const pandora::Cluster *&pSeedCluster) const
Get the next seed candidate, using a list of available candidates and a list of those already used...
std::unordered_map< const pandora::Cluster *, pandora::ClusterVector > SeedAssociationList
float m_directionTanAngle
Direction determination, look for vertex inside triangle with apex shifted along the cluster length...
unsigned int GetNVertexConnections(const pandora::CartesianVector &vertexPosition2D, const LArPointingClusterList &pointingClusterList) const
Get the number of clusters associated with the vertex.
void ProcessSeedAssociationDetails(const SeedAssociationList &seedAssociationList, const std::string &clusterListName, pandora::ClusterSet &usedClusters) const
Process the details stored in a specified seed association list.
float m_minVertexLongitudinalDistance
Vertex association check: min longitudinal distance cut.
static bool SortClusters(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sorting for clusters to determine order in which seeds are considered.
void SimpleModeShowerGrowing(const pandora::ClusterList *const pClusterList, const std::string &clusterListName) const
Simple single-pass shower growing mode.
void ProcessBranchClusters(const pandora::Cluster *const pParentCluster, const pandora::ClusterVector &branchClusters, const std::string &listName) const
Process the list of branch clusters, merging with specified parent cluster, dealing with any existing...
Header file for the vertex helper class.
float m_nearbyClusterDistance
The nearby cluster distance, used for determining cluster associations.
float m_maxVertexTransverseDistance
Vertex association check: max transverse distance cut.
ShowerGrowingAlgorithm class.
std::vector< string > StringVector
Definition: fcldump.cxx:29
unsigned int m_minCaloHitsPerCluster
The minimum number of calo hits per (seed or branch) cluster.
bool IsVertexAssociated(const LArPointingCluster &pointingCluster, const pandora::CartesianVector &vertexPosition2D) const
Whether a pointing cluster is assciated with a provided 2D vertex projection.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
AssociationType AreClustersAssociated(const pandora::Cluster *const pClusterSeed, const pandora::Cluster *const pCluster) const
Determine whether two clusters are associated.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
float GetFigureOfMerit(const SeedAssociationList &seedAssociationList) const
Get a figure of merit representing the consistency of the provided seed associated list...
ClusterDirectionMap m_clusterDirectionMap
The cluster direction map.
float m_vertexAngularAllowance
Vertex association check: pointing angular allowance in degrees.
Header file for the branch growing algorithm base class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_remoteClusterDistance
The remote cluster distance, used for determining cluster associations.