| 4 |
*/ |
*/ |
| 5 |
#include <TrkLevel2.h> |
#include <TrkLevel2.h> |
| 6 |
#include <iostream> |
#include <iostream> |
| 7 |
|
#include <math.h> |
| 8 |
using namespace std; |
using namespace std; |
| 9 |
//...................................... |
//...................................... |
| 10 |
// F77 routines |
// F77 routines |
| 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*); |
| 15 |
int readb_(const char*); |
int readb_(const char*); |
| 16 |
|
void mini2_(int*,int*,int*); |
| 17 |
} |
} |
| 18 |
//-------------------------------------- |
//-------------------------------------- |
| 19 |
// |
// |
| 23 |
seqno = -1; |
seqno = -1; |
| 24 |
image = -1; |
image = -1; |
| 25 |
chi2 = 0; |
chi2 = 0; |
| 26 |
|
nstep = 0; |
| 27 |
for(int it1=0;it1<5;it1++){ |
for(int it1=0;it1<5;it1++){ |
| 28 |
al[it1] = 0; |
al[it1] = 0; |
| 29 |
for(int it2=0;it2<5;it2++) |
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
|
coval[it1][it2] = 0; |
|
| 30 |
}; |
}; |
| 31 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
| 32 |
xgood[ip] = 0; |
xgood[ip] = 0; |
| 33 |
ygood[ip] = 0; |
ygood[ip] = 0; |
| 34 |
xm[ip] = 0; |
xm[ip] = 0; |
| 35 |
ym[ip] = 0; |
ym[ip] = 0; |
| 36 |
zm[ip] = 0; |
zm[ip] = 0; |
| 37 |
resx[ip] = 0; |
resx[ip] = 0; |
| 38 |
resy[ip] = 0; |
resy[ip] = 0; |
| 39 |
xv[ip] = 0; |
xv[ip] = 0; |
| 40 |
yv[ip] = 0; |
yv[ip] = 0; |
| 41 |
zv[ip] = 0; |
zv[ip] = 0; |
| 42 |
axv[ip] = 0; |
axv[ip] = 0; |
| 43 |
ayv[ip] = 0; |
ayv[ip] = 0; |
| 44 |
dedx_x[ip] = 0; |
dedx_x[ip] = 0; |
| 45 |
dedx_y[ip] = 0; |
dedx_y[ip] = 0; |
| 46 |
}; |
// clx[ip] = 0; |
| 47 |
|
// cly[ip] = 0; |
| 48 |
|
}; |
| 49 |
|
clx = new TRefArray(6,0); |
| 50 |
|
cly = new TRefArray(6,0); |
| 51 |
}; |
}; |
| 52 |
//-------------------------------------- |
//-------------------------------------- |
| 53 |
// |
// |
| 57 |
seqno = t.seqno; |
seqno = t.seqno; |
| 58 |
image = t.image; |
image = t.image; |
| 59 |
chi2 = t.chi2; |
chi2 = t.chi2; |
| 60 |
|
nstep = t.nstep; |
| 61 |
for(int it1=0;it1<5;it1++){ |
for(int it1=0;it1<5;it1++){ |
| 62 |
al[it1] = t.al[it1]; |
al[it1] = t.al[it1]; |
| 63 |
for(int it2=0;it2<5;it2++) |
for(int it2=0;it2<5;it2++)coval[it1][it2] = t.coval[it1][it2]; |
|
coval[it1][it2] = t.coval[it1][it2]; |
|
| 64 |
}; |
}; |
| 65 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
| 66 |
xgood[ip] = t.xgood[ip]; |
xgood[ip] = t.xgood[ip]; |
| 67 |
ygood[ip] = t.ygood[ip]; |
ygood[ip] = t.ygood[ip]; |
| 68 |
xm[ip] = t.xm[ip]; |
xm[ip] = t.xm[ip]; |
| 69 |
ym[ip] = t.ym[ip]; |
ym[ip] = t.ym[ip]; |
| 70 |
zm[ip] = t.zm[ip]; |
zm[ip] = t.zm[ip]; |
| 71 |
resx[ip] = t.resx[ip]; |
resx[ip] = t.resx[ip]; |
| 72 |
resy[ip] = t.resy[ip]; |
resy[ip] = t.resy[ip]; |
| 73 |
xv[ip] = t.xv[ip]; |
xv[ip] = t.xv[ip]; |
| 74 |
yv[ip] = t.yv[ip]; |
yv[ip] = t.yv[ip]; |
| 75 |
zv[ip] = t.zv[ip]; |
zv[ip] = t.zv[ip]; |
| 76 |
axv[ip] = t.axv[ip]; |
axv[ip] = t.axv[ip]; |
| 77 |
ayv[ip] = t.ayv[ip]; |
ayv[ip] = t.ayv[ip]; |
| 78 |
dedx_x[ip] = t.dedx_x[ip]; |
dedx_x[ip] = t.dedx_x[ip]; |
| 79 |
dedx_y[ip] = t.dedx_y[ip]; |
dedx_y[ip] = t.dedx_y[ip]; |
| 80 |
}; |
// clx[ip] = 0;//<<<<pointer |
| 81 |
|
// cly[ip] = 0;//<<<<pointer |
| 82 |
|
}; |
| 83 |
|
clx = new TRefArray(*(t.clx)); |
| 84 |
|
cly = new TRefArray(*(t.cly)); |
| 85 |
|
|
| 86 |
}; |
}; |
| 87 |
//-------------------------------------- |
//-------------------------------------- |
| 88 |
// |
// |
| 198 |
//-------------------------------------- |
//-------------------------------------- |
| 199 |
void TrkTrack::Dump(){ |
void TrkTrack::Dump(){ |
| 200 |
cout << endl << "========== Track " ; |
cout << endl << "========== Track " ; |
| 201 |
|
cout << endl << "seq. n. : "<< seqno; |
| 202 |
|
cout << endl << "image n. : "<< image; |
| 203 |
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] << " "; |
| 204 |
cout << endl << "chi^2 : "<< chi2; |
cout << endl << "chi^2 : "<< chi2; |
| 205 |
|
cout << endl << "n.step : "<< nstep; |
| 206 |
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] ; |
| 207 |
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] ; |
| 208 |
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] << " "; |
| 209 |
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] << " "; |
| 210 |
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] << " "; |
| 211 |
|
cout << endl << "xv : "; for(int i=0; i<6; i++)cout << xv[i] << " "; |
| 212 |
|
cout << endl << "yv : "; for(int i=0; i<6; i++)cout << yv[i] << " "; |
| 213 |
|
cout << endl << "zv : "; for(int i=0; i<6; i++)cout << zv[i] << " "; |
| 214 |
|
cout << endl << "resx : "; for(int i=0; i<6; i++)cout << resx[i] << " "; |
| 215 |
|
cout << endl << "resy : "; for(int i=0; i<6; i++)cout << resy[i] << " "; |
| 216 |
|
cout << endl << "coval : "; for(int i=0; i<5; i++)cout << coval[0][i]<<" "; |
| 217 |
|
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[1][i]<<" "; |
| 218 |
|
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[2][i]<<" "; |
| 219 |
|
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[3][i]<<" "; |
| 220 |
|
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[4][i]<<" "; |
| 221 |
cout << endl << "dedx_x : "; for(int i=0; i<6; i++)cout << dedx_x[i] << " "; |
cout << endl << "dedx_x : "; for(int i=0; i<6; i++)cout << dedx_x[i] << " "; |
| 222 |
cout << endl << "dedx_y : "; for(int i=0; i<6; i++)cout << dedx_y[i] << " "; |
cout << endl << "dedx_y : "; for(int i=0; i<6; i++)cout << dedx_y[i] << " "; |
| 223 |
|
cout << endl; |
| 224 |
|
} |
| 225 |
|
/** |
| 226 |
|
* Set the TrkTrack position measurements |
| 227 |
|
*/ |
| 228 |
|
void TrkTrack::SetMeasure(double *xmeas, double *ymeas, double *zmeas){ |
| 229 |
|
for(int i=0; i<6; i++) xm[i]=*xmeas++; |
| 230 |
|
for(int i=0; i<6; i++) ym[i]=*ymeas++; |
| 231 |
|
for(int i=0; i<6; i++) zm[i]=*zmeas++; |
| 232 |
|
} |
| 233 |
|
/** |
| 234 |
|
* Set the TrkTrack position resolution |
| 235 |
|
*/ |
| 236 |
|
void TrkTrack::SetResolution(double *rx, double *ry){ |
| 237 |
|
for(int i=0; i<6; i++) resx[i]=*rx++; |
| 238 |
|
for(int i=0; i<6; i++) resy[i]=*ry++; |
| 239 |
} |
} |
| 240 |
|
/** |
| 241 |
|
* Set the TrkTrack good measurement |
| 242 |
|
*/ |
| 243 |
|
void TrkTrack::SetGood(int *xg, int *yg){ |
| 244 |
|
for(int i=0; i<6; i++) xgood[i]=*xg++; |
| 245 |
|
for(int i=0; i<6; i++) ygood[i]=*yg++; |
| 246 |
|
} |
| 247 |
|
|
| 248 |
|
/** |
| 249 |
|
* Load the magnetic field |
| 250 |
|
*/ |
| 251 |
|
void TrkTrack::LoadField(TString s){ |
| 252 |
|
readb_(s.Data()); |
| 253 |
|
}; |
| 254 |
|
/** |
| 255 |
|
* Tracking method. It calls F77 mini routine. |
| 256 |
|
*/ |
| 257 |
|
void TrkTrack::Fit(double pfixed, int& fail, int iprint){ |
| 258 |
|
extern cMini2track track_; |
| 259 |
|
fail = 0; |
| 260 |
|
// extern cMini2fitinfo fit_info_; |
| 261 |
|
// extern void mini_2_(int*,int*); |
| 262 |
|
// track_.xm[0]=1.0; |
| 263 |
|
for(int i=0; i<6; i++) track_.xm[i]=xm[i]; |
| 264 |
|
for(int i=0; i<6; i++) track_.ym[i]=ym[i]; |
| 265 |
|
for(int i=0; i<6; i++) track_.zm[i]=zm[i]; |
| 266 |
|
for(int i=0; i<6; i++) track_.resx[i]=resx[i]; |
| 267 |
|
for(int i=0; i<6; i++) track_.resy[i]=resy[i]; |
| 268 |
|
for(int i=0; i<6; i++) track_.xgood[i]=xgood[i]; |
| 269 |
|
for(int i=0; i<6; i++) track_.ygood[i]=ygood[i]; |
| 270 |
|
// initial guess of "al" with linear fit |
| 271 |
|
if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.){ |
| 272 |
|
double szz=0., szx=0., szy=0., ssx=0., ssy=0., sz=0., s1=0.; |
| 273 |
|
double det, ax, ay, bx, by; |
| 274 |
|
for(int i=0; i<NPLANE; i++) { |
| 275 |
|
szz=szz+zm[i]*zm[i]; |
| 276 |
|
szx=szx+zm[i]*xm[i]; |
| 277 |
|
szy=szy+zm[i]*ym[i]; |
| 278 |
|
ssx=ssx+xm[i]; |
| 279 |
|
ssy=ssy+ym[i]; |
| 280 |
|
sz=sz+zm[i]; |
| 281 |
|
s1=s1+1.; |
| 282 |
|
} |
| 283 |
|
det=szz*s1-sz*sz; |
| 284 |
|
ax=(szx*s1-sz*ssx)/det; |
| 285 |
|
bx=(szz*ssx-szx*sz)/det; |
| 286 |
|
ay=(szy*s1-sz*ssy)/det; |
| 287 |
|
by=(szz*ssy-szy*sz)/det; |
| 288 |
|
al[0]=ax*23.5+bx; // ZINI = 23.5 !!! it should be the same parameter in all codes |
| 289 |
|
al[1]=ay*23.5+by; // " |
| 290 |
|
al[2]= sqrt(pow(ax,2)+pow(ay,2))/ sqrt(pow(ax,2)+pow(ay,2)+1.); |
| 291 |
|
al[3]=0.; |
| 292 |
|
if( (ax!=0.)||(ay!=0.) ) { |
| 293 |
|
al[3]= asin(ay/ sqrt(pow(ax,2)+pow(ay,2))); |
| 294 |
|
if(ax<0.) al[3]=acos(-1.)-al[3]; |
| 295 |
|
} |
| 296 |
|
al[4]=0.; |
| 297 |
|
} |
| 298 |
|
// end guess |
| 299 |
|
if(pfixed==0.) { |
| 300 |
|
al[4]=0.; // free momentum |
| 301 |
|
track_.pfixed=0.; // " |
| 302 |
|
} |
| 303 |
|
if(pfixed!=0.) { |
| 304 |
|
al[4]=1./pfixed; // to fix the momentum |
| 305 |
|
track_.pfixed=pfixed; // " |
| 306 |
|
} |
| 307 |
|
track_.zini = 23.5; // ZINI = 23.5 !!! it should be the same parameter in all codes |
| 308 |
|
for(int i=0; i<5; i++) track_.al[i]=al[i]; |
| 309 |
|
int istep=0; |
| 310 |
|
int ifail=0; |
| 311 |
|
mini2_(&istep,&ifail, &iprint); |
| 312 |
|
if(ifail!=0) { |
| 313 |
|
if(iprint==1)cout << "ERROR: ifail= " << ifail << endl; |
| 314 |
|
fail = 1; |
| 315 |
|
// return; |
| 316 |
|
} |
| 317 |
|
|
| 318 |
|
// cout << endl << "eta ===> " << track_.al[4] << endl; |
| 319 |
|
|
| 320 |
|
for(int i=0; i<5; i++) al[i]=track_.al[i]; |
| 321 |
|
chi2=track_.chi2; |
| 322 |
|
nstep=track_.nstep; |
| 323 |
|
for(int i=0; i<6; i++) xv[i]=track_.xv[i]; |
| 324 |
|
for(int i=0; i<6; i++) yv[i]=track_.yv[i]; |
| 325 |
|
for(int i=0; i<6; i++) zv[i]=track_.zv[i]; |
| 326 |
|
for(int i=0; i<6; i++) axv[i]=track_.axv[i]; |
| 327 |
|
for(int i=0; i<6; i++) ayv[i]=track_.ayv[i]; |
| 328 |
|
for(int i=0; i<5; i++) { |
| 329 |
|
for(int j=0; j<5; j++) coval[i][j]=track_.cov[i][j]; |
| 330 |
|
} |
| 331 |
|
}; |
| 332 |
|
/* |
| 333 |
|
* Reset the parameters fit |
| 334 |
|
*/ |
| 335 |
|
void TrkTrack::FitReset(){ |
| 336 |
|
for(int i=0; i<5; i++) al[i]=-9999.; |
| 337 |
|
chi2=0.; |
| 338 |
|
nstep=0; |
| 339 |
|
for(int i=0; i<6; i++) xv[i]=0.; |
| 340 |
|
for(int i=0; i<6; i++) yv[i]=0.; |
| 341 |
|
for(int i=0; i<6; i++) zv[i]=0.; |
| 342 |
|
for(int i=0; i<6; i++) axv[i]=0.; |
| 343 |
|
for(int i=0; i<6; i++) ayv[i]=0.; |
| 344 |
|
for(int i=0; i<5; i++) { |
| 345 |
|
for(int j=0; j<5; j++) coval[i][j]=0.; |
| 346 |
|
} |
| 347 |
|
} |
| 348 |
|
|
| 349 |
|
//-------------------------------------- |
| 350 |
|
// |
| 351 |
|
// |
| 352 |
|
//-------------------------------------- |
| 353 |
|
void TrkTrack::Clear(){ |
| 354 |
|
seqno = -1; |
| 355 |
|
image = -1; |
| 356 |
|
chi2 = 0; |
| 357 |
|
nstep = 0; |
| 358 |
|
for(int it1=0;it1<5;it1++){ |
| 359 |
|
al[it1] = 0; |
| 360 |
|
for(int it2=0;it2<5;it2++)coval[it1][it2] = 0; |
| 361 |
|
}; |
| 362 |
|
for(int ip=0;ip<6;ip++){ |
| 363 |
|
xgood[ip] = 0; |
| 364 |
|
ygood[ip] = 0; |
| 365 |
|
xm[ip] = 0; |
| 366 |
|
ym[ip] = 0; |
| 367 |
|
zm[ip] = 0; |
| 368 |
|
resx[ip] = 0; |
| 369 |
|
resy[ip] = 0; |
| 370 |
|
xv[ip] = 0; |
| 371 |
|
yv[ip] = 0; |
| 372 |
|
zv[ip] = 0; |
| 373 |
|
axv[ip] = 0; |
| 374 |
|
ayv[ip] = 0; |
| 375 |
|
dedx_x[ip] = 0; |
| 376 |
|
dedx_y[ip] = 0; |
| 377 |
|
// clx[ip] = 0; |
| 378 |
|
// cly[ip] = 0; |
| 379 |
|
}; |
| 380 |
|
clx->Clear(); |
| 381 |
|
cly->Clear(); |
| 382 |
|
}; |
| 383 |
|
//-------------------------------------- |
| 384 |
|
// |
| 385 |
|
// |
| 386 |
|
//-------------------------------------- |
| 387 |
|
void TrkTrack::Delete(){ |
| 388 |
|
Clear(); |
| 389 |
|
clx->Delete(); |
| 390 |
|
cly->Delete(); |
| 391 |
|
}; |
| 392 |
|
//-------------------------------------- |
| 393 |
|
// |
| 394 |
|
// |
| 395 |
|
//-------------------------------------- |
| 396 |
|
|
| 397 |
//-------------------------------------- |
//-------------------------------------- |
| 398 |
// |
// |
| 399 |
// |
// |
| 403 |
coord[0] = 0; |
coord[0] = 0; |
| 404 |
coord[1] = 0; |
coord[1] = 0; |
| 405 |
sgnl = 0; |
sgnl = 0; |
| 406 |
|
cls = 0; |
| 407 |
}; |
}; |
| 408 |
//-------------------------------------- |
//-------------------------------------- |
| 409 |
// |
// |
| 414 |
coord[0] = s.coord[0]; |
coord[0] = s.coord[0]; |
| 415 |
coord[1] = s.coord[1]; |
coord[1] = s.coord[1]; |
| 416 |
sgnl = s.sgnl; |
sgnl = s.sgnl; |
| 417 |
|
// cls = 0;//<<<<pointer |
| 418 |
|
cls = TRef(s.cls); |
| 419 |
}; |
}; |
| 420 |
//-------------------------------------- |
//-------------------------------------- |
| 421 |
// |
// |
| 433 |
// |
// |
| 434 |
//-------------------------------------- |
//-------------------------------------- |
| 435 |
TrkLevel2::TrkLevel2(){ |
TrkLevel2::TrkLevel2(){ |
| 436 |
good2 = -1; |
// good2 = -1; |
| 437 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
| 438 |
crc[i] = -1; |
// crc[i] = -1; |
| 439 |
}; |
good[i] = -1; |
| 440 |
|
}; |
| 441 |
Track = new TClonesArray("TrkTrack"); |
Track = new TClonesArray("TrkTrack"); |
| 442 |
SingletX = new TClonesArray("TrkSinglet"); |
SingletX = new TClonesArray("TrkSinglet"); |
| 443 |
SingletY = new TClonesArray("TrkSinglet"); |
SingletY = new TClonesArray("TrkSinglet"); |
| 450 |
// |
// |
| 451 |
//-------------------------------------- |
//-------------------------------------- |
| 452 |
void TrkLevel2::Dump(){ |
void TrkLevel2::Dump(){ |
| 453 |
|
|
| 454 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
| 455 |
TClonesArray &sx = *SingletX; |
TClonesArray &sx = *SingletX; |
| 456 |
TClonesArray &sy = *SingletY; |
TClonesArray &sy = *SingletY; |
| 457 |
|
// |
| 458 |
cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; |
cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; |
| 459 |
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]; |
|
| 460 |
cout << endl << "ntrk() : " << this->ntrk() ; |
cout << endl << "ntrk() : " << this->ntrk() ; |
| 461 |
cout << endl << "nclsx() : " << this->nclsx(); |
cout << endl << "nclsx() : " << this->nclsx(); |
| 462 |
cout << endl << "nclsy() : " << this->nclsy(); |
cout << endl << "nclsy() : " << this->nclsy(); |
| 472 |
* 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). |
| 473 |
*/ |
*/ |
| 474 |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){ |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){ |
| 475 |
// |
|
| 476 |
// Track = new TClonesArray("TrkTrack"); |
// temporary objects: |
|
// SingletX = new TClonesArray("TrkSinglet"); |
|
|
// SingletY = new TClonesArray("TrkSinglet"); |
|
|
// temporary objects: |
|
| 477 |
TrkSinglet* t_singlet = new TrkSinglet(); |
TrkSinglet* t_singlet = new TrkSinglet(); |
| 478 |
TrkTrack* t_track = new TrkTrack(); |
TrkTrack* t_track = new TrkTrack(); |
| 479 |
// general variables |
|
| 480 |
good2 = l2->good2; |
// **** general variables **** |
| 481 |
|
// good2 = l2->good2; |
| 482 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
| 483 |
crc[i] = l2->crc[i]; |
// crc[i] = l2->crc[i]; |
| 484 |
}; |
good[i] = l2->good[i]; |
| 485 |
// *** TRACKS *** |
}; |
| 486 |
|
// *** TRACKS *** |
| 487 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
| 488 |
for(int i=0; i<l2->ntrk; i++){ |
for(int i=0; i<l2->ntrk; i++){ |
| 489 |
t_track->seqno = i; |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
| 490 |
t_track->image = l2->image[i]-1; |
t_track->image = l2->image[i]-1; |
| 491 |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
| 492 |
t_track->chi2 = l2->chi2_nt[i]; |
t_track->chi2 = l2->chi2_nt[i]; |
| 493 |
for(int it1=0;it1<5;it1++){ |
t_track->nstep = l2->nstep_nt[i]; |
| 494 |
t_track->al[it1] = l2->al_nt[i][it1]; |
for(int it1=0;it1<5;it1++){ |
| 495 |
for(int it2=0;it2<5;it2++) |
t_track->al[it1] = l2->al_nt[i][it1]; |
| 496 |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
for(int it2=0;it2<5;it2++) |
| 497 |
}; |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
| 498 |
for(int ip=0;ip<6;ip++){ |
}; |
| 499 |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
for(int ip=0;ip<6;ip++){ |
| 500 |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
| 501 |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
| 502 |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
| 503 |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
t_track->ym[ip] = l2->ym_nt[i][ip]; |
| 504 |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
t_track->zm[ip] = l2->zm_nt[i][ip]; |
| 505 |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
t_track->resx[ip] = l2->resx_nt[i][ip]; |
| 506 |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
t_track->resy[ip] = l2->resy_nt[i][ip]; |
| 507 |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
t_track->xv[ip] = l2->xv_nt[i][ip]; |
| 508 |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
t_track->yv[ip] = l2->yv_nt[i][ip]; |
| 509 |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
t_track->zv[ip] = l2->zv_nt[i][ip]; |
| 510 |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
t_track->axv[ip] = l2->axv_nt[i][ip]; |
| 511 |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
| 512 |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
| 513 |
}; |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
| 514 |
new(t[i]) TrkTrack(*t_track); |
// t_track->clx[ip] = 0; |
| 515 |
t_track->Clear(); |
// t_track->cly[ip] = 0; |
| 516 |
|
}; |
| 517 |
|
new(t[i]) TrkTrack(*t_track); |
| 518 |
|
t_track->Clear(); |
| 519 |
}; |
}; |
| 520 |
// *** SINGLETS *** |
// *** SINGLETS *** |
| 521 |
TClonesArray &sx = *SingletX; |
TClonesArray &sx = *SingletX; |
| 522 |
for(int i=0; i<l2->nclsx; i++){ |
for(int i=0; i<l2->nclsx; i++){ |
| 523 |
t_singlet->plane = l2->planex[i]; |
t_singlet->plane = l2->planex[i]; |
| 524 |
t_singlet->coord[0] = l2->xs[i][0]; |
t_singlet->coord[0] = l2->xs[i][0]; |
| 525 |
t_singlet->coord[1] = l2->xs[i][1]; |
t_singlet->coord[1] = l2->xs[i][1]; |
| 526 |
t_singlet->sgnl = l2->signlxs[i]; |
t_singlet->sgnl = l2->signlxs[i]; |
| 527 |
new(sx[i]) TrkSinglet(*t_singlet); |
// t_singlet->cls = 0; |
| 528 |
t_singlet->Clear(); |
new(sx[i]) TrkSinglet(*t_singlet); |
| 529 |
|
t_singlet->Clear(); |
| 530 |
} |
} |
| 531 |
TClonesArray &sy = *SingletY; |
TClonesArray &sy = *SingletY; |
| 532 |
for(int i=0; i<l2->nclsy; i++){ |
for(int i=0; i<l2->nclsy; i++){ |
| 533 |
t_singlet->plane = l2->planey[i]; |
t_singlet->plane = l2->planey[i]; |
| 534 |
t_singlet->coord[0] = l2->ys[i][0]; |
t_singlet->coord[0] = l2->ys[i][0]; |
| 535 |
t_singlet->coord[1] = l2->ys[i][1]; |
t_singlet->coord[1] = l2->ys[i][1]; |
| 536 |
t_singlet->sgnl = l2->signlys[i]; |
t_singlet->sgnl = l2->signlys[i]; |
| 537 |
new(sy[i]) TrkSinglet(*t_singlet); |
// t_singlet->cls = 0; |
| 538 |
t_singlet->Clear(); |
new(sy[i]) TrkSinglet(*t_singlet); |
| 539 |
|
t_singlet->Clear(); |
| 540 |
|
}; |
| 541 |
|
|
| 542 |
|
delete t_track; |
| 543 |
|
delete t_singlet; |
| 544 |
|
} |
| 545 |
|
//-------------------------------------- |
| 546 |
|
// |
| 547 |
|
// |
| 548 |
|
//-------------------------------------- |
| 549 |
|
/** |
| 550 |
|
* Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). |
| 551 |
|
* Ref to Level1 data (clusters) is also set. |
| 552 |
|
*/ |
| 553 |
|
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ |
| 554 |
|
|
| 555 |
|
// temporary objects: |
| 556 |
|
TrkSinglet* t_singlet = new TrkSinglet(); |
| 557 |
|
TrkTrack* t_track = new TrkTrack(); |
| 558 |
|
// general variables |
| 559 |
|
// good2 = l2->good2; |
| 560 |
|
for(Int_t i=0; i<12 ; i++){ |
| 561 |
|
// crc[i] = l2->crc[i]; |
| 562 |
|
good[i] = l2->good[i]; |
| 563 |
|
}; |
| 564 |
|
// *** TRACKS *** |
| 565 |
|
TClonesArray &t = *Track; |
| 566 |
|
for(int i=0; i<l2->ntrk; i++){ |
| 567 |
|
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
| 568 |
|
t_track->image = l2->image[i]-1; |
| 569 |
|
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
| 570 |
|
t_track->chi2 = l2->chi2_nt[i]; |
| 571 |
|
t_track->nstep = l2->nstep_nt[i]; |
| 572 |
|
for(int it1=0;it1<5;it1++){ |
| 573 |
|
t_track->al[it1] = l2->al_nt[i][it1]; |
| 574 |
|
for(int it2=0;it2<5;it2++) |
| 575 |
|
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
| 576 |
|
}; |
| 577 |
|
for(int ip=0;ip<6;ip++){ |
| 578 |
|
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
| 579 |
|
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
| 580 |
|
t_track->xm[ip] = l2->xm_nt[i][ip]; |
| 581 |
|
t_track->ym[ip] = l2->ym_nt[i][ip]; |
| 582 |
|
t_track->zm[ip] = l2->zm_nt[i][ip]; |
| 583 |
|
t_track->resx[ip] = l2->resx_nt[i][ip]; |
| 584 |
|
t_track->resy[ip] = l2->resy_nt[i][ip]; |
| 585 |
|
t_track->xv[ip] = l2->xv_nt[i][ip]; |
| 586 |
|
t_track->yv[ip] = l2->yv_nt[i][ip]; |
| 587 |
|
t_track->zv[ip] = l2->zv_nt[i][ip]; |
| 588 |
|
t_track->axv[ip] = l2->axv_nt[i][ip]; |
| 589 |
|
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
| 590 |
|
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
| 591 |
|
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
| 592 |
|
// cout << "traccia "<<i<<" -- "<< ip << " "<< l2->cltrx[i][ip] <<" "<< l2->cltry[i][ip] <<" "<< t_track->xgood[ip] << t_track->ygood[ip]<<endl; |
| 593 |
|
//----------------------------------------------------- |
| 594 |
|
// t_track->clx[ip] = l1->GetCluster(l2->cltrx[i][ip]-1); |
| 595 |
|
// t_track->cly[ip] = l1->GetCluster(l2->cltry[i][ip]-1); |
| 596 |
|
if(t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
| 597 |
|
if(t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
| 598 |
|
// 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; |
| 599 |
|
// 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; |
| 600 |
|
//----------------------------------------------------- |
| 601 |
|
}; |
| 602 |
|
new(t[i]) TrkTrack(*t_track); |
| 603 |
|
t_track->Clear(); |
| 604 |
|
}; |
| 605 |
|
// *** SINGLETS *** |
| 606 |
|
TClonesArray &sx = *SingletX; |
| 607 |
|
for(int i=0; i<l2->nclsx; i++){ |
| 608 |
|
t_singlet->plane = l2->planex[i]; |
| 609 |
|
t_singlet->coord[0] = l2->xs[i][0]; |
| 610 |
|
t_singlet->coord[1] = l2->xs[i][1]; |
| 611 |
|
t_singlet->sgnl = l2->signlxs[i]; |
| 612 |
|
//----------------------------------------------------- |
| 613 |
|
// cout << "singolo x "<<i<<" -- "<< l2->clsx[i] <<endl; |
| 614 |
|
t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
| 615 |
|
// cout<<" i "<<i<<" l2->clsx[i] "<<l2->clsx[i]<< " l1->GetCluster(l2->clsx[i]-1) "<<l1->GetCluster(l2->clsx[i]-1)<<endl; |
| 616 |
|
//----------------------------------------------------- |
| 617 |
|
new(sx[i]) TrkSinglet(*t_singlet); |
| 618 |
|
t_singlet->Clear(); |
| 619 |
|
} |
| 620 |
|
TClonesArray &sy = *SingletY; |
| 621 |
|
for(int i=0; i<l2->nclsy; i++){ |
| 622 |
|
t_singlet->plane = l2->planey[i]; |
| 623 |
|
t_singlet->coord[0] = l2->ys[i][0]; |
| 624 |
|
t_singlet->coord[1] = l2->ys[i][1]; |
| 625 |
|
t_singlet->sgnl = l2->signlys[i]; |
| 626 |
|
//----------------------------------------------------- |
| 627 |
|
// cout << "singolo y "<<i<<" -- "<< l2->clsy[i] <<endl; |
| 628 |
|
t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
| 629 |
|
// cout<<" i "<<i<<" l2->clsy[i] "<<l2->clsy[i]<< " l1->GetCluster(l2->clsy[i]-1) "<<l1->GetCluster(l2->clsy[i]-1)<<endl; |
| 630 |
|
//----------------------------------------------------- |
| 631 |
|
new(sy[i]) TrkSinglet(*t_singlet); |
| 632 |
|
t_singlet->Clear(); |
| 633 |
}; |
}; |
| 634 |
|
|
| 635 |
delete t_track; |
delete t_track; |
| 642 |
void TrkLevel2::GetLevel2Struct(cTrkLevel2 *l2) const { |
void TrkLevel2::GetLevel2Struct(cTrkLevel2 *l2) const { |
| 643 |
|
|
| 644 |
// general variables |
// general variables |
| 645 |
l2->good2 = good2 ; |
// l2->good2 = good2 ; |
| 646 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
| 647 |
l2->crc[i] = crc[i]; |
// l2->crc[i] = crc[i]; |
| 648 |
|
l2->good[i] = good[i]; |
| 649 |
}; |
}; |
| 650 |
// *** TRACKS *** |
// *** TRACKS *** |
| 651 |
|
|
| 653 |
for(Int_t i=0;i<l2->ntrk;i++){ |
for(Int_t i=0;i<l2->ntrk;i++){ |
| 654 |
l2->image[i] = 1 + ((TrkTrack *)Track->At(i))->image; |
l2->image[i] = 1 + ((TrkTrack *)Track->At(i))->image; |
| 655 |
l2->chi2_nt[i] = ((TrkTrack *)Track->At(i))->chi2; |
l2->chi2_nt[i] = ((TrkTrack *)Track->At(i))->chi2; |
| 656 |
for(int it1=0;it1<5;it1++){ |
l2->nstep_nt[i] = ((TrkTrack *)Track->At(i))->nstep; |
| 657 |
|
for(int it1=0;it1<5;it1++){ |
| 658 |
l2->al_nt[i][it1] = ((TrkTrack *)Track->At(i))->al[it1]; |
l2->al_nt[i][it1] = ((TrkTrack *)Track->At(i))->al[it1]; |
| 659 |
for(int it2=0;it2<5;it2++) |
for(int it2=0;it2<5;it2++) |
| 660 |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
| 698 |
// |
// |
| 699 |
//-------------------------------------- |
//-------------------------------------- |
| 700 |
void TrkLevel2::Clear(){ |
void TrkLevel2::Clear(){ |
| 701 |
good2 = -1; |
// good2 = -1; |
| 702 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
| 703 |
crc[i] = -1; |
// crc[i] = -1; |
| 704 |
}; |
good[i] = -1; |
| 705 |
|
}; |
| 706 |
/* Track->RemoveAll(); |
/* Track->RemoveAll(); |
| 707 |
SingletX->RemoveAll(); |
SingletX->RemoveAll(); |
| 708 |
SingletY->RemoveAll();*/ |
SingletY->RemoveAll();*/ |
| 715 |
// |
// |
| 716 |
// |
// |
| 717 |
//-------------------------------------- |
//-------------------------------------- |
| 718 |
|
void TrkLevel2::Delete(){ |
| 719 |
|
|
| 720 |
|
Clear(); |
| 721 |
|
Track->Delete(); |
| 722 |
|
SingletX->Delete(); |
| 723 |
|
SingletY->Delete(); |
| 724 |
|
} |
| 725 |
|
//-------------------------------------- |
| 726 |
|
// |
| 727 |
|
// |
| 728 |
|
//-------------------------------------- |
| 729 |
/** |
/** |
| 730 |
* 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). |
| 731 |
* 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. |
| 732 |
*/ |
*/ |
|
// 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(){ |
|
| 733 |
TRefArray *TrkLevel2::GetTracks_NFitSorted(){ |
TRefArray *TrkLevel2::GetTracks_NFitSorted(){ |
| 734 |
|
|
|
// cout << "GetTracks_NFitSorted(it): new TRefArray()"<< endl; |
|
|
// TClonesArray *sorted = new TClonesArray("TrkTrack"); |
|
|
// TClonesArray &ts = *sorted; |
|
| 735 |
TRefArray *sorted = new TRefArray(); |
TRefArray *sorted = new TRefArray(); |
| 736 |
|
|
| 737 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
| 745 |
while(N != 0){ |
while(N != 0){ |
| 746 |
int nfit =0; |
int nfit =0; |
| 747 |
float chi2ref = numeric_limits<float>::max(); |
float chi2ref = numeric_limits<float>::max(); |
| 748 |
|
|
| 749 |
// first loop to search maximum num. of fit points |
// first loop to search maximum num. of fit points |
| 750 |
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; |
|
| 751 |
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
| 752 |
nfit = ((TrkTrack *)t[i])->GetNtot(); |
nfit = ((TrkTrack *)t[i])->GetNtot(); |
| 753 |
} |
} |
| 754 |
} |
} |
| 755 |
//second loop to search minimum chi2 among selected |
//second loop to search minimum chi2 among selected |
| 756 |
for(int i=0; i<this->ntrk(); i++){ |
for(int i=0; i<this->ntrk(); i++){ |
| 757 |
if( ((TrkTrack *)t[i])->chi2 < chi2ref |
Float_t chi2 = ((TrkTrack *)t[i])->chi2; |
| 758 |
&& ((TrkTrack *)t[i])->GetNtot()== nfit |
if(chi2 < 0) chi2 = chi2*1000; |
| 759 |
&& m[i]==1){ |
if( chi2 < chi2ref |
| 760 |
|
&& ((TrkTrack *)t[i])->GetNtot() == nfit |
| 761 |
|
&& m[i]==1){ |
| 762 |
chi2ref = ((TrkTrack *)t[i])->chi2; |
chi2ref = ((TrkTrack *)t[i])->chi2; |
| 763 |
indi = i; |
indi = i; |
| 764 |
// cout << "2** "<<i<< " " << nfit <<" "<<chi2ref<<endl; |
}; |
| 765 |
} |
}; |
|
} |
|
| 766 |
if( ((TrkTrack *)t[indi])->HasImage() ){ |
if( ((TrkTrack *)t[indi])->HasImage() ){ |
| 767 |
m[((TrkTrack *)t[indi])->image] = 0; |
m[((TrkTrack *)t[indi])->image] = 0; |
| 768 |
N--; |
N--; |
| 769 |
|
|
|
// Int_t nfiti=((TrkTrack *)t[((TrkTrack *)t[indi])->image ])->GetNtot(); |
|
|
// Float_t chi2i=((TrkTrack *)t[((TrkTrack *)t[indi])->image ])->chi2; |
|
|
|
|
| 770 |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
| 771 |
} |
}; |
|
// new(ts[indo]) TrkTrack(*(TrkTrack*)t[indi]); |
|
|
// cout << "GetTracks_NFitSorted(it): Add("<<indo<<")"<< endl; |
|
| 772 |
sorted->Add( (TrkTrack*)t[indi] ); |
sorted->Add( (TrkTrack*)t[indi] ); |
| 773 |
|
|
| 774 |
m[indi] = 0; |
m[indi] = 0; |
| 848 |
* Retrieves the it-th "physical" track, sorted by the method GetNTracks(). |
* Retrieves the it-th "physical" track, sorted by the method GetNTracks(). |
| 849 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
| 850 |
*/ |
*/ |
| 851 |
/*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; |
|
|
}*/ |
|
| 852 |
TrkTrack *TrkLevel2::GetTrack(int it){ |
TrkTrack *TrkLevel2::GetTrack(int it){ |
| 853 |
|
|
| 854 |
if(it >= this->GetNTracks()){ |
if(it >= this->GetNTracks()){ |
| 869 |
|
|
| 870 |
Float_t ntot=0; |
Float_t ntot=0; |
| 871 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
| 872 |
for(int i=0; i<ntrk(); i++) { |
for(int i=0; i<ntrk(); i++) { |
| 873 |
if( ((TrkTrack *)t[i])->GetImageSeqNo() == -1 ) ntot+=1.; |
if( ((TrkTrack *)t[i])->GetImageSeqNo() == -1 ) ntot+=1.; |
| 874 |
else ntot+=0.5; |
else ntot+=0.5; |
| 875 |
} |
} |
| 884 |
* 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(). |
| 885 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
| 886 |
*/ |
*/ |
|
/*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; |
|
|
|
|
|
}*/ |
|
| 887 |
TrkTrack *TrkLevel2::GetTrackImage(int it){ |
TrkTrack *TrkLevel2::GetTrackImage(int it){ |
| 888 |
|
|
| 889 |
if(it >= this->GetNTracks()){ |
if(it >= this->GetNTracks()){ |
| 1013 |
tl = new float[npoint]; |
tl = new float[npoint]; |
| 1014 |
int i=0; |
int i=0; |
| 1015 |
do{ |
do{ |
| 1016 |
x[i] = 0; |
x[i] = 0; |
| 1017 |
y[i] = 0; |
y[i] = 0; |
| 1018 |
z[i] = zin[i]; |
z[i] = zin[i]; |
| 1019 |
thx[i] = 0; |
thx[i] = 0; |
| 1020 |
thy[i] = 0; |
thy[i] = 0; |
| 1021 |
tl[i] = 0; |
tl[i] = 0; |
| 1022 |
i++; |
i++; |
| 1023 |
}while(zin[i-1] > zin[i] && i < npoint); |
}while(zin[i-1] > zin[i] && i < npoint); |
| 1024 |
npoint=i; |
npoint=i; |
| 1025 |
if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl; |
if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl; |
| 1062 |
|
|
| 1063 |
} |
} |
| 1064 |
|
|
| 1065 |
|
|
| 1066 |
ClassImp(TrkLevel2); |
ClassImp(TrkLevel2); |
| 1067 |
ClassImp(TrkSinglet); |
ClassImp(TrkSinglet); |
| 1068 |
ClassImp(TrkTrack); |
ClassImp(TrkTrack); |