7 |
|
|
8 |
#include "TrkChi2DeflTimeCut.h" |
#include "TrkChi2DeflTimeCut.h" |
9 |
|
|
10 |
double TrkChi2DeflTimeCut::_GetChi2(PamLevel2 *event){ |
double TrkChi2DeflTimeCut::_GetChi2(PamLevel2 *event) { |
11 |
return event->GetTrack(0)->GetTrkTrack()->chi2; |
return event->GetTrack(0)->GetTrkTrack()->chi2; |
12 |
} |
} |
13 |
|
|
16 |
double chi2 = _GetChi2(event); |
double chi2 = _GetChi2(event); |
17 |
if (chi2 < 0.) |
if (chi2 < 0.) |
18 |
return 0; |
return 0; |
19 |
Double_t eta2 = event->GetTrack(0)->GetTrkTrack()->GetDeflection(); //Sign doesn't matter |
Double_t etaMod = fabs(event->GetTrack(0)->GetTrkTrack()->GetDeflection()); |
|
eta2 *= eta2; // Now eta2 is deflection^2 |
|
|
|
|
|
#ifdef DEBUGPAMCUT |
|
|
|
|
|
h_trk_chi2_defl[0]->Fill(event->GetTrack(0)->GetTrkTrack()->GetDeflection(), pow(chi2,0.25)); |
|
|
|
|
|
#endif |
|
20 |
|
|
21 |
_time.Set(event->GetOrbitalInfo()->absTime, kFALSE, 0, kFALSE); |
_time.Set(event->GetOrbitalInfo()->absTime, kFALSE, 0, kFALSE); |
22 |
// TTimestamp::GetDate() returns date in format YYYYMMDD so to compare it |
// TTimestamp::GetDate() returns date in format YYYYMMDD so to compare it |
23 |
// with 4-digits dates (YYMM) we must subtract 20000000 and then divide by 100 (divide by integer) |
// with 6-digits dates (YYMMDD) we must subtract 20000000 |
24 |
|
|
25 |
Int_t iMonthSel = (_time.GetDate(kFALSE) - 20000000)/100; // note: GetDate returns an unsigned integer |
Int_t iDaySel = (_time.GetDate(kFALSE) - 20000000); // note: GetDate returns an unsigned integer |
26 |
|
|
27 |
for (UInt_t i=0; i<_iMonth.size(); i++) { |
bool found = false; |
28 |
if (_iMonth[i]==iMonthSel) { |
for (UInt_t i = 0; i < _iDayFirst.size(); i++) { |
29 |
_p0sel=_p0[i]; |
if (_iDayFirst[i] <= iDaySel && iDaySel <= _iDayLast[i]) { |
30 |
_p1sel=_p1[i]; |
for (int iPar=0; iPar<_nPar; iPar++) { |
31 |
_p2sel=_p2[i]; |
_pSel[iPar] = _p[iPar][i]; |
32 |
// cout << "FOUND: month " << iMonthSel << endl; |
} |
33 |
// cout << _p0sel << " " << _p1sel << " " << _p2sel << endl; |
|
34 |
|
// cout << "FOUND: day " << iDaySel << endl; |
35 |
|
// cout << _iDayFirst[i] << " " << _iDayLast[i] << endl; |
36 |
|
// cout << _pSel[0] << " " << _pSel[1] << " " << _pSel[2] << " " << _pSel[3] << endl; |
37 |
|
|
38 |
|
found = true; |
39 |
break; |
break; |
40 |
} |
} |
41 |
} |
} |
42 |
|
|
43 |
if (chi2 > _p0sel + _p1sel * eta2 + _p2sel * eta2 * eta2) { |
if (!found) |
44 |
return 0; |
return 0; |
45 |
|
|
46 |
|
double chi2max; |
47 |
|
|
48 |
|
if (_nPar==4) { |
49 |
|
|
50 |
|
chi2max=_pSel[0] + _pSel[1] * pow(etaMod, _pSel[2]) * (1. + pow(_pSel[3] * etaMod, 2)); |
51 |
|
|
52 |
|
// cout << "chi2max " << chi2max << endl; |
53 |
|
|
54 |
|
} |
55 |
|
else if (_nPar==5) { |
56 |
|
chi2max=_pSel[0] + _pSel[1] * pow(etaMod, _pSel[2]) * (1. + pow(_pSel[3] * etaMod, _pSel[4])); |
57 |
|
} |
58 |
|
else { |
59 |
|
chi2max=-1; |
60 |
} |
} |
61 |
|
|
62 |
#ifdef DEBUGPAMCUT |
// cout << "chi2 " << chi2 << endl; |
63 |
|
|
64 |
|
if (chi2 > chi2max) { |
65 |
|
|
66 |
|
// cout << "KO" << endl; |
67 |
|
|
68 |
|
return 0; |
69 |
|
|
70 |
h_trk_chi2_defl[1]->Fill(event->GetTrack(0)->GetTrkTrack()->GetDeflection(), pow(chi2,0.25)); |
} |
71 |
|
|
72 |
#endif |
// cout << "OK" << endl; |
73 |
|
|
74 |
return CUTOK; |
return CUTOK; |
75 |
|
|