LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ThreeDTrackFragmentsAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_THREE_D_TRACK_FRAGMENTS_ALGORITHM_H
9 #define LAR_THREE_D_TRACK_FRAGMENTS_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 #include "Pandora/AlgorithmTool.h"
13 
15 
17 
18 #include <unordered_map>
19 
20 namespace lar_content
21 {
22 
23 class FragmentTensorTool;
24 
25 //------------------------------------------------------------------------------------------------------------------------------------------
26 
30 class ThreeDTrackFragmentsAlgorithm : public ThreeDTracksBaseAlgorithm<FragmentOverlapResult>
31 {
32 public:
37 
38  void UpdateForNewCluster(const pandora::Cluster *const pNewCluster);
39 
46  void RebuildClusters(const pandora::ClusterList &rebuildList, pandora::ClusterList &newClusters) const;
47 
48 protected:
49  void PerformMainLoop();
50  void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW);
51 
63  pandora::StatusCode CalculateOverlapResult(const TwoDSlidingFitResult &fitResult1, const TwoDSlidingFitResult &fitResult2,
64  const pandora::ClusterList &inputClusterList, const pandora::Cluster *&pBestMatchedCluster, FragmentOverlapResult &fragmentOverlapResult) const;
65 
66  typedef std::unordered_map<const pandora::CaloHit*, const pandora::Cluster*> HitToClusterMap;
67 
77  pandora::StatusCode GetProjectedPositions(const TwoDSlidingFitResult &fitResult1, const TwoDSlidingFitResult &fitResult2,
78  pandora::CartesianPointVector &projectedPositions) const;
79 
90  pandora::StatusCode GetMatchedHits(const pandora::ClusterList &inputClusterList, const pandora::CartesianPointVector &projectedPositions,
91  HitToClusterMap &hitToClusterMap, pandora::CaloHitList &matchedCaloHits) const;
92 
103  pandora::StatusCode GetMatchedClusters(const pandora::CaloHitList &matchedHits, const HitToClusterMap &hitToClusterMap,
104  pandora::ClusterList &matchedClusters, const pandora::Cluster *&pBestMatchedCluster) const;
105 
114  void GetFragmentOverlapResult(const pandora::CartesianPointVector &projectedPositions, const pandora::CaloHitList &matchedHits,
115  const pandora::ClusterList &matchedClusters, FragmentOverlapResult &fragmentOverlapResult) const;
116 
125  bool CheckMatchedClusters(const pandora::CartesianPointVector &projectedPositions, const pandora::ClusterList &matchedClusters) const;
126 
134  bool CheckOverlapResult(const FragmentOverlapResult &overlapResult) const;
135 
136  void ExamineTensor();
137  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
138 
139  typedef std::unordered_map<const pandora::Cluster*, unsigned int> ClusterToMatchedHitsMap;
140 
142 
143  typedef std::vector<FragmentTensorTool*> TensorToolVector;
144  TensorToolVector m_algorithmToolVector;
145 
146  unsigned int m_nMaxTensorToolRepeats;
147 
152  unsigned int m_minMatchedHits;
153 };
154 
155 //------------------------------------------------------------------------------------------------------------------------------------------
156 
160 class FragmentTensorTool : public pandora::AlgorithmTool
161 {
162 public:
164  typedef std::vector<TensorType::ElementList::const_iterator> IteratorList;
165 
174  virtual bool Run(ThreeDTrackFragmentsAlgorithm *const pAlgorithm, TensorType &overlapTensor) = 0;
175 };
176 
177 } // namespace lar_content
178 
179 #endif // #ifndef LAR_THREE_D_TRACK_FRAGMENTS_ALGORITHM_H
float m_minMatchedSamplingPointFraction
minimum fraction of matched sampling points
FragmentOverlapResult class.
void ExamineTensor()
Examine contents of tensor, collect together best-matching 2D particles and modify clusters as requir...
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void PerformMainLoop()
Main loop over cluster combinations in order to populate the tensor. Responsible for calling Calculat...
void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)
Calculate cluster overlap result and store in tensor.
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...
ThreeDTrackFragmentsAlgorithm::TensorType TensorType
void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)
Update to reflect addition of a new cluster to the problem space.
std::unordered_map< const pandora::CaloHit *, const pandora::Cluster * > HitToClusterMap
std::unordered_map< const pandora::Cluster *, unsigned int > ClusterToMatchedHitsMap
ThreeDTransverseTracksAlgorithm class.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
std::string m_reclusteringAlgorithmName
Name of daughter algorithm to use for cluster re-building.
std::vector< TensorType::ElementList::const_iterator > IteratorList
bool CheckMatchedClusters(const pandora::CartesianPointVector &projectedPositions, const pandora::ClusterList &matchedClusters) const
Whether the matched clusters are consistent with the projected positions.
unsigned int m_minMatchedHits
minimum number of matched calo hits
TensorToolVector m_algorithmToolVector
The algorithm tool list.
float m_minXOverlapFraction
requirement on minimum X overlap fraction for associated clusters
Header file for the lar track overlap result class.
bool CheckOverlapResult(const FragmentOverlapResult &overlapResult) const
Whether the matched clusters and hits pass the algorithm quality cuts.
Header file for the three dimensional tracks algorithm base class.
std::vector< FragmentTensorTool * > TensorToolVector
float m_minXOverlap
requirement on minimum X overlap for associated clusters
float m_maxPointDisplacementSquared
maximum allowed distance (squared) between projected points and associated hits
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...
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.
void GetFragmentOverlapResult(const pandora::CartesianPointVector &projectedPositions, const pandora::CaloHitList &matchedHits, const pandora::ClusterList &matchedClusters, FragmentOverlapResult &fragmentOverlapResult) const
Get the populated fragment overlap result.
void RebuildClusters(const pandora::ClusterList &rebuildList, pandora::ClusterList &newClusters) const
Rebuild clusters after fragmentation.