The multipeakfinder, Mountainfinder, is designed to find local peaks in the three-dimensional pad-tdc-adc domain of a cluster pattern, and to implement an on-the-fly peak-to-valley cut to select significant peaks.
The algorithm is diagrammed schematically in Figure 10. The pixels in a cluster pattern are sorted in decreasing order according to their ADC value. The first pixel in the list is then a local (and global) peak in the pattern. The position of this peak is stored and this pixel and its neighbors in the two-dimensional pad-tdc space are marked as ``used.'' A ``used'' pixel is no longer considered a possible peak. For the first candidate, no peak:valley cut is applied, and the peak is stored.
Figure 10: A schematic of the algorithm used to find multiple peaks in a cluster pattern.
The pixels are then considered according to the sorted list. If the pixel under consideration has already been marked ``used,'' then its neighbors are now marked ``used,'' and one considers the next pixel on the sorted list. Only a pixel who is ``unused'' when his turn in the list comes up has an ADC value larger than all of its neighbors, and so becomes a peak candidate. Although there is some redundancy in sometimes re-marking a ``used'' pixel as ``used,'' significant time is saved by not having to compare each pixel's ADC value against its neighbors in each direction.
Even if a pixel is a local maximum, it is often useful to select on the significance of the maximum before designating it a peak. Such a cut may be useful, for example, to eliminate noise or digitization peaks. A peak:valley cut in two dimensions may be implemented in several ways. For example, one could take an average of the ADC values of a candidate pixel's neighbors, and compare it to the ADC value of the candidate. However, in our case, the relevant quantity is the relative height (ADC value) of the peak candidate to pixels between the candidate and other peaks. In Figure 11 is shown a candidate peak in a cluster pattern which contains two larger (and so previously-found) peaks. The relevant valleys with which to compare the candidate peak are defined by the lines connecting the candidate with the larger peaks. The pixel with the lowest ADC value lying along each line defines the valley value. The peak:valley cut is then made on the quantity (ADC value of candidate peak pixel)/(ADC value of valley) for each line (Typically a ratio of 1.3 is required. See below.) If a candiate passes the peak:valley cut with respect to all previously found peaks, it is considered a peak and stored. Any further peak:valley tests involving that peak will be against smaller candidate peaks. In the case of failure, the smaller candidate peak is discarded, but the larger peak is not. Thus, in this algorithm, if two possible peaks do not have a sufficient dip (valley) between them, the larger possible peak is kept.
Figure 11: A cluster pattern in which two peaks have been found (larger filled circle) and a third candidate is being considered (small filled circle). Valleys are formed along lines in the pad-tdc space connecting the peak positions with the candidate position. Cuts are performed on the ratio of the height of the candidate peak to the lowest depth of these valleys.
Local peaks are sought until no pixels remain above a lower threshold.
Once the peaks in a cluster pattern are found the position and orientation information is associated with each (see above), and an entry is stored in the TPHIT table.