All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ThreeViewTransverseTracksAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArTransverseTrackMatching/ThreeViewTransverseTracksAlgorithm.h
3  *
4  * @brief Header file for the three view transverse tracks algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_THREE_VIEW_TRANSVERSE_TRACKS_ALGORITHM_H
9 #define LAR_THREE_VIEW_TRANSVERSE_TRACKS_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 #include "Pandora/AlgorithmTool.h"
13 
15 
18 
19 namespace lar_content
20 {
21 
22 class TransverseTensorTool;
23 
24 //------------------------------------------------------------------------------------------------------------------------------------------
25 
26 /**
27  * @brief ThreeViewTransverseTracksAlgorithm class
28  */
29 class ThreeViewTransverseTracksAlgorithm : public NViewTrackMatchingAlgorithm<ThreeViewMatchingControl<TransverseOverlapResult>>
30 {
31 public:
33 
34  /**
35  * @brief Default constructor
36  */
38 
39 private:
40  typedef std::map<unsigned int, TransverseOverlapResult> FitSegmentToOverlapResultMap;
41  typedef std::map<unsigned int, FitSegmentToOverlapResultMap> FitSegmentMatrix;
42  typedef std::map<unsigned int, FitSegmentMatrix> FitSegmentTensor;
43 
44  void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW);
45 
46  /**
47  * @brief Calculate the overlap result for given group of clusters
48  *
49  * @param pClusterU the cluster from the U view
50  * @param pClusterV the cluster from the V view
51  * @param pClusterW the cluster from the W view
52  * @param overlapResult to receive the overlap result
53  *
54  * @return statusCode, faster than throwing in regular use-cases
55  */
56  pandora::StatusCode CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV,
57  const pandora::Cluster *const pClusterW, TransverseOverlapResult &overlapResult);
58 
59  /**
60  * @brief Get the number of matched points for three fit segments and accompanying sliding fit results
61  *
62  * @param slidingFitResultU sliding fit result for u cluster
63  * @param slidingFitResultV sliding fit result for v cluster
64  * @param slidingFitResultW sliding fit result for w cluster
65  * @param fitSegmentTensor the fit segment tensor
66  */
67  void GetFitSegmentTensor(const TwoDSlidingFitResult &slidingFitResultU, const TwoDSlidingFitResult &slidingFitResultV,
68  const TwoDSlidingFitResult &slidingFitResultW, FitSegmentTensor &fitSegmentTensor) const;
69 
70  /**
71  * @brief Get the overlap result for three fit segments and the accompanying sliding fit results
72  *
73  * @param fitSegmentU the fit segment u
74  * @param fitSegmentV the fit segment v
75  * @param fitSegmentW the fit segment w
76  * @param slidingFitResultU sliding fit result for u cluster
77  * @param slidingFitResultV sliding fit result for v cluster
78  * @param slidingFitResultW sliding fit result for w cluster
79  * @param transverseOverlapResult to receive the transverse overlap result
80  *
81  * @return statusCode, faster than throwing in regular use-cases
82  */
83  pandora::StatusCode GetSegmentOverlap(const FitSegment &fitSegmentU, const FitSegment &fitSegmentV, const FitSegment &fitSegmentW,
84  const TwoDSlidingFitResult &slidingFitResultU, const TwoDSlidingFitResult &slidingFitResultV,
85  const TwoDSlidingFitResult &slidingFitResultW, TransverseOverlapResult &transverseOverlapResult) const;
86 
87  /**
88  * @brief Get the best overlap result, by examining the fit segment tensor
89  *
90  * @param fitSegmentTensor the fit segment tensor
91  * @param bestTransverseOverlapResult to receive the best transverse overlap result
92  */
93  void GetBestOverlapResult(const FitSegmentTensor &fitSegmentTensor, TransverseOverlapResult &bestTransverseOverlapResult) const;
94 
95  /**
96  * @brief Get track overlap results for possible connected segments
97  *
98  * @param indexU the index u
99  * @param indexV the index v
100  * @param indexW the index w
101  * @param transverseOverlapResultVector the transverse overlap result vector
102  */
103  void GetPreviousOverlapResults(const unsigned int indexU, const unsigned int indexV, const unsigned int indexW,
104  FitSegmentTensor &fitSegmentSumTensor, TransverseOverlapResultVector &transverseOverlapResultVector) const;
105 
107  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
108 
109  typedef std::vector<TransverseTensorTool *> TensorToolVector;
110  TensorToolVector m_algorithmToolVector; ///< The algorithm tool vector
111 
112  unsigned int m_nMaxTensorToolRepeats; ///< The maximum number of repeat loops over tensor tools
113  unsigned int m_maxFitSegmentIndex; ///< The maximum number of fit segments used when identifying best overlap result
114  float m_pseudoChi2Cut; ///< The pseudo chi2 cut to identify matched sampling points
115  float m_minSegmentMatchedFraction; ///< The minimum segment matched sampling fraction to allow segment grouping
116  unsigned int m_minSegmentMatchedPoints; ///< The minimum number of matched segment sampling points to allow segment grouping
117  float m_minOverallMatchedFraction; ///< The minimum matched sampling fraction to allow particle creation
118  unsigned int m_minOverallMatchedPoints; ///< The minimum number of matched segment sampling points to allow particle creation
119  float m_minSamplingPointsPerLayer; ///< The minimum number of sampling points per layer to allow particle creation
120 };
121 
122 //------------------------------------------------------------------------------------------------------------------------------------------
123 
124 /**
125  * @brief TransverseTensorTool class
126  */
127 class TransverseTensorTool : public pandora::AlgorithmTool
128 {
129 public:
131  typedef std::vector<TensorType::ElementList::const_iterator> IteratorList;
132 
133  /**
134  * @brief Run the algorithm tool
135  *
136  * @param pAlgorithm address of the calling algorithm
137  * @param overlapTensor the overlap tensor
138  *
139  * @return whether changes have been made by the tool
140  */
141  virtual bool Run(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor) = 0;
142 };
143 
144 } // namespace lar_content
145 
146 #endif // #ifndef LAR_THREE_VIEW_TRANSVERSE_TRACKS_ALGORITHM_H
NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > > BaseAlgorithm
Header file for the n view track matching algorithm class.
virtual bool Run(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)=0
Run the algorithm tool.
std::vector< TensorType::ElementList::const_iterator > IteratorList
std::map< unsigned int, FitSegmentMatrix > FitSegmentTensor
ThreeViewTransverseTracksAlgorithm::MatchingType::TensorType TensorType
float m_minSegmentMatchedFraction
The minimum segment matched sampling fraction to allow segment grouping.
float m_minOverallMatchedFraction
The minimum matched sampling fraction to allow particle creation.
std::map< unsigned int, FitSegmentToOverlapResultMap > FitSegmentMatrix
float m_pseudoChi2Cut
The pseudo chi2 cut to identify matched sampling points.
std::vector< TransverseOverlapResult > TransverseOverlapResultVector
void GetPreviousOverlapResults(const unsigned int indexU, const unsigned int indexV, const unsigned int indexW, FitSegmentTensor &fitSegmentSumTensor, TransverseOverlapResultVector &transverseOverlapResultVector) const
Get track overlap results for possible connected segments.
float m_minSamplingPointsPerLayer
The minimum number of sampling points per layer to allow particle creation.
void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)
Calculate cluster overlap result and store in container.
std::map< unsigned int, TransverseOverlapResult > FitSegmentToOverlapResultMap
TransverseOverlapResult class.
unsigned int m_minSegmentMatchedPoints
The minimum number of matched segment sampling points to allow segment grouping.
TensorToolVector m_algorithmToolVector
The algorithm tool vector.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Header file for the lar track overlap result class.
unsigned int m_maxFitSegmentIndex
The maximum number of fit segments used when identifying best overlap result.
Header file for the three view matching control class.
unsigned int m_minOverallMatchedPoints
The minimum number of matched segment sampling points to allow particle creation. ...
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
void GetFitSegmentTensor(const TwoDSlidingFitResult &slidingFitResultU, const TwoDSlidingFitResult &slidingFitResultV, const TwoDSlidingFitResult &slidingFitResultW, FitSegmentTensor &fitSegmentTensor) const
Get the number of matched points for three fit segments and accompanying sliding fit results...
void ExamineOverlapContainer()
Examine contents of overlap container, collect together best-matching 2D particles and modify cluster...
pandora::StatusCode GetSegmentOverlap(const FitSegment &fitSegmentU, const FitSegment &fitSegmentV, const FitSegment &fitSegmentW, const TwoDSlidingFitResult &slidingFitResultU, const TwoDSlidingFitResult &slidingFitResultV, const TwoDSlidingFitResult &slidingFitResultW, TransverseOverlapResult &transverseOverlapResult) const
Get the overlap result for three fit segments and the accompanying sliding fit results.
void GetBestOverlapResult(const FitSegmentTensor &fitSegmentTensor, TransverseOverlapResult &bestTransverseOverlapResult) const
Get the best overlap result, by examining the fit segment tensor.