18 |
// |
// |
19 |
//-------------------------------------- |
//-------------------------------------- |
20 |
TrkTrack::TrkTrack(){ |
TrkTrack::TrkTrack(){ |
21 |
image = 0; |
seqno = -1; |
22 |
|
image = -1; |
23 |
chi2 = 0; |
chi2 = 0; |
24 |
for(int it1=0;it1<5;it1++){ |
for(int it1=0;it1<5;it1++){ |
25 |
al[it1] = 0; |
al[it1] = 0; |
48 |
// |
// |
49 |
//-------------------------------------- |
//-------------------------------------- |
50 |
TrkTrack::TrkTrack(const TrkTrack& t){ |
TrkTrack::TrkTrack(const TrkTrack& t){ |
51 |
|
seqno = t.seqno; |
52 |
image = t.image; |
image = t.image; |
53 |
chi2 = t.chi2; |
chi2 = t.chi2; |
54 |
for(int it1=0;it1<5;it1++){ |
for(int it1=0;it1<5;it1++){ |
240 |
Track = new TClonesArray("TrkTrack"); |
Track = new TClonesArray("TrkTrack"); |
241 |
SingletX = new TClonesArray("TrkSinglet"); |
SingletX = new TClonesArray("TrkSinglet"); |
242 |
SingletY = new TClonesArray("TrkSinglet"); |
SingletY = new TClonesArray("TrkSinglet"); |
243 |
|
// Track = 0; |
244 |
|
// Singlet = 0; |
245 |
|
// SingletY = 0; |
246 |
} |
} |
247 |
//-------------------------------------- |
//-------------------------------------- |
248 |
// |
// |
271 |
* 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). |
272 |
*/ |
*/ |
273 |
void TrkLevel2::FillCommonVar(cTrkLevel2 *l2){ |
void TrkLevel2::FillCommonVar(cTrkLevel2 *l2){ |
274 |
|
// |
275 |
|
// Track = new TClonesArray("TrkTrack"); |
276 |
|
// SingletX = new TClonesArray("TrkSinglet"); |
277 |
|
// SingletY = new TClonesArray("TrkSinglet"); |
278 |
// temporary objects: |
// temporary objects: |
279 |
TrkSinglet* t_singlet = new TrkSinglet(); |
TrkSinglet* t_singlet = new TrkSinglet(); |
280 |
TrkTrack* t_track = new TrkTrack(); |
TrkTrack* t_track = new TrkTrack(); |
286 |
// *** TRACKS *** |
// *** TRACKS *** |
287 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
288 |
for(int i=0; i<l2->ntrk; i++){ |
for(int i=0; i<l2->ntrk; i++){ |
289 |
|
t_track->seqno = i; |
290 |
t_track->image = l2->image[i]-1; |
t_track->image = l2->image[i]-1; |
291 |
|
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
292 |
t_track->chi2 = l2->chi2_nt[i]; |
t_track->chi2 = l2->chi2_nt[i]; |
293 |
for(int it1=0;it1<5;it1++){ |
for(int it1=0;it1<5;it1++){ |
294 |
t_track->al[it1] = l2->al_nt[i][it1]; |
t_track->al[it1] = l2->al_nt[i][it1]; |
356 |
* 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. |
357 |
*/ |
*/ |
358 |
TClonesArray *TrkLevel2::GetTracks(){ |
TClonesArray *TrkLevel2::GetTracks(){ |
359 |
|
TClonesArray *sorted = GetTracks_NFitSorted(); |
360 |
|
return sorted; |
361 |
|
}; |
362 |
|
TClonesArray *TrkLevel2::GetTracks_Chi2Sorted(){ |
363 |
|
|
364 |
TClonesArray *sorted = new TClonesArray("TrkTrack"); |
TClonesArray *sorted = new TClonesArray("TrkTrack"); |
365 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
388 |
} |
} |
389 |
return sorted; |
return sorted; |
390 |
} |
} |
391 |
|
TClonesArray *TrkLevel2::GetTracks_NFitSorted(){ |
392 |
|
|
393 |
|
TClonesArray *sorted = new TClonesArray("TrkTrack"); |
394 |
|
TClonesArray &t = *Track; |
395 |
|
TClonesArray &ts = *sorted; |
396 |
|
int N=this->ntrk(); |
397 |
|
vector<int> m(N); for(int i=0; i<N; i++)m[i]=1; |
398 |
|
|
399 |
|
int indo=0; |
400 |
|
int indi=0; |
401 |
|
while(N != 0){ |
402 |
|
int nfit =0; |
403 |
|
float chi2ref=1000000; |
404 |
|
// first loop to search maximum num. of fit points |
405 |
|
for(int i=0; i<this->ntrk(); i++){ |
406 |
|
if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){ |
407 |
|
nfit = ((TrkTrack *)t[i])->GetNtot(); |
408 |
|
// cout << "1** "<<i<< " " << nfit<<endl; |
409 |
|
} |
410 |
|
} |
411 |
|
//second loop to search minimum chi2 among selected |
412 |
|
for(int i=0; i<this->ntrk(); i++){ |
413 |
|
if( ((TrkTrack *)t[i])->chi2 < chi2ref |
414 |
|
&& ((TrkTrack *)t[i])->GetNtot()== nfit |
415 |
|
&& m[i]==1){ |
416 |
|
chi2ref = ((TrkTrack *)t[i])->chi2; |
417 |
|
indi = i; |
418 |
|
// cout << "2** "<<i<< " " << nfit <<" "<<chi2ref<<endl; |
419 |
|
} |
420 |
|
} |
421 |
|
if( ((TrkTrack *)t[indi])->HasImage() ){ |
422 |
|
m[((TrkTrack *)t[indi])->image] = 0; |
423 |
|
N--; |
424 |
|
|
425 |
|
// Int_t nfiti=((TrkTrack *)t[((TrkTrack *)t[indi])->image ])->GetNtot(); |
426 |
|
// Float_t chi2i=((TrkTrack *)t[((TrkTrack *)t[indi])->image ])->chi2; |
427 |
|
|
428 |
|
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
429 |
|
} |
430 |
|
new(ts[indo]) TrkTrack(*(TrkTrack*)t[indi]); |
431 |
|
m[indi] = 0; |
432 |
|
N--; |
433 |
|
indo++; |
434 |
|
} |
435 |
|
return sorted; |
436 |
|
} |
437 |
//-------------------------------------- |
//-------------------------------------- |
438 |
// |
// |
439 |
// |
// |