24 float f1, f2, f3, f4, f5, Y, chi2;
26 for (Int_t
i = 0;
i < 4;
i++) {
29 for (Int_t j = 0; j < 4; j++) {
34 const int N = triplet.
N();
40 cout <<
" **************** Param before Refit_1 ************ " << endl;
44 cout <<
" param.Tx()[0] " << param.Tx()[0] <<
" param.Ty()[0] " << param.Ty()[0] <<
" param.QP()[0] " << param.QP()[0] <<
" param.X()[0] " << param.
X()[0] <<
" param.Y()[0] " 45 << param.
Y()[0] <<
" param.Z()[0] " << param.
Z()[0] <<
" param.Chi2()[0] " << param.
Chi2()[0] <<
" param.NDF()[0] " << param.
NDF()[0] << endl;
49 Bx = param.
X()[0] - param.Tx()[0] * param.
Z()[0];
50 By = param.
Y()[0] - param.Ty()[0] * param.
Z()[0];
57 cout <<
" **************** Before Refit_1 ************ " << endl;
58 cout <<
" Tx " << Tx << endl;
59 cout <<
" Ty " << Ty << endl;
60 cout <<
" Bx " << Bx << endl;
61 cout <<
" By " << By << endl;
65 for (
int it = 0; it < 3; it++) {
67 for (Int_t
i = 0;
i < 4;
i++) {
70 for (Int_t j = 0; j < 4; j++) {
75 for (
int ihit = 0; ihit < N; ihit++) {
76 const TESV &index = triplet.
IHit(ihit);
77 cout <<
"index.s station " << index.
s <<
" index.e " << index.
e << endl;
80 const FTSCAHit &hit = hits_st[index.
e[0]];
83 cout <<
"chtck hit.IStation()" << ISta << endl;
90 cout <<
" ************************************************* " << endl;
96 cout <<
" hit.R() " << hit.R() <<
" hit.ErrR() " <<
sqrt(hit.Err2R()) << endl;
97 cout <<
" X " << hit.
X1() <<
" Y " << hit.
X2() <<
" Z " << hit.
X0() << endl;
100 const float s = station.
f.
sin;
102 const float c = station.
f.
cos;
104 cout <<
" s " << s <<
" c " << c << endl;
110 float R_MC = (c * (Tx_MC * hit.
X0() + Bx_MC - hit.
X1()) + s * (Ty_MC * hit.
X0() + By_MC - hit.
X2())) /
sqrt(1.
f + (c * Tx_MC + s * Ty_MC) * (c * Tx_MC + s * Ty_MC));
115 float Diff_D_R = D2_mc_hit - hit.R();
116 cout <<
" D2_mc_hit " << D2_mc_hit <<
" hit.R() " << hit.R() <<
" Diff_D_R " << Diff_D_R << endl;
122 diff_R = R_MC - hit.R();
124 diff_R = R_MC + hit.R();
126 cout <<
" diff_R " << diff_R << endl;
129 (c * (Tx_MC * hit_1.
point_Z + Bx_MC - hit.
X1()) + s * (Ty_MC * hit_1.
point_Z + By_MC - hit.
X2())) /
sqrt(1.
f + (c * Tx_MC + s * Ty_MC) * (c * Tx_MC + s * Ty_MC));
133 diff_R_1 = R_MC_1 - hit.R();
135 diff_R_1 = R_MC_1 + hit.R();
137 cout <<
" diff_R_1 " << diff_R_1 << endl;
139 float R_MC_2 = (c * (hit_1.
point_X - hit.
X1()) + s * (hit_1.
point_Y - hit.
X2())) /
sqrt(1.
f + (c * Tx_MC + s * Ty_MC) * (c * Tx_MC + s * Ty_MC));
141 cout <<
" R_MC_2 " << R_MC_2 <<
" hit.R()" << hit.R() << endl;
145 diff_R_2 = R_MC_2 + hit.R();
147 diff_R_2 = R_MC_2 - hit.R();
149 cout <<
" diff_R_2 " << diff_R_2 << endl;
162 float Y_point_of_wire = 0.f;
165 float fX = Tx * hit.
X0() + Bx;
166 float fY = Ty * hit.
X0() + By;
168 cout <<
" Tx " << Tx <<
" Bx " << Bx <<
" Ty " << Ty <<
" By " << By << endl;
170 float tx = c * Tx + s * Ty;
171 float rCorrection =
sqrt(1.
f + tx * tx);
173 float Diff = c * (fX - hit.
X1()) + s * (fY - hit.
X2());
180 cout <<
" Diff " << Diff <<
" Diff_mc " << Diff_mc << endl;
182 cout <<
" ************************************************* " << endl;
193 float err =
sqrt(hit.Err2R());
196 Y = (R - (Diff / rCorrection)) / err;
199 f1 = (c * hit.
X0() / rCorrection - c * Diff * tx / (rCorrection * rCorrection * rCorrection)) / err;
204 f2 = c / (rCorrection * err);
207 f3 = (s * hit.
X0() / rCorrection - s * Diff * tx / (rCorrection * rCorrection * rCorrection)) / err;
210 f4 = s / (rCorrection * err);
216 H(0, 0) = H(0, 0) + f1 * f1;
217 H(0, 1) = H(0, 1) + f1 * f2;
218 H(0, 2) = H(0, 2) + f1 * f3;
219 H(0, 3) = H(0, 3) + f1 * f4;
221 H(1, 1) = H(1, 1) + f2 * f2;
222 H(1, 2) = H(1, 2) + f2 * f3;
223 H(1, 3) = H(1, 3) + f2 * f4;
226 H(2, 2) = H(2, 2) + f3 * f3;
227 H(2, 3) = H(2, 3) + f3 * f4;
231 H(3, 3) = H(2, 3) + f4 * f4;
233 HY(0, 0) = HY(0, 0) + Y * f1;
234 HY(1, 0) = HY(1, 0) + Y * f2;
235 HY(2, 0) = HY(2, 0) + Y * f3;
236 HY(3, 0) = HY(3, 0) + Y * f4;
245 cout <<
"det= " << det << endl;
250 cout <<
"DTx= " << HC(0, 0) <<
" +- " <<
sqrt(Cov(0, 0)) << endl;
251 cout <<
"DBx= " << HC(1, 0) <<
" +- " <<
sqrt(Cov(1, 1)) << endl;
252 cout <<
"DTy= " << HC(2, 0) <<
" +- " <<
sqrt(Cov(2, 2)) << endl;
253 cout <<
"DBy= " << HC(3, 0) <<
" +- " <<
sqrt(Cov(3, 3)) << endl;
260 cout <<
"Tx= " << Tx << endl;
261 cout <<
"Ty= " << Ty << endl;
262 cout <<
"Bx= " << Bx << endl;
263 cout <<
"By= " << By << endl;
269 param.
SetX(Tx * param.
Z()[0] + Bx);
270 param.
SetY(Ty * param.
Z()[0] + By);
275 float Tx_1 = param.Tx()[0];
276 float Ty_1 = param.Ty()[0];
277 float Bx_1 = param.Bx()[0];
282 for (
int ihit = 0; ihit < N; ihit++) {
283 const TESV &index = triplet.
IHit(ihit);
284 cout <<
"index.s station " << index.
s <<
" index.e " << index.
e << endl;
287 const FTSCAHit &hit = hits_st[index.
e[0]];
290 cout <<
"chtck hit.IStation()" << ISta << endl;
293 const float s_1 = station.
f.
sin;
295 const float c_1 = station.
f.
cos;
297 cout <<
" s_1 " << s_1 <<
" c_1 " << c_1 << endl;
299 float tx_1 = c_1 * Tx_1 + s_1 * Ty_1;
300 float rCorrection_1 =
sqrt(1.
f + tx_1 * tx_1);
301 float fX_1 = Tx_1 * hit.
X0() + Bx_1;
302 float fY_1 = Ty_1 * hit.
X0() + By_1;
304 float Diff_1 = c_1 * (fX_1 - hit.
X1()) + s_1 * (fY_1 - hit.
X2());
306 float tx_k = c_1 * Tx_K + s_1 * Ty_K;
307 float rCorrection_k =
sqrt(1.
f + tx_k * tx_k);
308 float fX_k = Tx_K * hit.
X0() + Bx_K;
309 float fY_k = Ty_K * hit.
X0() + By_K;
311 float Diff_k = c_1 * (fX_k - hit.
X1()) + s_1 * (fY_k - hit.
X2());
317 float Y_point_of_wire_1 = 0.f;
324 float err_1 =
sqrt(hit.Err2R());
334 Mes = (Diff_1 / rCorrection_1 - R_1) /
sqrt(hit.Err2R());
335 Mes_k = (Diff_k / rCorrection_k - R_k) /
sqrt(hit.Err2R());
337 float Mes1 = (Diff_1 - R_1 * rCorrection_1) / (err_1 * rCorrection_1);
339 cout <<
" change sighn for hit " << ihit << endl;
341 cout <<
" Mes " << Mes <<
" Mes1 " << Mes1 << endl;
342 chi2 = chi2 + Mes * Mes;
343 chi2_k = chi2_k + Mes_k * Mes_k;
344 cout <<
" Mes*Mes " << Mes * Mes << endl;
346 cout <<
" chi2 " << chi2 <<
" chi2_k " << chi2_k << endl;
void SetY(const float_v &v)
const PndFTSCATrackParamVector & Param() const
void SetX(const float_v &v)
friend F32vec4 sqrt(const F32vec4 &a)
const PndFTSCAParam & GetParameters() const
void SetChi2(const float_v &v)
const FTSCAStation & Station(short i) const
PndFTSResizableArray< PndFTSCAGBHit > fHits
const TESV & IHit(int IH) const
const FTSCAElementsOnStation< T > & OnStationConst(char i) const
TMatrixT< double > TMatrixD
void Refit_1(FTSCANPletV &triplet, const FTSCAHits &hits)