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