All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CosmicRaySplittingAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTwoDReco/LArCosmicRay/CosmicRaySplittingAlgorithm.h
3  *
4  * @brief Header file for the cosmic ray splitting algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_COSMIC_RAY_SPLITTING_ALGORITHM_H
9 #define LAR_COSMIC_RAY_SPLITTING_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
14 
15 namespace lar_content
16 {
17 
18 /**
19  * @brief CosmicRaySplittingAlgorithm class
20  */
21 class CosmicRaySplittingAlgorithm : public pandora::Algorithm
22 {
23 public:
24  /**
25  * @brief Default constructor
26  */
28 
29 private:
30  pandora::StatusCode Run();
31  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
32 
33  /**
34  * @brief Populate cluster vector with subset of cluster list, containing clusters judged to be clean
35  *
36  * @param pClusterList address of the cluster list
37  * @param clusterVector to receive the populated cluster vector
38  */
39  void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &clusterVector) const;
40 
41  /**
42  * @brief Build the map of sliding fit results
43  *
44  * @param clusterVector the input cluster vector
45  * @param slidingFitResultMap the output sliding fit result map
46  */
47  void BuildSlidingFitResultMap(const pandora::ClusterVector &clusterVector, TwoDSlidingFitResultMap &slidingFitResultMap) const;
48 
49  /**
50  * @brief Find the position of greatest scatter along a sliding linear fit
51  *
52  * @param slidingFitResult the input sliding linear fit result
53  * @param splitPosition the position of greatest scatter
54  * @param splitDirection1 the direction vector just above the scatter position
55  * @param splitDirection2 the direction vector just below the scatter position
56  */
57  pandora::StatusCode FindBestSplitPosition(const TwoDSlidingFitResult &slidingFitResult, pandora::CartesianVector &splitPosition,
58  pandora::CartesianVector &splitDirection1, pandora::CartesianVector &splitDirection2) const;
59 
60  /**
61  * @brief Find a second replacement cluster that aligns with the scatter of the first branch cluster
62  *
63  * @param branchSlidingFitResult the sliding fit result for the branch cluster
64  * @param replacementSlidingFitResult the sliding fit result for the replacement cluster
65  * @param splitPosition the candidate split position on the branch cluster
66  * @param splitDirection1 the first track direction just above the split position
67  * @param splitDirection2 the second track direction just below the split position
68  * @param lengthSquared1 figure of merit for association with first track direction
69  * @param lengthSquared2 figure of merit for association with second track direction
70  */
71  pandora::StatusCode ConfirmSplitPosition(const TwoDSlidingFitResult &branchSlidingFitResult, const TwoDSlidingFitResult &replacementSlidingFitResult,
72  const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &splitDirection1,
73  const pandora::CartesianVector &splitDirection2, float &lengthSquared1, float &lengthSquared2) const;
74 
75  /**
76  * @brief Split a branch cluster for case of one replacement cluster
77  *
78  * @param pBranchCluster the branch cluster
79  * @param pReplacementCluster the replacement cluster
80  * @param splitPosition the split position
81  * @param forwardDirection the direction of the branch cluster just above the split position
82  * @param backwardDirection the direction of the branch cluster just below the split position
83  */
84  pandora::StatusCode PerformSingleSplit(const pandora::Cluster *const pBranchCluster, const pandora::Cluster *const pReplacementCluster,
85  const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &forwardDirection,
86  const pandora::CartesianVector &backwardDirection) const;
87 
88  /**
89  * @brief Split a branch cluster for case of two replacement clusters
90  *
91  * @param pBranchCluster the branch cluster
92  * @param pReplacementCluster1 the first replacement cluster
93  * @param pReplacementCluster2 the second replacement cluster
94  * @param splitPosition the split position
95  * @param splitDirection1 the direction of the branch cluster just above the split position
96  * @param splitDirection2 the direction of the branch cluster just below the split position
97  */
98  pandora::StatusCode PerformDoubleSplit(const pandora::Cluster *const pBranchCluster, const pandora::Cluster *const pReplacementCluster1,
99  const pandora::Cluster *const pReplacementCluster2, const pandora::CartesianVector &splitPosition,
100  const pandora::CartesianVector &splitDirection1, const pandora::CartesianVector &splitDirection2) const;
101 
102  /**
103  * @brief Get list of calo hits to move in order to split a branch cluster into two segments for case of one replacement cluster
104  *
105  * @param pBranchCluster the branch cluster
106  * @param pReplacementCluster the replacement cluster
107  * @param splitPosition the split position
108  * @param forwardDirection the direction of the branch cluster just above the split position
109  * @param backwardDirection the direction of the branch cluster just below the split position
110  * @param caloHitList the output hits to be removed from the branch cluster
111  */
112  void GetCaloHitListToMove(const pandora::Cluster *const pBranchCluster, const pandora::Cluster *const pReplacementCluster,
113  const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &forwardDirection,
114  const pandora::CartesianVector &backwardDirection, pandora::CaloHitList &caloHitList) const;
115 
116  /**
117  * @brief Get lists of calo hits to move in order to split a branch cluster into two segments for case of two replacement clusters
118  *
119  * @param pBranchCluster the branch cluster
120  * @param splitPosition the split position
121  * @param splitDirection1 the direction of the branch cluster just above the split position
122  * @param splitDirection2 the direction of the branch cluster just below the split position
123  * @param caloHitList1 the first segment to be split from the branch cluster
124  * @param caloHitList2 the second segment to be split from the branch cluster
125  */
126  void GetCaloHitListsToMove(const pandora::Cluster *const pBranchCluster, const pandora::CartesianVector &splitPosition,
127  const pandora::CartesianVector &splitDirection1, const pandora::CartesianVector &splitDirection2,
128  pandora::CaloHitList &caloHitList1, pandora::CaloHitList &caloHitList2) const;
129 
130  /**
131  * @brief Identify crossed tracks formed from the branch cluster and its replacement cluster
132  *
133  * @param pBranchCluster the branch cluster
134  * @param pReplacementCluster1 the first replacement cluster
135  * @param pReplacementCluster2 the second replacement cluster
136  * @param splitPosition the split position
137  */
138  bool IdentifyCrossedTracks(const pandora::Cluster *const pBranchCluster, const pandora::Cluster *const pReplacementCluster1,
139  const pandora::Cluster *const pReplacementCluster2, const pandora::CartesianVector &splitPosition) const;
140 
141  /**
142  * @brief Split the branch cluster and add hits to the replacement cluster
143  *
144  * @param pBranchCluster the branch cluster
145  * @param caloHitListToMove the list of hits to be removed from the branch cluster and added to the replacement cluster
146  * @param caloHitListToKeep to receive the list of calo hits to keep
147  */
148  pandora::StatusCode GetCaloHitListToKeep(const pandora::Cluster *const pBranchCluster, const pandora::CaloHitList &caloHitListToMove,
149  pandora::CaloHitList &caloHitListToKeep) const;
150 
151  /**
152  * @brief Split the branch cluster and add hits to the replacement cluster
153  *
154  * @param pBranchCluster the branch cluster
155  * @param pReplacementCluster the replacement cluster
156  * @param caloHitListToMove the list of hits to be removed from the branch cluster and added to the replacement cluster
157  */
158  pandora::StatusCode SplitCluster(const pandora::Cluster *const pBranchCluster, const pandora::Cluster *const pReplacementCluster,
159  const pandora::CaloHitList &caloHitListToMove) const;
160 
161  float m_clusterMinLength; ///< minimum length of clusters for this algorithm
162  unsigned int m_halfWindowLayers; ///< number of layers to use for half-window of sliding fit
163  float m_samplingPitch; ///< sampling pitch for walking along sliding linear fit
164  float m_maxCosSplittingAngle; ///< smallest scatter angle allowed when splitting cluster
165  float m_minCosMergingAngle; ///< largest relative angle allowed when merging clusters
166  float m_maxTransverseDisplacement; ///< maximum transverse displacement of associated clusters
167  float m_maxLongitudinalDisplacement; ///< maximum longitudinal displacement of associated clusters
168  float m_maxLongitudinalDisplacementSquared; ///< longitudinal displacement squared
169 };
170 
171 } // namespace lar_content
172 
173 #endif // #ifndef LAR_COSMIC_RAY_SPLITTING_ALGORITHM_H
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...
void GetCaloHitListsToMove(const pandora::Cluster *const pBranchCluster, const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &splitDirection1, const pandora::CartesianVector &splitDirection2, pandora::CaloHitList &caloHitList1, pandora::CaloHitList &caloHitList2) const
Get lists of calo hits to move in order to split a branch cluster into two segments for case of two r...
bool IdentifyCrossedTracks(const pandora::Cluster *const pBranchCluster, const pandora::Cluster *const pReplacementCluster1, const pandora::Cluster *const pReplacementCluster2, const pandora::CartesianVector &splitPosition) const
Identify crossed tracks formed from the branch cluster and its replacement cluster.
float m_maxLongitudinalDisplacement
maximum longitudinal displacement of associated clusters
void GetCaloHitListToMove(const pandora::Cluster *const pBranchCluster, const pandora::Cluster *const pReplacementCluster, const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &forwardDirection, const pandora::CartesianVector &backwardDirection, pandora::CaloHitList &caloHitList) const
Get list of calo hits to move in order to split a branch cluster into two segments for case of one re...
float m_clusterMinLength
minimum length of clusters for this algorithm
pandora::StatusCode SplitCluster(const pandora::Cluster *const pBranchCluster, const pandora::Cluster *const pReplacementCluster, const pandora::CaloHitList &caloHitListToMove) const
Split the branch cluster and add hits to the replacement cluster.
pandora::StatusCode PerformSingleSplit(const pandora::Cluster *const pBranchCluster, const pandora::Cluster *const pReplacementCluster, const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &forwardDirection, const pandora::CartesianVector &backwardDirection) const
Split a branch cluster for case of one replacement cluster.
float m_minCosMergingAngle
largest relative angle allowed when merging clusters
pandora::StatusCode GetCaloHitListToKeep(const pandora::Cluster *const pBranchCluster, const pandora::CaloHitList &caloHitListToMove, pandora::CaloHitList &caloHitListToKeep) const
Split the branch cluster and add hits to the replacement cluster.
float m_maxCosSplittingAngle
smallest scatter angle allowed when splitting cluster
float m_maxLongitudinalDisplacementSquared
longitudinal displacement squared
Header file for the lar two dimensional sliding fit result class.
pandora::StatusCode PerformDoubleSplit(const pandora::Cluster *const pBranchCluster, const pandora::Cluster *const pReplacementCluster1, const pandora::Cluster *const pReplacementCluster2, const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &splitDirection1, const pandora::CartesianVector &splitDirection2) const
Split a branch cluster for case of two replacement clusters.
std::unordered_map< const pandora::Cluster *, TwoDSlidingFitResult > TwoDSlidingFitResultMap
void BuildSlidingFitResultMap(const pandora::ClusterVector &clusterVector, TwoDSlidingFitResultMap &slidingFitResultMap) const
Build the map of sliding fit results.
float m_maxTransverseDisplacement
maximum transverse displacement of associated clusters
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::StatusCode ConfirmSplitPosition(const TwoDSlidingFitResult &branchSlidingFitResult, const TwoDSlidingFitResult &replacementSlidingFitResult, const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &splitDirection1, const pandora::CartesianVector &splitDirection2, float &lengthSquared1, float &lengthSquared2) const
Find a second replacement cluster that aligns with the scatter of the first branch cluster...
std::vector< art::Ptr< recob::Cluster > > ClusterVector
pandora::StatusCode FindBestSplitPosition(const TwoDSlidingFitResult &slidingFitResult, pandora::CartesianVector &splitPosition, pandora::CartesianVector &splitDirection1, pandora::CartesianVector &splitDirection2) const
Find the position of greatest scatter along a sliding linear fit.
unsigned int m_halfWindowLayers
number of layers to use for half-window of sliding fit
float m_samplingPitch
sampling pitch for walking along sliding linear fit