TwoDSlidingFitConsolidationAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTwoDReco/LArClusterSplitting/TwoDSlidingFitConsolidationAlgorithm.h
3  *
4  * @brief Header file for the 2D sliding fit consolidation algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_TWO_D_SLIDING_FIT_CONSOLIDATION_ALGORITHM_H
9 #define LAR_TWO_D_SLIDING_FIT_CONSOLIDATION_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
14 
15 #include <unordered_map>
16 
17 namespace lar_content
18 {
19 
20 /**
21  * @brief TwoDSlidingFitConsolidationAlgorithm class
22  */
23 class TwoDSlidingFitConsolidationAlgorithm : public pandora::Algorithm
24 {
25 public:
26  /**
27  * @brief Default constructor
28  */
30 
31 protected:
32  pandora::StatusCode Run();
33  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
34 
35  typedef std::unordered_map<const pandora::Cluster *, pandora::CaloHitList> ClusterToHitMap;
36 
37  /**
38  * @brief Get the list of hits to be added or removed from clusters
39  *
40  * @param slidingFitResultList the list of sliding linear fits to track clusters
41  * @param showerClusters the vector of shower clusters
42  * @param caloHitsToAdd the output map of hits to be added to clusters
43  * @param caloHitsToRemove the output map of hits to be removed from clusters
44  */
45  virtual void GetReclusteredHits(const TwoDSlidingFitResultList &slidingFitResultList, const pandora::ClusterVector &showerClusters,
46  ClusterToHitMap &caloHitsToAdd, ClusterToHitMap &caloHitsToRemove) const = 0;
47 
48 private:
49  /**
50  * @brief Sort input cluster list into track-like clusters and shower-like clusters
51  *
52  * @param pClusterList the input cluster list
53  * @param trackClusters the output vector of track-like clusters
54  * @param showerClusters the output vector of shower-like clusters
55  */
56  void SortInputClusters(
57  const pandora::ClusterList *const pClusterList, pandora::ClusterVector &trackClusters, pandora::ClusterVector &showerClusters) const;
58 
59  /**
60  * @brief Apply sliding linear fits to track clusters
61  *
62  * @param trackClusters the input vector of track-like clusters
63  * @param slidingFitResultList the output list of sliding linear fits
64  */
65  void BuildSlidingLinearFits(const pandora::ClusterVector &trackClusters, TwoDSlidingFitResultList &slidingFitResultList) const;
66 
67  /**
68  * @brief Remove hits from clusters
69  *
70  * @param clustersToRebuild the list of hits to be removed from clusters
71  * @param unavailableClusters the list of deleted clusters
72  */
73  pandora::StatusCode RemoveHitsFromClusters(const ClusterToHitMap &clustersToRebuild, pandora::ClusterSet &unavailableClusters) const;
74 
75  /**
76  * @brief Add hits to clusters
77  *
78  * @param clustersToRebuild the list of hits to be added to clusters
79  * @param unavailableClusters the list of modified clusters
80  */
81  pandora::StatusCode AddHitsToClusters(const ClusterToHitMap &clustersToRebuild, pandora::ClusterSet &unavailableClusters) const;
82 
83  /**
84  * @brief Re-build clusters
85  *
86  * @param clustersAtStart the initial mapping of clusters to hits
87  * @param unavailableClusters the list of unavailable clusters
88  */
89  pandora::StatusCode RebuildClusters(const ClusterToHitMap &clustersAtStart, const pandora::ClusterSet &unavailableClusters) const;
90 
91  std::string m_reclusteringAlgorithmName; ///< Name of daughter algorithm to use for cluster re-building
92  float m_minTrackLength; ///< Minimum length of track clusters to consolidate
93  float m_maxClusterLength; ///< Maximum length of shower clusters to use in re-building
94  unsigned int m_halfWindowLayers; ///< Size of layer window for sliding fit results
95 };
96 
97 } // namespace lar_content
98 
99 #endif // #ifndef LAR_TWO_D_SLIDING_FIT_CONSOLIDATION_ALGORITHM_H
unsigned int m_halfWindowLayers
Size of layer window for sliding fit results.
std::unordered_map< const pandora::Cluster *, pandora::CaloHitList > ClusterToHitMap
std::string string
Definition: nybbler.cc:12
float m_maxClusterLength
Maximum length of shower clusters to use in re-building.
float m_minTrackLength
Minimum length of track clusters to consolidate.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void BuildSlidingLinearFits(const pandora::ClusterVector &trackClusters, TwoDSlidingFitResultList &slidingFitResultList) const
Apply sliding linear fits to track clusters.
Header file for the lar two dimensional sliding fit result class.
std::vector< TwoDSlidingFitResult > TwoDSlidingFitResultList
std::string m_reclusteringAlgorithmName
Name of daughter algorithm to use for cluster re-building.
void SortInputClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &trackClusters, pandora::ClusterVector &showerClusters) const
Sort input cluster list into track-like clusters and shower-like clusters.
virtual void GetReclusteredHits(const TwoDSlidingFitResultList &slidingFitResultList, const pandora::ClusterVector &showerClusters, ClusterToHitMap &caloHitsToAdd, ClusterToHitMap &caloHitsToRemove) const =0
Get the list of hits to be added or removed from clusters.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
pandora::StatusCode AddHitsToClusters(const ClusterToHitMap &clustersToRebuild, pandora::ClusterSet &unavailableClusters) const
Add hits to clusters.
pandora::StatusCode RemoveHitsFromClusters(const ClusterToHitMap &clustersToRebuild, pandora::ClusterSet &unavailableClusters) const
Remove hits from clusters.
pandora::StatusCode RebuildClusters(const ClusterToHitMap &clustersAtStart, const pandora::ClusterSet &unavailableClusters) const
Re-build clusters.