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 |
// Check if good clusters have meaningful energy releases |
28 |
for (unsigned int ip = 0; ip < 6; ip++) { |
29 |
if (trkTrack->XGood(ip) == 1 && trkTrack->GetDEDX(ip, 0) <= 0.) |
30 |
trkTrack->xgood[ip] = 0; // Set it to bad |
31 |
if (trkTrack->YGood(ip) == 1 && trkTrack->GetDEDX(ip, 1) <= 0.) |
32 |
trkTrack->ygood[ip] = 0; // Set it to bad |
33 |
} |
34 |
|
35 |
if (!(trkTrack->nstep < 100 && trkTrack->chi2 > 0.)) |
36 |
return 0; // check that the track is meaningful |
37 |
|
38 |
// identification of TRK-track TOF-index (this index is generally different from TRK-track TRK-index) |
39 |
iTrackTof = -1000; |
40 |
for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { |
41 |
if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkTrack->GetSeqNo()) { |
42 |
iTrackTof = i; |
43 |
break; |
44 |
} |
45 |
} |
46 |
|
47 |
return CUTOK; |
48 |
|
49 |
} |