TwoViewTransverseTracksAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArTwoViewMatching/TwoViewTransverseTracksAlgorithm.h
3  *
4  * @brief Header file for the two view transverse tracks algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_TWO_VIEW_TRANSVERSE_TRACKS_ALGORITHM_H
9 #define LAR_TWO_VIEW_TRANSVERSE_TRACKS_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 #include "Pandora/AlgorithmTool.h"
13 
16 
19 
20 #include <random>
21 
22 namespace lar_content
23 {
24 
25 class TransverseMatrixTool;
26 
27 //------------------------------------------------------------------------------------------------------------------------------------------
28 
29 /**
30  * @brief TwoViewTransverseTracksAlgorithm class
31  */
32 class TwoViewTransverseTracksAlgorithm : public NViewTrackMatchingAlgorithm<TwoViewMatchingControl<TwoViewTransverseOverlapResult>>
33 {
34 public:
36  typedef std::set<unsigned int> UIntSet;
37 
38  /**
39  * @brief Default constructor
40  */
42 
43 private:
44  void CalculateOverlapResult(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const);
45 
46  /**
47  * @brief Calculates the two view overlap result
48  *
49  * @param pCluster1 the view 0 cluster
50  * @param pCluster2 the view 1 cluster
51  * @param overlapResult the two view overlap result
52  */
53  pandora::StatusCode CalculateOverlapResult(
54  const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, TwoViewTransverseOverlapResult &overlapResult);
55 
56  /**
57  * @brief Calculates the number of the sliding windows that contains charge bins that locally match
58  *
59  * @param discreteProbabilityVector1 the view 0 discrete probability vector containing the charge information
60  * @param pCluster2 the view 1 discrete probability vector containing the charge information
61  * @param randomNumberGenerator a seeded random number generator
62  *
63  * @result the number of locally matching sampling points
64  */
65  unsigned int CalculateNumberOfLocallyMatchingSamplingPoints(const DiscreteProbabilityVector &discreteProbabilityVector1,
66  const DiscreteProbabilityVector &discreteProbabilityVector2, std::mt19937 &randomNumberGenerator);
67 
68  /**
69  * @brief Get the dot product between the cluster's primary axis and the drift axis
70  *
71  * @param pCluster the cluster
72  *
73  * @result dot product
74  */
75  float GetPrimaryAxisDotDriftAxis(const pandora::Cluster *const pCluster);
76 
78  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
79 
80  typedef std::vector<TransverseMatrixTool *> MatrixToolVector;
81  MatrixToolVector m_algorithmToolVector; ///< The algorithm tool vector
82 
83  unsigned int m_nMaxMatrixToolRepeats; ///< The maximum number of repeat loops over matrix tools
84  unsigned int m_downsampleFactor; ///< The downsampling (hit merging) applied to hits in the overlap region
85  unsigned int m_minSamples; ///< The minimum number of samples needed for comparing charges
86  unsigned int m_nPermutations; ///< The number of permutations for calculating p-values
87  float m_localMatchingScoreThreshold; ///< The minimum score to classify a local region as matching
88  float m_maxDotProduct; ///M The maximum allowed cluster primary qxis Dot drift axis to fill the overlap result
89  float m_minOverallMatchingScore; ///< The minimum required global matching score to fill the overlap result
90  float m_minOverallLocallyMatchedFraction; ///< The minimum required lcoally matched fraction to fill the overlap result
91  std::mt19937 m_randomNumberGenerator; ///< The random number generator
92 };
93 
94 //------------------------------------------------------------------------------------------------------------------------------------------
95 
96 /**
97  * @brief TransverseMatrixTool class
98  */
99 class TransverseMatrixTool : public pandora::AlgorithmTool
100 {
101 public:
103  typedef std::vector<MatrixType::ElementList::const_iterator> IteratorList;
104 
105  /**
106  * @brief Run the algorithm tool
107  *
108  * @param pAlgorithm address of the calling algorithm
109  * @param overlapMatrix the overlap matrix
110  *
111  * @return whether changes have been made by the tool
112  */
113  virtual bool Run(TwoViewTransverseTracksAlgorithm *const pAlgorithm, MatrixType &overlapMatrix) = 0;
114 };
115 
116 } // namespace lar_content
117 
118 #endif // #ifndef LAR_TWO_VIEW_TRANSVERSE_TRACKS_ALGORITHM_H
Header file for the n view track matching algorithm class.
std::mt19937 m_randomNumberGenerator
The random number generator.
float m_localMatchingScoreThreshold
The minimum score to classify a local region as matching.
MatrixToolVector m_algorithmToolVector
The algorithm tool vector.
NViewTrackMatchingAlgorithm< TwoViewMatchingControl< TwoViewTransverseOverlapResult > > BaseAlgorithm
TwoViewTransverseTracksAlgorithm::MatchingType::MatrixType MatrixType
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float GetPrimaryAxisDotDriftAxis(const pandora::Cluster *const pCluster)
Get the dot product between the cluster&#39;s primary axis and the drift axis.
Header file for the lar discrete probability vector class.
unsigned int m_nPermutations
The number of permutations for calculating p-values.
unsigned int CalculateNumberOfLocallyMatchingSamplingPoints(const DiscreteProbabilityVector &discreteProbabilityVector1, const DiscreteProbabilityVector &discreteProbabilityVector2, std::mt19937 &randomNumberGenerator)
Calculates the number of the sliding windows that contains charge bins that locally match...
unsigned int m_minSamples
The minimum number of samples needed for comparing charges.
float m_minOverallMatchingScore
M The maximum allowed cluster primary qxis Dot drift axis to fill the overlap result.
float m_minOverallLocallyMatchedFraction
The minimum required lcoally matched fraction to fill the overlap result.
void ExamineOverlapContainer()
Examine contents of overlap container, collect together best-matching 2D particles and modify cluster...
unsigned int m_downsampleFactor
The downsampling (hit merging) applied to hits in the overlap region.
std::vector< MatrixType::ElementList::const_iterator > IteratorList
Header file for the two view matching control class.
void CalculateOverlapResult(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const)
Calculate cluster overlap result and store in container.
Header file for the lar track two view overlap result class.
unsigned int m_nMaxMatrixToolRepeats
The maximum number of repeat loops over matrix tools.