All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TwoViewThreeDKinkTool.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArTwoViewMatching/TwoViewThreeDKinkTool.h
3  *
4  * @brief Header file for the two view three d kink tool class.
5  *
6  * $Log: $
7  */
8 #ifndef TWO_VIEW_THREE_D_KINK_TOOL_H
9 #define TWO_VIEW_THREE_D_KINK_TOOL_H 1
10 
12 
14 
15 namespace lar_content
16 {
17 
18 /**
19  * @brief TwoViewThreeDKinkTool class
20  */
22 {
23 public:
24  /**
25  * @brief Constructor
26  *
27  * @param nCommonClusters the number of common clusters to select
28  */
30 
31  /**
32  * @brief Destructor
33  */
34  virtual ~TwoViewThreeDKinkTool();
35 
36  bool Run(TwoViewTransverseTracksAlgorithm *const pAlgorithm, MatrixType &overlapMatrix);
37 
38 private:
39  /**
40  * @brief Modification class
41  */
43  {
44  public:
45  SplitPositionMap m_splitPositionMap; ///< The split position map
46  ClusterMergeMap m_clusterMergeMap; ///< The cluster merge map
47  pandora::ClusterList m_affectedClusters; ///< The list of affected clusters
48  };
49 
50  typedef std::vector<Modification> ModificationList;
51 
52  /**
53  * @brief Particle class
54  */
55  class Particle
56  {
57  public:
58  /**
59  * @brief Constructor
60  *
61  * @param elementA the matrix element A
62  * @param elementB the matrix element B
63  */
64  Particle(const MatrixType::Element &elementA, const MatrixType::Element &elementB);
65 
66  const pandora::Cluster *m_pClusterA; ///< Address of non-shared cluster in element A
67  const pandora::Cluster *m_pClusterB; ///< Address of non-shared cluster in element B
68  const pandora::Cluster *m_pCommonCluster; ///< Address of the common cluster
69  };
70 
71  /**
72  * @brief Get modification objects, identifying required splits and merges
73  * for clusters
74  *
75  * @param pAlgorithm address of the calling algorithm
76  * @param overlapMatrix the overlap matrix
77  * @param modificationList to be populated with modifications
78  */
79  void GetModifications(TwoViewTransverseTracksAlgorithm *const pAlgorithm, const MatrixType &overlapMatrix, ModificationList &modificationList) const;
80 
81  /**
82  * @brief Whether a provided (iterator to a) matrix element passes the
83  * selection cuts for overshoot identification
84  *
85  * @param eIter the iterator to the matrix element
86  * @param usedClusters the list of used clusters
87  */
88  bool PassesElementCuts(MatrixType::ElementList::const_iterator eIter, const pandora::ClusterSet &usedClusters) const;
89 
90  /**
91  * @brief Select elements representing possible components of interest due
92  * to overshoots or undershoots in clustering
93  *
94  * @param eIter iterator to a candidate element
95  * @param elementList the provided element list
96  * @param usedClusters the list of used clusters
97  * @param iteratorList to receive a list of iterators to relevant elements
98  */
100  const pandora::ClusterSet &usedClusters, IteratorList &iteratorList) const;
101 
102  /**
103  * @brief Get modification objects for specific elements of the matrix, identifying required splits and merges for clusters
104  *
105  * @param pAlgorithm address of the calling algorithm
106  * @param iteratorList list of iterators to relevant tensor elements
107  * @param modificationList to be populated with modifications
108  */
110  TwoViewTransverseTracksAlgorithm *const pAlgorithm, const IteratorList &iteratorList, ModificationList &modificationList) const;
111 
112  /**
113  * @brief Whether pointing cluster labelled A extends to lowest x positions
114  * (as opposed to that labelled B)
115  *
116  * @param pointingClusterA pointing cluster A
117  * @param pointingClusterB pointing cluster B
118  */
119  static bool IsALowestInX(const LArPointingCluster &pointingClusterA, const LArPointingCluster &pointingClusterB);
120 
121  /**
122  * @brief Whether the provided particle is consistent with being a kink,
123  * when examined in three dimensions at the provided split position
124  *
125  * @param pAlgorithm the calling algorithm
126  * @param particle the particle
127  * @param splitPosition the candidate split position
128  * @param isALowestInX whether cluster associated with matrix element a
129  * extends to lowest x positions
130  *
131  * @return boolean
132  */
133  bool IsThreeDKink(TwoViewTransverseTracksAlgorithm *const pAlgorithm, const Particle &particle,
134  const pandora::CartesianVector &splitPosition, const bool isALowestInX) const;
135 
136  /**
137  * @brief Get a sampling point in x that is common to sliding linear fit
138  * objects in two views
139  *
140  * @param splitPosition1 the split position in view 1
141  * @param isForwardInX whether to work forwards (or backwards) in x
142  * @param fitResult1 the sliding fit result in view 1
143  * @param fitResult2 the sliding fit result in view 2
144  *
145  * @return the sampling point
146  */
147  float GetXSamplingPoint(const pandora::CartesianVector &splitPosition1, const bool isForwardInX, const TwoDSlidingFitResult &fitResult1,
148  const TwoDSlidingFitResult &fitResult2) const;
149 
150  /**
151  * @brief Apply the changes cached in a modification list and update the
152  * matrix accordingly
153  *
154  * @param pAlgorithm address of the calling algorithm
155  * @param modificationList the modification list
156  *
157  * @return whether changes to the matrix have been made
158  */
159  bool ApplyChanges(TwoViewTransverseTracksAlgorithm *const pAlgorithm, const ModificationList &modificationList) const;
160 
161  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
162 
163  float m_minXOverlapFraction; ///< The min x overlap fraction value for particle creation
164  float m_minMatchingScore; ///< The min global matching score for particle creation
165  float m_minLocallyMatchedFraction; ///< The min locally matched fraction for particle creation
166  float m_minLongitudinalImpactParameter; ///< The min longitudinal impact parameter for connecting accompanying clusters
167  int m_nLayersForKinkSearch; ///< The number of sliding fit layers to step in the kink search
168  float m_additionalXStepForKinkSearch; ///< An additional (safety) step to tack-on when choosing x sampling
169  float m_maxTransverseImpactParameter; ///< The maximum transverse impact parameter for connecting broken clusters
170  float m_minImpactParameterCosTheta; ///< The minimum cos theta (angle between vertex directions) for connecting broken clusters
171  float m_cosThetaCutForKinkSearch; ///< The cos theta cut used for the kink search in three dimensions
172 };
173 
174 } // namespace lar_content
175 
176 #endif // #ifndef TWO_VIEW_THREE_D_KINK_TOOL_H
float m_minLocallyMatchedFraction
The min locally matched fraction for particle creation.
Header file for the lar pointing cluster class.
const pandora::Cluster * m_pClusterB
Address of non-shared cluster in element B.
static bool IsALowestInX(const LArPointingCluster &pointingClusterA, const LArPointingCluster &pointingClusterB)
Whether pointing cluster labelled A extends to lowest x positions (as opposed to that labelled B) ...
SplitPositionMap m_splitPositionMap
The split position map.
LArPointingCluster class.
std::vector< Modification > ModificationList
float m_minMatchingScore
The min global matching score for particle creation.
Particle(const MatrixType::Element &elementA, const MatrixType::Element &elementB)
Constructor.
const pandora::Cluster * m_pClusterA
Address of non-shared cluster in element A.
float m_minXOverlapFraction
The min x overlap fraction value for particle creation.
float m_additionalXStepForKinkSearch
An additional (safety) step to tack-on when choosing x sampling.
bool IsThreeDKink(TwoViewTransverseTracksAlgorithm *const pAlgorithm, const Particle &particle, const pandora::CartesianVector &splitPosition, const bool isALowestInX) const
Whether the provided particle is consistent with being a kink, when examined in three dimensions at t...
TwoViewThreeDKinkTool class.
void GetModifications(TwoViewTransverseTracksAlgorithm *const pAlgorithm, const MatrixType &overlapMatrix, ModificationList &modificationList) const
Get modification objects, identifying required splits and merges for clusters.
void SelectMatrixElements(MatrixType::ElementList::const_iterator eIter, const MatrixType::ElementList &elementList, const pandora::ClusterSet &usedClusters, IteratorList &iteratorList) const
Select elements representing possible components of interest due to overshoots or undershoots in clus...
std::unordered_map< const pandora::Cluster *, pandora::CartesianPointVector > SplitPositionMap
float m_maxTransverseImpactParameter
The maximum transverse impact parameter for connecting broken clusters.
int m_nLayersForKinkSearch
The number of sliding fit layers to step in the kink search.
Header file for the two view transverse tracks algorithm class.
bool Run(TwoViewTransverseTracksAlgorithm *const pAlgorithm, MatrixType &overlapMatrix)
Run the algorithm tool.
float m_cosThetaCutForKinkSearch
The cos theta cut used for the kink search in three dimensions.
bool PassesElementCuts(MatrixType::ElementList::const_iterator eIter, const pandora::ClusterSet &usedClusters) const
Whether a provided (iterator to a) matrix element passes the selection cuts for overshoot identificat...
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_minImpactParameterCosTheta
The minimum cos theta (angle between vertex directions) for connecting broken clusters.
pandora::ClusterList m_affectedClusters
The list of affected clusters.
void GetIteratorListModifications(TwoViewTransverseTracksAlgorithm *const pAlgorithm, const IteratorList &iteratorList, ModificationList &modificationList) const
Get modification objects for specific elements of the matrix, identifying required splits and merges ...
bool ApplyChanges(TwoViewTransverseTracksAlgorithm *const pAlgorithm, const ModificationList &modificationList) const
Apply the changes cached in a modification list and update the matrix accordingly.
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterMergeMap
ClusterMergeMap m_clusterMergeMap
The cluster merge map.
float m_minLongitudinalImpactParameter
The min longitudinal impact parameter for connecting accompanying clusters.
std::vector< MatrixType::ElementList::const_iterator > IteratorList
float GetXSamplingPoint(const pandora::CartesianVector &splitPosition1, const bool isForwardInX, const TwoDSlidingFitResult &fitResult1, const TwoDSlidingFitResult &fitResult2) const
Get a sampling point in x that is common to sliding linear fit objects in two views.
const pandora::Cluster * m_pCommonCluster
Address of the common cluster.