1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* TrkChi2DeflTimeCut.cpp |
3 |
|
|
* |
4 |
|
|
* Created on: 6-oct-2009 |
5 |
|
|
* Author: S. Ricciarini |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#include "TrkChi2DeflTimeCut.h" |
9 |
|
|
|
10 |
pam-fi |
1.4 |
double TrkChi2DeflTimeCut::_GetChi2(PamLevel2 *event) { |
11 |
pam-fi |
1.2 |
return event->GetTrack(0)->GetTrkTrack()->chi2; |
12 |
|
|
} |
13 |
|
|
|
14 |
pam-fi |
1.1 |
int TrkChi2DeflTimeCut::Check(PamLevel2 *event) { |
15 |
|
|
|
16 |
pam-fi |
1.2 |
double chi2 = _GetChi2(event); |
17 |
pam-fi |
1.1 |
if (chi2 < 0.) |
18 |
|
|
return 0; |
19 |
pam-fi |
1.3 |
Double_t etaMod = fabs(event->GetTrack(0)->GetTrkTrack()->GetDeflection()); |
20 |
pam-fi |
1.1 |
|
21 |
|
|
_time.Set(event->GetOrbitalInfo()->absTime, kFALSE, 0, kFALSE); |
22 |
|
|
// TTimestamp::GetDate() returns date in format YYYYMMDD so to compare it |
23 |
pam-fi |
1.3 |
// with 6-digits dates (YYMMDD) we must subtract 20000000 |
24 |
pam-fi |
1.1 |
|
25 |
pam-fi |
1.3 |
Int_t iDaySel = (_time.GetDate(kFALSE) - 20000000); // note: GetDate returns an unsigned integer |
26 |
pam-fi |
1.4 |
|
27 |
|
|
bool found = false; |
28 |
|
|
for (UInt_t i = 0; i < _iDayFirst.size(); i++) { |
29 |
|
|
if (_iDayFirst[i] <= iDaySel && iDaySel <= _iDayLast[i]) { |
30 |
|
|
_p0sel = _p0[i]; |
31 |
|
|
_p1sel = _p1[i]; |
32 |
|
|
_p2sel = _p2[i]; |
33 |
|
|
_p3sel = _p3[i]; |
34 |
|
|
// cout << "FOUND: day " << iDaySel << endl; |
35 |
|
|
// cout << _iDayFirst[i] << " " << _iDayLast[i] << endl; |
36 |
|
|
// cout << _p0sel << " " << _p1sel << " " << _p2sel << " " << _p3sel << endl; |
37 |
|
|
found = true; |
38 |
pam-fi |
1.1 |
break; |
39 |
|
|
} |
40 |
pam-fi |
1.4 |
} |
41 |
|
|
|
42 |
|
|
if (!found) |
43 |
pam-fi |
1.3 |
return 0; |
44 |
pam-fi |
1.4 |
|
45 |
|
|
if (chi2 > _p0sel + _p1sel * pow(etaMod, _p2sel) * (1. + pow(_p3sel * etaMod, 2))) { |
46 |
pam-fi |
1.1 |
return 0; |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
return CUTOK; |
50 |
|
|
|
51 |
|
|
} |