7 |
|
|
8 |
#include "TrkChi2DeflTimeCut.h" |
#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) { |
int TrkChi2DeflTimeCut::Check(PamLevel2 *event) { |
15 |
|
|
16 |
Double_t chi2 = event->GetTrack(0)->GetTrkTrack()->chi2; |
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++) { |
for (UInt_t i=0; i<_iDayFirst.size(); i++) { |
28 |
if (_iMonth[i]==iMonthSel) { |
if (_iDayFirst[i]<=iDaySel && iDaySel<=_iDayLast[i]) { |
29 |
_p0sel=_p0[i]; |
_p0sel=_p0[i]; |
30 |
_p1sel=_p1[i]; |
_p1sel=_p1[i]; |
31 |
_p2sel=_p2[i]; |
_p2sel=_p2[i]; |
32 |
// cout << "FOUND: month " << iMonthSel << endl; |
_p3sel=_p3[i]; |
33 |
// cout << _p0sel << " " << _p1sel << " " << _p2sel << endl; |
// cout << "FOUND: day " << iDaySel << endl; |
34 |
|
// cout << _iDayFirst[i] << " " << _iDayLast[i] << endl; |
35 |
|
// cout << _p0sel << " " << _p1sel << " " << _p2sel << " " << _p3sel << endl; |
36 |
break; |
break; |
37 |
} |
} |
38 |
|
return 0; |
39 |
} |
} |
40 |
|
if (chi2 > _p0sel + _p1sel * pow(etaMod,_p2sel) * (1.+ pow(_p3sel*etaMod,2) ) ){ |
|
if (chi2 > _p0sel + _p1sel * eta2 + _p2sel * eta2 * eta2) { |
|
41 |
return 0; |
return 0; |
42 |
} |
} |
43 |
|
|
|
#ifdef DEBUGPAMCUT |
|
|
|
|
|
h_trk_chi2_defl[1]->Fill(event->GetTrack(0)->GetTrkTrack()->GetDeflection(), pow(chi2,0.25)); |
|
|
|
|
|
#endif |
|
|
|
|
44 |
return CUTOK; |
return CUTOK; |
45 |
|
|
46 |
} |
} |