1 |
/* |
2 |
* TrkPhSinCut.cpp |
3 |
* |
4 |
* Created on: 13-mar-2009 |
5 |
* Author: Sergio Ricciarini, Nicola Mori |
6 |
*/ |
7 |
|
8 |
/*! @file TrkPhSinCut.cpp The TrkPhSinCut class implementation file */ |
9 |
|
10 |
#include "TrkPhSinCut.h" |
11 |
|
12 |
int TrkPhSinCut::Check(PamLevel2 *event) { |
13 |
|
14 |
if (!(event->GetTrkLevel2()->GetNTracks() == 1)) |
15 |
return 0; // one track exists (physical or not) |
16 |
|
17 |
// selection of the physical track (see TrkId below) |
18 |
event->SetSortingMethod(_sortingMethod); |
19 |
pamTrack = event->GetTrack(0); |
20 |
|
21 |
// NOTE: pamtrack is null pointer if no physical track is selected; this is a redundant check to find bugs in the level2 (at least one physical track should always be present, given that GetNTracks()=1 according to the previous cut). |
22 |
if (!pamTrack) |
23 |
return 0; // redundant check |
24 |
|
25 |
trkTrack = pamTrack->GetTrkTrack(); |
26 |
|
27 |
if (!(trkTrack->nstep < 100 && trkTrack->chi2 > 0.)) |
28 |
return 0; // check that the track is meaningful |
29 |
|
30 |
// int imatch=0; |
31 |
|
32 |
// identification of TRK-track TOF-index (this index is generally different from TRK-track TRK-index) |
33 |
iTrackTof = -1000; |
34 |
for (int i=0; i<event->GetToFLevel2()->ntrk(); i++) { |
35 |
if ( event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkTrack->GetSeqNo() ) { |
36 |
iTrackTof = i; |
37 |
// cout << "trkseqno " << event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno << " TOF track id " << i << endl; |
38 |
// imatch++; |
39 |
break; |
40 |
} |
41 |
} |
42 |
|
43 |
return CUTOK; |
44 |
|
45 |
} |