All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ThreeDKinkBaseTool.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArTransverseTrackMatching/ThreeDKinkBaseTool.h
3  *
4  * @brief Header file for the three d kink base tool
5  *
6  * $Log: $
7  */
8 #ifndef THREE_D_KINK_BASE_TOOL_H
9 #define THREE_D_KINK_BASE_TOOL_H 1
10 
12 
14 
15 namespace lar_content
16 {
17 
18 /**
19  * @brief ThreeDKinkBaseTool class
20  */
22 {
23 public:
24  /**
25  * @brief Constructor
26  *
27  * @param nCommonClusters the number of common clusters to select
28  */
29  ThreeDKinkBaseTool(const unsigned int nCommonClusters);
30 
31  /**
32  * @brief Destructor
33  */
34  virtual ~ThreeDKinkBaseTool();
35 
36  bool Run(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor);
37 
38 protected:
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 Whether a provided (iterator to a) tensor element passes the selection cuts for overshoot identification
54  *
55  * @param eIter the iterator to the tensor element
56  * @param usedClusters the list of used clusters
57  */
58  virtual bool PassesElementCuts(TensorType::ElementList::const_iterator eIter, const pandora::ClusterSet &usedClusters) const;
59 
60  /**
61  * @brief Get modification objects for a specific elements of the tensor, identifying required splits and merges for clusters
62  *
63  * @param pAlgorithm address of the calling algorithm
64  * @param iteratorList list of iterators to relevant tensor elements
65  * @param modificationList to be populated with modifications
66  */
67  virtual void GetIteratorListModifications(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const IteratorList &iteratorList,
68  ModificationList &modificationList) const = 0;
69 
70  /**
71  * @brief Get a sampling point in x that is common to sliding linear fit objects in three views
72  *
73  * @param splitPosition1 the split position in view 1
74  * @param isForwardInX whether to work forwards (or backwards) in x
75  * @param fitResult1 the sliding fit result in view 1
76  * @param fitResult2 the sliding fit result in view 2
77  * @param fitResult3 the sliding fit result in view 3
78  *
79  * @return the sampling point
80  */
81  float GetXSamplingPoint(const pandora::CartesianVector &splitPosition1, const bool isForwardInX, const TwoDSlidingFitResult &fitResult1,
82  const TwoDSlidingFitResult &fitResult2, const TwoDSlidingFitResult &fitResult3) const;
83 
84  /**
85  * @brief Whether pointing cluster labelled A extends to lowest x positions (as opposed to that labelled B)
86  *
87  * @param pointingClusterA pointing cluster A
88  * @param pointingClusterB pointing cluster B
89  */
90  static bool IsALowestInX(const LArPointingCluster &pointingClusterA, const LArPointingCluster &pointingClusterB);
91 
92  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
93 
94  unsigned int m_nCommonClusters; ///< The number of common clusters
95  bool m_majorityRulesMode; ///< Whether to run in majority rules mode (always split overshoots, always merge undershoots)
96  float m_minMatchedFraction; ///< The min matched sampling point fraction for use as a key tensor element
97  unsigned int m_minMatchedSamplingPoints; ///< The min number of matched sampling points for use as a key tensor element
98  float m_minLongitudinalImpactParameter; ///< The min longitudinal impact parameter for connecting accompanying clusters
99  int m_nLayersForKinkSearch; ///< The number of sliding fit layers to step in the kink search
100  float m_additionalXStepForKinkSearch; ///< An additional (safety) step to tack-on when choosing x sampling points
101 
102 private:
103  /**
104  * @brief Get modification objects, identifying required splits and merges for clusters
105  *
106  * @param pAlgorithm address of the calling algorithm
107  * @param overlapTensor the overlap tensor
108  * @param modificationList to be populated with modifications
109  */
110  void GetModifications(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const TensorType &overlapTensor, ModificationList &modificationList) const;
111 
112  /**
113  * @brief Select elements representing possible components of interest due to overshoots or undershoots in clustering
114  *
115  * @param eIter iterator to a candidate element
116  * @param elementList the provided element list
117  * @param usedClusters the list of used clusters
118  * @param iteratorList to receive a list of iterators to relevant elements
119  */
121  const pandora::ClusterSet &usedClusters, IteratorList &iteratorList) const;
122 
123  /**
124  * @brief Apply the changes cached in a modification list and update the tensor accordingly
125  *
126  * @param pAlgorithm address of the calling algorithm
127  * @param modificationList the modification list
128  *
129  * @return whether changes to the tensor have been made
130  */
131  bool ApplyChanges(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const ModificationList &modificationList) const;
132 };
133 
134 } // namespace lar_content
135 
136 #endif // #ifndef THREE_D_KINK_BASE_TOOL_H
pandora::ClusterList m_affectedClusters
The list of affected clusters.
std::vector< Modification > ModificationList
bool ApplyChanges(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const ModificationList &modificationList) const
Apply the changes cached in a modification list and update the tensor accordingly.
float GetXSamplingPoint(const pandora::CartesianVector &splitPosition1, const bool isForwardInX, const TwoDSlidingFitResult &fitResult1, const TwoDSlidingFitResult &fitResult2, const TwoDSlidingFitResult &fitResult3) const
Get a sampling point in x that is common to sliding linear fit objects in three views.
Header file for the lar pointing cluster class.
std::vector< TensorType::ElementList::const_iterator > IteratorList
unsigned int m_nCommonClusters
The number of common clusters.
LArPointingCluster class.
ClusterMergeMap m_clusterMergeMap
The cluster merge map.
virtual ~ThreeDKinkBaseTool()
Destructor.
int m_nLayersForKinkSearch
The number of sliding fit layers to step in the kink search.
std::unordered_map< const pandora::Cluster *, pandora::CartesianPointVector > SplitPositionMap
Header file for the three view transverse tracks algorithm class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void GetModifications(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const TensorType &overlapTensor, ModificationList &modificationList) const
Get modification objects, identifying required splits and merges for clusters.
void SelectTensorElements(TensorType::ElementList::const_iterator eIter, const TensorType::ElementList &elementList, const pandora::ClusterSet &usedClusters, IteratorList &iteratorList) const
Select elements representing possible components of interest due to overshoots or undershoots in clus...
virtual bool PassesElementCuts(TensorType::ElementList::const_iterator eIter, const pandora::ClusterSet &usedClusters) const
Whether a provided (iterator to a) tensor element passes the selection cuts for overshoot identificat...
bool Run(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
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) ...
float m_additionalXStepForKinkSearch
An additional (safety) step to tack-on when choosing x sampling points.
virtual void GetIteratorListModifications(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const IteratorList &iteratorList, ModificationList &modificationList) const =0
Get modification objects for a specific elements of the tensor, identifying required splits and merge...
ThreeDKinkBaseTool(const unsigned int nCommonClusters)
Constructor.
ThreeDKinkBaseTool class.
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for use as a key tensor element.
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterMergeMap
bool m_majorityRulesMode
Whether to run in majority rules mode (always split overshoots, always merge undershoots) ...
float m_minLongitudinalImpactParameter
The min longitudinal impact parameter for connecting accompanying clusters.
float m_minMatchedFraction
The min matched sampling point fraction for use as a key tensor element.
SplitPositionMap m_splitPositionMap
The split position map.