LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ThreeViewTrackFragmentsAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_THREE_VIEW_TRACK_FRAGMENTS_ALGORITHM_H
9 #define LAR_THREE_VIEW_TRACK_FRAGMENTS_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 #include "Pandora/AlgorithmTool.h"
13 
15 
18 
19 #include <unordered_map>
20 
21 namespace lar_content
22 {
23 
24 class FragmentTensorTool;
25 
26 //------------------------------------------------------------------------------------------------------------------------------------------
27 
31 class ThreeViewTrackFragmentsAlgorithm : public NViewTrackMatchingAlgorithm<ThreeViewMatchingControl<FragmentOverlapResult>>
32 {
33 public:
35 
40 
41  void UpdateForNewCluster(const pandora::Cluster *const pNewCluster);
42 
49  void RebuildClusters(const pandora::ClusterList &rebuildList, pandora::ClusterList &newClusters) const;
50 
51 protected:
52  void PerformMainLoop();
53  void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW);
54 
66  pandora::StatusCode CalculateOverlapResult(const TwoDSlidingFitResult &fitResult1, const TwoDSlidingFitResult &fitResult2,
67  const pandora::ClusterList &inputClusterList, const pandora::Cluster *&pBestMatchedCluster, FragmentOverlapResult &fragmentOverlapResult) const;
68 
69  typedef std::unordered_map<const pandora::CaloHit *, const pandora::Cluster *> HitToClusterMap;
70 
80  pandora::StatusCode GetProjectedPositions(const TwoDSlidingFitResult &fitResult1, const TwoDSlidingFitResult &fitResult2,
81  pandora::CartesianPointVector &projectedPositions) const;
82 
93  pandora::StatusCode GetMatchedHits(const pandora::ClusterList &inputClusterList, const pandora::CartesianPointVector &projectedPositions,
94  HitToClusterMap &hitToClusterMap, pandora::CaloHitList &matchedCaloHits) const;
95 
106  pandora::StatusCode GetMatchedClusters(const pandora::CaloHitList &matchedHits, const HitToClusterMap &hitToClusterMap,
107  pandora::ClusterList &matchedClusters, const pandora::Cluster *&pBestMatchedCluster) const;
108 
117  void GetFragmentOverlapResult(const pandora::CartesianPointVector &projectedPositions, const pandora::CaloHitList &matchedHits,
118  const pandora::ClusterList &matchedClusters, FragmentOverlapResult &fragmentOverlapResult) const;
119 
128  bool CheckMatchedClusters(const pandora::CartesianPointVector &projectedPositions, const pandora::ClusterList &matchedClusters) const;
129 
137  bool CheckOverlapResult(const FragmentOverlapResult &overlapResult) const;
138 
140  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
141 
142  typedef std::unordered_map<const pandora::Cluster *, unsigned int> ClusterToMatchedHitsMap;
143 
145 
146  typedef std::vector<FragmentTensorTool *> TensorToolVector;
147  TensorToolVector m_algorithmToolVector;
148 
149  unsigned int m_nMaxTensorToolRepeats;
150 
155  unsigned int m_minMatchedHits;
156 };
157 
158 //------------------------------------------------------------------------------------------------------------------------------------------
159 
163 class FragmentTensorTool : public pandora::AlgorithmTool
164 {
165 public:
167  typedef std::vector<TensorType::ElementList::const_iterator> IteratorList;
168 
177  virtual bool Run(ThreeViewTrackFragmentsAlgorithm *const pAlgorithm, TensorType &overlapTensor) = 0;
178 };
179 
180 } // namespace lar_content
181 
182 #endif // #ifndef LAR_THREE_VIEW_TRACK_FRAGMENTS_ALGORITHM_H
FragmentOverlapResult class.
void RebuildClusters(const pandora::ClusterList &rebuildList, pandora::ClusterList &newClusters) const
Rebuild clusters after fragmentation.
Header file for the n view track matching algorithm class.
void GetFragmentOverlapResult(const pandora::CartesianPointVector &projectedPositions, const pandora::CaloHitList &matchedHits, const pandora::ClusterList &matchedClusters, FragmentOverlapResult &fragmentOverlapResult) const
Get the populated fragment overlap result.
void PerformMainLoop()
Main loop over cluster combinations in order to populate the overlap container. Responsible for calli...
pandora::StatusCode GetMatchedClusters(const pandora::CaloHitList &matchedHits, const HitToClusterMap &hitToClusterMap, pandora::ClusterList &matchedClusters, const pandora::Cluster *&pBestMatchedCluster) const
Get the list of the relevant clusters and the address of the single best matched cluster.
pandora::StatusCode GetProjectedPositions(const TwoDSlidingFitResult &fitResult1, const TwoDSlidingFitResult &fitResult2, pandora::CartesianPointVector &projectedPositions) const
Get the list of projected positions, in the third view, corresponding to a pair of sliding fit result...
std::unordered_map< const pandora::Cluster *, unsigned int > ClusterToMatchedHitsMap
unsigned int m_minMatchedHits
minimum number of matched calo hits
NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< FragmentOverlapResult > > BaseAlgorithm
void ExamineOverlapContainer()
Examine contents of overlap container, collect together best-matching 2D particles and modify cluster...
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)
Update to reflect addition of a new cluster to the problem space.
bool CheckOverlapResult(const FragmentOverlapResult &overlapResult) const
Whether the matched clusters and hits pass the algorithm quality cuts.
std::string m_reclusteringAlgorithmName
Name of daughter algorithm to use for cluster re-building.
std::vector< TensorType::ElementList::const_iterator > IteratorList
ThreeViewTrackFragmentsAlgorithm::MatchingType::TensorType TensorType
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.
bool CheckMatchedClusters(const pandora::CartesianPointVector &projectedPositions, const pandora::ClusterList &matchedClusters) const
Whether the matched clusters are consistent with the projected positions.
Header file for the lar track overlap result class.
TensorToolVector m_algorithmToolVector
The algorithm tool list.
Header file for the three view matching control class.
std::unordered_map< const pandora::CaloHit *, const pandora::Cluster * > HitToClusterMap
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
float m_minXOverlapFraction
requirement on minimum X overlap fraction for associated clusters
float m_maxPointDisplacementSquared
maximum allowed distance (squared) between projected points and associated hits
float m_minXOverlap
requirement on minimum X overlap for associated clusters
float m_minMatchedSamplingPointFraction
minimum fraction of matched sampling points
pandora::StatusCode GetMatchedHits(const pandora::ClusterList &inputClusterList, const pandora::CartesianPointVector &projectedPositions, HitToClusterMap &hitToClusterMap, pandora::CaloHitList &matchedCaloHits) const
Get the list of hits associated with the projected positions and a useful hit to cluster map...