TwoDSlidingFitSplittingAndSwitchingAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTwoDReco/LArClusterSplitting/TwoDSlidingFitSplittingAndSwitchingAlgorithm.h
3  *
4  * @brief Header file for the two dimensional sliding fit splitting and switching algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_TWO_D_SLIDING_FIT_SPLITTING_AND_SWITCHING_ALGORITHM_H
9 #define LAR_TWO_D_SLIDING_FIT_SPLITTING_AND_SWITCHING_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
14 
15 namespace lar_content
16 {
17 
18 /**
19  * @brief TwoDSlidingFitSplittingAndSwitchingAlgorithm class
20  */
21 class TwoDSlidingFitSplittingAndSwitchingAlgorithm : public pandora::Algorithm
22 {
23 public:
24  /**
25  * @brief Default constructor
26  */
28 
29 protected:
30  virtual pandora::StatusCode Run();
31  virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
32 
33  /**
34  * @brief Perform any preparatory actions, such as caching information for subsequent expensive calculations
35  *
36  * @param clusterVector the cluster vector
37  */
38  virtual pandora::StatusCode PreparationStep(const pandora::ClusterVector &clusterVector);
39 
40  /**
41  * @brief Tidy up any information cached in e.g. the preparation step
42  */
43  virtual pandora::StatusCode TidyUpStep();
44 
45  /**
46  * @brief Find the best split position and direction for a pair of clusters
47  *
48  * @param slidingFit1 the sliding linear fit to the first cluster
49  * @param slidingFit2 the sliding linear fit to the second cluster
50  * @param splitPosition the output split position
51  * @param direction1 the output direction of the first new cluster
52  * @param direction2 the output direction of the second new cluster
53  */
54  virtual pandora::StatusCode FindBestSplitPosition(const TwoDSlidingFitResult &slidingFit1, const TwoDSlidingFitResult &slidingFit2,
55  pandora::CartesianVector &splitPosition, pandora::CartesianVector &direction1, pandora::CartesianVector &direction2) const = 0;
56 
57 private:
58  /**
59  * @brief Populate cluster vector with subset of cluster list, containing clusters judged to be clean
60  *
61  * @param pClusterList address of the cluster list
62  * @param clusterVector to receive the populated cluster vector
63  */
64  void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &clusterVector) const;
65 
66  /**
67  * @brief Build the map of sliding fit results
68  *
69  * @param clusterVector the input cluster vector
70  * @param slidingFitResultMap the output sliding fit result map
71  */
72  void BuildSlidingFitResultMap(const pandora::ClusterVector &clusterVector, TwoDSlidingFitResultMap &slidingFitResultMap) const;
73 
74  /**
75  * @brief Split cluster at a given position and direction
76  *
77  * @param pCluster the cluster
78  * @param splitPosition the position at which to split the cluster
79  * @param splitDirection the direction of the un-crossed cluster
80  * @param firstCaloHitList the hits to be added to the first new cluster
81  * @param secondCaloHitList the hits to be added to the second new cluster
82  */
83  void SplitCluster(const pandora::Cluster *const pCluster, const pandora::CartesianVector &splitPosition,
84  const pandora::CartesianVector &splitDirection, pandora::CaloHitList &firstCaloHitList, pandora::CaloHitList &secondCaloHitList) const;
85 
86  /**
87  * @brief Replace crossed clusters with un-crossed clusters
88  *
89  * @param pCluster1 the first cluster to be deleted
90  * @param pCluster2 the second cluster to be deleted
91  * @param splitPosition the split position
92  * @param firstDirection the direction of the first new cluster
93  * @param secondDirection the direction of the second new cluster
94  */
95  pandora::StatusCode ReplaceClusters(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2,
96  const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &firstDirection,
97  const pandora::CartesianVector &secondDirection) const;
98 
99  unsigned int m_halfWindowLayers; ///< half window layers for sliding linear fot
100  float m_minClusterLength; ///< minimum length of clusters
101 };
102 
103 } // namespace lar_content
104 
105 #endif // #ifndef LAR_TWO_D_SLIDING_FIT_SPLITTING_AND_SWITCHING_ALGORITHM_H
unsigned int m_halfWindowLayers
half window layers for sliding linear fot
virtual pandora::StatusCode FindBestSplitPosition(const TwoDSlidingFitResult &slidingFit1, const TwoDSlidingFitResult &slidingFit2, pandora::CartesianVector &splitPosition, pandora::CartesianVector &direction1, pandora::CartesianVector &direction2) const =0
Find the best split position and direction for a pair of clusters.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
virtual pandora::StatusCode TidyUpStep()
Tidy up any information cached in e.g. the preparation step.
pandora::StatusCode ReplaceClusters(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &firstDirection, const pandora::CartesianVector &secondDirection) const
Replace crossed clusters with un-crossed clusters.
Header file for the lar two dimensional sliding fit result class.
void SplitCluster(const pandora::Cluster *const pCluster, const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &splitDirection, pandora::CaloHitList &firstCaloHitList, pandora::CaloHitList &secondCaloHitList) const
Split cluster at a given position and direction.
std::unordered_map< const pandora::Cluster *, TwoDSlidingFitResult > TwoDSlidingFitResultMap
void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &clusterVector) const
Populate cluster vector with subset of cluster list, containing clusters judged to be clean...
std::vector< art::Ptr< recob::Cluster > > ClusterVector
virtual pandora::StatusCode PreparationStep(const pandora::ClusterVector &clusterVector)
Perform any preparatory actions, such as caching information for subsequent expensive calculations...
void BuildSlidingFitResultMap(const pandora::ClusterVector &clusterVector, TwoDSlidingFitResultMap &slidingFitResultMap) const
Build the map of sliding fit results.