def select_hits(input_file_hits, output_file_hits, condition=None, cluster_size_condition=None, n_cluster_condition=None, chunk_size=<NUM_LIT>):
logging.info('<STR_LIT>' + condition + '<STR_LIT>' + str(output_file_hits))<EOL>if cluster_size_condition is None and n_cluster_condition is None:  <EOL><INDENT>with tb.open_file(input_file_hits, mode="<STR_LIT>") as in_hit_file_h5:<EOL><INDENT>analysis_utils.index_event_number(in_hit_file_h5.root.Hits)  <EOL>with tb.open_file(output_file_hits, mode="<STR_LIT:w>") as out_hit_file_h5:<EOL><INDENT>hit_table_out = out_hit_file_h5.create_table(out_hit_file_h5.root, name='<STR_LIT>', description=data_struct.HitInfoTable, title='<STR_LIT>', filters=tb.Filters(complib='<STR_LIT>', complevel=<NUM_LIT:5>, fletcher32=False))<EOL>analysis_utils.write_hits_in_event_range(hit_table_in=in_hit_file_h5.root.Hits, hit_table_out=hit_table_out, condition=condition)  <EOL>in_hit_file_h5.root.meta_data.copy(out_hit_file_h5.root)  <EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>with tb.open_file(input_file_hits, mode="<STR_LIT>") as in_hit_file_h5:  <EOL><INDENT>analysis_utils.index_event_number(in_hit_file_h5.root.Hits)  <EOL>analysis_utils.index_event_number(in_hit_file_h5.root.Cluster)  <EOL>with tb.open_file(output_file_hits, mode="<STR_LIT:w>") as out_hit_file_h5:<EOL><INDENT>hit_table_out = out_hit_file_h5.create_table(out_hit_file_h5.root, name='<STR_LIT>', description=data_struct.HitInfoTable, title='<STR_LIT>', filters=tb.Filters(complib='<STR_LIT>', complevel=<NUM_LIT:5>, fletcher32=False))<EOL>cluster_table = in_hit_file_h5.root.Cluster<EOL>last_word_number = <NUM_LIT:0><EOL>progress_bar = progressbar.ProgressBar(widgets=['<STR_LIT>', progressbar.Percentage(), '<STR_LIT:U+0020>', progressbar.Bar(marker='<STR_LIT:*>', left='<STR_LIT:|>', right='<STR_LIT:|>'), '<STR_LIT:U+0020>', progressbar.AdaptiveETA()], maxval=cluster_table.shape[<NUM_LIT:0>], term_width=<NUM_LIT>)<EOL>progress_bar.start()<EOL>for data, index in analysis_utils.data_aligned_at_events(cluster_table, chunk_size=chunk_size):<EOL><INDENT>if cluster_size_condition is not None:<EOL><INDENT>selected_events = analysis_utils.get_events_with_cluster_size(event_number=data['<STR_LIT>'], cluster_size=data['<STR_LIT:size>'], condition='<STR_LIT>' + str(cluster_size_condition))  <EOL>if n_cluster_condition is not None:<EOL><INDENT>selected_events_2 = analysis_utils.get_events_with_n_cluster(event_number=data['<STR_LIT>'], condition='<STR_LIT>' + str(n_cluster_condition))  <EOL>selected_events = selected_events[analysis_utils.in1d_events(selected_events, selected_events_2)]  <EOL><DEDENT><DEDENT>elif n_cluster_condition is not None:<EOL><INDENT>selected_events = analysis_utils.get_events_with_n_cluster(event_number=data['<STR_LIT>'], condition='<STR_LIT>' + str(n_cluster_condition))<EOL><DEDENT>else:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>last_word_number = analysis_utils.write_hits_in_events(hit_table_in=in_hit_file_h5.root.Hits, hit_table_out=hit_table_out, events=selected_events, start_hit_word=last_word_number, condition=condition, chunk_size=chunk_size)  <EOL>progress_bar.update(index)<EOL><DEDENT>progress_bar.finish()<EOL>in_hit_file_h5.root.meta_data.copy(out_hit_file_h5.root)<EOL><DEDENT><DEDENT><DEDENT>
Takes a hit table and stores only selected hits into a new table. The selection of hits is done with a numexp string. Only if
    this expression evaluates to true the hit is taken. One can also select hits from cluster conditions. This selection is done
    on an event basis, meaning events are selected where the cluster condition is true and then hits of these events are taken.

     Parameters
    ----------
    input_file_hits: str
        the input file name with hits
    output_file_hits: str
        the output file name for the hits
    condition: str
        Numexpr string to select hits (e.g.: '(relative_BCID == 6) & (column == row)')
        All hit infos can be used (column, row, ...)
    cluster_size_condition: int
        Hit of events with the given cluster size are selected.
    n_cluster_condition: int
        Hit of events with the given cluster number are selected.