NViewTrackMatchingAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArThreeDBase/NViewTrackMatchingAlgorithm.h
3  *
4  * @brief Header file for the n view track matching algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_N_VIEW_TRACK_MATCHING_ALGORITHM_H
9 #define LAR_N_VIEW_TRACK_MATCHING_ALGORITHM_H 1
10 
12 
14 
15 namespace lar_content
16 {
17 
18 typedef std::unordered_map<const pandora::Cluster *, pandora::CartesianPointVector> SplitPositionMap;
19 
20 //------------------------------------------------------------------------------------------------------------------------------------------
21 
22 /**
23  * @brief NViewTrackMatchingAlgorithm class
24  */
25 template <typename T>
27 {
28 public:
29  /**
30  * @brief Default constructor
31  */
33 
34  /**
35  * @brief Destructor
36  */
38 
39  /**
40  * @brief Get a sliding fit result from the algorithm cache
41  *
42  * @param pCluster address of the relevant cluster
43  */
44  const TwoDSlidingFitResult &GetCachedSlidingFitResult(const pandora::Cluster *const pCluster) const;
45 
46  /**
47  * @brief Get the layer window for the sliding linear fits
48  *
49  * @return the layer window for the sliding linear fits
50  */
51  unsigned int GetSlidingFitWindow() const;
52 
53  /**
54  * @brief Make cluster splits
55  *
56  * @param splitPositionMap the split position map
57  *
58  * @return whether changes to the overlap container have been made
59  */
60  virtual bool MakeClusterSplits(const SplitPositionMap &splitPositionMap);
61 
62  /**
63  * @brief Make a cluster split
64  *
65  * @param splitPosition the split position
66  * @param pCurrentCluster the cluster to split
67  * @param pLowXCluster to receive the low x cluster
68  * @param pHighXCluster to receive the high x cluster
69  *
70  * @return whether a cluster split occurred
71  */
72  virtual bool MakeClusterSplit(const pandora::CartesianVector &splitPosition, const pandora::Cluster *&pCurrentCluster,
73  const pandora::Cluster *&pLowXCluster, const pandora::Cluster *&pHighXCluster) const;
74 
75  /**
76  * @brief Sort split position cartesian vectors by increasing x coordinate
77  *
78  * @param lhs the first cartesian vector
79  * @param rhs the second cartesian vector
80  */
81  static bool SortSplitPositions(const pandora::CartesianVector &lhs, const pandora::CartesianVector &rhs);
82 
83  virtual void UpdateForNewCluster(const pandora::Cluster *const pNewCluster);
84  virtual void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster);
85  virtual void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const;
86  virtual void PrepareInputClusters(pandora::ClusterList &preparedClusterList);
87  virtual void SetPfoParticleId(PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const;
88 
89 protected:
90  /**
91  * @brief Add a new sliding fit result, for the specified cluster, to the algorithm cache
92  *
93  * @param pCluster address of the relevant cluster
94  */
95  void AddToSlidingFitCache(const pandora::Cluster *const pCluster);
96 
97  /**
98  * @brief Remova an existing sliding fit result, for the specified cluster, from the algorithm cache
99  *
100  * @param pCluster address of the relevant cluster
101  */
102  void RemoveFromSlidingFitCache(const pandora::Cluster *const pCluster);
103 
104  virtual void TidyUp();
105  virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
106 
107 private:
108  unsigned int m_slidingFitWindow; ///< The layer window for the sliding linear fits
109  TwoDSlidingFitResultMap m_slidingFitResultMap; ///< The sliding fit result map
110 
111  unsigned int m_minClusterCaloHits; ///< The min number of hits in base cluster selection method
112  float m_minClusterLengthSquared; ///< The min length (squared) in base cluster selection method
113 };
114 
115 //------------------------------------------------------------------------------------------------------------------------------------------
116 
117 template <typename T>
119 {
120  return m_slidingFitWindow;
121 }
122 
123 } // namespace lar_content
124 
125 #endif // #ifndef LAR_N_VIEW_TRACK_MATCHING_ALGORITHM_H
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
static bool SortSplitPositions(const pandora::CartesianVector &lhs, const pandora::CartesianVector &rhs)
Sort split position cartesian vectors by increasing x coordinate.
void AddToSlidingFitCache(const pandora::Cluster *const pCluster)
Add a new sliding fit result, for the specified cluster, to the algorithm cache.
NViewMatchingAlgorithm class.
virtual bool MakeClusterSplits(const SplitPositionMap &splitPositionMap)
Make cluster splits.
virtual void PrepareInputClusters(pandora::ClusterList &preparedClusterList)
Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results...
virtual void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
const TwoDSlidingFitResult & GetCachedSlidingFitResult(const pandora::Cluster *const pCluster) const
Get a sliding fit result from the algorithm cache.
virtual void TidyUp()
Tidy member variables in derived class.
float m_minClusterLengthSquared
The min length (squared) in base cluster selection method.
Header file for the n view matching algorithm class.
std::unordered_map< const pandora::Cluster *, pandora::CartesianPointVector > SplitPositionMap
Header file for the lar two dimensional sliding fit result class.
std::unordered_map< const pandora::Cluster *, TwoDSlidingFitResult > TwoDSlidingFitResultMap
void RemoveFromSlidingFitCache(const pandora::Cluster *const pCluster)
Remova an existing sliding fit result, for the specified cluster, from the algorithm cache...
virtual void SetPfoParticleId(PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
Set pfo particle id.
unsigned int m_minClusterCaloHits
The min number of hits in base cluster selection method.
virtual bool MakeClusterSplit(const pandora::CartesianVector &splitPosition, const pandora::Cluster *&pCurrentCluster, const pandora::Cluster *&pLowXCluster, const pandora::Cluster *&pHighXCluster) const
Make a cluster split.
virtual void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const
Select a subset of input clusters for processing in this algorithm.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
TwoDSlidingFitResultMap m_slidingFitResultMap
The sliding fit result map.
virtual void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)
Update to reflect addition of a new cluster to the problem space.
unsigned int GetSlidingFitWindow() const
Get the layer window for the sliding linear fits.