1 |
/* |
2 |
* TrkChi2DeflTimeCut.cpp |
3 |
* |
4 |
* Created on: 6-oct-2009 |
5 |
* Author: S. Ricciarini |
6 |
*/ |
7 |
|
8 |
#include "TrkChi2DeflTimeCut.h" |
9 |
|
10 |
int TrkChi2DeflTimeCut::Check(PamLevel2 *event) { |
11 |
|
12 |
Double_t chi2 = event->GetTrack(0)->GetTrkTrack()->chi2; |
13 |
if (chi2 < 0.) |
14 |
return 0; |
15 |
Double_t eta2 = event->GetTrack(0)->GetTrkTrack()->GetDeflection(); //Sign doesn't matter |
16 |
eta2 *= eta2; // Now eta2 is deflection^2 |
17 |
|
18 |
#ifdef DEBUGPAMCUT |
19 |
|
20 |
h_trk_chi2_defl[0]->Fill(event->GetTrack(0)->GetTrkTrack()->GetDeflection(), pow(chi2,0.25)); |
21 |
|
22 |
#endif |
23 |
|
24 |
_time.Set(event->GetOrbitalInfo()->absTime, kFALSE, 0, kFALSE); |
25 |
// TTimestamp::GetDate() returns date in format YYYYMMDD so to compare it |
26 |
// with 4-digits dates (YYMM) we must subtract 20000000 and then divide by 100 (divide by integer) |
27 |
|
28 |
Int_t iMonthSel = (_time.GetDate(kFALSE) - 20000000)/100; // note: GetDate returns an unsigned integer |
29 |
|
30 |
for (UInt_t i=0; i<_iMonth.size(); i++) { |
31 |
if (_iMonth[i]==iMonthSel) { |
32 |
_p0sel=_p0[i]; |
33 |
_p1sel=_p1[i]; |
34 |
_p2sel=_p2[i]; |
35 |
// cout << "FOUND: month " << iMonthSel << endl; |
36 |
// cout << _p0sel << " " << _p1sel << " " << _p2sel << endl; |
37 |
break; |
38 |
} |
39 |
} |
40 |
|
41 |
if (chi2 > _p0sel + _p1sel * eta2 + _p2sel * eta2 * eta2) { |
42 |
return 0; |
43 |
} |
44 |
|
45 |
#ifdef DEBUGPAMCUT |
46 |
|
47 |
h_trk_chi2_defl[1]->Fill(event->GetTrack(0)->GetTrkTrack()->GetDeflection(), pow(chi2,0.25)); |
48 |
|
49 |
#endif |
50 |
|
51 |
return CUTOK; |
52 |
|
53 |
} |