HoughResult.cxx
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////////////////
2 /// \file HoughResult.cxx
3 /// \brief Data resulting from a Hough transform on the cell hit positions
4 /// \version $Id: HoughResult.cxx,v 1.4 2011-12-15 18:42:19 mbaird42 Exp $
5 /// \author messier@indiana.edu
6 /////////////////////////////////////////////////////////////////////////////
7 #include "RecoBase/HoughResult.h"
8 
9 #include <algorithm>
10 #include <cassert>
11 #include <cmath>
12 
13 namespace rb
14 {
15  //.....................................................................
17  fRho(0),
18  fTheta(0),
19  fH(0),
20  fThr(0.0),
21  fSR(0),
22  fST(0)
23  { }
24 
25  //......................................................................
26 
27  HoughPeak::HoughPeak(double r, double q, double h, double thr, double sr, double st) :
28  fRho(r),
29  fTheta(q),
30  fH(h),
31  fThr(thr),
32  fSR(sr),
33  fST(st)
34  { }
35 
36  //......................................................................
37 
39  fView(geo::kXorY),
40  fTNSlo(0),
41  fTNShi(0),
42  fXY0(0),
43  fZ0(0)
44  { }
45 
46  //......................................................................
47 
49  double tlo,
50  double thi,
51  double xy0,
52  double z0) :
53  fView(v),
54  fTNSlo(tlo),
55  fTNShi(thi),
56  fXY0(xy0),
57  fZ0(z0)
58  { }
59 
60  //......................................................................
61 
62  void HoughResult::SlopeIcept(unsigned int i, double* m, double* b) const
63  {
64  assert(i<fPeak.size());
65  double s = sin(fPeak[i].fTheta);
66  double c = cos(fPeak[i].fTheta);
67  if (s==0.0) s = 1.0E-9;
68  //
69  // Put the slope and intercepts into detector coordinates
70  //
71  *m = -c/s;
72  *b = fPeak[i].fRho/s - (*m)*fZ0 + fXY0;
73  }
74 
75  //......................................................................
76 
77  static bool compare_peaks(const HoughPeak& a, const HoughPeak& b)
78  {
79  return a.fH>b.fH;
80  }
81  //......................................................................
82 
84  {
85  sort(fPeak.begin(), fPeak.end(), compare_peaks);
86  }
87 
88 } // end namespace rb
89 ////////////////////////////////////////////////////////////////////////
double fXY0
X/Y offset applied to hits.
Definition: HoughResult.h:59
double fZ0
Z offset applied to hits.
Definition: HoughResult.h:60
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Definition: geo.h:1
std::vector< HoughPeak > fPeak
List of peaks found in Hough space.
Definition: HoughResult.h:61
double fRho
Distance to line.
Definition: HoughResult.h:24
double fThr
Calculated threshold for hough map.
Definition: HoughResult.h:27
double fTheta
Angle to line (radians)
Definition: HoughResult.h:25
static bool compare_peaks(const HoughPeak &a, const HoughPeak &b)
Definition: HoughResult.cxx:77
const XML_Char * s
Definition: expat.h:262
void SortPeaks()
Sort Hough peaks from best (highest) to worst.
Definition: HoughResult.cxx:83
void SlopeIcept(unsigned int i, double *m, double *b) const
Slope and intercepts of Hough lines.
Definition: HoughResult.cxx:62
Data for a single peak in Hough space.
Definition: HoughResult.h:18
const double a
double fSR
Uncertainty in Rho (999 indicates peak was below threshold)
Definition: HoughResult.h:28
caf::StandardRecord * sr
Perform a "2 point" Hough transform on a collection of hits.
geo::View_t fView
Transform of x or y view?
Definition: HoughResult.h:56
double fTNShi
Upper edge of time slice transformed.
Definition: HoughResult.h:58
T sin(T number)
Definition: d0nt_math.hpp:132
double fTNSlo
Low edge of time slice transformed.
Definition: HoughResult.h:57
Data resulting from a Hough transform on the cell hit positions.
double fH
Height of peak (arbitrary units)
Definition: HoughResult.h:26
const hit & b
Definition: hits.cxx:21
T cos(T number)
Definition: d0nt_math.hpp:78
assert(nhit_max >=nhit_nbins)
TRandom3 r(0)
double fST
Uncertainty in Theta (999 indicates peak was below threshold)
Definition: HoughResult.h:29
Helper for AttenCurve.
Definition: Path.h:10