• Keine Ergebnisse gefunden

Cellular automaton track finder for CBM

4.2 Track finding

4.2.4 Cellular automaton track finder for CBM

later. This optimizes memory access, since no data is read or processed twice.

These algorithm features make it suitable for parallel implementation on modern many-core CPU/GPU computer architectures.

Different variations of this scheme were applied in HEP experiments with high track multiplicity. In the next section details of the CA-based track finder algorithm for the CBM experiment are discussed.

Pseudocode for CBM CA Track Finder

1Sort_Input_Hits_According_to_Grid();

2

3for track_set (high_p_primary, low_p_primary, secondary, broken)

4

5switch (track_set) 6 case high_p_primary:

7 Build_Triplets (min_momentum_for_fast_tracks,

primary_track_parameter_initilisation, triplets_wo_gaps);

8

9 case low_p_primary:

10 Build_Triplets (min_momentum_for_slow_tracks,

primary_track_parameter_initilisation, triplets_wo_gaps);

11

12 case secondary:

13 Build_Triplets (min_momentum_for_slow_tracks,

secondary_track_parameter_initilisation, triplets_wo_gaps);

14

15 case broken:

16 Build_Triplets (min_momentum_for_slow_tracks, secondary_track_parameter_initilisation, triplets_with/

wo_gaps) 17

18 Find_Neighbours();

19 20 21 22

23 for track_length := NStation to 3 do 24 for station := FirstStation to NStation do 25 for triplets := First_Triplet_Station to

Last_Triplet_Station do

26 track_candidate = Build_Best_Candidate (triplet);

27 28

29 Save_Candidates(all_track_candidates);

30

31 Delete_Used_Hits();

void function Build_Triplets (min_momentum, prim/sec_track_parameter_initilisation, triplets_with/wo_gaps)

{

for station := (NStation-2) to FirstStation do for hits_portion := First_Portion_Station to Last_Portion_Station do

Find_Singlets(hits_portion);

Find_Doublets(singlets_in_portion);

Find_Triplets(doublets_in_portion);

}

void function Find_Neighbours (All_Triplets) {

for triplet := First_Triplet to Last_Triplet do

Find_Save_Neighbours(triplet);

Calculate_Level(triplet);

}

void function

Save_Candidates(All_Track_Candidate) {

Sort_Candidates();

for candidate := First_Candidate to Last_Candidate do

if (used_hits) discard candidate else save candidate;

}

Figure 4.13: A pseudocode scheme for the CA track finder algorithm.

memory for the input information and prepares a special data structure to store hits — the grid (Fig. 4.14).

The grid structure plays an important role for the speed of the algorithm, since it provides fast access towards hits for the most time-consuming part of triplets construction. While binding hits into triplets, one often faces a task of finding a hit of the triplet in the certain spatial area of a station. In order to do it quickly, a regular 2D grid is introduced on each station, with the cell size inversely proportional to the hit density on the station. All hits are sorted and stored in the memory in the order of their cell numbers. For each cell the pointer to the first hit in this cell is stored.

The idea of grid approach is illustrated in Fig. 4.14. After extrapolation of the track segment to the next station, the algorithm obtains the estimated position (x, y) with extrapolation errors. It defines a certain region of interest on the station, where potentially the next hit can be located. In order not to go through

(x,y)

1 2 3 4 5

6 7 8 9 10

11 12 14 15

16 17 18 19 20

21 22 23 24

13

25

9

8 7 6 5

4 1

2 3

10

16 15 14 13

12 11

25

24 23 22 21

20 17

18 19

26

32 31 30 29

28 27

41

40 39 38 37

36 33

34 35

42

48 47 46 45

44 43

57

56 55

54 52

58

64 63 62 61

60 59

Δt1

Δt2

Δt3

Δt4

y x t

Figure 4.14: The grid structure for one STS station provides fast access towards the hit measurements in the area of track extrapolation within the extrapolation errors.

the whole list of hits on the station and check whether they lay in the region of interest, one can use the grid structure.

After defining the region of interest, the algorithm builds a special object — HitArea, which is defined by the area of bins fully covering the region of interest (shown with blue square in the figure). The grid structure allows a fast access towards the hits laying within the HitArea. Since the grid stores indexes of the first hits in the bin for each bin, to check all the hits in the HitArea, the algorithm just needs to check several groups of hits, sorted and located locally in the memory, instead of going through the whole list of hits on the station. In this example, it would be:

• starting from 1st hit in bin 7 until 1st hit in bin 10,

• starting from 1st hit in bin 12 until 1st hit in bin 15,

• starting from 1st hit in bin 17 until 1st hit in bin 20.

This approach allows for quick identification of hits in a certain area of the station, since they are located close to each other in the memory and the grid structure instantly provides indexes of desired hits.

The most time-consuming part of the algorithm (90.4% of the total time) is the triplet building stage. Triplets are built out of hit measurements, which can potentially belong to the same track. Since the tracking algorithm is designed for online reconstruction, the algorithm speed plays a crucial role and a lot of

optimi-sation efforts were devoted to speed up the execution. One of such optimioptimi-sations come into play in the very beginning.

The Monte Carlo simulation has shown that the major part of the particles of the particular physics interest come from the region of the primary vertex with momentum greater than 0.1 GeV/c. Knowing in advance that the particle is emerging from the primary vertex with a large momentum, drastically improves the time needed to reconstruct such a track, due to a better initial track param-eter initialization and a small curvature of the track. These observations have led to the decision to split the reconstruction procedure into several stages, in order to perform fast and computationally easy parts at first and suppress the combinatorial enumeration for later stages.

