33 Double_t vecRKoutT[7];
35 Norm[0]=vec1[1]*vec2[2] - vec2[2] * vec2[1];
36 Norm[1]=vec1[2]*vec2[0] - vec1[0] * vec2[2];
37 Norm[2]=vec1[0]*vec2[1] - vec1[1] * vec2[0];
39 Mag=TMath::Sqrt(Norm[0]*Norm[0]+Norm[1]*Norm[1]+Norm[2]*Norm[2]);
48 dist[0]=vecRKIn[0]-vec3[0];
49 dist[1]=vecRKIn[1]-vec3[1];
50 dist[2]=vecRKIn[2]-vec3[2];
52 distance[0]=Norm[0]*dist[0];
53 distance[1]=Norm[1]*dist[1];
54 distance[2]=Norm[2]*dist[2];
56 Double_t diff = TMath::Abs(distance[0]+distance[1]+distance[2]);
59 Double_t res_old = 100.0;
68 Step(Charge,vecRKIn,vecRKOut);
69 dist[0]=(vecRKOut[0]-vec3[0])*Norm[0];
70 dist[1]=(vecRKOut[1]-vec3[1])*Norm[1];
71 dist[2]=(vecRKOut[2]-vec3[2])*Norm[2];
72 fMaxStep=TMath::Sqrt(dist[0]*dist[0]+dist[1]*dist[1]+dist[2]*dist[2]);
75 if( res< 0.001 || res >res_old ) {
78 for (Int_t i=0; i< 3; i++) {
79 vecRKIn[i]=vecRKOut[i];
80 vecRKoutT[i]=vecRKOut[i];
84 if(nIter++>1000) {
break; }
88 for (Int_t i=0; i< 3; i++) {
89 if (res > res_old) { vecOut[i]=vecRKoutT[i]; }
90 else { vecOut[i]=vecRKOut[i]; }
96 Double_t diff = Pos[2] - vecRKIn[2];
98 Double_t res_old= diff;
100 Double_t vecRKOut[7];
101 Double_t vecRKOutT[7];
102 for (Int_t i=0; i< 7; i++) {vecRKOut[i]=0; vecRKOutT[i]=0;}
106 Step(Charge,vecRKIn,vecRKOut);
107 res=(vecRKOut[2]-Pos[2])/diff;
108 if( TMath::Abs(res)< 0.01 || res >res_old ) {
111 for (Int_t i=0; i< 3; i++) {
112 vecRKOutT[i]=vecRKOut[i];
113 vecRKIn[i]=vecRKOut[i];
116 if(nIter++>1000) {
break; }
118 if (res > res_old)
for (Int_t
k=0;
k< 7;
k++) { vecRKOut[
k]=vecRKOutT[
k]; }
119 for (Int_t
k=0;
k< 3;
k++) {
printf(
" vecRKOut[%i] =%f ",
k, vecRKOut[
k] ); }
126 Double_t vecRKOut[7];
127 for (Int_t i=0; i< 7; i++) { vecRKOut[i]=0; }
132 vecOut[0] = vecRKOut[0];
133 vecOut[1] = vecRKOut[1];
134 vecOut[2] = vecRKOut[2];
135 vecOut[6] = vecRKOut[6];
136 vecOut[3] = vecRKOut[3]/vecOut[6];
137 vecOut[4] = vecRKOut[4]/vecOut[6];
138 vecOut[5] = vecRKOut[5]/vecOut[6];
144 Double_t* vect, Double_t* vout)
171 Double_t
h2, h4, f[4];
172 Double_t
xyzt[3], a=0, b=0,
c=0, ph,ph2;
173 Double_t secxs[4],secys[4],seczs[4];
174 Double_t ang2, dxt, dyt, dzt;
175 Double_t est,
at, bt, ct, cba;
188 Double_t maxcut = 11;
190 const Double_t hmin = 1
e-4;
191 const Double_t kdlt = 1
e-3;
192 const Double_t kdlt32 = kdlt/32.;
193 const Double_t kthird = 1./3.;
194 const Double_t khalf = 0.5;
195 const Double_t kec = 2.9979251e-3;
196 const Double_t kpisqua = 9.86960440109;
211 for(Int_t j = 0; j < 7; j++) {
215 Double_t pinv = kec * charge / vect[6];
222 printf(
" Step no. %i x=%f y=%f z=%f px/p = %f py/p =%f pz/p= %f \n", iter, x,y,z,a,b,
c);
223 if (TMath::Abs(h) > TMath::Abs(rest)) {
254 secxs[0] = (b * f[2] -
c * f[1]) * ph2;
255 secys[0] = (
c * f[0] - a * f[2]) * ph2;
256 seczs[0] = (a * f[1] - b * f[0]) * ph2;
257 ang2 = (secxs[0]*secxs[0] + secys[0]*secys[0] + seczs[0]*seczs[0]);
258 if (ang2 > kpisqua) {
break; }
260 dxt = h2 * a + h4 * secxs[0];
261 dyt = h2 * b + h4 * secys[0];
262 dzt = h2 *
c + h4 * seczs[0];
269 est = TMath::Abs(dxt) + TMath::Abs(dyt) + TMath::Abs(dzt);
271 if (ncut++ > maxcut) {
break; }
300 secxs[1] = (bt * f[2] - ct * f[1]) * ph2;
301 secys[1] = (ct * f[0] - at * f[2]) * ph2;
302 seczs[1] = (at * f[1] - bt * f[0]) * ph2;
306 secxs[2] = (bt * f[2] - ct * f[1]) * ph2;
307 secys[2] = (ct * f[0] - at * f[2]) * ph2;
308 seczs[2] = (at * f[1] - bt * f[0]) * ph2;
309 dxt = h * (a + secxs[2]);
310 dyt = h * (b + secys[2]);
311 dzt = h * (
c + seczs[2]);
315 at = a + 2.*secxs[2];
316 bt = b + 2.*secys[2];
317 ct =
c + 2.*seczs[2];
320 est = TMath::Abs(dxt)+TMath::Abs(dyt)+TMath::Abs(dzt);
321 if (est > 2.*TMath::Abs(h)) {
322 if (ncut++ > maxcut) {
break; }
341 z = z + (
c + (seczs[0] + seczs[1] + seczs[2]) * kthird) *
h;
342 y = y + (b + (secys[0] + secys[1] + secys[2]) * kthird) *
h;
343 x = x + (a + (secxs[0] + secxs[1] + secxs[2]) * kthird) *
h;
345 secxs[3] = (bt*f[2] - ct*f[1])* ph2;
346 secys[3] = (ct*f[0] - at*f[2])* ph2;
347 seczs[3] = (at*f[1] - bt*f[0])* ph2;
348 a = a+(secxs[0]+secxs[3]+2. * (secxs[1]+secxs[2])) * kthird;
349 b = b+(secys[0]+secys[3]+2. * (secys[1]+secys[2])) * kthird;
350 c =
c+(seczs[0]+seczs[3]+2. * (seczs[1]+seczs[2])) * kthird;
352 est = TMath::Abs(secxs[0]+secxs[3] - (secxs[1]+secxs[2]))
353 + TMath::Abs(secys[0]+secys[3] - (secys[1]+secys[2]))
354 + TMath::Abs(seczs[0]+seczs[3] - (seczs[1]+seczs[2]));
356 if (est > kdlt && TMath::Abs(h) > hmin) {
357 if (ncut++ > maxcut) {
break; }
364 if (iter++ > maxit) {
break; }
370 cba = 1./ TMath::Sqrt(a*a + b*b +
c*
c);
382 if (step < 0.) { rest = -rest; }
383 if (rest < 1.
e-5*TMath::Abs(step)) {
return; }