HoughSeedFinderAlg.h
Go to the documentation of this file.
1 /**
2  * @file HoughSeedFinderAlg.h
3  *
4  * @brief This is an algorithm for finding recob::Seed objects in 3D clusters
5  *
6  */
7 #ifndef HoughSeedFinderAlg_h
8 #define HoughSeedFinderAlg_h
9 
10 // Framework includes
11 #include "fhiclcpp/fwd.h"
12 
13 // LArSoft includes
17 namespace geo {
18  class Geometry;
19 }
20 
21 // ROOT includes
22 #include "TCanvas.h"
23 class TFrame;
24 class TVector3;
25 class TVirtualPad;
26 
27 //------------------------------------------------------------------------------------------------------------------------------------------
28 
29 namespace lar_cluster3d {
30 
31  /**
32  * @brief HoughSeedFinderAlg class
33  */
34  class HoughSeedFinderAlg : public SeedFinderAlgBase {
35  public:
36  /**
37  * @brief Constructor
38  *
39  * @param pset
40  */
41  HoughSeedFinderAlg(fhicl::ParameterSet const& pset);
42 
43  /**
44  * @brief Given the list of hits this will search for candidate Seed objects and return them
45  */
46  bool findTrackSeeds(reco::HitPairListPtr& hitPairListPtr,
47  reco::PrincipalComponents& inputPCA,
48  SeedHitPairListPairVec& seedHitPairVec) const override;
49 
50  /**
51  * @brief Given the list of hits this will return the sets of hits which belong on the same line
52  */
53  bool findTrackHits(reco::HitPairListPtr& hitPairListPtr,
54  reco::PrincipalComponents& inputPCA,
55  reco::HitPairListPtrList& hitPairListPtrList) const;
56 
57  private:
58  /**
59  * @brief Using Principal Components Axis, look for gaps in a list of 3D hits
60  *
61  * @param inputHitList - input list of 3D hits to check
62  * @param pca - Principal Components Axis to use
63  * @param hitListList - output list of hit lists which are gap free
64  */
65  void findHitGaps(reco::HitPairListPtr& inputHitList, reco::HitPairListPtr& outputList) const;
66 
67  /**
68  * @brief Forward declaration of some of the objects necessary for hough transform
69  */
70 
71  class AccumulatorBin;
72  class SortHoughClusterList;
74 
75  // Basic structure for holding our accumlator bins (to avoid a full array)
76  // structure will be rho bin for first key, theta bin for second key
77  typedef std::pair<int, int> BinIndex;
78  typedef std::map<BinIndex, AccumulatorBin> RhoThetaAccumulatorBinMap;
79  typedef std::list<BinIndex> HoughCluster;
80  typedef std::list<HoughCluster> HoughClusterList;
81 
82  void HoughRegionQuery(BinIndex& curBin,
83  RhoThetaAccumulatorBinMap& rhoThetaAccumulatorBinMap,
84  HoughCluster& neighborPts,
85  size_t threshold) const;
86 
87  void expandHoughCluster(BinIndex& curBin,
88  HoughCluster& neighborPts,
89  HoughCluster& houghCluster,
90  RhoThetaAccumulatorBinMap& rhoThetaAccumulatorBinMap,
91  size_t threshold) const;
92 
93  void findHoughClusters(const reco::HitPairListPtr& inputHits,
95  int& nLoops,
96  RhoThetaAccumulatorBinMap& rhoThetaMap,
97  HoughClusterList& clusterList) const;
98 
99  /**
100  * @brief Given a list of candidate "seed" 3D hits, build the seed and get associated unique 2D hits
101  */
102  bool buildSeed(reco::HitPairListPtr& seed3DHits, SeedHitPairListPair& seedHitPair) const;
103 
104  void LineFit2DHits(std::set<const reco::ClusterHit2D*>& hitList,
105  double XOrigin,
106  TVector3& Pos,
107  TVector3& Dir,
108  double& ChiDOF) const;
109 
110  size_t m_minimum3DHits; ///<
111  int m_thetaBins; ///<
112  int m_rhoBins; ///<
113  size_t m_hiThresholdMin; ///<
114  double m_hiThresholdFrac; ///<
115  double m_loThresholdFrac; ///<
116  size_t m_numSeed2DHits; ///<
117  double m_numAveDocas; ///<
118  int m_numSkippedHits; ///<
119  int m_maxLoopsPerCluster; ///<
120  double m_maximumGap; ///<
121 
122  geo::Geometry const* m_geometry; // pointer to the Geometry service
123  PrincipalComponentsAlg m_pcaAlg; // For running Principal Components Analysis
124 
125  bool m_displayHist;
126  mutable std::vector<std::unique_ptr<TCanvas>> m_Canvases; ///< Graphical trace canvases.
127  mutable std::vector<TVirtualPad*> m_Pads; ///< View pads in current canvas.
128  };
129 
130 } // namespace lar_cluster3d
131 #endif
std::list< HitPairListPtr > HitPairListPtrList
Definition: Cluster3D.h:337
std::pair< recob::Seed, reco::HitPairListPtr > SeedHitPairListPair
std::list< HoughCluster > HoughClusterList
std::list< const reco::ClusterHit3D * > HitPairListPtr
Definition: Cluster3D.h:335
The geometry of one entire detector, as served by art.
Definition: Geometry.h:196
std::map< BinIndex, AccumulatorBin > RhoThetaAccumulatorBinMap
std::vector< SeedHitPairListPair > SeedHitPairListPairVec
LArSoft geometry interface.
Definition: ChannelGeo.h:16