Thus, the CA track finder consists of the following stages (pseudocode line 3):

1. the search for tracks from fast (p > 1 GeV/c) quasi-primary (emitted from the target region) particles,

2. the search for tracks from slow (0.1< p <1 GeV/c) quasi-primary particles, 3. the search for tracks from secondary particles with arbitrary momentum, 4. the search for tracks with a missed hit on a station.

For each set of the tracks the same procedure is repeated with different initial parameters and a different set of cuts. After each stage, the input hits included in reconstructed tracks are tagged as used and removed from consideration in the next stage. This approach suppresses possible random combinations of hits and improves the speed of the algorithm at high track multiplicities.

After the type of initial triplet parameter initialization (for the primary or secondary track search) and cut values (for the large or small momentum track search) are defined by setting the desired track type (pseudocode line 3), the actual triplet building procedure is to begin (pseudocode lines 5–16). Triplets are built station by station, moving upstream starting from the sixth station to the first station.

In the beginning in order to use SIMD registers, all input data is packed in single precision SIMD vectors, so that all calculations later are vectorised. For the reasons of memory optimization all hits on each station are split into portions of N hits. N here is a number divisible by the number of elements in the SIMD

1.

2.

3.

Figure 4.15: The illustration of three types of triplets built by the CA algorithm: 1) with the second hit missing 2) with the third hit missing 3) with no missing hits (left side). Two neighboring triplets, combined into a track (right side).

register, since the hits are processed in a SIMD-ised manner.

Each triplet is build in 3 steps: to the starting hit consecutively second and third hits are added, rejecting non-physical combinations according to the local track model at each step. Thus, at first each hit on the station is considered a starting hit of the triplet. To the starting hit we add the target with some errors, this way obtaining a certain spatial direction. This structure is called singlet.

The singlet together with its errors is extrapolated to the next station, taking into account track model and possible multiple scattering. While searching for the next hit on this station, the algorithm creates a new HitArea object. All hits within the hit area potentially belong to the same track as the singlet hit does.

Adding each hit from the hit area to the singlet, one obtains an array of doublets.

The doublets are fitted with the Kalman filter method and some of them are rejected due to highχ2-value. In same manner each doublet is propagated to the next station and the array of triplets for the starting hit is obtained. The major part of random combinations are rejected due to χ2-value after adding the third hit to triplets.

Out of triplets discussed above one can construct tracks with consecutively registered hits in each station only. However the detector inefficiency may lead to the fact that some hits cannot be registered. In this case a hit on a certain

station will be missing. In order to make the algorithm more stable towards detector inefficiency there is one more additional stage of building triplets with one hit missing (Fig. 4.15). This way we introduce two additional categories of triplets:

• with hits on k-th, (k+ 1)-th and (k+ 3)-th stations

• with hits on k-th, (k+ 2)-th and (k+ 3)-th stations,

where k — is the starting station number. Since the probability of having two hits missing in the raw in the track is less than 0.05%, nearly all tracks can be reconstructed with this approach. After all triplets are constructed including the ones with missing hits, they are copied to one general array.

Now the triplets should be grouped into track candidates. Since the momen-tum is conserved in a magnetic field, in order to find triplets potentially belonging to the same track, one needs to take into account all five state vector parame-ters. Such so-called neighboring triplets should coincide in position, slope and momentum. The easiest way of fulfilling this requirement is to define neighbors as the triplets, sharing two common hits and having the same momentum within estimated errors (Fig. 4.15). Thus, as the next step the algorithm loops over all triplets and finds and stores for each one the list of possible neighbors according to this definition.

In order to further simplify the procedure of combining triplets into tracks, one can also estimate the position of the triplet in the track. It is done with the help of, so-called, level, which is calculated for each triplet during the search for neighbors. The level of a triplet is defined as the length of the longest continuous chain of neighboring triplets in the direction to the target. The level of a triplet helps to locate the triplet on the track: the greater the value it takes, the longer track can be potentially constructed with a certain triplet.

Having estimated the possible position in the track, the triplets can be easily connected into a candidate tracks (pseudocode lines 23–26). The main aim of this procedure is to build the best set of tracks according to χ2-value, that share no hits in common. It allows suppressing of random combinations of triplets. If two track candidates share a hit in common, the preference is given to the longest track, since the probability of a random hit combination to represent the track

model decreases exponentially with the number of hits.

Thus, the procedure of constructing tracks is designed in such a way, that it starts with building the longest tracks first. Their hits are tagged as used and removed from consideration. After the longest tracks are found, the algorithm consecutively searches for tracks with one hit less and so on until the primary tracks with 3 hits only.

Starting with the triplets with the maximum level, the chain of neighbors with a level consecutively descending by one is connected into track candidates.

A treelike structure of potential track candidates is formed in this manner, from which the best track is selected according to theχ2 criterion.

Having all the candidates of a certain length constructed, the algorithm sorts them according to theirχ2. After this procedure is finished, candidates one by one sequentially are checked to contain used hits. If at least one used hit is found, the candidate gets discarded, if not — the candidate is stored (pseudocode line 29).

After the stage of track reconstruction for the current set of tracks is finished, the final stage of the algorithm takes place (pseudocode line 31): all the hits used in the reconstructed track are removed from the input information for the next stage.