## 4 Results and Discussion
### Parallel Algorithm 2  
In reality, due to inhomogeneity of the magnetic field of the SPD setup and the influence of various factors distorting the particle trajectory, such as Coulomb scattering, etc., the helical line in space ceases to adequately describe the trajectory. In addition, the iterative nonlinear fitting method described above proves to be slower than the linear approach and more complicated to parallelize. Therefore, another method using a third-degree spatial polynomial was applied.  
Assuming we have a set of n knot points \(P_{0},P_{1},\ldots,P_{(}n-1)\), where \(P_{i}=(x_{i},y_{i},z_{i})T\in R^{3}\), the parametrization is made, which associates knot points with parameters \(u_{i}\). Based on that parametrization, we can find an approximation curve, \(f(u)=(f_{x}(u),f_{y}(u),f_{z}(u))\). Each of the approximation curves is represented by a polynomial function of a certain degree \(k\).  
\[f_{x}(u)=\sum_{r=0}^{k}a_{x_{r}}\cdot u^{r},f_{y}(u)=\sum_{r=0}^{k}a_{y_{r}} \cdot u^{r},f_{z}(u)=\sum_{r=0}^{k}a_{z_{r}}\cdot u^{r}.\]  
The idea is to fit the curve \(f(u)\) such that the distance to the knot points from the curve is minimized given the parametrization \(u\). To perform this step, we rely on the method of the least squares, where the sum of squares of residuals of the curve points and their corresponding knot points are minimized.  
To iteratively approximate the parameters, it is required to make an initial parametrization, which is based on the centripetal parametrization approach (see formula below):  
\[u_{0}=0,\quad u_{i}=u_{i-1}+\frac{|P_{i}-P_{i-1}|^{1/2}}{\sum_{j=1}^{n-1}|P_{j }-P_{j-1}|^{1/2}}\]  
The input parameters for the algorithm are the same as for Algorithm 1 and contain the coordinates of the event node \(x\), \(y\), \(z\), the event identification number \(N\), the station number \(s\), the detector number \(d\), and the track number \(T\) within the event.  
The algorithm is based on fitting spatial polynomials of the third degree to track coordinates. To find new estimates of parameters at each iteration, the Golden Ratio search method is used for locally minimizing the approximation error computed as described above from the residual values of knot points and the corresponding curve. Due to the more efficient computational cycle, this algorithm is characterized by a fast computation procedure and is therefore less computationally demanding.  
Because the Golden search method demands a certain number of iterations until convergence, we need to determine the optimal number of iterations for convergence to the required calculation accuracy. To this end, we have applied convergence estimation methods according to the formula  
\[n=\frac{\log\Bigl{(}\frac{\varepsilon}{\left\|p-a\right\|}\Bigr{)}}{\log(R)} \tag{12}\]  
Using this formula, we can estimate the number of iterations \(n\) that algorithm will take to find a minimum on the given interval between endpoints \(u_{i-1}\) and \(u_{i+1}\) for each corresponding dimension in the 3D plane for the estimated parameter value \(u_{i}\). The Golden Ratio search is an effective way of gradually reducing the interval for finding the minimum. Ensuring that the estimated minimum falls within the range defined by the two points immediately adjacent to the point with the lowest estimated value is crucial, regardless of the number of estimated points.  
Next, polynomials are constructed using standard quadratic error minimization techniques:  
\[E=\sum_{j=1}^{k}\left|p(x_{j})-y_{j}\right|^{2}\]