GridSearch.h
Go to the documentation of this file.
1 ///
2 /// \file GridSearch.h
3 /// \brief TODO
4 /// \version $Id: GridSearch.h,v 1.7 2012-10-04 21:23:23 messier Exp $
5 /// \author messier@indiana.edu
6 ///
7 #ifndef EARMS_GRIDSEARCH_H
8 #define EARMS_GRIDSEARCH_H
9 
10 #include <vector>
11 
12 namespace rb { class HoughResult; }
13 namespace earms { class ElasticArms; }
14 
15 namespace earms
16 {
17  ///
18  /// Implement a grid search over a specified range of verticies and
19  /// directions
20  ///
21  class GridSearch
22  {
23  public:
24  ///
25  /// Construct an object to search for a good elastic arms seed
26  ///
27  /// \param xmn - Lower edge of vertex box [cm]
28  /// \param xmx - Upper edge of vertex box [cm]
29  /// \param ymn - Lower edge of vertex box [cm]
30  /// \param ymx - Upper edge of vertex box [cm]
31  /// \param zmn - Lower edge of vertex box [cm]
32  /// \param zmx - Upper edge of vertex box [cm]
33  /// \param colinear - Cut on dot product to determin colinearity
34  /// \param nseeddir - How many seed directions to check
35  GridSearch(double xmn, double xmx,
36  double ymn, double ymx,
37  double zmn, double zmx,
38  double colinear,
39  unsigned int nseeddir);
40  ///
41  /// Add a vertex point to the list to be considered
42  ///
43  /// \param x,y,z - vertex location (cm)
44  ///
45  void AddVertex(double x, double y, double z);
46 
47  ///
48  /// Add a collection of vertex seeds near the hit locations
49  /// specified by f
50  ///
51  /// \param f - a list of percentages marking hits to choose
52  ///
53  void AddVtxPoints(const ElasticArms& arms,
54  const std::vector<double>& mx,
55  const std::vector<double>& bx,
56  const std::vector<double>& my,
57  const std::vector<double>& by,
58  const std::vector<double>& f);
59 
60  ///
61  /// Produce a list of vertex seed locations from the hough
62  /// analysis
63  ///
64  /// \param hrx - Hough results for the x view
65  /// \param hry - Hough results for the y view
66  /// \param nmx - Maximum number of hough results to use
67  /// \param nmh - Number of hough lines to match in other view
68  /// \param flipped - Used internally when hrx <-> hry
69  ///
70  void AddHoughIntersections(const rb::HoughResult& hrx,
71  const rb::HoughResult& hry,
72  unsigned int nmx,
73  unsigned int nmh,
74  bool flipped=false);
75  ///
76  /// Add a direction in spherical coordinates to the list of arm
77  /// directions to be considered.
78  ///
79  /// \param theta, phi - spherical coordinates of arm direction
80  ///
81  void AddDirection(double theta, double phi);
82 
83  ///
84  /// Make a list of some standard direction vectors
85  ///
86  void SetStandardDirections();
87 
88  ///
89  /// Choose the direction of prong i which gives the least energy
90  ///
91  /// \return The best energy found in selecting this arm. Leaves
92  /// arms in best state found.
93  ///
94  double ChooseBestProngDir(ElasticArms& arms, unsigned int i);
95 
96  ///
97  /// Loop over vertex and direction seeds looking for the best
98  /// choice.
99  ///
100  /// \return The best energy found. Leaves 'arms' in the best state
101  /// found
102  ///
103  double FindBestVtx(ElasticArms& arms);
104 
105  public:
106  double fXmin; ///< Only consider vertex locations inside a box [cm]
107  double fXmax; ///< Only consider vertex locations inside a box [cm]
108  double fYmin; ///< Only consider vertex locations inside a box [cm]
109  double fYmax; ///< Only consider vertex locations inside a box [cm]
110  double fZmin; ///< Only consider vertex locations inside a box [cm]
111  double fZmax; ///< Only consider vertex locations inside a box [cm]
112  double fColinear; ///< |dot product|>fColinear means lines are colinear
113  unsigned int fNseedDir; ///< How many default seed directoins to check
114 
115  std::vector<double> fX; ///< List of vertex x coordinates
116  std::vector<double> fY; ///< List of vertex y coordinates
117  std::vector<double> fZ; ///< List of vertex z coorfinates
118  std::vector<double> fTheta; ///< List of prong directions
119  std::vector<double> fPhi; ///< List of prong directions
120  };
121 }
122 
123 #endif
124 ////////////////////////////////////////////////////////////////////////
double fYmin
Only consider vertex locations inside a box [cm].
Definition: GridSearch.h:108
std::vector< double > fPhi
List of prong directions.
Definition: GridSearch.h:119
double fColinear
|dot product|>fColinear means lines are colinear
Definition: GridSearch.h:112
std::vector< double > fZ
List of vertex z coorfinates.
Definition: GridSearch.h:117
std::vector< double > fTheta
List of prong directions.
Definition: GridSearch.h:118
Elastic Arms vertex finding algorithm.
unsigned int fNseedDir
How many default seed directoins to check.
Definition: GridSearch.h:113
double fZmax
Only consider vertex locations inside a box [cm].
Definition: GridSearch.h:111
std::vector< double > fY
List of vertex y coordinates.
Definition: GridSearch.h:116
Perform a "2 point" Hough transform on a collection of hits.
double fXmax
Only consider vertex locations inside a box [cm].
Definition: GridSearch.h:107
z
Definition: test.py:28
double fXmin
Only consider vertex locations inside a box [cm].
Definition: GridSearch.h:106
double fYmax
Only consider vertex locations inside a box [cm].
Definition: GridSearch.h:109
std::vector< double > fX
List of vertex x coordinates.
Definition: GridSearch.h:115
double fZmin
Only consider vertex locations inside a box [cm].
Definition: GridSearch.h:110
Summary from a Hough transform applied to a group of cell hits.
Definition: HoughResult.h:35