All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackMergeRefinementAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTwoDReco/LArCosmicRay/TrackMergeRefinementAlgorithm.h
3  *
4  * @brief Header file for the track merge refinement class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_TRACK_MERGE_REFINEMENT_ALGORITHM_H
9 #define LAR_TRACK_MERGE_REFINEMENT_ALGORITHM_H 1
10 
12 
13 namespace lar_content
14 {
15 /**
16  * @brief TrackMergeRefinementAlgorithm class
17  */
19 {
20 public:
21  /**
22  * @brief Default constructor
23  */
25 
26 private:
27  pandora::StatusCode Run();
28  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
29 
30  /**
31  * @brief Find the best cluster association
32  *
33  * @param clusterVector the vector of clusters to consider
34  * @param slidingFitResultMapPair the {micro, macro} pair of [cluster -> TwoDSlidingFitResult] maps
35  * @param clusterAssociation the cluster pair association
36  *
37  * @return whether a cluster pair association was found
38  */
39  bool FindBestClusterAssociation(const pandora::ClusterVector &clusterVector, const SlidingFitResultMapPair &slidingFitResultMapPair,
40  ClusterPairAssociation &clusterAssociation) const;
41 
42  /**
43  * @brief Whether two clusters are assoicated to one another
44  *
45  * @param upstreamPoint the merge point of the upstream cluster
46  * @param upstreamDirection the local direction of the upstream cluster at the merge point
47  * @param downstreamPoint the merge point of the downstream cluster
48  * @param downstreamDirection the local direction of the downstrean cluster at the merge point
49  *
50  * @return whether the clusters are associated
51  */
52  bool AreClustersAssociated(const pandora::CartesianVector &upstreamPoint, const pandora::CartesianVector &upstreamDirection,
53  const pandora::CartesianVector &downstreamPoint, const pandora::CartesianVector &downstreamDirection) const;
54 
55  /**
56  * @brief Obtain a list of clusters whos hits are protected and cannot be reassigned
57  *
58  * @param clusterAssociation the clusterPairAssociation
59  * @param createdMainTrackClusters the list of main track clusters that have hitherto collected
60  * @param unavailableProtectedClusters the output list of protected clusters
61  */
62  void GetUnavailableProtectedClusters(const ClusterPairAssociation &clusterAssociation,
63  const pandora::ClusterList &createdMainTrackClusters, pandora::ClusterList &unavailableProtectedClusters) const;
64 
65  /**
66  * @brief Check the separation of the extremal extrapolated hits with the cluster merge points or, in the case of no hits, the cluster merge point separation
67  *
68  * @param extrapolatedHitVector the extrapolated hit vector (ordered closest hit to the upstream merge point -> furthest hit)
69  * @param clusterAssociation the cluster association
70  *
71  * @return whether the checks pass
72  */
73  bool AreExtrapolatedHitsNearBoundaries(const pandora::CaloHitVector &extrapolatedHitVector, ClusterAssociation &clusterAssociation) const;
74 
75  /**
76  * @brief Remove the cluster association from the cluster vector so that the same cluster pair is not considered again
77  *
78  * @param clusterAssociation the cluster pair association
79  * @param clusterVector the vector of clusters considered in future iterations of the algorithm
80  * @param slidingFitResultMapPair the {micro, macro} pair of [cluster -> TwoDSlidingFitResult] maps
81  */
82  void ConsiderClusterAssociation(const ClusterPairAssociation &clusterAssociation, pandora::ClusterVector &clusterVector,
83  SlidingFitResultMapPair &slidingFitResultMapPair) const;
84 
85  /**
86  * @brief Refine the cluster endpoints and merge together the associated clusters alongside any extrapolated hits
87  *
88  * @param clusterAssociation the cluster pair association
89  * @param clusterToCaloHitListMap the map [parent cluster -> list of hits which belong to the main track]
90  * @param pClusterList the list of all clusters
91  * @param clusterVector the vector of clusters considered in future iterations of the algorithm
92  * @param slidingFitResultMapPair the {micro, macro} pair of [cluster -> TwoDSlidingFitResult] maps
93  *
94  * @return the address of the created main track cluster
95  */
96  const pandora::Cluster *CreateMainTrack(const ClusterPairAssociation &clusterAssociation, const ClusterToCaloHitListMap &clusterToCaloHitListMap,
97  const pandora::ClusterList *pClusterList, pandora::ClusterVector &clusterVector, SlidingFitResultMapPair &slidingFitResultMapPair) const;
98 
99  unsigned int m_maxLoopIterations; ///< The maximum number of main loop iterations
100  float m_minClusterLengthSum; ///< The threshold cluster and associated cluster length sum
101  float m_minSeparationDistance; ///< The threshold separation distance between associated clusters
102  float m_minDirectionDeviationCosAngle; ///< The threshold cos opening angle of the associated cluster directions
103  float m_maxPredictedMergePointOffset; ///< The threshold separation distance between the predicted and true cluster merge points
104  float m_distanceToLine; ///< The threshold hit distance of an extrapolated hit from the segment connecting line
105  float m_boundaryTolerance; ///< The maximum allowed distance of an extremal extrapolate hit to a cluster merge point
106 };
107 
108 } // namespace lar_content
109 
110 #endif // #ifndef LAR_TRACK_MERGE_REFINEMENT_ALGORITHM_H
ClusterAssociation class.
bool AreExtrapolatedHitsNearBoundaries(const pandora::CaloHitVector &extrapolatedHitVector, ClusterAssociation &clusterAssociation) const
Check the separation of the extremal extrapolated hits with the cluster merge points or...
std::pair< TwoDSlidingFitResultMap *, TwoDSlidingFitResultMap * > SlidingFitResultMapPair
void ConsiderClusterAssociation(const ClusterPairAssociation &clusterAssociation, pandora::ClusterVector &clusterVector, SlidingFitResultMapPair &slidingFitResultMapPair) const
Remove the cluster association from the cluster vector so that the same cluster pair is not considere...
std::unordered_map< const pandora::Cluster *, pandora::CaloHitList > ClusterToCaloHitListMap
float m_maxPredictedMergePointOffset
The threshold separation distance between the predicted and true cluster merge points.
float m_minClusterLengthSum
The threshold cluster and associated cluster length sum.
bool AreClustersAssociated(const pandora::CartesianVector &upstreamPoint, const pandora::CartesianVector &upstreamDirection, const pandora::CartesianVector &downstreamPoint, const pandora::CartesianVector &downstreamDirection) const
Whether two clusters are assoicated to one another.
bool FindBestClusterAssociation(const pandora::ClusterVector &clusterVector, const SlidingFitResultMapPair &slidingFitResultMapPair, ClusterPairAssociation &clusterAssociation) const
Find the best cluster association.
ClusterPairAssociation class.
Header file for the track refinement base class.
const pandora::Cluster * CreateMainTrack(const ClusterPairAssociation &clusterAssociation, const ClusterToCaloHitListMap &clusterToCaloHitListMap, const pandora::ClusterList *pClusterList, pandora::ClusterVector &clusterVector, SlidingFitResultMapPair &slidingFitResultMapPair) const
Refine the cluster endpoints and merge together the associated clusters alongside any extrapolated hi...
float m_minSeparationDistance
The threshold separation distance between associated clusters.
unsigned int m_maxLoopIterations
The maximum number of main loop iterations.
float m_boundaryTolerance
The maximum allowed distance of an extremal extrapolate hit to a cluster merge point.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void GetUnavailableProtectedClusters(const ClusterPairAssociation &clusterAssociation, const pandora::ClusterList &createdMainTrackClusters, pandora::ClusterList &unavailableProtectedClusters) const
Obtain a list of clusters whos hits are protected and cannot be reassigned.
float m_distanceToLine
The threshold hit distance of an extrapolated hit from the segment connecting line.
float m_minDirectionDeviationCosAngle
The threshold cos opening angle of the associated cluster directions.