12 |
extern "C" { |
extern "C" { |
13 |
void dotrack_(int*, double*, double*, double*, double*, int*); |
void dotrack_(int*, double*, double*, double*, double*, int*); |
14 |
void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); |
void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); |
|
// int readb_(const char*); |
|
|
// int readb_(); |
|
15 |
void mini2_(int*,int*,int*); |
void mini2_(int*,int*,int*); |
16 |
void guess_(); |
void guess_(); |
17 |
void gufld_(float*, float*); |
void gufld_(float*, float*); |
39 |
zm[ip] = 0; |
zm[ip] = 0; |
40 |
resx[ip] = 0; |
resx[ip] = 0; |
41 |
resy[ip] = 0; |
resy[ip] = 0; |
42 |
|
tailx[ip] = 0; |
43 |
|
taily[ip] = 0; |
44 |
xv[ip] = 0; |
xv[ip] = 0; |
45 |
yv[ip] = 0; |
yv[ip] = 0; |
46 |
zv[ip] = 0; |
zv[ip] = 0; |
49 |
dedx_x[ip] = 0; |
dedx_x[ip] = 0; |
50 |
dedx_y[ip] = 0; |
dedx_y[ip] = 0; |
51 |
}; |
}; |
52 |
clx = 0; |
// clx = 0; |
53 |
cly = 0; |
// cly = 0; |
54 |
// clx = new TRefArray(6,0); |
// clx = new TRefArray(6,0); //forse causa memory leak??? |
55 |
// cly = new TRefArray(6,0); |
// cly = new TRefArray(6,0); //forse causa memory leak??? |
56 |
|
// clx = TRefArray(6,0); |
57 |
|
// cly = TRefArray(6,0); |
58 |
|
|
59 |
}; |
}; |
60 |
//-------------------------------------- |
//-------------------------------------- |
61 |
// |
// |
78 |
zm[ip] = t.zm[ip]; |
zm[ip] = t.zm[ip]; |
79 |
resx[ip] = t.resx[ip]; |
resx[ip] = t.resx[ip]; |
80 |
resy[ip] = t.resy[ip]; |
resy[ip] = t.resy[ip]; |
81 |
|
tailx[ip] = t.tailx[ip]; |
82 |
|
taily[ip] = t.taily[ip]; |
83 |
xv[ip] = t.xv[ip]; |
xv[ip] = t.xv[ip]; |
84 |
yv[ip] = t.yv[ip]; |
yv[ip] = t.yv[ip]; |
85 |
zv[ip] = t.zv[ip]; |
zv[ip] = t.zv[ip]; |
88 |
dedx_x[ip] = t.dedx_x[ip]; |
dedx_x[ip] = t.dedx_x[ip]; |
89 |
dedx_y[ip] = t.dedx_y[ip]; |
dedx_y[ip] = t.dedx_y[ip]; |
90 |
}; |
}; |
91 |
clx = 0; |
// clx = 0; |
92 |
cly = 0; |
// cly = 0; |
93 |
if(t.clx)clx = new TRefArray(*(t.clx)); |
// if(t.clx)clx = new TRefArray(*(t.clx)); |
94 |
if(t.cly)cly = new TRefArray(*(t.cly)); |
// if(t.cly)cly = new TRefArray(*(t.cly)); |
95 |
|
// clx = TRefArray(t.clx); |
96 |
|
// cly = TRefArray(t.cly); |
97 |
|
|
98 |
}; |
}; |
99 |
//-------------------------------------- |
//-------------------------------------- |
100 |
// |
// |
118 |
t.zm[ip] = zm[ip]; |
t.zm[ip] = zm[ip]; |
119 |
t.resx[ip] = resx[ip]; |
t.resx[ip] = resx[ip]; |
120 |
t.resy[ip] = resy[ip]; |
t.resy[ip] = resy[ip]; |
121 |
|
t.tailx[ip] = tailx[ip]; |
122 |
|
t.taily[ip] = taily[ip]; |
123 |
t.xv[ip] = xv[ip]; |
t.xv[ip] = xv[ip]; |
124 |
t.yv[ip] = yv[ip]; |
t.yv[ip] = yv[ip]; |
125 |
t.zv[ip] = zv[ip]; |
t.zv[ip] = zv[ip]; |
129 |
t.dedx_y[ip] = dedx_y[ip]; |
t.dedx_y[ip] = dedx_y[ip]; |
130 |
|
|
131 |
}; |
}; |
132 |
|
|
133 |
|
// t.clx = TRefArray(clx); |
134 |
|
// t.cly = TRefArray(cly); |
135 |
|
|
136 |
}; |
}; |
137 |
//-------------------------------------- |
//-------------------------------------- |
245 |
return def; |
return def; |
246 |
}; |
}; |
247 |
// |
// |
248 |
Float_t TrkTrack::GetDEDX(){ |
/** |
249 |
Float_t dedx=0; |
* Method to retrieve the dE/dx measured on a tracker view. |
250 |
for(Int_t i=0; i<6; i++)dedx+=dedx_x[i]*xgood[i]+dedx_y[i]*ygood[i]; |
* @param ip plane (0-5) |
251 |
dedx = dedx/(this->GetNX()+this->GetNY()); |
* @param iv view (0=x 1=y) |
252 |
return dedx; |
*/ |
253 |
|
Float_t TrkTrack::GetDEDX(int ip, int iv){ |
254 |
|
if(iv==0 && ip>=0 && ip<6)return fabs(dedx_x[ip]); |
255 |
|
else if(iv==1 && ip>=0 && ip<6)return fabs(dedx_y[ip]); |
256 |
|
else { |
257 |
|
cout << "TrkTrack::GetDEDX(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl; |
258 |
|
return 0.; |
259 |
|
} |
260 |
|
} |
261 |
|
/** |
262 |
|
* Method to evaluate the dE/dx measured on a tracker plane. |
263 |
|
* The two measurements on x- and y-view are averaged. |
264 |
|
* @param ip plane (0-5) |
265 |
|
*/ |
266 |
|
Float_t TrkTrack::GetDEDX(int ip){ |
267 |
|
if( (Int_t)XGood(ip)+(Int_t)YGood(ip) == 0 ) return 0; |
268 |
|
return (GetDEDX(ip,0)+GetDEDX(ip,1))/((Int_t)XGood(ip)+(Int_t)YGood(ip)); |
269 |
}; |
}; |
270 |
|
|
271 |
|
/** |
272 |
|
* Method to evaluate the dE/dx averaged over all planes. |
273 |
|
*/ |
274 |
|
Float_t TrkTrack::GetDEDX(){ |
275 |
|
Float_t dedx=0; |
276 |
|
for(Int_t ip=0; ip<6; ip++)dedx+=GetDEDX(ip,0)*XGood(ip)+GetDEDX(ip,1)*YGood(ip); |
277 |
|
dedx = dedx/(GetNX()+GetNY()); |
278 |
|
return dedx; |
279 |
|
}; |
280 |
|
/** |
281 |
|
* Returns 1 if the cluster on a tracker view includes bad strips. |
282 |
|
* @param ip plane (0-5) |
283 |
|
* @param iv view (0=x 1=y) |
284 |
|
*/ |
285 |
|
Bool_t TrkTrack::IsBad(int ip,int iv){ |
286 |
|
if(iv==0 && ip>=0 && ip<6)return (xgood[ip]<0) ; |
287 |
|
else if(iv==1 && ip>=0 && ip<6)return (ygood[ip]<0) ; |
288 |
|
else { |
289 |
|
cout << "TrkTrack::IsBad(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl; |
290 |
|
return 0.; |
291 |
|
} |
292 |
|
}; |
293 |
|
/** |
294 |
|
* Returns 1 if the signal on a tracker view is saturated. |
295 |
|
* @param ip plane (0-5) |
296 |
|
* @param iv view (0=x 1=y) |
297 |
|
*/ |
298 |
|
Bool_t TrkTrack::IsSaturated(int ip,int iv){ |
299 |
|
if(iv==0 && ip>=0 && ip<6)return (dedx_x[ip]<0) ; |
300 |
|
else if(iv==1 && ip>=0 && ip<6)return (dedx_y[ip]<0) ; |
301 |
|
else { |
302 |
|
cout << "TrkTrack::IsSaturated(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl; |
303 |
|
return 0.; |
304 |
|
} |
305 |
|
}; |
306 |
|
/** |
307 |
|
* Returns 1 if either the x or the y signal on a tracker plane is saturated. |
308 |
|
* @param ip plane (0-5) |
309 |
|
*/ |
310 |
|
Bool_t TrkTrack::IsSaturated(int ip){ |
311 |
|
return (IsSaturated(ip,0)||IsSaturated(ip,1)); |
312 |
|
}; |
313 |
|
/** |
314 |
|
* Returns 1 if there is at least a saturated signal along the track. |
315 |
|
*/ |
316 |
|
Bool_t TrkTrack::IsSaturated(){ |
317 |
|
for(int ip=0; ip<6; ip++)for(int iv=0; iv<2; iv++)if(IsSaturated(ip,iv))return true; |
318 |
|
return false; |
319 |
|
} |
320 |
|
/** |
321 |
|
* Returns the track "lever-arm" on the x view, defined as the distance (in planes) between |
322 |
|
* the upper and lower x measurements (the maximum value of lever-arm is 6). |
323 |
|
*/ |
324 |
|
Int_t TrkTrack::GetLeverArmX(){ |
325 |
|
int first_plane = -1; |
326 |
|
int last_plane = -1; |
327 |
|
for(Int_t ip=0; ip<6; ip++){ |
328 |
|
if( XGood(ip) && first_plane == -1 )first_plane = ip; |
329 |
|
if( XGood(ip) && first_plane != -1 )last_plane = ip; |
330 |
|
} |
331 |
|
if( first_plane == -1 || last_plane == -1){ |
332 |
|
cout<< "Int_t TrkTrack::GetLeverArmX() -- XGood(ip) always false ??? "<<endl; |
333 |
|
return 0; |
334 |
|
} |
335 |
|
return (last_plane-first_plane+1); |
336 |
|
} |
337 |
|
/** |
338 |
|
* Returns the track "lever-arm" on the y view, defined as the distance (in planes) between |
339 |
|
* the upper and lower y measurements (the maximum value of lever-arm is 6). |
340 |
|
*/ |
341 |
|
Int_t TrkTrack::GetLeverArmY(){ |
342 |
|
int first_plane = -1; |
343 |
|
int last_plane = -1; |
344 |
|
for(Int_t ip=0; ip<6; ip++){ |
345 |
|
if( YGood(ip) && first_plane == -1 )first_plane = ip; |
346 |
|
if( YGood(ip) && first_plane != -1 )last_plane = ip; |
347 |
|
} |
348 |
|
if( first_plane == -1 || last_plane == -1){ |
349 |
|
cout<< "Int_t TrkTrack::GetLeverArmY() -- YGood(ip) always false ??? "<<endl; |
350 |
|
return 0; |
351 |
|
} |
352 |
|
return (last_plane-first_plane+1); |
353 |
|
} |
354 |
//-------------------------------------- |
//-------------------------------------- |
355 |
// |
// |
356 |
// |
// |
362 |
cout << endl << "al : "; for(int i=0; i<5; i++)cout << al[i] << " "; |
cout << endl << "al : "; for(int i=0; i<5; i++)cout << al[i] << " "; |
363 |
cout << endl << "chi^2 : "<< chi2; |
cout << endl << "chi^2 : "<< chi2; |
364 |
cout << endl << "n.step : "<< nstep; |
cout << endl << "n.step : "<< nstep; |
365 |
cout << endl << "xgood : "; for(int i=0; i<6; i++)cout << xgood[i] ; |
cout << endl << "xgood : "; for(int i=0; i<6; i++)cout << XGood(i) ; |
366 |
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) ; |
367 |
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] << " "; |
368 |
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] << " "; |
369 |
cout << endl << "zm : "; for(int i=0; i<6; i++)cout << zm[i] << " "; |
cout << endl << "zm : "; for(int i=0; i<6; i++)cout << zm[i] << " "; |
400 |
* Set the TrkTrack good measurement |
* Set the TrkTrack good measurement |
401 |
*/ |
*/ |
402 |
void TrkTrack::SetGood(int *xg, int *yg){ |
void TrkTrack::SetGood(int *xg, int *yg){ |
403 |
|
// NB! si perdera` l'informazione sul numero del cluster |
404 |
for(int i=0; i<6; i++) xgood[i]=*xg++; |
for(int i=0; i<6; i++) xgood[i]=*xg++; |
405 |
for(int i=0; i<6; i++) ygood[i]=*yg++; |
for(int i=0; i<6; i++) ygood[i]=*yg++; |
406 |
} |
} |
428 |
|
|
429 |
for(int i=0; i<6; i++){ |
for(int i=0; i<6; i++){ |
430 |
|
|
431 |
track.xgood[i]=xgood[i]; |
// track.xgood[i]=xgood[i]; |
432 |
track.ygood[i]=ygood[i]; |
// track.ygood[i]=ygood[i]; |
433 |
|
track.xgood[i]=XGood(i); |
434 |
|
track.ygood[i]=YGood(i); |
435 |
|
|
436 |
track.xm[i]=xm[i]; |
track.xm[i]=xm[i]; |
437 |
track.ym[i]=ym[i]; |
track.ym[i]=ym[i]; |
444 |
track.xm_b[i]=xm[i]; |
track.xm_b[i]=xm[i]; |
445 |
track.ym_a[i]=ym[i]; |
track.ym_a[i]=ym[i]; |
446 |
track.ym_b[i]=ym[i]; |
track.ym_b[i]=ym[i]; |
447 |
if( xgood[i] && !ygood[i] ){ |
if( XGood(i) && !YGood(i) ){ |
448 |
track.ym_a[i] = track.ym_a[i]+segment; |
track.ym_a[i] = track.ym_a[i]+segment; |
449 |
track.ym_b[i] = track.ym_b[i]-segment; |
track.ym_b[i] = track.ym_b[i]-segment; |
450 |
}else if( !xgood[i] && ygood[i]){ |
}else if( !XGood(i) && YGood(i)){ |
451 |
track.xm_a[i] = track.xm_a[i]+segment; |
track.xm_a[i] = track.xm_a[i]+segment; |
452 |
track.xm_b[i] = track.xm_b[i]-segment; |
track.xm_b[i] = track.xm_b[i]-segment; |
453 |
} |
} |
565 |
for(int j=0; j<5; j++) coval[i][j]=0.; |
for(int j=0; j<5; j++) coval[i][j]=0.; |
566 |
} |
} |
567 |
} |
} |
568 |
|
/* |
569 |
|
* Set the tracking mode |
570 |
|
*/ |
571 |
void TrkTrack::SetTrackingMode(int trackmode){ |
void TrkTrack::SetTrackingMode(int trackmode){ |
572 |
extern cMini2track track_; |
extern cMini2track track_; |
573 |
track_.trackmode = trackmode; |
track_.trackmode = trackmode; |
574 |
} |
} |
575 |
|
/* |
576 |
|
* Set the factor scale for tracking precision |
577 |
|
*/ |
578 |
|
void TrkTrack::SetPrecisionFactor(double fact){ |
579 |
|
extern cMini2track track_; |
580 |
|
track_.fact = fact; |
581 |
|
} |
582 |
|
/* |
583 |
|
* Set the factor scale for tracking precision |
584 |
|
*/ |
585 |
|
void TrkTrack::SetStepMin(int istepmin){ |
586 |
|
extern cMini2track track_; |
587 |
|
track_.istepmin = istepmin; |
588 |
|
} |
589 |
|
|
590 |
|
|
591 |
|
/* |
592 |
|
* Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track. |
593 |
|
* If no cluster is associated, ID=-1. |
594 |
|
* @param ip Tracker plane (0-5) |
595 |
|
*/ |
596 |
|
Int_t TrkTrack::GetClusterX_ID(int ip){ |
597 |
|
return ((Int_t)fabs(xgood[ip]))%10000000-1; |
598 |
|
}; |
599 |
|
/* |
600 |
|
* Method to retrieve ID (0-xxx) of y-cluster (if any) associated to this track. |
601 |
|
* If no cluster is associated, ID=-1. |
602 |
|
* @param ip Tracker plane (0-5) |
603 |
|
*/ |
604 |
|
Int_t TrkTrack::GetClusterY_ID(int ip){ |
605 |
|
return ((Int_t)fabs(ygood[ip]))%10000000-1; |
606 |
|
}; |
607 |
|
/* |
608 |
|
* Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane. |
609 |
|
* If no ladder is traversed (dead area) the metod retuns -1. |
610 |
|
* @param ip Tracker plane (0-5) |
611 |
|
*/ |
612 |
|
Int_t TrkTrack::GetLadder(int ip){ |
613 |
|
if(XGood(ip))return (Int_t)fabs(xgood[ip]/100000000)-1; |
614 |
|
if(YGood(ip))return (Int_t)fabs(ygood[ip]/100000000)-1; |
615 |
|
return -1; |
616 |
|
}; |
617 |
|
/* |
618 |
|
* Method to retrieve the sensor (0-1, increasing y) traversed by the track on this plane. |
619 |
|
* If no sensor is traversed (dead area) the metod retuns -1. |
620 |
|
* @param ip Tracker plane (0-5) |
621 |
|
*/ |
622 |
|
Int_t TrkTrack::GetSensor(int ip){ |
623 |
|
if(XGood(ip))return (Int_t)((Int_t)fabs(xgood[ip]/10000000)%10)-1; |
624 |
|
if(YGood(ip))return (Int_t)((Int_t)fabs(ygood[ip]/10000000)%10)-1; |
625 |
|
return -1; |
626 |
|
}; |
627 |
|
|
628 |
|
|
629 |
//-------------------------------------- |
//-------------------------------------- |
630 |
// |
// |
648 |
zm[ip] = 0; |
zm[ip] = 0; |
649 |
resx[ip] = 0; |
resx[ip] = 0; |
650 |
resy[ip] = 0; |
resy[ip] = 0; |
651 |
|
tailx[ip] = 0; |
652 |
|
taily[ip] = 0; |
653 |
xv[ip] = 0; |
xv[ip] = 0; |
654 |
yv[ip] = 0; |
yv[ip] = 0; |
655 |
zv[ip] = 0; |
zv[ip] = 0; |
659 |
dedx_y[ip] = 0; |
dedx_y[ip] = 0; |
660 |
|
|
661 |
}; |
}; |
662 |
if(clx)clx->Clear(); |
// if(clx)clx->Clear(); |
663 |
if(cly)cly->Clear(); |
// if(cly)cly->Clear(); |
664 |
|
// clx.Clear(); |
665 |
|
// cly.Clear(); |
666 |
}; |
}; |
667 |
//-------------------------------------- |
//-------------------------------------- |
668 |
// |
// |
670 |
//-------------------------------------- |
//-------------------------------------- |
671 |
void TrkTrack::Delete(){ |
void TrkTrack::Delete(){ |
672 |
// cout << "TrkTrack::Delete()"<<endl; |
// cout << "TrkTrack::Delete()"<<endl; |
673 |
// Clear(); |
Clear(); |
674 |
if(clx)delete clx; |
// if(clx)delete clx; |
675 |
if(cly)delete cly; |
// if(cly)delete cly; |
676 |
}; |
}; |
677 |
//-------------------------------------- |
//-------------------------------------- |
678 |
// |
// |
702 |
coord[1] = s.coord[1]; |
coord[1] = s.coord[1]; |
703 |
sgnl = s.sgnl; |
sgnl = s.sgnl; |
704 |
// cls = 0;//<<<<pointer |
// cls = 0;//<<<<pointer |
705 |
cls = TRef(s.cls); |
// cls = TRef(s.cls); |
706 |
}; |
}; |
707 |
//-------------------------------------- |
//-------------------------------------- |
708 |
// |
// |
735 |
TrkLevel2::TrkLevel2(){ |
TrkLevel2::TrkLevel2(){ |
736 |
// cout <<"TrkLevel2::TrkLevel2()"<<endl; |
// cout <<"TrkLevel2::TrkLevel2()"<<endl; |
737 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
738 |
good[i] = -1; |
good[i] = -1; |
739 |
}; |
VKmask[i] = 0; |
740 |
// okkio!! memory-leak |
VKflag[i] = 0; |
741 |
// Track = new TClonesArray("TrkTrack"); |
}; |
|
// SingletX = new TClonesArray("TrkSinglet"); |
|
|
// SingletY = new TClonesArray("TrkSinglet"); |
|
742 |
Track = 0; |
Track = 0; |
743 |
SingletX = 0; |
SingletX = 0; |
744 |
SingletY = 0; |
SingletY = 0; |
765 |
cout << endl << "ntrk() : " << this->ntrk() ; |
cout << endl << "ntrk() : " << this->ntrk() ; |
766 |
cout << endl << "nclsx() : " << this->nclsx(); |
cout << endl << "nclsx() : " << this->nclsx(); |
767 |
cout << endl << "nclsy() : " << this->nclsy(); |
cout << endl << "nclsy() : " << this->nclsy(); |
|
// TClonesArray &t = *Track; |
|
|
// TClonesArray &sx = *SingletX; |
|
|
// TClonesArray &sy = *SingletY; |
|
|
// for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
|
|
// for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump(); |
|
|
// for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
|
768 |
if(Track){ |
if(Track){ |
769 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
770 |
for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
783 |
// |
// |
784 |
//-------------------------------------- |
//-------------------------------------- |
785 |
/** |
/** |
786 |
* Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). |
* The method returns false if the viking-chip was masked |
787 |
|
* either apriori ,on the basis of the mask read from the DB, |
788 |
|
* or run-by-run, on the basis of the calibration parameters) |
789 |
|
* @param iv Tracker view (0-11) |
790 |
|
* @param ivk Viking-chip number (0-23) |
791 |
|
*/ |
792 |
|
Bool_t TrkLevel2::GetVKMask(int iv, int ivk){ |
793 |
|
Int_t whichbit = (Int_t)pow(2,ivk); |
794 |
|
return (whichbit&VKmask[iv])!=0; |
795 |
|
} |
796 |
|
/** |
797 |
|
* The method returns false if the viking-chip was masked |
798 |
|
* for this event due to common-noise computation failure. |
799 |
|
* @param iv Tracker view (0-11) |
800 |
|
* @param ivk Viking-chip number (0-23) |
801 |
|
*/ |
802 |
|
Bool_t TrkLevel2::GetVKFlag(int iv, int ivk){ |
803 |
|
Int_t whichbit = (Int_t)pow(2,ivk); |
804 |
|
return (whichbit&VKflag[iv])!=0; |
805 |
|
} |
806 |
|
/** |
807 |
|
* The method returns true if the viking-chip was masked, either |
808 |
|
* forced (see TrkLevel2::GetVKMask(int,int)) or |
809 |
|
* for this event only (TrkLevel2::GetVKFlag(int,int)). |
810 |
|
* @param iv Tracker view (0-11) |
811 |
|
* @param ivk Viking-chip number (0-23) |
812 |
*/ |
*/ |
813 |
// void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){ |
Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){ |
814 |
|
return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) ); |
815 |
|
}; |
816 |
|
|
|
// // temporary objects: |
|
|
// TrkSinglet* t_singlet = new TrkSinglet(); |
|
|
// TrkTrack* t_track = new TrkTrack(); |
|
|
|
|
|
// // **** general variables **** |
|
|
// // good2 = l2->good2; |
|
|
// for(Int_t i=0; i<12 ; i++){ |
|
|
// // crc[i] = l2->crc[i]; |
|
|
// good[i] = l2->good[i]; |
|
|
// }; |
|
|
// // *** TRACKS *** |
|
|
// if(!Track) Track = new TClonesArray("TrkTrack"); |
|
|
// TClonesArray &t = *Track; |
|
|
// for(int i=0; i<l2->ntrk; i++){ |
|
|
// t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
|
|
// t_track->image = l2->image[i]-1; |
|
|
// // cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
|
|
// t_track->chi2 = l2->chi2_nt[i]; |
|
|
// t_track->nstep = l2->nstep_nt[i]; |
|
|
// for(int it1=0;it1<5;it1++){ |
|
|
// t_track->al[it1] = l2->al_nt[i][it1]; |
|
|
// for(int it2=0;it2<5;it2++) |
|
|
// t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
|
|
// }; |
|
|
// for(int ip=0;ip<6;ip++){ |
|
|
// t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
|
|
// t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
|
|
// t_track->xm[ip] = l2->xm_nt[i][ip]; |
|
|
// t_track->ym[ip] = l2->ym_nt[i][ip]; |
|
|
// t_track->zm[ip] = l2->zm_nt[i][ip]; |
|
|
// t_track->resx[ip] = l2->resx_nt[i][ip]; |
|
|
// t_track->resy[ip] = l2->resy_nt[i][ip]; |
|
|
// t_track->xv[ip] = l2->xv_nt[i][ip]; |
|
|
// t_track->yv[ip] = l2->yv_nt[i][ip]; |
|
|
// t_track->zv[ip] = l2->zv_nt[i][ip]; |
|
|
// t_track->axv[ip] = l2->axv_nt[i][ip]; |
|
|
// t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
|
|
// t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
|
|
// t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
|
|
// // t_track->clx[ip] = 0; |
|
|
// // t_track->cly[ip] = 0; |
|
|
// }; |
|
|
// new(t[i]) TrkTrack(*t_track); |
|
|
// t_track->Clear(); |
|
|
// }; |
|
|
// // *** SINGLETS *** |
|
|
// if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
|
|
// TClonesArray &sx = *SingletX; |
|
|
// for(int i=0; i<l2->nclsx; i++){ |
|
|
// t_singlet->plane = l2->planex[i]; |
|
|
// t_singlet->coord[0] = l2->xs[i][0]; |
|
|
// t_singlet->coord[1] = l2->xs[i][1]; |
|
|
// t_singlet->sgnl = l2->signlxs[i]; |
|
|
// // t_singlet->cls = 0; |
|
|
// new(sx[i]) TrkSinglet(*t_singlet); |
|
|
// t_singlet->Clear(); |
|
|
// } |
|
|
// if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
|
|
// TClonesArray &sy = *SingletY; |
|
|
// for(int i=0; i<l2->nclsy; i++){ |
|
|
// t_singlet->plane = l2->planey[i]; |
|
|
// t_singlet->coord[0] = l2->ys[i][0]; |
|
|
// t_singlet->coord[1] = l2->ys[i][1]; |
|
|
// t_singlet->sgnl = l2->signlys[i]; |
|
|
// // t_singlet->cls = 0; |
|
|
// new(sy[i]) TrkSinglet(*t_singlet); |
|
|
// t_singlet->Clear(); |
|
|
// }; |
|
|
|
|
|
// delete t_track; |
|
|
// delete t_singlet; |
|
|
// } |
|
817 |
//-------------------------------------- |
//-------------------------------------- |
818 |
// |
// |
819 |
// |
// |
820 |
//-------------------------------------- |
//-------------------------------------- |
821 |
/** |
/** |
822 |
* 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). |
823 |
* Ref to Level1 data (clusters) is also set. |
* Ref to Level1 data (clusters) is also set. If l1==NULL no references are set. |
824 |
|
* (NB It make sense to set references only if events are stored in a tree that contains also the Level1 branch) |
825 |
*/ |
*/ |
826 |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ |
827 |
|
|
828 |
|
// cout << "void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1)"<<endl; |
829 |
|
Clear(); |
830 |
|
|
831 |
// temporary objects: |
// temporary objects: |
832 |
TrkSinglet* t_singlet = new TrkSinglet(); |
TrkSinglet* t_singlet = new TrkSinglet(); |
833 |
TrkTrack* t_track = new TrkTrack(); |
TrkTrack* t_track = new TrkTrack(); |
834 |
// general variables |
|
835 |
// good2 = l2->good2; |
// ----------------- |
836 |
for(Int_t i=0; i<12 ; i++){ |
// general variables |
837 |
// crc[i] = l2->crc[i]; |
// ----------------- |
838 |
good[i] = l2->good[i]; |
for(Int_t i=0; i<12 ; i++){ |
839 |
|
good[i] = l2->good[i]; |
840 |
|
VKmask[i]=0; |
841 |
|
VKflag[i]=0; |
842 |
|
for(Int_t ii=0; ii<24 ; ii++){ |
843 |
|
Int_t setbit = (Int_t)pow(2,ii); |
844 |
|
if( l2->vkflag[ii][i]!=-1 )VKmask[i]=VKmask[i]|setbit; |
845 |
|
if( l2->vkflag[ii][i]!=0 )VKflag[i]=VKflag[i]|setbit; |
846 |
}; |
}; |
847 |
// *** TRACKS *** |
}; |
848 |
if(!Track) Track = new TClonesArray("TrkTrack"); |
// -------------- |
849 |
TClonesArray &t = *Track; |
// *** TRACKS *** |
850 |
//----------------------------------------------------- |
// -------------- |
851 |
if(l1 && !t_track->clx)t_track->clx = new TRefArray(6,0); |
if(!Track) Track = new TClonesArray("TrkTrack"); |
852 |
if(l1 && !t_track->cly)t_track->cly = new TRefArray(6,0); |
TClonesArray &t = *Track; |
853 |
//----------------------------------------------------- |
|
854 |
for(int i=0; i<l2->ntrk; i++){ |
for(int i=0; i<l2->ntrk; i++){ |
855 |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
856 |
t_track->image = l2->image[i]-1; |
t_track->image = l2->image[i]-1; |
857 |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
t_track->chi2 = l2->chi2_nt[i]; |
858 |
t_track->chi2 = l2->chi2_nt[i]; |
t_track->nstep = l2->nstep_nt[i]; |
859 |
t_track->nstep = l2->nstep_nt[i]; |
for(int it1=0;it1<5;it1++){ |
860 |
for(int it1=0;it1<5;it1++){ |
t_track->al[it1] = l2->al_nt[i][it1]; |
861 |
t_track->al[it1] = l2->al_nt[i][it1]; |
for(int it2=0;it2<5;it2++) |
862 |
for(int it2=0;it2<5;it2++) |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
|
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
|
|
}; |
|
|
for(int ip=0;ip<6;ip++){ |
|
|
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
|
|
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
|
|
t_track->xm[ip] = l2->xm_nt[i][ip]; |
|
|
t_track->ym[ip] = l2->ym_nt[i][ip]; |
|
|
t_track->zm[ip] = l2->zm_nt[i][ip]; |
|
|
t_track->resx[ip] = l2->resx_nt[i][ip]; |
|
|
t_track->resy[ip] = l2->resy_nt[i][ip]; |
|
|
t_track->xv[ip] = l2->xv_nt[i][ip]; |
|
|
t_track->yv[ip] = l2->yv_nt[i][ip]; |
|
|
t_track->zv[ip] = l2->zv_nt[i][ip]; |
|
|
t_track->axv[ip] = l2->axv_nt[i][ip]; |
|
|
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
|
|
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
|
|
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
|
|
//----------------------------------------------------- |
|
|
//----------------------------------------------------- |
|
|
if(l1 && t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
|
|
if(l1 && t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
|
|
//----------------------------------------------------- |
|
|
//----------------------------------------------------- |
|
|
}; |
|
|
new(t[i]) TrkTrack(*t_track); |
|
|
t_track->Clear(); |
|
863 |
}; |
}; |
864 |
// *** SINGLETS *** |
for(int ip=0;ip<6;ip++){ |
865 |
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
// --------------------------------- |
866 |
TClonesArray &sx = *SingletX; |
// new implementation of xgood/ygood |
867 |
for(int i=0; i<l2->nclsx; i++){ |
// --------------------------------- |
868 |
t_singlet->plane = l2->planex[i]; |
t_track->xgood[ip] = l2->cltrx[i][ip]; //cluster ID |
869 |
t_singlet->coord[0] = l2->xs[i][0]; |
t_track->ygood[ip] = l2->cltry[i][ip]; //cluster ID |
870 |
t_singlet->coord[1] = l2->xs[i][1]; |
t_track->xgood[ip] += 10000000*l2->ls[i][ip]; // ladder+sensor |
871 |
t_singlet->sgnl = l2->signlxs[i]; |
t_track->ygood[ip] += 10000000*l2->ls[i][ip]; // ladder+sensor |
872 |
//----------------------------------------------------- |
if(l2->xbad[i][ip]>0)t_track->xgood[ip]=-t_track->xgood[ip]; |
873 |
if(l1) t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
if(l2->ybad[i][ip]>0)t_track->ygood[ip]=-t_track->ygood[ip]; |
874 |
//----------------------------------------------------- |
// if(l2->xbad[i][ip]>0 || l2->ybad[i][ip]>0){ |
875 |
new(sx[i]) TrkSinglet(*t_singlet); |
// if(l2->dedx_x[i][ip]<0 || l2->dedx_y[i][ip]<0){ |
876 |
t_singlet->Clear(); |
// cout << ip << " - "<< l2->cltrx[i][ip] << " "<<l2->cltry[i][ip]<<" "<<l2->ls[i][ip]<<endl; |
877 |
} |
// cout << ip << " - "<<t_track->xgood[ip]<<" "<<t_track->ygood[ip]<<endl; |
878 |
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
// cout << ip << " - "<<t_track->GetClusterX_ID(ip)<<" "<<t_track->GetClusterY_ID(ip)<<" "<<t_track->GetLadder(ip)<<" "<<t_track->GetSensor(ip)<<endl; |
879 |
TClonesArray &sy = *SingletY; |
// cout << ip << " - "<<t_track->BadClusterX(ip)<<" "<<t_track->BadClusterY(ip)<<endl; |
880 |
for(int i=0; i<l2->nclsy; i++){ |
// cout << ip << " - "<<t_track->SaturatedClusterX(ip)<<" "<<t_track->SaturatedClusterY(ip)<<endl; |
881 |
t_singlet->plane = l2->planey[i]; |
// } |
882 |
t_singlet->coord[0] = l2->ys[i][0]; |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
883 |
t_singlet->coord[1] = l2->ys[i][1]; |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
884 |
t_singlet->sgnl = l2->signlys[i]; |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
885 |
//----------------------------------------------------- |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
886 |
if(l1) t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
887 |
//----------------------------------------------------- |
t_track->tailx[ip] = l2->tailx[i][ip]; |
888 |
new(sy[i]) TrkSinglet(*t_singlet); |
t_track->taily[ip] = l2->taily[i][ip]; |
889 |
t_singlet->Clear(); |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
890 |
|
t_track->yv[ip] = l2->yv_nt[i][ip]; |
891 |
|
t_track->zv[ip] = l2->zv_nt[i][ip]; |
892 |
|
t_track->axv[ip] = l2->axv_nt[i][ip]; |
893 |
|
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
894 |
|
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
895 |
|
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
896 |
|
//----------------------------------------------------- |
897 |
|
//----------------------------------------------------- |
898 |
|
//----------------------------------------------------- |
899 |
|
//----------------------------------------------------- |
900 |
}; |
}; |
901 |
|
// if(t_track->IsSaturated())t_track->Dump(); |
902 |
|
new(t[i]) TrkTrack(*t_track); |
903 |
|
t_track->Clear(); |
904 |
|
}; |
905 |
|
|
906 |
|
// ---------------- |
907 |
|
// *** SINGLETS *** |
908 |
|
// ---------------- |
909 |
|
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
910 |
|
TClonesArray &sx = *SingletX; |
911 |
|
for(int i=0; i<l2->nclsx; i++){ |
912 |
|
t_singlet->plane = l2->planex[i]; |
913 |
|
t_singlet->coord[0] = l2->xs[i][0]; |
914 |
|
t_singlet->coord[1] = l2->xs[i][1]; |
915 |
|
t_singlet->sgnl = l2->signlxs[i]; |
916 |
|
//----------------------------------------------------- |
917 |
|
// if(l1) t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
918 |
|
//----------------------------------------------------- |
919 |
|
new(sx[i]) TrkSinglet(*t_singlet); |
920 |
|
t_singlet->Clear(); |
921 |
|
} |
922 |
|
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
923 |
|
TClonesArray &sy = *SingletY; |
924 |
|
for(int i=0; i<l2->nclsy; i++){ |
925 |
|
t_singlet->plane = l2->planey[i]; |
926 |
|
t_singlet->coord[0] = l2->ys[i][0]; |
927 |
|
t_singlet->coord[1] = l2->ys[i][1]; |
928 |
|
t_singlet->sgnl = l2->signlys[i]; |
929 |
|
//----------------------------------------------------- |
930 |
|
// if(l1) t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
931 |
|
//----------------------------------------------------- |
932 |
|
new(sy[i]) TrkSinglet(*t_singlet); |
933 |
|
t_singlet->Clear(); |
934 |
|
}; |
935 |
|
|
936 |
delete t_track; |
delete t_track; |
937 |
delete t_singlet; |
delete t_singlet; |
938 |
} |
} |
939 |
/** |
/** |
940 |
* Fills a struct cTrkLevel2 with values from a TrkLevel2 object (to put data into a F77 common). |
* Fills a struct cTrkLevel2 with values from a TrkLevel2 object (to put data into a F77 common). |
962 |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
963 |
}; |
}; |
964 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
965 |
l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->xgood[ip]; |
l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->XGood(ip); |
966 |
l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->ygood[ip]; |
l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->YGood(ip); |
967 |
l2->xm_nt[i][ip] = ((TrkTrack *)Track->At(i))->xm[ip]; |
l2->xm_nt[i][ip] = ((TrkTrack *)Track->At(i))->xm[ip]; |
968 |
l2->ym_nt[i][ip] = ((TrkTrack *)Track->At(i))->ym[ip]; |
l2->ym_nt[i][ip] = ((TrkTrack *)Track->At(i))->ym[ip]; |
969 |
l2->zm_nt[i][ip] = ((TrkTrack *)Track->At(i))->zm[ip]; |
l2->zm_nt[i][ip] = ((TrkTrack *)Track->At(i))->zm[ip]; |
970 |
l2->resx_nt[i][ip] = ((TrkTrack *)Track->At(i))->resx[ip]; |
l2->resx_nt[i][ip] = ((TrkTrack *)Track->At(i))->resx[ip]; |
971 |
l2->resy_nt[i][ip] = ((TrkTrack *)Track->At(i))->resy[ip]; |
l2->resy_nt[i][ip] = ((TrkTrack *)Track->At(i))->resy[ip]; |
972 |
|
l2->tailx[i][ip] = ((TrkTrack *)Track->At(i))->tailx[ip]; |
973 |
|
l2->taily[i][ip] = ((TrkTrack *)Track->At(i))->taily[ip]; |
974 |
l2->xv_nt[i][ip] = ((TrkTrack *)Track->At(i))->xv[ip]; |
l2->xv_nt[i][ip] = ((TrkTrack *)Track->At(i))->xv[ip]; |
975 |
l2->yv_nt[i][ip] = ((TrkTrack *)Track->At(i))->yv[ip]; |
l2->yv_nt[i][ip] = ((TrkTrack *)Track->At(i))->yv[ip]; |
976 |
l2->zv_nt[i][ip] = ((TrkTrack *)Track->At(i))->zv[ip]; |
l2->zv_nt[i][ip] = ((TrkTrack *)Track->At(i))->zv[ip]; |
1009 |
void TrkLevel2::Clear(){ |
void TrkLevel2::Clear(){ |
1010 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
1011 |
good[i] = -1; |
good[i] = -1; |
1012 |
|
VKflag[i] = 0; |
1013 |
|
VKmask[i] = 0; |
1014 |
}; |
}; |
1015 |
// if(Track)Track->Clear("C"); |
// if(Track)Track->Clear("C"); |
1016 |
// if(SingletX)SingletX->Clear("C"); |
// if(SingletX)SingletX->Clear("C"); |