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