1 #ifndef __CYLINDRICALHOUGH__
2 #define __CYLINDRICALHOUGH__
4 #include "CircleHough.h"
10 #define M_PI 3.14159265358979323846
32 static float absDiff(
float angle1,
float angle2)
34 float diff = ( angle1 - angle2 );
36 while(diff < -
M_PI){diff += 2.*
M_PI;}
55 vec.push_back(angind);
63 for(
unsigned int i=0;i<
vec.size();i++)
67 result.push_back(&(
vec[i]));
75 int a = (
int)(angle/twopi);
77 while(angle < 0.){angle +=
twopi;}
78 while(angle >= twopi){angle -=
twopi;}
86 unsigned int current = closest;
87 unsigned int lowest = 0;
88 unsigned int highest =
vec.size()-1;
93 result.push_back(&(
vec[current]));
94 current = (current+1)%(
vec.size());
95 if(current==closest){
break;}
103 if(closest==0){
return;}
106 if(current <= closest)
119 result.push_back(&(
vec[current]));
120 if( (current==lowest) || (current==highest) ){
break;}
121 current = ((current +
vec.size()) - 1)%(
vec.size());
133 unsigned int closest = lower;
135 for(
unsigned int i=(lower+1);i<=upper;i++)
138 if( tempdiff < diff )
156 std::sort(
vec.begin(),
vec.end());
160 unsigned int lower = 0;
161 unsigned int upper =
vec.size() - 1;
162 unsigned int middle =
vec.size()/2;
167 if(angle <=
vec[middle].angle)
170 middle = (lower + upper)/2;
175 middle = (lower + upper)/2;
180 std::vector<AngleIndexPair>
vec;
188 CylindricalHough(std::vector<float>& detrad,
unsigned int inv_radius_nbin,
unsigned int center_angle_nbin,
unsigned int dca_origin_nbin, CircleResolution& min_resolution, CircleResolution& max_resolution, CircleRange& range,
unsigned int z0_nbin,
unsigned int theta_nbin, ZResolution& minzres, ZResolution& maxzres, ZRange& zrange,
double sxy=70.
e-4,
double sz=500.
e-4);
191 void customFindHelicesInit(std::vector<SimpleHit3D>&
hits,
unsigned int min_hits,
unsigned int max_hits,
unsigned int min_zhits,
unsigned int max_zhits,
double chi2_cut,
float xydiffcut, std::vector<SimpleTrack3D>& tracks,
unsigned int maxtracks=0);
193 void addHits(
unsigned int zlevel, std::vector<SimpleTrack3D>& temptracks, std::vector<SimpleTrack3D>& tracks, std::vector<float>& params,
int tracks_per_hit,
float z_cut);
195 void init_ZHough(
int z0_nbin,
unsigned int theta_nbin, ZResolution& minzres, ZResolution& maxzres, ZRange& zrange);
207 bool intersect_circles(
bool hel,
double startx,
double starty,
double rad_det,
double rad_trk,
double cx,
double cy,
double&
x,
double&
y);