15 for (Int_t
i=0;
i<4;
i++){
18 for (Int_t j=0; j<4; j++){
23 const int N = triplet.
N();
29 cout <<
" **************** Param before Refit_1 ************ " << endl;
33 cout <<
" param.Tx()[0] " << param.Tx()[0]
34 <<
" param.Ty()[0] " << param.Ty()[0]
35 <<
" param.QP()[0] " << param.QP()[0]
36 <<
" param.X()[0] " << param.
X()[0]
37 <<
" param.Y()[0] " << param.
Y()[0]
38 <<
" param.Z()[0] " << param.
Z()[0]
39 <<
" param.Chi2()[0] " << param.
Chi2()[0]
40 <<
" param.NDF()[0] " << param.
NDF()[0] << endl;
44 Bx = param.
X()[0] - param.Tx()[0]*param.
Z()[0];
45 By = param.
Y()[0] - param.Ty()[0]*param.
Z()[0];
52 cout <<
" **************** Before Refit_1 ************ " << endl;
53 cout <<
" Tx " << Tx << endl;
54 cout <<
" Ty " << Ty << endl;
55 cout <<
" Bx " << Bx << endl;
56 cout <<
" By " << By << endl;
60 for (
int it = 0; it < 3; it++ ) {
62 for (Int_t
i=0;
i<4;
i++){
65 for (Int_t j=0; j<4; j++){
70 for (
int ihit = 0; ihit < N; ihit++ ) {
71 const TESV& index = triplet.
IHit(ihit);
72 cout <<
"index.s station " << index.
s <<
" index.e " << index.
e << endl;
78 cout <<
"chtck hit.IStation()" << ISta << endl;
87 cout <<
" ************************************************* " << endl;
93 cout <<
" hit.R() " << hit.R() <<
" hit.ErrR() " <<
sqrt(hit.Err2R()) << endl;
94 cout <<
" X " << hit.
X1() <<
" Y " << hit.
X2() <<
" Z " << hit.
X0() << endl;
99 const float s = station.
f.
sin;
101 const float c = station.
f.
cos;
103 cout <<
" s " << s <<
" c " << c << endl;
109 float R_MC = (c*(Tx_MC*hit.
X0()+ Bx_MC - hit.
X1())
110 + s*(Ty_MC*hit.
X0()+ By_MC - hit.
X2()) )/
sqrt(1.
f + (c*Tx_MC + s*Ty_MC)*(c*Tx_MC + s*Ty_MC));
116 float Diff_D_R = D2_mc_hit -hit.R();
117 cout <<
" D2_mc_hit " << D2_mc_hit <<
" hit.R() " << hit.R() <<
118 " Diff_D_R " << Diff_D_R << endl;
125 diff_R = R_MC - hit.R();
127 diff_R = R_MC + hit.R();
129 cout <<
" diff_R " << diff_R << endl;
131 float R_MC_1 = (c*(Tx_MC*hit_1.
point_Z + Bx_MC - hit.
X1())
132 + 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));
136 diff_R_1 = R_MC_1 - hit.R();
138 diff_R_1 = R_MC_1 + hit.R();
140 cout <<
" diff_R_1 " << diff_R_1 << endl;
142 float R_MC_2 = (c*(hit_1.
point_X - hit.
X1())
143 + s*(hit_1.
point_Y - hit.
X2()) )/
sqrt(1.
f + (c*Tx_MC + s*Ty_MC)*(c*Tx_MC + s*Ty_MC));
145 cout <<
" R_MC_2 " << R_MC_2 <<
" hit.R()" << hit.R() << endl;
149 diff_R_2 = R_MC_2 + hit.R();
151 diff_R_2 = R_MC_2 - hit.R();
153 cout <<
" diff_R_2 " << diff_R_2 << endl;
168 float Y_point_of_wire=0.f;
172 float fX = Tx*hit.
X0() + Bx;
173 float fY = Ty*hit.
X0() + By;
175 cout <<
" Tx " << Tx <<
" Bx " << Bx <<
" Ty " << Ty <<
" By " << By << endl;
178 float tx = c*Tx + s*Ty;
179 float rCorrection =
sqrt(1.
f+tx*tx);
181 float Diff = c*(fX - hit.
X1()) + s*(fY - hit.
X2());
188 cout <<
" Diff " << Diff <<
" Diff_mc " << Diff_mc << endl;
190 cout <<
" ************************************************* " << endl;
194 if (Diff < 0.
f ) R=(-1.f)*R;
201 float err =
sqrt(hit.Err2R());
204 Y=(R-(Diff/rCorrection))/err;
207 f1 = (c*hit.
X0()/rCorrection - c*Diff*tx/(rCorrection*rCorrection*rCorrection))/err;
216 f2 = c/(rCorrection*err);
219 f3= (s*hit.
X0()/rCorrection - s*Diff*tx/(rCorrection*rCorrection*rCorrection))/err;
223 f4 = s/(rCorrection*err);
231 H(0,0) = H(0,0) + f1*
f1;
232 H(0,1) = H(0,1) + f1*
f2;
233 H(0,2) = H(0,2) + f1*
f3;
234 H(0,3) = H(0,3) + f1*
f4;
236 H(1,1) = H(1,1) + f2*
f2;
237 H(1,2) = H(1,2) + f2*
f3;
238 H(1,3) = H(1,3) + f2*
f4;
241 H(2,2) = H(2,2) + f3*
f3;
242 H(2,3) = H(2,3) + f3*
f4;
246 H(3,3) = H(2,3) + f4*
f4;
248 HY(0,0) = HY(0,0) + Y*
f1;
249 HY(1,0) = HY(1,0) + Y*
f2;
250 HY(2,0) = HY(2,0) + Y*
f3;
251 HY(3,0) = HY(3,0) + Y*
f4;
261 cout <<
"det= " << det << endl;
268 cout <<
"DTx= " << HC(0,0) <<
" +- " <<
sqrt(Cov(0,0)) << endl;
269 cout <<
"DBx= " << HC(1,0) <<
" +- " <<
sqrt(Cov(1,1)) << endl;
270 cout <<
"DTy= " << HC(2,0) <<
" +- " <<
sqrt(Cov(2,2)) << endl;
271 cout <<
"DBy= " << HC(3,0) <<
" +- " <<
sqrt(Cov(3,3)) << endl;
279 cout <<
"Tx= " << Tx << endl;
280 cout <<
"Ty= " << Ty << endl;
281 cout <<
"Bx= " << Bx << endl;
282 cout <<
"By= " << By << endl;
289 param.
SetX(Tx*param.
Z()[0] + Bx);
290 param.
SetY(Ty*param.
Z()[0] + By);
297 float Tx_1 = param.Tx()[0];
298 float Ty_1 = param.Ty()[0];
299 float Bx_1 = param.Bx()[0];
305 for (
int ihit = 0; ihit < N; ihit++ ) {
306 const TESV& index = triplet.
IHit(ihit);
307 cout <<
"index.s station " << index.
s <<
" index.e " << index.
e << endl;
313 cout <<
"chtck hit.IStation()" << ISta << endl;
316 const float s_1 = station.
f.
sin;
318 const float c_1 = station.
f.
cos;
320 cout <<
" s_1 " << s_1 <<
" c_1 " << c_1 << endl;
322 float tx_1 = c_1*Tx_1 + s_1*Ty_1;
323 float rCorrection_1 =
sqrt(1.
f+tx_1*tx_1);
324 float fX_1 = Tx_1*hit.
X0() + Bx_1;
325 float fY_1 = Ty_1*hit.
X0() + By_1;
327 float Diff_1 = c_1*(fX_1 - hit.
X1()) + s_1*(fY_1 - hit.
X2());
329 float tx_k = c_1*Tx_K + s_1*Ty_K;
330 float rCorrection_k =
sqrt(1.
f+tx_k*tx_k);
331 float fX_k = Tx_K*hit.
X0() + Bx_K;
332 float fY_k = Ty_K*hit.
X0() + By_K;
334 float Diff_k = c_1*(fX_k - hit.
X1()) + s_1*(fY_k - hit.
X2());
336 if (Diff_k < 0.
f ) R_k=(-1.f)*R_k;
341 float Y_point_of_wire_1=0.f;
344 if (Diff_1 < 0.
f ) R_1=(-1.f)*R_1;
347 float err_1 =
sqrt(hit.Err2R());
360 Mes = (Diff_1/rCorrection_1 - R_1)/
sqrt(hit.Err2R());
361 Mes_k = (Diff_k/rCorrection_k - R_k)/
sqrt(hit.Err2R());
364 float Mes1 = (Diff_1 - R_1*rCorrection_1)/(err_1*rCorrection_1);
366 cout <<
" change sighn for hit " << ihit << endl;
368 cout <<
" Mes " << Mes <<
" Mes1 " << Mes1 << endl;
370 chi2_k=chi2_k + Mes_k*Mes_k;
371 cout <<
" Mes*Mes " << Mes*Mes << endl;
374 cout <<
" chi2 " << chi2 <<
" chi2_k " << chi2_k << endl;
const TESV & IHit(int IH) const
const FTSCAStation & Station(short i) const
void SetY(const float_v &v)
void SetX(const float_v &v)
friend F32vec4 sqrt(const F32vec4 &a)
void SetChi2(const float_v &v)
const FTSCAElementsOnStation< T > & OnStationConst(char i) const
PndFTSResizableArray< PndFTSCAGBHit > fHits
const PndFTSCAParam & GetParameters() const
const PndFTSCATrackParamVector & Param() const
TMatrixT< double > TMatrixD
void Refit_1(FTSCANPletV &triplet, const FTSCAHits &hits)