All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MissingTrackSegmentTool.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArTransverseTrackMatching/MissingTrackSegmentTool.h
3  *
4  * @brief Header file for the missing track segment tool class.
5  *
6  * $Log: $
7  */
8 #ifndef MISSING_TRACK_SEGMENT_TOOL_H
9 #define MISSING_TRACK_SEGMENT_TOOL_H 1
10 
12 
13 #include <unordered_map>
14 
15 namespace lar_content
16 {
17 
18 /**
19  * @brief MissingTrackSegmentTool class
20  */
22 {
23 public:
24  /**
25  * @brief Default constructor
26  */
28 
29  bool Run(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor);
30 
31 private:
32  /**
33  * @brief Particle class
34  */
35  class Particle
36  {
37  public:
38  /**
39  * @brief Constructor
40  *
41  * @param element the tensor element
42  */
43  Particle(const TensorType::Element &element);
44 
45  const pandora::Cluster *m_pShortCluster; ///< Address of the short cluster
46  const pandora::Cluster *m_pCluster1; ///< Address of long cluster in view 1
47  const pandora::Cluster *m_pCluster2; ///< Address of long cluster in view 2
48  pandora::HitType m_shortHitType; ///< The hit type of the short cluster
49  pandora::HitType m_hitType1; ///< The hit type of the long cluster in view 1
50  pandora::HitType m_hitType2; ///< The hit type of the long cluster in view 2
51  float m_shortMinX; ///< The min x coordinate of the short cluster
52  float m_shortMaxX; ///< The max x coordinate of the short cluster
53  float m_longMinX; ///< The min x coordinate of the long clusters
54  float m_longMaxX; ///< The max x coordinate of the long clusters
55  };
56 
57  /**
58  * @brief SegmentOverlap class
59  */
61  {
62  public:
63  /**
64  * @brief Default constructor
65  */
67 
68  unsigned int m_nSamplingPoints; ///< The number of sampling points
69  unsigned int m_nMatchedSamplingPoints; ///< The number of matched sampling points
70  float m_pseudoChi2Sum; ///< The pseudo chi2 sum
71  float m_matchedSamplingMinX; ///< The min matched sampling point x coordinate
72  float m_matchedSamplingMaxX; ///< The max matched sampling point x coordinate
73  };
74 
75  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
76 
77  typedef std::unordered_map<const pandora::Cluster *, SegmentOverlap> SegmentOverlapMap;
78  typedef std::unordered_map<const pandora::Cluster *, pandora::ClusterList> ClusterMergeMap;
79 
80  /**
81  * @brief Find remaining tracks, hidden by missing track segments (and maybe other ambiguities) in the tensor
82  *
83  * @param pAlgorithm address of the calling algorithm
84  * @param overlapTensor the overlap tensor
85  * @param protoParticleVector to receive the list of proto particles
86  * @param clusterMergeMap to receive the cluster merge map
87  */
88  void FindTracks(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const TensorType &overlapTensor,
89  ProtoParticleVector &protoParticleVector, ClusterMergeMap &clusterMergeMap) const;
90 
91  /**
92  * @brief Select a list of the relevant elements from a set of connected tensor elements
93  *
94  * @param elementList the full list of connected tensor elements
95  * @param usedClusters the list of clusters already marked as to be added to a pfo
96  * @param iteratorList to receive a list of iterators to long track-like elements
97  */
98  void SelectElements(const TensorType::ElementList &elementList, const pandora::ClusterSet &usedClusters, IteratorList &iteratorList) const;
99 
100  /**
101  * @brief Whether a provided tensor element can be used to construct a pfo
102  *
103  * @param pAlgorithm address of the calling algorithm
104  * @param element the tensor element
105  * @param usedClusters the list of used clusters
106  * @param clusterMergeMap to receive the cluster merge map
107  */
108  bool PassesParticleChecks(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const TensorType::Element &element,
109  pandora::ClusterSet &usedClusters, ClusterMergeMap &clusterMergeMap) const;
110 
111  /**
112  * @brief Get a list of candidate clusters, which may represent missing track segments for a provided particle
113  *
114  * @param pAlgorithm address of the calling algorithm
115  * @param particle the particle
116  * @param candidateClusters to receive the list of candidate clusters
117  */
118  void GetCandidateClusters(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const Particle &particle, pandora::ClusterList &candidateClusters) const;
119 
120  /**
121  * @brief Get a sliding fit result map for the list of candidate clusters
122  *
123  * @param pAlgorithm address of the calling algorithm
124  * @param candidateClusters the list of candidate clusters
125  * @param slidingFitResultMap to receive the sliding fit result map
126  */
127  void GetSlidingFitResultMap(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const pandora::ClusterList &candidateClusterList,
128  TwoDSlidingFitResultMap &slidingFitResultMap) const;
129 
130  /**
131  * @brief Get a segment overlap map, describing overlap between a provided particle and all clusters in a sliding fit result map
132  *
133  * @param pAlgorithm address of the calling algorithm
134  * @param particle the particle
135  * @param slidingFitResultMap the sliding fit result map
136  * @param segmentOverlapMap to receive the segment overlap map
137  */
138  void GetSegmentOverlapMap(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const Particle &particle,
139  const TwoDSlidingFitResultMap &slidingFitResultMap, SegmentOverlapMap &segmentOverlapMap) const;
140 
141  /**
142  * @brief Make decisions about whether to create a pfo for a provided particle and whether to make cluster merges
143  *
144  * @param particle the particle
145  * @param slidingFitResultMap the sliding fit result map
146  * @param segmentOverlapMap the segment overlap map
147  * @param usedClusters the list of used clusters
148  * @param clusterMergeMap to receive details of cluster merges clusterMergeMap
149  *
150  * @return whether to make the particle
151  */
152  bool MakeDecisions(const Particle &particle, const TwoDSlidingFitResultMap &slidingFitResultMap,
153  const SegmentOverlapMap &segmentOverlapMap, pandora::ClusterSet &usedClusters, ClusterMergeMap &clusterMergeMap) const;
154 
155  /**
156  * @brief Whether the segment overlap object passes cuts on matched sampling points, etc.
157  *
158  * @param segmentOverlap the segment overlap
159  *
160  * @return boolean
161  */
162  bool PassesSamplingCuts(const SegmentOverlap &segmentOverlap) const;
163 
164  /**
165  * @brief Whether the cluster could be merged with the candidate particle
166  *
167  * @param pCluster address of the cluster
168  * @param particle the particle
169  * @param segmentOverlap the segment overlap
170  * @param slidingFitResultMap the sliding fit result map
171  *
172  * @return boolean
173  */
174  bool IsPossibleMerge(const pandora::Cluster *const pCluster, const Particle &particle, const SegmentOverlap &segmentOverlap,
175  const TwoDSlidingFitResultMap &slidingFitResultMap) const;
176 
177  float m_minMatchedFraction; ///< The min matched sampling point fraction for particle creation
178  unsigned int m_minMatchedSamplingPoints; ///< The min number of matched sampling points for particle creation
179  unsigned int m_minMatchedSamplingPointRatio; ///< The min ratio between 1st and 2nd highest msps for simple ambiguity resolution
180 
181  float m_minInitialXOverlapFraction; ///< The min x overlap fraction (between long clusters and short cluster vs. shared overlap)
182  float m_minFinalXOverlapFraction; ///< The min x overlap fraction between extended short cluster and the long clusters
183 
184  unsigned int m_minCaloHitsInCandidateCluster; ///< The min no. of calo hits in a candidate cluster, for matching with long clusters
185  float m_pseudoChi2Cut; ///< The pseudo chi2 cut to determine whether a sampling point is matched
186 
187  unsigned int m_makePfoMinSamplingPoints; ///< The min number of sampling points in order to be able to make pfo
188  unsigned int m_makePfoMinMatchedSamplingPoints; ///< The min number of matched sampling points in order to be able to make pfo
189  float m_makePfoMinMatchedFraction; ///< The min matched sampling point fraction in order to be able to make pfo
190  float m_makePfoMaxImpactParameter; ///< The max transverse impact parameter in order to be able to make pfo
191 
192  float m_mergeMaxChi2PerSamplingPoint; ///< The max value of chi2 per sampling point in order to merge cluster with parent
193  float m_mergeXContainmentTolerance; ///< The tolerance in determining whether candidate cluster is contained in x window
194 };
195 
196 //------------------------------------------------------------------------------------------------------------------------------------------
197 
199  m_nSamplingPoints(0),
200  m_nMatchedSamplingPoints(0),
201  m_pseudoChi2Sum(0.f),
202  m_matchedSamplingMinX(std::numeric_limits<float>::max()),
203  m_matchedSamplingMaxX(-std::numeric_limits<float>::max())
204 {
205 }
206 
207 } // namespace lar_content
208 
209 #endif // #ifndef MISSING_TRACK_SEGMENT_TOOL_H
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
float m_longMaxX
The max x coordinate of the long clusters.
std::vector< ProtoParticle > ProtoParticleVector
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
const pandora::Cluster * m_pShortCluster
Address of the short cluster.
std::vector< TensorType::ElementList::const_iterator > IteratorList
void GetSegmentOverlapMap(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const Particle &particle, const TwoDSlidingFitResultMap &slidingFitResultMap, SegmentOverlapMap &segmentOverlapMap) const
Get a segment overlap map, describing overlap between a provided particle and all clusters in a slidi...
bool IsPossibleMerge(const pandora::Cluster *const pCluster, const Particle &particle, const SegmentOverlap &segmentOverlap, const TwoDSlidingFitResultMap &slidingFitResultMap) const
Whether the cluster could be merged with the candidate particle.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterMergeMap
float m_matchedSamplingMaxX
The max matched sampling point x coordinate.
float m_minInitialXOverlapFraction
The min x overlap fraction (between long clusters and short cluster vs. shared overlap) ...
bool PassesParticleChecks(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const TensorType::Element &element, pandora::ClusterSet &usedClusters, ClusterMergeMap &clusterMergeMap) const
Whether a provided tensor element can be used to construct a pfo.
float m_matchedSamplingMinX
The min matched sampling point x coordinate.
void GetCandidateClusters(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const Particle &particle, pandora::ClusterList &candidateClusters) const
Get a list of candidate clusters, which may represent missing track segments for a provided particle...
bool Run(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
bool MakeDecisions(const Particle &particle, const TwoDSlidingFitResultMap &slidingFitResultMap, const SegmentOverlapMap &segmentOverlapMap, pandora::ClusterSet &usedClusters, ClusterMergeMap &clusterMergeMap) const
Make decisions about whether to create a pfo for a provided particle and whether to make cluster merg...
unsigned int m_makePfoMinMatchedSamplingPoints
The min number of matched sampling points in order to be able to make pfo.
float m_makePfoMaxImpactParameter
The max transverse impact parameter in order to be able to make pfo.
const pandora::Cluster * m_pCluster1
Address of long cluster in view 1.
unsigned int m_minCaloHitsInCandidateCluster
The min no. of calo hits in a candidate cluster, for matching with long clusters. ...
std::unordered_map< const pandora::Cluster *, SegmentOverlap > SegmentOverlapMap
unsigned int m_nSamplingPoints
The number of sampling points.
Header file for the three view transverse tracks algorithm class.
void SelectElements(const TensorType::ElementList &elementList, const pandora::ClusterSet &usedClusters, IteratorList &iteratorList) const
Select a list of the relevant elements from a set of connected tensor elements.
void FindTracks(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector, ClusterMergeMap &clusterMergeMap) const
Find remaining tracks, hidden by missing track segments (and maybe other ambiguities) in the tensor...
const pandora::Cluster * m_pCluster2
Address of long cluster in view 2.
float m_pseudoChi2Cut
The pseudo chi2 cut to determine whether a sampling point is matched.
pandora::HitType m_hitType1
The hit type of the long cluster in view 1.
unsigned int m_minMatchedSamplingPointRatio
The min ratio between 1st and 2nd highest msps for simple ambiguity resolution.
unsigned int m_makePfoMinSamplingPoints
The min number of sampling points in order to be able to make pfo.
std::unordered_map< const pandora::Cluster *, TwoDSlidingFitResult > TwoDSlidingFitResultMap
float m_minFinalXOverlapFraction
The min x overlap fraction between extended short cluster and the long clusters.
float m_longMinX
The min x coordinate of the long clusters.
float m_mergeXContainmentTolerance
The tolerance in determining whether candidate cluster is contained in x window.
unsigned int m_nMatchedSamplingPoints
The number of matched sampling points.
pandora::HitType m_shortHitType
The hit type of the short cluster.
MissingTrackSegmentTool class.
Particle(const TensorType::Element &element)
Constructor.
bool PassesSamplingCuts(const SegmentOverlap &segmentOverlap) const
Whether the segment overlap object passes cuts on matched sampling points, etc.
float m_makePfoMinMatchedFraction
The min matched sampling point fraction in order to be able to make pfo.
float m_shortMaxX
The max x coordinate of the short cluster.
float m_mergeMaxChi2PerSamplingPoint
The max value of chi2 per sampling point in order to merge cluster with parent.
float m_shortMinX
The min x coordinate of the short cluster.
void GetSlidingFitResultMap(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, const pandora::ClusterList &candidateClusterList, TwoDSlidingFitResultMap &slidingFitResultMap) const
Get a sliding fit result map for the list of candidate clusters.
pandora::HitType m_hitType2
The hit type of the long cluster in view 2.