1 #ifndef __HELIX_HOUGH_H__
2 #define __HELIX_HOUGH_H__
10 #include <xmmintrin.h>
11 #include <emmintrin.h>
18 #define M_PI 3.14159265358979323846
29 ParRange(
unsigned int min_cAngle,
unsigned int max_cAngle,
unsigned int min_dca,
unsigned int max_dca,
unsigned int min_invR,
unsigned int max_invR,
unsigned int min_theta,
unsigned int max_theta,
unsigned int min_z,
unsigned int max_z) :
min_k(min_invR),
max_k(max_invR),
min_phi(min_cAngle),
max_phi(max_cAngle),
min_d(min_dca),
max_d(max_dca),
min_dzdl(min_theta),
max_dzdl(max_theta),
min_z0(min_z),
max_z0(max_z) {}
86 return (
bin < other.
bin );
89 static unsigned int linearBin(
unsigned int nbins2,
unsigned int nbins3,
unsigned int nbins4,
unsigned int nbins5,
unsigned int bin1,
unsigned int bin2,
unsigned int bin3,
unsigned int bin4,
unsigned int bin5)
91 return bin5 + nbins5*(bin4 + nbins4*(bin3 + nbins3*( bin2 + nbins2*bin1 )));
94 void bin5D(
unsigned int nbins2,
unsigned int nbins3,
unsigned int nbins4,
unsigned int nbins5,
unsigned int& bin1,
unsigned int& bin2,
unsigned int& bin3,
unsigned int& bin4,
unsigned int& bin5)
const
96 unsigned int temp1 = nbins2*nbins3*nbins4*nbins5;
99 temp1 = nbins3*nbins4*nbins5;
102 temp1 = nbins4*nbins5;
122 HelixHough(std::vector<std::vector<unsigned int> >& zoom_profile,
unsigned int minzoom,
HelixRange& range);
127 void findHelices(std::vector<SimpleHit3D>&
hits,
unsigned int min_hits,
unsigned int max_hits, std::vector<SimpleTrack3D>& tracks,
unsigned int maxtracks=0);
129 void findHelices(
unsigned int min_hits,
unsigned int max_hits, std::vector<SimpleTrack3D>& tracks,
unsigned int maxtracks,
unsigned int zoomlevel);
131 void findSeededHelices(std::vector<SimpleTrack3D>& seeds, std::vector<SimpleHit3D>& hits,
unsigned int min_hits,
unsigned int max_hits, std::vector<SimpleTrack3D>& tracks,
unsigned int maxtracks=0);
132 void findSeededHelices_run(std::vector<SimpleTrack3D>& seeds, std::vector<SimpleHit3D>& hits,
unsigned int min_hits,
unsigned int max_hits, std::vector<SimpleTrack3D>& tracks,
unsigned int maxtracks=0);
133 void findSeededHelices(
unsigned int min_hits,
unsigned int max_hits, std::vector<SimpleTrack3D>& tracks,
unsigned int maxtracks,
unsigned int zoomlevel);
135 void vote(
unsigned int zoomlevel);
136 static void phiRange_sse(
float* hit_x,
float* hit_y,
float* min_d,
float* max_d,
float* min_k,
float* max_k,
float* min_phi_1,
float* max_phi_1,
float* min_phi_2,
float* max_phi_2);
137 static void phiRange_sse(
float* hit_x,
float* hit_y,
float* min_d,
float* max_d,
float* min_k,
float* max_k,
float* min_phi,
float* max_phi,
float hel, __m128& phi_3_out, __m128& phi_4_out);
138 static void phiRange_sse(
float* hit_x,
float* hit_y,
float* min_d,
float* max_d,
float* max_k,
float* min_phi,
float* max_phi,
float hel, __m128& phi_3, __m128& phi_4, __m128& phi_3_out, __m128& phi_4_out);
139 static void dzdlRange_sse(
float* x_a,
float* y_a,
float* z_a,
float cosphi1,
float sinphi1,
float cosphi2,
float sinphi2,
float min_k,
float max_k,
float min_d,
float max_d,
float* min_z0,
float* max_z0,
float* min_dzdl_a,
float* max_dzdl_a);
140 static void phiRange_sse(
float* hit_x,
float* hit_y,
float* min_d,
float* max_d,
float* min_k,
float* max_k,
float* min_phi,
float* max_phi,
float* min_phi_2,
float* max_phi_2,
float hel, __m128& phi_3_out, __m128& phi_4_out,
float* hit_x_2,
float* hit_y_2, __m128& phi_3_out_2, __m128& phi_4_out_2);
141 static void phiRange_sse(
float* hit_x,
float* hit_y,
float* min_d,
float* max_d,
float* min_k,
float* max_k,
float* min_phi,
float* max_phi,
float* min_phi_2,
float* max_phi_2,
float hel, __m128& phi_3, __m128& phi_4, __m128& phi_3_out, __m128& phi_4_out,
float* hit_x_2,
float* hit_y_2, __m128& phi_3_2, __m128& phi_4_2, __m128& phi_3_out_2, __m128& phi_4_out_2);
145 virtual void finalize(std::vector<SimpleTrack3D>&, std::vector<SimpleTrack3D>&){}
146 virtual void findTracks(std::vector<SimpleHit3D>&, std::vector<SimpleTrack3D>&,
const HelixRange&) = 0;
147 virtual void initEvent(std::vector<SimpleHit3D>&,
unsigned int){}
155 virtual float phiError(
SimpleHit3D&,
float,
float,
float,
float,
float,
float,
float,
float,
bool =
false){
return 0.;}
157 virtual float dzdlError(
SimpleHit3D&,
float,
float,
float,
float,
float,
float,
float,
float,
bool =
false){
return 0.;}
178 void splitIntoBins(
unsigned int min_hits,
unsigned int max_hits, std::vector<HelixRange>& ranges, std::vector<std::vector<SimpleHit3D> >& split_hits,
unsigned int zoomlevel);
216 std::vector<std::vector<std::pair<unsigned int,unsigned int> >* >
pairs_vec;
220 std::vector<std::vector<BinEntryPair5D>* >
bins_vec;
259 static void allButKappaRange_sse(
float* x1_a,
float* x2_a,
float* y1_a,
float* y2_a,
float* z1_a,
float* z2_a,
float* min_k_a,
float* max_k_a,
float* min_phi_1_a,
float* max_phi_1_a,
float* min_phi_2_a,
float* max_phi_2_a,
float* min_d_1_a,
float* max_d_1_a,
float* min_d_2_a,
float* max_d_2_a,
float* min_dzdl_a,
float* max_dzdl_a,
float* min_z0_1_a,
float* max_z0_1_a,
float* min_z0_2_a,
float* max_z0_2_a);
262 void fillBins(
unsigned int total_bins,
unsigned int hit_counter,
float* min_phi_a,
float* max_phi_a, std::vector<SimpleHit3D>& four_hits,
fastvec2d& z_bins,
unsigned int n_d,
unsigned int n_k,
unsigned int n_dzdl,
unsigned int n_z0,
unsigned int d_bin,
unsigned int k_bin,
unsigned int n_phi,
unsigned int zoomlevel,
float low_phi,
float high_phi,
float inv_phi_range,
fastvec& vote_array);
264 void makeClusters(
unsigned int zoomlevel,
unsigned int MAX,
unsigned int n_phi,
unsigned int n_d,
unsigned int n_k,
unsigned int n_dzdl,
unsigned int n_z0,
unsigned int min_hits, std::vector<ParameterCluster>& clusters,
bool& use_clusters,
bool& is_super_bin);
266 bool attemptClusterMerge(
unsigned int zoomlevel,
unsigned int MAX,
unsigned int ca,
unsigned int d,
unsigned int r,
unsigned int th,
unsigned int zz0,
unsigned int bin,
unsigned int newbin, std::vector<unsigned char>& good_bins,
unsigned int volume,
float cluster_size_cut,
float overlap_cut, std::vector<ParameterCluster>& clusters,
unsigned int*
bins_start,
unsigned int*
bins_end, std::vector<unsigned int>& map_clus, std::vector<unsigned char>& too_big, std::vector<unsigned int>& temp_merged, std::vector<unsigned int>&
C);
268 void vote_z(
unsigned int zoomlevel,
unsigned int n_phi,
unsigned int n_d,
unsigned int
269 n_k,
unsigned int n_dzdl,
unsigned int n_z0,
fastvec2d& z_bins);
273 void fillBins(
unsigned int total_bins,
unsigned int pair_counter,
unsigned int* pair_index,
float* min_phi,
float* max_phi,
float* min_d,
float* max_d,
float* min_dzdl,
float* max_dzdl,
float* min_z0,
float* max_z0, std::vector<std::vector<SimpleHit3D> > & four_pairs,
unsigned int n_d,
unsigned int n_k,
unsigned int n_dzdl,
unsigned int n_z0,
unsigned int k_bin,
unsigned int n_phi,
unsigned int zoomlevel,
float low_phi,
float high_phi,
float low_d,
float high_d,
float low_z0,
float high_z0,
float low_dzdl,
float high_dzdl,
float inv_phi_range,
float inv_d_range,
float inv_z0_range,
float inv_dzdl_range,
fastvec& vote_array);
274 void findHelicesByPairsBegin(
unsigned int min_hits,
unsigned int max_hits, std::vector<SimpleTrack3D>& tracks,
unsigned int maxtracks,
unsigned int zoomlevel);
275 void findHelicesByPairs(
unsigned int min_hits,
unsigned int max_hits, std::vector<SimpleTrack3D>& tracks,
unsigned int maxtracks,
unsigned int zoomlevel);
279 std::vector<std::pair<unsigned int, unsigned int> >
temp_pairs;