#ifndef RIEMANN_TRACK_FINDER_ #define RIEMANN_TRACK_FINDER_ /** @file riemann-track-finder.h header for riemann track finder algorithm */ #include #include "util.h" #include "hit.h" #include "track.h" using namespace std; /** options for riemann track finder algorithm */ struct RiemannTrackFinderOptions { RiemannTrackFinderOptions() : hits_path("data/mvd-hits.csv"), output_file("output.txt"), verbosity(1), max_sz_chi_square(1.), max_dist_from_plane(.2), max_dist_from_sz_line(.1){} RiemannTrackFinderOptions(char* _hits_path, char* _output_file){ hits_path = _hits_path; output_file = _output_file; } /** path to hits file */ const char *hits_path; /** output file name; leave off file extension; various output files extend this name */ const char *output_file; /** cut values */ float max_sz_chi_square; float max_dist_from_plane; float max_dist_from_sz_line; /** verbosity level */ int verbosity; }; /** the class that implements the riemann track finder algorithm */ class RiemannTrackFinder { public: /** create riemann track finder with options */ RiemannTrackFinder(const RiemannTrackFinderOptions &opts); /** destructor */ ~RiemannTrackFinder(); /** performs reconstruction @returns reconstructed tracks */ vector find_tracks(); private: /** riemann track finder options */ RiemannTrackFinderOptions opts; /** all hit information for the event */ vector hits; /** id's of the hits after being sorted by layer; currently unused */ vector id_of_sorted_hit; /** track candidates produced */ vector tracks; /** the Monte Carlo track id's that appear in the event */ vector unique_track_ids; float* d_hits; /* hit point data (x_0, y_0, w_0, z_0, x_1, y_1, w_1, z_1, x_2, y_2, ...) */ int* d_layer_triplets; /* storage for layer triplets */ int* d_layer_triplet_write_location; /* managed with atomics */ int* d_num_hit_triplets_in_layer_triplet; /* number of hit triplets possible to generate from each layer triplet; later the scan of itself */ int* d_hit_triplets; /* storage for hit triplets */ int* d_hit_triplet_write_location; /* managed with atomics */ int num_layers; /* number of hit-containing layers */ int* d_num_hits_in_layer; /* number of hits in each layer */ int* d_layer_offset; /* first hit in each layer */ int* d_layer_of_hit; /* which layer each hit belongs to (in sorted-by-layer order) */ //int* sorted_hit_index_to_hit_id; /* mapping from hit indices in sorted hit list to original hit id's */ int* d_cut_hit_triplets; /* storage for cut hit triplets (hit triplets that pass sz fit cut) */ int* d_cut_hit_triplet_write_location; /* managed with atomics */ int num_hit_triplets; /* number of hit triplets */ int* d_tracks; /* track candidate int data (param_save_loc_0, length_0, hit_0, hit_1, hit_2, ..., param_save_loc_1, length_1, hit_0, hit_1, hit_2, ...) */ int* d_tracks_write_location; /* managed with atomics */ float* d_track_parameters; /* track candidate float data (r_0, x0_0, y0_0, dip_0, r_1, x0_1, y0_1, dip_1, ...) */ int* d_track_parameters_write_location; /* managed with atomics */ // prepare hits int read_hits(); // return of 0 indicates success void sort_hits_by_layer(); // prepare device void initialize_layer_offset_and_num_hits_in_layer_and_layer_of_hit(); void initialize_hits(); void project_onto_paraboloid(); // run algorithm void generate_seeds(); void grow_seeds(); // TODO merge duplicate tracks // save tracks void transfer_tracks_to_host(); void write_tracks(); // evaluate performance void compare_tracks_to_true_tracks(); }; // class RiemannTrackFinder #endif