18 #include "Utilities/func/MathUtil.h" 35 fSigma(3.0/
sqrt(12.)),
47 double* rho,
double*
theta,
48 double* sigmarho,
double* sigmatheta)
50 *theta =
atan2(x1-x2,y2-y1);
51 *rho = 0.5*(
cos(*theta)*(x1+
x2)+
sin(*theta)*(y1+
y2));
59 while (*theta>=
M_PI) {
95 if (
fView==
geo::kX) { tiw =
"fHough2P_Hx"; tii=
"Hough2P_Ix"; }
96 else if (
fView==
geo::kY) { tiw =
"fHough2P_Hy"; tii=
"Hough2P_Iy"; }
102 ";rho [cm];theta [radians]",
104 nth,-0.5*
M_PI/180.0,179.5*
M_PI/180.0);
110 ";rho [cm];theta [radians]",
131 double tlo=9E9, thi=-9e9;
134 for (i=0; i<h.size(); ++
i) {
136 if (h[i].fZ<xlo) xlo = h[
i].fZ;
137 if (h[i].fZ>xhi) xhi = h[
i].fZ;
138 if (h[i].fXY<ylo) ylo = h[
i].fXY;
139 if (h[i].fXY>yhi) yhi = h[
i].fXY;
140 if (h[i].fT<tlo) tlo = h[
i].fT;
141 if (h[i].fT>tlo) thi = h[
i].fT;
155 for (i=0; i<h.size(); ++
i) {
157 for (j=i+1; j<h.size(); ++
j) {
162 if (rsqr>
fRsqr)
continue;
171 double sigmarho, sigmatheta;
175 &sigmarho, &sigmatheta);
179 int ixlo = xaxis->FindBin(rho-3.0*sigmarho);
180 int ixhi = xaxis->FindBin(rho+3.0*sigmarho);
181 int iylo = yaxis->FindBin(theta-3.0*sigmatheta);
182 int iyhi = yaxis->FindBin(theta+3.0*sigmatheta);
184 if (ixlo<1) ixlo = 1;
185 if (iylo<1) iylo = 1;
186 if (ixhi>xaxis->GetNbins()) ixhi = xaxis->GetNbins();
187 if (iyhi>yaxis->GetNbins()) iyhi = yaxis->GetNbins();
190 for (ix=ixlo; ix<=ixhi; ++ix) {
191 double x = xaxis->GetBinCenter(ix);
192 for (iy=iylo; iy<=iyhi; ++iy) {
193 double y = yaxis->GetBinCenter(iy);
194 double w = 2.0*h[
i].fW*h[
j].fW/(h[
i].fW+h[
j].fW);
225 for (ix=1; ix<=
fHspaceI->GetNbinsX(); ++ix) {
226 for (iy=1; iy<=
fHspaceI->GetNbinsY(); ++iy) {
227 if (
fHspaceI->GetBinContent(ix,iy)==ipeak+1) {
231 r =
fHspaceW->GetXaxis()->GetBinCenter(ix);
232 theta =
fHspaceW->GetYaxis()->GetBinCenter(iy);
252 for (ix=1; ix<=
fHspaceW->GetNbinsX(); ++ix) {
253 for (iy=1; iy<=
fHspaceW->GetNbinsY(); ++iy) {
257 r =
fHspaceW->GetXaxis()->GetBinCenter(ix);
258 theta =
fHspaceW->GetYaxis()->GetBinCenter(iy);
289 for(
int a = 0;
a < wx;
a++) {
290 for(
int b = 0;
b < wy;
b++) {
300 nx = htmp->GetNbinsX();
301 ny = htmp->GetNbinsY();
302 for (i=1; i<=nx; ++
i) {
303 for(j=1; j<=ny; ++
j) {
313 if (iy>ny) iy = iy%ny;
314 if (iy<1) iy = ny+iy;
geo::View_t fView
Which detector view?
double fRsqr
Distance^2 cut on points (cm^2)
int fYwinSz
Smoothing size (bins) in y.
double fXY0
X/Y offset applied to hits.
double fZ0
Z offset applied to hits.
Perform a "2 point" Hough transform on a collection of hits.
Float_t y1[n_points_granero]
double fThetaSz
Size of theta bins (degrees)
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
IslandsTH2 * fHspaceI
Islands for x view.
Float_t x1[n_points_granero]
std::vector< HoughPeak > fPeak
List of peaks found in Hough space.
Vertical planes which measure X.
T sqr(T x)
More efficient square function than pow(x,2)
Horizontal planes which measure Y.
TH2F * fHspaceW
Hough transform.
void SortPeaks()
Sort Hough peaks from best (highest) to worst.
Just the essential information required for track fitting.
Data for a single peak in Hough space.
double fRhoSz
Size of rho bins (cm)
double Gaus(TH1D *h, double &err, bool isTruth)
double fTNShi
Upper edge of time slice transformed.
void LabelIslands(const TH2 *h)
double fTNSlo
Low edge of time slice transformed.
double pythag(double x, double y)
2D Euclidean distance
rb::HoughResult fH
Results of Hough transformation;.
int fXwinSz
Smoothing size (bins) in x.
double fSigma
Assumed location error on points (cm)
unsigned int Nislands() const
double fPco
Number of sigma abouve average peak height to use as cutoff.
void Map(const rb::HitList &h)
void BuildMap(double xlo, double xhi, double ylo, double yhi)
Hough2P(geo::View_t v, double rhosz, double thetasz, int rhosm, int thetasm, double rsqr, double pco)
Construct the 2-point Hough transform.
void RhoTheta(double x1, double y1, double x2, double y2, double *rho, double *theta, double *sigmarho, double *sigmatheta)