def analyze_hit_table(self, analyzed_data_file=None, analyzed_data_out_file=None):
close_analyzed_data_file = False<EOL>if analyzed_data_file is not None:  <EOL><INDENT>if self.is_open(self.out_file_h5) and os.path.abspath(analyzed_data_file) == os.path.abspath(self.out_file_h5.filename):<EOL><INDENT>in_file_h5 = self.out_file_h5<EOL><DEDENT>else:<EOL><INDENT>analyzed_data_file = os.path.abspath(analyzed_data_file)<EOL>if os.path.splitext(analyzed_data_file)[<NUM_LIT:1>].lower() != "<STR_LIT>":<EOL><INDENT>analyzed_data_file = os.path.splitext(analyzed_data_file)[<NUM_LIT:0>] + "<STR_LIT>"<EOL><DEDENT>in_file_h5 = tb.open_file(analyzed_data_file, mode="<STR_LIT>")<EOL>close_analyzed_data_file = True<EOL><DEDENT><DEDENT>elif self.is_open(self.out_file_h5):<EOL><INDENT>in_file_h5 = self.out_file_h5<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>close_analyzed_data_out_file = False<EOL>if analyzed_data_out_file is not None:  <EOL><INDENT>if self.is_open(self.out_file_h5) and os.path.abspath(analyzed_data_out_file) == os.path.abspath(self.out_file_h5.filename):<EOL><INDENT>out_file_h5 = self.out_file_h5<EOL><DEDENT>elif self.is_open(in_file_h5) and os.path.abspath(analyzed_data_out_file) == os.path.abspath(in_file_h5.filename):<EOL><INDENT>out_file_h5 = in_file_h5<EOL><DEDENT>else:<EOL><INDENT>analyzed_data_out_file = os.path.abspath(analyzed_data_out_file)<EOL>if os.path.splitext(analyzed_data_out_file)[<NUM_LIT:1>].lower() != "<STR_LIT>":<EOL><INDENT>analyzed_data_out_file = os.path.splitext(analyzed_data_out_file)[<NUM_LIT:0>] + "<STR_LIT>"<EOL><DEDENT>out_file_h5 = tb.open_file(analyzed_data_out_file, mode="<STR_LIT:w>", title="<STR_LIT>")<EOL>close_analyzed_data_out_file = True<EOL><DEDENT><DEDENT>elif self.is_open(self.out_file_h5):<EOL><INDENT>out_file_h5 = self.out_file_h5<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>tmp_out_file_h5 = self.out_file_h5<EOL>if not self.is_open(self.out_file_h5):<EOL><INDENT>if os.path.abspath(in_file_h5.filename) == os.path.abspath(out_file_h5.filename):<EOL><INDENT>close_analyzed_data_file = False<EOL>tmp_out_file_h5 = in_file_h5<EOL><DEDENT><DEDENT>self.out_file_h5 = out_file_h5<EOL>self._analyzed_data_file = self.out_file_h5.filename<EOL>if self._create_cluster_table:<EOL><INDENT>cluster_table = self.out_file_h5.create_table(self.out_file_h5.root, name='<STR_LIT>', description=data_struct.ClusterInfoTable, title='<STR_LIT>', filters=self._filter_table, expectedrows=self._chunk_size)<EOL><DEDENT>if self._create_cluster_hit_table:<EOL><INDENT>cluster_hit_table = self.out_file_h5.create_table(self.out_file_h5.root, name='<STR_LIT>', description=data_struct.ClusterHitInfoTable, title='<STR_LIT>', filters=self._filter_table, expectedrows=self._chunk_size)<EOL><DEDENT>if self._create_cluster_size_hist:  <EOL><INDENT>self._cluster_size_hist = np.zeros(shape=(<NUM_LIT:6>, ), dtype=np.uint32)<EOL><DEDENT>if self._create_cluster_tot_hist:  <EOL><INDENT>self._cluster_tot_hist = np.zeros(shape=(<NUM_LIT:16>, <NUM_LIT:6>), dtype=np.uint32)<EOL><DEDENT>try:<EOL><INDENT>meta_data_table = in_file_h5.root.meta_data<EOL>meta_data = meta_data_table[:]<EOL>self.scan_parameters = analysis_utils.get_unique_scan_parameter_combinations(meta_data, scan_parameter_columns_only=True)<EOL>if self.scan_parameters is not None:  <EOL><INDENT>meta_event_index = np.ascontiguousarray(analysis_utils.get_unique_scan_parameter_combinations(meta_data)['<STR_LIT>'].astype(np.uint64))<EOL>self.histogram.add_meta_event_index(meta_event_index, array_length=len(meta_event_index))<EOL>self.scan_parameter_index = analysis_utils.get_scan_parameters_index(self.scan_parameters)  <EOL>self.histogram.add_scan_parameter(self.scan_parameter_index)  <EOL>scan_parameter_names = analysis_utils.get_scan_parameter_names(self.scan_parameters)<EOL>logging.info('<STR_LIT>', ('<STR_LIT:U+002CU+0020>').join(scan_parameter_names) if scan_parameter_names else '<STR_LIT:None>',)<EOL><DEDENT>else:<EOL><INDENT>logging.info("<STR_LIT>")<EOL>self.histogram.set_no_scan_parameter()<EOL><DEDENT><DEDENT>except tb.exceptions.NoSuchNodeError:<EOL><INDENT>logging.info("<STR_LIT>")<EOL>self.histogram.set_no_scan_parameter()<EOL><DEDENT>table_size = in_file_h5.root.Hits.nrows<EOL>n_hits = <NUM_LIT:0>  <EOL>logging.info('<STR_LIT>')<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=table_size, term_width=<NUM_LIT>)<EOL>progress_bar.start()<EOL>for hits, index in analysis_utils.data_aligned_at_events(in_file_h5.root.Hits, chunk_size=self._chunk_size):<EOL><INDENT>n_hits += hits.shape[<NUM_LIT:0>]<EOL>if self.is_cluster_hits():<EOL><INDENT>cluster_hits, clusters = self.cluster_hits(hits)<EOL><DEDENT>if self.is_histogram_hits():<EOL><INDENT>self.histogram_hits(hits)<EOL><DEDENT>if self._analyzed_data_file is not None and self._create_cluster_hit_table:<EOL><INDENT>cluster_hit_table.append(cluster_hits)<EOL><DEDENT>if self._analyzed_data_file is not None and self._create_cluster_table:<EOL><INDENT>cluster_table.append(clusters)<EOL>if self._create_cluster_size_hist:<EOL><INDENT>if clusters['<STR_LIT:size>'].shape[<NUM_LIT:0>] > <NUM_LIT:0> and np.max(clusters['<STR_LIT:size>']) + <NUM_LIT:1> > self._cluster_size_hist.shape[<NUM_LIT:0>]:<EOL><INDENT>self._cluster_size_hist.resize(np.max(clusters['<STR_LIT:size>']) + <NUM_LIT:1>)<EOL><DEDENT>self._cluster_size_hist += fast_analysis_utils.hist_1d_index(clusters['<STR_LIT:size>'], shape=self._cluster_size_hist.shape)<EOL><DEDENT>if self._create_cluster_tot_hist:<EOL><INDENT>if clusters['<STR_LIT>'].shape[<NUM_LIT:0>] > <NUM_LIT:0> and np.max(clusters['<STR_LIT>']) + <NUM_LIT:1> > self._cluster_tot_hist.shape[<NUM_LIT:0>]:<EOL><INDENT>self._cluster_tot_hist.resize((np.max(clusters['<STR_LIT>']) + <NUM_LIT:1>, self._cluster_tot_hist.shape[<NUM_LIT:1>]))<EOL><DEDENT>if clusters['<STR_LIT:size>'].shape[<NUM_LIT:0>] > <NUM_LIT:0> and np.max(clusters['<STR_LIT:size>']) + <NUM_LIT:1> > self._cluster_tot_hist.shape[<NUM_LIT:1>]:<EOL><INDENT>self._cluster_tot_hist.resize((self._cluster_tot_hist.shape[<NUM_LIT:0>], np.max(clusters['<STR_LIT:size>']) + <NUM_LIT:1>))<EOL><DEDENT>self._cluster_tot_hist += fast_analysis_utils.hist_2d_index(clusters['<STR_LIT>'], clusters['<STR_LIT:size>'], shape=self._cluster_tot_hist.shape)<EOL><DEDENT><DEDENT>self.out_file_h5.flush()<EOL>progress_bar.update(index)<EOL><DEDENT>progress_bar.finish()<EOL>if table_size == <NUM_LIT:0>:<EOL><INDENT>logging.warning('<STR_LIT>')<EOL><DEDENT>if n_hits != table_size:<EOL><INDENT>raise analysis_utils.AnalysisError('<STR_LIT>')<EOL><DEDENT>self._create_additional_hit_data()<EOL>self._create_additional_cluster_data()<EOL>if close_analyzed_data_out_file:<EOL><INDENT>out_file_h5.close()<EOL><DEDENT>if close_analyzed_data_file:<EOL><INDENT>in_file_h5.close()<EOL><DEDENT>else:<EOL><INDENT>self.out_file_h5 = tmp_out_file_h5<EOL><DEDENT>if self.is_open(self.out_file_h5):<EOL><INDENT>self._analyzed_data_file = self.out_file_h5.filename<EOL><DEDENT>else:<EOL><INDENT>self._analyzed_data_file = None<EOL><DEDENT>
Analyzes a hit table with the c++ histogrammming/clusterizer.

        Parameters
        ----------
        analyzed_data_file : string
            The filename of the analyzed data file. If None, the analyzed data file
            specified during initialization is taken.
            Filename extension (.h5) does not need to be provided.
        analyzed_data_out_file : string
            The filename of the new analyzed data file. If None, the analyzed data file
            specified during initialization is taken.
            Filename extension (.h5) does not need to be provided.