11 |
extern "C" { |
extern "C" { |
12 |
void dotrack_(int*, double*, double*, double*, double*, int*); |
void dotrack_(int*, double*, double*, double*, double*, int*); |
13 |
void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); |
void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); |
14 |
int readb_(const char*); |
int readb_(const char*); |
15 |
} |
} |
16 |
//-------------------------------------- |
//-------------------------------------- |
17 |
// |
// |
21 |
seqno = -1; |
seqno = -1; |
22 |
image = -1; |
image = -1; |
23 |
chi2 = 0; |
chi2 = 0; |
24 |
for(int it1=0;it1<5;it1++){ |
nstep = 0; |
25 |
al[it1] = 0; |
for(int it1=0;it1<5;it1++){ |
26 |
for(int it2=0;it2<5;it2++) |
al[it1] = 0; |
27 |
coval[it1][it2] = 0; |
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
28 |
}; |
}; |
29 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
30 |
xgood[ip] = 0; |
xgood[ip] = 0; |
31 |
ygood[ip] = 0; |
ygood[ip] = 0; |
32 |
xm[ip] = 0; |
xm[ip] = 0; |
33 |
ym[ip] = 0; |
ym[ip] = 0; |
34 |
zm[ip] = 0; |
zm[ip] = 0; |
35 |
resx[ip] = 0; |
resx[ip] = 0; |
36 |
resy[ip] = 0; |
resy[ip] = 0; |
37 |
xv[ip] = 0; |
xv[ip] = 0; |
38 |
yv[ip] = 0; |
yv[ip] = 0; |
39 |
zv[ip] = 0; |
zv[ip] = 0; |
40 |
axv[ip] = 0; |
axv[ip] = 0; |
41 |
ayv[ip] = 0; |
ayv[ip] = 0; |
42 |
dedx_x[ip] = 0; |
dedx_x[ip] = 0; |
43 |
dedx_y[ip] = 0; |
dedx_y[ip] = 0; |
44 |
}; |
// clx[ip] = 0; |
45 |
|
// cly[ip] = 0; |
46 |
|
}; |
47 |
|
clx = new TRefArray(6,0); |
48 |
|
cly = new TRefArray(6,0); |
49 |
}; |
}; |
50 |
//-------------------------------------- |
//-------------------------------------- |
51 |
// |
// |
55 |
seqno = t.seqno; |
seqno = t.seqno; |
56 |
image = t.image; |
image = t.image; |
57 |
chi2 = t.chi2; |
chi2 = t.chi2; |
58 |
for(int it1=0;it1<5;it1++){ |
nstep = t.nstep; |
59 |
al[it1] = t.al[it1]; |
for(int it1=0;it1<5;it1++){ |
60 |
for(int it2=0;it2<5;it2++) |
al[it1] = t.al[it1]; |
61 |
coval[it1][it2] = t.coval[it1][it2]; |
for(int it2=0;it2<5;it2++)coval[it1][it2] = t.coval[it1][it2]; |
62 |
}; |
}; |
63 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
64 |
xgood[ip] = t.xgood[ip]; |
xgood[ip] = t.xgood[ip]; |
65 |
ygood[ip] = t.ygood[ip]; |
ygood[ip] = t.ygood[ip]; |
66 |
xm[ip] = t.xm[ip]; |
xm[ip] = t.xm[ip]; |
67 |
ym[ip] = t.ym[ip]; |
ym[ip] = t.ym[ip]; |
68 |
zm[ip] = t.zm[ip]; |
zm[ip] = t.zm[ip]; |
69 |
resx[ip] = t.resx[ip]; |
resx[ip] = t.resx[ip]; |
70 |
resy[ip] = t.resy[ip]; |
resy[ip] = t.resy[ip]; |
71 |
xv[ip] = t.xv[ip]; |
xv[ip] = t.xv[ip]; |
72 |
yv[ip] = t.yv[ip]; |
yv[ip] = t.yv[ip]; |
73 |
zv[ip] = t.zv[ip]; |
zv[ip] = t.zv[ip]; |
74 |
axv[ip] = t.axv[ip]; |
axv[ip] = t.axv[ip]; |
75 |
ayv[ip] = t.ayv[ip]; |
ayv[ip] = t.ayv[ip]; |
76 |
dedx_x[ip] = t.dedx_x[ip]; |
dedx_x[ip] = t.dedx_x[ip]; |
77 |
dedx_y[ip] = t.dedx_y[ip]; |
dedx_y[ip] = t.dedx_y[ip]; |
78 |
}; |
// clx[ip] = 0;//<<<<pointer |
79 |
|
// cly[ip] = 0;//<<<<pointer |
80 |
|
}; |
81 |
|
clx = new TRefArray(*(t.clx)); |
82 |
|
cly = new TRefArray(*(t.cly)); |
83 |
|
|
84 |
}; |
}; |
85 |
//-------------------------------------- |
//-------------------------------------- |
86 |
// |
// |
196 |
//-------------------------------------- |
//-------------------------------------- |
197 |
void TrkTrack::Dump(){ |
void TrkTrack::Dump(){ |
198 |
cout << endl << "========== Track " ; |
cout << endl << "========== Track " ; |
199 |
cout << endl << "al : "; for(int i=0; i<5; i++)cout << al[i] << " "; |
cout << endl << "seq. n. : "<< seqno; |
200 |
|
cout << endl << "image n. : "<< image; |
201 |
|
cout << endl << "al : "; for(int i=0; i<5; i++)cout << al[i] << " "; |
202 |
cout << endl << "chi^2 : "<< chi2; |
cout << endl << "chi^2 : "<< chi2; |
203 |
cout << endl << "xgood : "; for(int i=0; i<6; i++)cout << xgood[i] ; |
cout << endl << "n.step : "<< nstep; |
204 |
|
cout << endl << "xgood : "; for(int i=0; i<6; i++)cout << xgood[i] ; |
205 |
cout << endl << "ygood : "; for(int i=0; i<6; i++)cout << ygood[i] ; |
cout << endl << "ygood : "; for(int i=0; i<6; i++)cout << ygood[i] ; |
206 |
cout << endl << "xm : "; for(int i=0; i<6; i++)cout << xm[i] << " "; |
cout << endl << "xm : "; for(int i=0; i<6; i++)cout << xm[i] << " "; |
207 |
cout << endl << "ym : "; for(int i=0; i<6; i++)cout << ym[i] << " "; |
cout << endl << "ym : "; for(int i=0; i<6; i++)cout << ym[i] << " "; |
213 |
// |
// |
214 |
// |
// |
215 |
//-------------------------------------- |
//-------------------------------------- |
216 |
|
void TrkTrack::Clear(){ |
217 |
|
seqno = -1; |
218 |
|
image = -1; |
219 |
|
chi2 = 0; |
220 |
|
nstep = 0; |
221 |
|
for(int it1=0;it1<5;it1++){ |
222 |
|
al[it1] = 0; |
223 |
|
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
224 |
|
}; |
225 |
|
for(int ip=0;ip<6;ip++){ |
226 |
|
xgood[ip] = 0; |
227 |
|
ygood[ip] = 0; |
228 |
|
xm[ip] = 0; |
229 |
|
ym[ip] = 0; |
230 |
|
zm[ip] = 0; |
231 |
|
resx[ip] = 0; |
232 |
|
resy[ip] = 0; |
233 |
|
xv[ip] = 0; |
234 |
|
yv[ip] = 0; |
235 |
|
zv[ip] = 0; |
236 |
|
axv[ip] = 0; |
237 |
|
ayv[ip] = 0; |
238 |
|
dedx_x[ip] = 0; |
239 |
|
dedx_y[ip] = 0; |
240 |
|
// clx[ip] = 0; |
241 |
|
// cly[ip] = 0; |
242 |
|
}; |
243 |
|
clx->Clear(); |
244 |
|
cly->Clear(); |
245 |
|
}; |
246 |
|
//-------------------------------------- |
247 |
|
// |
248 |
|
// |
249 |
|
//-------------------------------------- |
250 |
|
void TrkTrack::Delete(){ |
251 |
|
Clear(); |
252 |
|
clx->Delete(); |
253 |
|
cly->Delete(); |
254 |
|
}; |
255 |
|
//-------------------------------------- |
256 |
|
// |
257 |
|
// |
258 |
|
//-------------------------------------- |
259 |
|
|
260 |
|
//-------------------------------------- |
261 |
|
// |
262 |
|
// |
263 |
|
//-------------------------------------- |
264 |
TrkSinglet::TrkSinglet(){ |
TrkSinglet::TrkSinglet(){ |
265 |
plane = 0; |
plane = 0; |
266 |
coord[0] = 0; |
coord[0] = 0; |
267 |
coord[1] = 0; |
coord[1] = 0; |
268 |
sgnl = 0; |
sgnl = 0; |
269 |
|
cls = 0; |
270 |
}; |
}; |
271 |
//-------------------------------------- |
//-------------------------------------- |
272 |
// |
// |
277 |
coord[0] = s.coord[0]; |
coord[0] = s.coord[0]; |
278 |
coord[1] = s.coord[1]; |
coord[1] = s.coord[1]; |
279 |
sgnl = s.sgnl; |
sgnl = s.sgnl; |
280 |
|
// cls = 0;//<<<<pointer |
281 |
|
cls = TRef(s.cls); |
282 |
}; |
}; |
283 |
//-------------------------------------- |
//-------------------------------------- |
284 |
// |
// |
296 |
// |
// |
297 |
//-------------------------------------- |
//-------------------------------------- |
298 |
TrkLevel2::TrkLevel2(){ |
TrkLevel2::TrkLevel2(){ |
299 |
good2 = -1; |
// good2 = -1; |
300 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
301 |
crc[i] = -1; |
// crc[i] = -1; |
302 |
}; |
good[i] = -1; |
303 |
|
}; |
304 |
Track = new TClonesArray("TrkTrack"); |
Track = new TClonesArray("TrkTrack"); |
305 |
SingletX = new TClonesArray("TrkSinglet"); |
SingletX = new TClonesArray("TrkSinglet"); |
306 |
SingletY = new TClonesArray("TrkSinglet"); |
SingletY = new TClonesArray("TrkSinglet"); |
313 |
// |
// |
314 |
//-------------------------------------- |
//-------------------------------------- |
315 |
void TrkLevel2::Dump(){ |
void TrkLevel2::Dump(){ |
316 |
|
|
317 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
318 |
TClonesArray &sx = *SingletX; |
TClonesArray &sx = *SingletX; |
319 |
TClonesArray &sy = *SingletY; |
TClonesArray &sy = *SingletY; |
320 |
|
// |
321 |
cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; |
cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; |
322 |
cout << endl << "good2 : " << good2; |
cout << endl << "good : "; for(int i=0; i<12; i++) cout << good[i]<<" "; |
|
cout << endl << "crc : "; for(int i=0; i<12; i++) cout << crc[i]; |
|
323 |
cout << endl << "ntrk() : " << this->ntrk() ; |
cout << endl << "ntrk() : " << this->ntrk() ; |
324 |
cout << endl << "nclsx() : " << this->nclsx(); |
cout << endl << "nclsx() : " << this->nclsx(); |
325 |
cout << endl << "nclsy() : " << this->nclsy(); |
cout << endl << "nclsy() : " << this->nclsy(); |
335 |
* Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). |
* Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). |
336 |
*/ |
*/ |
337 |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){ |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){ |
338 |
// |
|
339 |
// Track = new TClonesArray("TrkTrack"); |
// temporary objects: |
|
// SingletX = new TClonesArray("TrkSinglet"); |
|
|
// SingletY = new TClonesArray("TrkSinglet"); |
|
|
// temporary objects: |
|
340 |
TrkSinglet* t_singlet = new TrkSinglet(); |
TrkSinglet* t_singlet = new TrkSinglet(); |
341 |
TrkTrack* t_track = new TrkTrack(); |
TrkTrack* t_track = new TrkTrack(); |
342 |
// general variables |
|
343 |
good2 = l2->good2; |
// **** general variables **** |
344 |
|
// good2 = l2->good2; |
345 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
346 |
crc[i] = l2->crc[i]; |
// crc[i] = l2->crc[i]; |
347 |
}; |
good[i] = l2->good[i]; |
348 |
// *** TRACKS *** |
}; |
349 |
|
// *** TRACKS *** |
350 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
351 |
for(int i=0; i<l2->ntrk; i++){ |
for(int i=0; i<l2->ntrk; i++){ |
352 |
t_track->seqno = i; |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
353 |
t_track->image = l2->image[i]-1; |
t_track->image = l2->image[i]-1; |
354 |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
355 |
t_track->chi2 = l2->chi2_nt[i]; |
t_track->chi2 = l2->chi2_nt[i]; |
356 |
for(int it1=0;it1<5;it1++){ |
t_track->nstep = l2->nstep_nt[i]; |
357 |
t_track->al[it1] = l2->al_nt[i][it1]; |
for(int it1=0;it1<5;it1++){ |
358 |
for(int it2=0;it2<5;it2++) |
t_track->al[it1] = l2->al_nt[i][it1]; |
359 |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
for(int it2=0;it2<5;it2++) |
360 |
}; |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
361 |
for(int ip=0;ip<6;ip++){ |
}; |
362 |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
for(int ip=0;ip<6;ip++){ |
363 |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
364 |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
365 |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
366 |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
367 |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
368 |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
369 |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
370 |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
371 |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
372 |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
373 |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
374 |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
375 |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
376 |
}; |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
377 |
new(t[i]) TrkTrack(*t_track); |
// t_track->clx[ip] = 0; |
378 |
t_track->Clear(); |
// t_track->cly[ip] = 0; |
379 |
|
}; |
380 |
|
new(t[i]) TrkTrack(*t_track); |
381 |
|
t_track->Clear(); |
382 |
}; |
}; |
383 |
// *** SINGLETS *** |
// *** SINGLETS *** |
384 |
TClonesArray &sx = *SingletX; |
TClonesArray &sx = *SingletX; |
385 |
for(int i=0; i<l2->nclsx; i++){ |
for(int i=0; i<l2->nclsx; i++){ |
386 |
t_singlet->plane = l2->planex[i]; |
t_singlet->plane = l2->planex[i]; |
387 |
t_singlet->coord[0] = l2->xs[i][0]; |
t_singlet->coord[0] = l2->xs[i][0]; |
388 |
t_singlet->coord[1] = l2->xs[i][1]; |
t_singlet->coord[1] = l2->xs[i][1]; |
389 |
t_singlet->sgnl = l2->signlxs[i]; |
t_singlet->sgnl = l2->signlxs[i]; |
390 |
new(sx[i]) TrkSinglet(*t_singlet); |
// t_singlet->cls = 0; |
391 |
t_singlet->Clear(); |
new(sx[i]) TrkSinglet(*t_singlet); |
392 |
|
t_singlet->Clear(); |
393 |
} |
} |
394 |
TClonesArray &sy = *SingletY; |
TClonesArray &sy = *SingletY; |
395 |
for(int i=0; i<l2->nclsy; i++){ |
for(int i=0; i<l2->nclsy; i++){ |
396 |
t_singlet->plane = l2->planey[i]; |
t_singlet->plane = l2->planey[i]; |
397 |
t_singlet->coord[0] = l2->ys[i][0]; |
t_singlet->coord[0] = l2->ys[i][0]; |
398 |
t_singlet->coord[1] = l2->ys[i][1]; |
t_singlet->coord[1] = l2->ys[i][1]; |
399 |
t_singlet->sgnl = l2->signlys[i]; |
t_singlet->sgnl = l2->signlys[i]; |
400 |
new(sy[i]) TrkSinglet(*t_singlet); |
// t_singlet->cls = 0; |
401 |
t_singlet->Clear(); |
new(sy[i]) TrkSinglet(*t_singlet); |
402 |
|
t_singlet->Clear(); |
403 |
|
}; |
404 |
|
|
405 |
|
delete t_track; |
406 |
|
delete t_singlet; |
407 |
|
} |
408 |
|
//-------------------------------------- |
409 |
|
// |
410 |
|
// |
411 |
|
//-------------------------------------- |
412 |
|
/** |
413 |
|
* Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). |
414 |
|
* Ref to Level1 data (clusters) is also set. |
415 |
|
*/ |
416 |
|
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ |
417 |
|
|
418 |
|
// temporary objects: |
419 |
|
TrkSinglet* t_singlet = new TrkSinglet(); |
420 |
|
TrkTrack* t_track = new TrkTrack(); |
421 |
|
// general variables |
422 |
|
// good2 = l2->good2; |
423 |
|
for(Int_t i=0; i<12 ; i++){ |
424 |
|
// crc[i] = l2->crc[i]; |
425 |
|
good[i] = l2->good[i]; |
426 |
|
}; |
427 |
|
// *** TRACKS *** |
428 |
|
TClonesArray &t = *Track; |
429 |
|
for(int i=0; i<l2->ntrk; i++){ |
430 |
|
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
431 |
|
t_track->image = l2->image[i]-1; |
432 |
|
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
433 |
|
t_track->chi2 = l2->chi2_nt[i]; |
434 |
|
t_track->nstep = l2->nstep_nt[i]; |
435 |
|
for(int it1=0;it1<5;it1++){ |
436 |
|
t_track->al[it1] = l2->al_nt[i][it1]; |
437 |
|
for(int it2=0;it2<5;it2++) |
438 |
|
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
439 |
|
}; |
440 |
|
for(int ip=0;ip<6;ip++){ |
441 |
|
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
442 |
|
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
443 |
|
t_track->xm[ip] = l2->xm_nt[i][ip]; |
444 |
|
t_track->ym[ip] = l2->ym_nt[i][ip]; |
445 |
|
t_track->zm[ip] = l2->zm_nt[i][ip]; |
446 |
|
t_track->resx[ip] = l2->resx_nt[i][ip]; |
447 |
|
t_track->resy[ip] = l2->resy_nt[i][ip]; |
448 |
|
t_track->xv[ip] = l2->xv_nt[i][ip]; |
449 |
|
t_track->yv[ip] = l2->yv_nt[i][ip]; |
450 |
|
t_track->zv[ip] = l2->zv_nt[i][ip]; |
451 |
|
t_track->axv[ip] = l2->axv_nt[i][ip]; |
452 |
|
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
453 |
|
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
454 |
|
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
455 |
|
// cout << "traccia "<<i<<" -- "<< ip << " "<< l2->cltrx[i][ip] <<" "<< l2->cltry[i][ip] <<" "<< t_track->xgood[ip] << t_track->ygood[ip]<<endl; |
456 |
|
//----------------------------------------------------- |
457 |
|
// t_track->clx[ip] = l1->GetCluster(l2->cltrx[i][ip]-1); |
458 |
|
// t_track->cly[ip] = l1->GetCluster(l2->cltry[i][ip]-1); |
459 |
|
if(t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
460 |
|
if(t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
461 |
|
// if(t_track->ygood[ip])cout<<" i "<<i<<" ip "<<ip<<" l2->cltry[i][ip] "<<l2->cltry[i][ip]<< " l1->GetCluster(l2->cltry[i][ip]-1) "<<l1->GetCluster(l2->cltry[i][ip]-1)<<endl; |
462 |
|
// if(t_track->xgood[ip])cout<<" i "<<i<<" ip "<<ip<<" l2->cltrx[i][ip] "<<l2->cltrx[i][ip]<< " l1->GetCluster(l2->cltrx[i][ip]-1) "<<l1->GetCluster(l2->cltrx[i][ip]-1)<<endl; |
463 |
|
//----------------------------------------------------- |
464 |
|
}; |
465 |
|
new(t[i]) TrkTrack(*t_track); |
466 |
|
t_track->Clear(); |
467 |
|
}; |
468 |
|
// *** SINGLETS *** |
469 |
|
TClonesArray &sx = *SingletX; |
470 |
|
for(int i=0; i<l2->nclsx; i++){ |
471 |
|
t_singlet->plane = l2->planex[i]; |
472 |
|
t_singlet->coord[0] = l2->xs[i][0]; |
473 |
|
t_singlet->coord[1] = l2->xs[i][1]; |
474 |
|
t_singlet->sgnl = l2->signlxs[i]; |
475 |
|
//----------------------------------------------------- |
476 |
|
// cout << "singolo x "<<i<<" -- "<< l2->clsx[i] <<endl; |
477 |
|
t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
478 |
|
// cout<<" i "<<i<<" l2->clsx[i] "<<l2->clsx[i]<< " l1->GetCluster(l2->clsx[i]-1) "<<l1->GetCluster(l2->clsx[i]-1)<<endl; |
479 |
|
//----------------------------------------------------- |
480 |
|
new(sx[i]) TrkSinglet(*t_singlet); |
481 |
|
t_singlet->Clear(); |
482 |
|
} |
483 |
|
TClonesArray &sy = *SingletY; |
484 |
|
for(int i=0; i<l2->nclsy; i++){ |
485 |
|
t_singlet->plane = l2->planey[i]; |
486 |
|
t_singlet->coord[0] = l2->ys[i][0]; |
487 |
|
t_singlet->coord[1] = l2->ys[i][1]; |
488 |
|
t_singlet->sgnl = l2->signlys[i]; |
489 |
|
//----------------------------------------------------- |
490 |
|
// cout << "singolo y "<<i<<" -- "<< l2->clsy[i] <<endl; |
491 |
|
t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
492 |
|
// cout<<" i "<<i<<" l2->clsy[i] "<<l2->clsy[i]<< " l1->GetCluster(l2->clsy[i]-1) "<<l1->GetCluster(l2->clsy[i]-1)<<endl; |
493 |
|
//----------------------------------------------------- |
494 |
|
new(sy[i]) TrkSinglet(*t_singlet); |
495 |
|
t_singlet->Clear(); |
496 |
}; |
}; |
497 |
|
|
498 |
delete t_track; |
delete t_track; |
505 |
void TrkLevel2::GetLevel2Struct(cTrkLevel2 *l2) const { |
void TrkLevel2::GetLevel2Struct(cTrkLevel2 *l2) const { |
506 |
|
|
507 |
// general variables |
// general variables |
508 |
l2->good2 = good2 ; |
// l2->good2 = good2 ; |
509 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
510 |
l2->crc[i] = crc[i]; |
// l2->crc[i] = crc[i]; |
511 |
|
l2->good[i] = good[i]; |
512 |
}; |
}; |
513 |
// *** TRACKS *** |
// *** TRACKS *** |
514 |
|
|
516 |
for(Int_t i=0;i<l2->ntrk;i++){ |
for(Int_t i=0;i<l2->ntrk;i++){ |
517 |
l2->image[i] = 1 + ((TrkTrack *)Track->At(i))->image; |
l2->image[i] = 1 + ((TrkTrack *)Track->At(i))->image; |
518 |
l2->chi2_nt[i] = ((TrkTrack *)Track->At(i))->chi2; |
l2->chi2_nt[i] = ((TrkTrack *)Track->At(i))->chi2; |
519 |
for(int it1=0;it1<5;it1++){ |
l2->nstep_nt[i] = ((TrkTrack *)Track->At(i))->nstep; |
520 |
|
for(int it1=0;it1<5;it1++){ |
521 |
l2->al_nt[i][it1] = ((TrkTrack *)Track->At(i))->al[it1]; |
l2->al_nt[i][it1] = ((TrkTrack *)Track->At(i))->al[it1]; |
522 |
for(int it2=0;it2<5;it2++) |
for(int it2=0;it2<5;it2++) |
523 |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
561 |
// |
// |
562 |
//-------------------------------------- |
//-------------------------------------- |
563 |
void TrkLevel2::Clear(){ |
void TrkLevel2::Clear(){ |
564 |
good2 = -1; |
// good2 = -1; |
565 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
566 |
crc[i] = -1; |
// crc[i] = -1; |
567 |
}; |
good[i] = -1; |
568 |
|
}; |
569 |
/* Track->RemoveAll(); |
/* Track->RemoveAll(); |
570 |
SingletX->RemoveAll(); |
SingletX->RemoveAll(); |
571 |
SingletY->RemoveAll();*/ |
SingletY->RemoveAll();*/ |
578 |
// |
// |
579 |
// |
// |
580 |
//-------------------------------------- |
//-------------------------------------- |
581 |
|
void TrkLevel2::Delete(){ |
582 |
|
|
583 |
|
Clear(); |
584 |
|
Track->Delete(); |
585 |
|
SingletX->Delete(); |
586 |
|
SingletY->Delete(); |
587 |
|
} |
588 |
|
//-------------------------------------- |
589 |
|
// |
590 |
|
// |
591 |
|
//-------------------------------------- |
592 |
/** |
/** |
593 |
* Sort physical tracks and stores them in a TObjectArray, ordering by increasing chi**2 value (in case of track image, it selects the one with lower chi**2). The total number of physical tracks is given by GetNTracks() and the it-th physical track can be retrieved by means of the method GetTrack(int it). |
* Sort physical tracks and stores them in a TObjectArray, ordering by increasing chi**2 value (in case of track image, it selects the one with lower chi**2). The total number of physical tracks is given by GetNTracks() and the it-th physical track can be retrieved by means of the method GetTrack(int it). |
594 |
* This method is overridden by PamLevel2::GetTracks(), where calorimeter and TOF information is used. |
* This method is overridden by PamLevel2::GetTracks(), where calorimeter and TOF information is used. |
595 |
*/ |
*/ |
|
// TClonesArray *TrkLevel2::GetTracks(){ |
|
|
// TClonesArray *sorted = GetTracks_NFitSorted(); |
|
|
// return sorted; |
|
|
// }; |
|
|
|
|
|
/*TClonesArray *TrkLevel2::GetTracks_Chi2Sorted(){ |
|
|
|
|
|
TClonesArray *sorted = new TClonesArray("TrkTrack"); |
|
|
TClonesArray &t = *Track; |
|
|
TClonesArray &ts = *sorted; |
|
|
int N=this->ntrk(); |
|
|
vector<int> m(N); for(int i=0; i<N; i++)m[i]=1; |
|
|
|
|
|
int indo=0; |
|
|
int indi=0; |
|
|
while(N != 0){ |
|
|
float chi2ref=1000000; |
|
|
for(int i=0; i<this->ntrk(); i++){ |
|
|
if(((TrkTrack *)t[i])->chi2 < chi2ref && m[i]==1){ |
|
|
chi2ref = ((TrkTrack *)t[i])->chi2; |
|
|
indi = i; |
|
|
} |
|
|
} |
|
|
if( ((TrkTrack *)t[indi])->image != -1 ){ |
|
|
m[((TrkTrack *)t[indi])->image] = 0; |
|
|
N--; |
|
|
} |
|
|
new(ts[indo]) TrkTrack(*(TrkTrack*)t[indi]); |
|
|
m[indi] = 0; |
|
|
N--; |
|
|
indo++; |
|
|
} |
|
|
return sorted; |
|
|
}*/ |
|
|
/*TClonesArray *TrkLevel2::GetTracks_NFitSorted(){ |
|
|
|
|
|
TClonesArray *sorted = new TClonesArray("TrkTrack"); |
|
|
TClonesArray &t = *Track; |
|
|
TClonesArray &ts = *sorted; |
|
|
// TClonesArray &ts = *PhysicalTrack; |
|
|
int N = ntrk(); |
|
|
vector<int> m(N); for(int i=0; i<N; i++)m[i]=1; |
|
|
// int m[50]; for(int i=0; i<N; i++)m[i]=1; |
|
|
|
|
|
int indo=0; |
|
|
int indi=0; |
|
|
while(N != 0){ |
|
|
int nfit =0; |
|
|
float chi2ref = numeric_limits<float>::max(); |
|
|
// first loop to search maximum num. of fit points |
|
|
for(int i=0; i < ntrk(); i++){ |
|
|
// if(N==ntrk())cout << "** "<<i<< " " << ((TrkTrack *)t[i])->GetImageSeqNo()<< " " <<((TrkTrack *)t[i])->GetNtot() << " " <<((TrkTrack *)t[i])->chi2 << endl; |
|
|
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
|
|
nfit = ((TrkTrack *)t[i])->GetNtot(); |
|
|
} |
|
|
} |
|
|
//second loop to search minimum chi2 among selected |
|
|
for(int i=0; i<this->ntrk(); i++){ |
|
|
if( ((TrkTrack *)t[i])->chi2 < chi2ref |
|
|
&& ((TrkTrack *)t[i])->GetNtot()== nfit |
|
|
&& m[i]==1){ |
|
|
chi2ref = ((TrkTrack *)t[i])->chi2; |
|
|
indi = i; |
|
|
// cout << "2** "<<i<< " " << nfit <<" "<<chi2ref<<endl; |
|
|
} |
|
|
} |
|
|
if( ((TrkTrack *)t[indi])->HasImage() ){ |
|
|
m[((TrkTrack *)t[indi])->image] = 0; |
|
|
N--; |
|
|
|
|
|
// Int_t nfiti=((TrkTrack *)t[((TrkTrack *)t[indi])->image ])->GetNtot(); |
|
|
// Float_t chi2i=((TrkTrack *)t[((TrkTrack *)t[indi])->image ])->chi2; |
|
|
|
|
|
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
|
|
} |
|
|
new(ts[indo]) TrkTrack(*(TrkTrack*)t[indi]); |
|
|
m[indi] = 0; |
|
|
// cout << "SORTED "<< indo << " "<< indi << " "<< N << endl; |
|
|
N--; |
|
|
indo++; |
|
|
} |
|
|
m.clear(); |
|
|
return sorted; |
|
|
// return PhysicalTrack; |
|
|
}*/ |
|
|
//TClonesArray *TrkLevel2::GetTracks_NFitSorted(){ |
|
596 |
TRefArray *TrkLevel2::GetTracks_NFitSorted(){ |
TRefArray *TrkLevel2::GetTracks_NFitSorted(){ |
597 |
|
|
|
// cout << "GetTracks_NFitSorted(it): new TRefArray()"<< endl; |
|
|
// TClonesArray *sorted = new TClonesArray("TrkTrack"); |
|
|
// TClonesArray &ts = *sorted; |
|
598 |
TRefArray *sorted = new TRefArray(); |
TRefArray *sorted = new TRefArray(); |
599 |
|
|
600 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
608 |
while(N != 0){ |
while(N != 0){ |
609 |
int nfit =0; |
int nfit =0; |
610 |
float chi2ref = numeric_limits<float>::max(); |
float chi2ref = numeric_limits<float>::max(); |
611 |
|
|
612 |
// first loop to search maximum num. of fit points |
// first loop to search maximum num. of fit points |
613 |
for(int i=0; i < ntrk(); i++){ |
for(int i=0; i < ntrk(); i++){ |
|
// if(N==ntrk())cout << "** "<<i<< " " << ((TrkTrack *)t[i])->GetImageSeqNo()<< " " <<((TrkTrack *)t[i])->GetNtot() << " " <<((TrkTrack *)t[i])->chi2 << endl; |
|
614 |
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
615 |
nfit = ((TrkTrack *)t[i])->GetNtot(); |
nfit = ((TrkTrack *)t[i])->GetNtot(); |
616 |
} |
} |
617 |
} |
} |
618 |
//second loop to search minimum chi2 among selected |
//second loop to search minimum chi2 among selected |
619 |
for(int i=0; i<this->ntrk(); i++){ |
for(int i=0; i<this->ntrk(); i++){ |
620 |
if( ((TrkTrack *)t[i])->chi2 < chi2ref |
Float_t chi2 = ((TrkTrack *)t[i])->chi2; |
621 |
&& ((TrkTrack *)t[i])->GetNtot()== nfit |
if(chi2 < 0) chi2 = chi2*1000; |
622 |
&& m[i]==1){ |
if( chi2 < chi2ref |
623 |
|
&& ((TrkTrack *)t[i])->GetNtot() == nfit |
624 |
|
&& m[i]==1){ |
625 |
chi2ref = ((TrkTrack *)t[i])->chi2; |
chi2ref = ((TrkTrack *)t[i])->chi2; |
626 |
indi = i; |
indi = i; |
627 |
// cout << "2** "<<i<< " " << nfit <<" "<<chi2ref<<endl; |
}; |
628 |
} |
}; |
|
} |
|
629 |
if( ((TrkTrack *)t[indi])->HasImage() ){ |
if( ((TrkTrack *)t[indi])->HasImage() ){ |
630 |
m[((TrkTrack *)t[indi])->image] = 0; |
m[((TrkTrack *)t[indi])->image] = 0; |
631 |
N--; |
N--; |
632 |
|
|
|
// Int_t nfiti=((TrkTrack *)t[((TrkTrack *)t[indi])->image ])->GetNtot(); |
|
|
// Float_t chi2i=((TrkTrack *)t[((TrkTrack *)t[indi])->image ])->chi2; |
|
|
|
|
633 |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
634 |
} |
}; |
|
// new(ts[indo]) TrkTrack(*(TrkTrack*)t[indi]); |
|
|
// cout << "GetTracks_NFitSorted(it): Add("<<indo<<")"<< endl; |
|
635 |
sorted->Add( (TrkTrack*)t[indi] ); |
sorted->Add( (TrkTrack*)t[indi] ); |
636 |
|
|
637 |
m[indi] = 0; |
m[indi] = 0; |
711 |
* Retrieves the it-th "physical" track, sorted by the method GetNTracks(). |
* Retrieves the it-th "physical" track, sorted by the method GetNTracks(). |
712 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
713 |
*/ |
*/ |
714 |
/*TrkTrack *TrkLevel2::GetTrack(int it){ |
|
|
|
|
|
if(it >= this->GetNTracks()){ |
|
|
cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl; |
|
|
cout << " Physical tracks GetNTracks() = "<< this->ntrk() << endl; |
|
|
return 0; |
|
|
} |
|
|
TClonesArray* sorted = GetTracks(); |
|
|
TClonesArray &ts = *sorted; |
|
|
|
|
|
// TrkTrack *track = (TrkTrack*)ts[it]; |
|
|
TrkTrack *track = new TrkTrack( *(TrkTrack*)ts[it] ); //copia |
|
|
sorted->Delete("all");////TEMPORANEO |
|
|
return track; |
|
|
}*/ |
|
715 |
TrkTrack *TrkLevel2::GetTrack(int it){ |
TrkTrack *TrkLevel2::GetTrack(int it){ |
716 |
|
|
717 |
if(it >= this->GetNTracks()){ |
if(it >= this->GetNTracks()){ |
732 |
|
|
733 |
Float_t ntot=0; |
Float_t ntot=0; |
734 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
735 |
for(int i=0; i<ntrk(); i++) { |
for(int i=0; i<ntrk(); i++) { |
736 |
if( ((TrkTrack *)t[i])->GetImageSeqNo() == -1 ) ntot+=1.; |
if( ((TrkTrack *)t[i])->GetImageSeqNo() == -1 ) ntot+=1.; |
737 |
else ntot+=0.5; |
else ntot+=0.5; |
738 |
} |
} |
747 |
* Retrieves (if present) the image of the it-th "physical" track, sorted by the method GetNTracks(). |
* Retrieves (if present) the image of the it-th "physical" track, sorted by the method GetNTracks(). |
748 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
749 |
*/ |
*/ |
|
/*TrkTrack *TrkLevel2::GetTrackImage(int it){ |
|
|
|
|
|
if(it >= this->GetNTracks()){ |
|
|
cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl; |
|
|
cout << " Physical tracks GetNTracks() = "<< this->ntrk() << endl; |
|
|
return 0; |
|
|
} |
|
|
|
|
|
TClonesArray* sorted = GetTracks(); |
|
|
TClonesArray &ts = *sorted; |
|
|
TrkTrack *track = (TrkTrack*)ts[it]; |
|
|
// TrkTrack *track = (TrkTrack*)(*(this->GetTracks()))[it]; |
|
|
|
|
|
if(!track->HasImage()){ |
|
|
cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl; |
|
|
return 0; |
|
|
} |
|
|
TrkTrack *image = (TrkTrack*)(*Track)[track->image]; |
|
|
|
|
|
// GetTracks()->Delete(); ////TEMPORANEO |
|
|
sorted->Delete(); ////TEMPORANEO |
|
|
|
|
|
return image; |
|
|
|
|
|
}*/ |
|
750 |
TrkTrack *TrkLevel2::GetTrackImage(int it){ |
TrkTrack *TrkLevel2::GetTrackImage(int it){ |
751 |
|
|
752 |
if(it >= this->GetNTracks()){ |
if(it >= this->GetNTracks()){ |
876 |
tl = new float[npoint]; |
tl = new float[npoint]; |
877 |
int i=0; |
int i=0; |
878 |
do{ |
do{ |
879 |
x[i] = 0; |
x[i] = 0; |
880 |
y[i] = 0; |
y[i] = 0; |
881 |
z[i] = zin[i]; |
z[i] = zin[i]; |
882 |
thx[i] = 0; |
thx[i] = 0; |
883 |
thy[i] = 0; |
thy[i] = 0; |
884 |
tl[i] = 0; |
tl[i] = 0; |
885 |
i++; |
i++; |
886 |
}while(zin[i-1] > zin[i] && i < npoint); |
}while(zin[i-1] > zin[i] && i < npoint); |
887 |
npoint=i; |
npoint=i; |
888 |
if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl; |
if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl; |
925 |
|
|
926 |
} |
} |
927 |
|
|
928 |
|
|
929 |
ClassImp(TrkLevel2); |
ClassImp(TrkLevel2); |
930 |
ClassImp(TrkSinglet); |
ClassImp(TrkSinglet); |
931 |
ClassImp(TrkTrack); |
ClassImp(TrkTrack); |