def analyze_hits(self, hits, scan_parameter=None):
        n_hits = hits.shape[0]
        logging.debug('Analyze %d hits' % n_hits)

        if scan_parameter is None:  # if nothing specified keep actual setting
            logging.debug('Keep scan parameter settings ')
        elif not scan_parameter:    # set no scan parameter
            logging.debug('No scan parameter used')
            self.histogram.set_no_scan_parameter()
        else:
            logging.info('Setting a scan parameter')
            self.histogram.add_scan_parameter(scan_parameter)

        if self.is_cluster_hits():
            logging.debug('Cluster hits')
            cluster_hits, clusters = self.cluster_hits(hits)
        else:
            cluster_hits = None
            clusters = None

        if self.is_histogram_hits():
            logging.debug('Histogramming hits')
            self.histogram_hits(hits)

        return cluster_hits, clusters