14 #include <JANA/jerror.h>
15 #include <JANA/JObject.h>
25 DHoughFind(
double xmin,
double xmax,
double ymin,
double ymax,
unsigned int Nbinsx,
unsigned int Nbinsy);
27 virtual const char*
className(
void)
const {
return static_className();}
30 inline double signof(
double a){
return a<0.0 ? -1.0:1.0;}
32 void SetLimits(
double xmin,
double xmax,
double ymin,
double ymax,
unsigned int Nbinsx,
unsigned int Nbinsy);
35 double GetMaxBinContent(
void);
36 double GetSigmaX(
void);
37 double GetSigmaY(
void);
39 DVector2 Find(
const vector<DVector2> &points);
41 void Fill(
double x,
double sigmax,
double y,
double sigmay);
42 static DVector2 GetMaxBinLocation(vector<const DHoughFind*> &houghs);
45 void AddPoint(
const DVector2 &point);
46 void AddPoint(
const double &
x,
const double &
y);
47 void AddPoints(
const vector<DVector2> &points);
50 void ClearPoints(
void);
53 inline void FindIndexes(
const DVector2 &pos,
int &ix,
int &iy);
54 inline double FindBeta(
double xlo,
double ylo,
double widthx,
double widthy,
DVector2 &pos,
DVector2 &step);
57 TH2D* MakeIntoRootHist(
string hname);
89 ix = (int)floor((pos.X()-xmin)/bin_widthx);
90 iy = (int)floor((pos.Y()-
ymin)/bin_widthy);
105 stepdir = step/step.Mod();
111 beta[0] = FindBeta(start, xdir, pos, stepdir);
113 start.Set(xlo+widthx, ylo);
114 beta[1] = FindBeta(start, ydir, pos, stepdir);
116 start.Set(xlo+widthx, ylo+widthy);
117 beta[2] = FindBeta(start, -1.0*xdir, pos, stepdir);
119 start.Set(xlo, ylo+widthy);
120 beta[3] = FindBeta(start, -1.0*ydir, pos, stepdir);
128 DVector2 bin_center(xlo+widthx/2.0, ylo+widthy/2.0);
129 double min_dist_to_center = 1.0E6;
130 double min_beta = 1.0E6;
131 for(
unsigned int i=0; i<4; i++){
132 if(fabs(beta[i])<1.0E-6*bin_size)
continue;
134 DVector2 delta_center = pos + beta[i]*stepdir - bin_center;
135 if(delta_center.Mod() < min_dist_to_center){
136 min_dist_to_center = delta_center.Mod();
170 double k = bx*dx + by*dy;
171 double alphax = ax - cx;
172 double alphay = ay - cy;
173 double betax = dx - k*bx;
174 double betay = dy - k*by;
176 return (betax*alphax + betay*alphay)/(1.0-k*k);
181 #endif // _DHoughFind_
double FindBeta(double xlo, double ylo, double widthx, double widthy, DVector2 &pos, DVector2 &step)
unsigned int GetNPoints(void)
virtual const char * className(void) const
vector< DVector2 > GetPoints(void)
vector< DVector2 > points
void FindIndexes(const DVector2 &pos, int &ix, int &iy)
locHist_TaggerEnergy Add(locHist_TaggerEnergyAcc,-1.)
static const char * static_className(void)