--- PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.cpp 2010/02/20 12:56:45 1.4 +++ PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.cpp 2011/05/27 14:01:39 1.5 @@ -27,13 +27,14 @@ bool found = false; for (UInt_t i = 0; i < _iDayFirst.size(); i++) { if (_iDayFirst[i] <= iDaySel && iDaySel <= _iDayLast[i]) { - _p0sel = _p0[i]; - _p1sel = _p1[i]; - _p2sel = _p2[i]; - _p3sel = _p3[i]; - // cout << "FOUND: day " << iDaySel << endl; - // cout << _iDayFirst[i] << " " << _iDayLast[i] << endl; - // cout << _p0sel << " " << _p1sel << " " << _p2sel << " " << _p3sel << endl; + for (int iPar=0; iPar<_nPar; iPar++) { + _pSel[iPar] = _p[iPar][i]; + } + +// cout << "FOUND: day " << iDaySel << endl; +// cout << _iDayFirst[i] << " " << _iDayLast[i] << endl; +// cout << _pSel[0] << " " << _pSel[1] << " " << _pSel[2] << " " << _pSel[3] << endl; + found = true; break; } @@ -42,10 +43,34 @@ if (!found) return 0; - if (chi2 > _p0sel + _p1sel * pow(etaMod, _p2sel) * (1. + pow(_p3sel * etaMod, 2))) { + double chi2max; + + if (_nPar==4) { + + chi2max=_pSel[0] + _pSel[1] * pow(etaMod, _pSel[2]) * (1. + pow(_pSel[3] * etaMod, 2)); + +// cout << "chi2max " << chi2max << endl; + + } + else if (_nPar==5) { + chi2max=_pSel[0] + _pSel[1] * pow(etaMod, _pSel[2]) * (1. + pow(_pSel[3] * etaMod, _pSel[4])); + } + else { + chi2max=-1; + } + +// cout << "chi2 " << chi2 << endl; + + if (chi2 > chi2max) { + +// cout << "KO" << endl; + return 0; + } +// cout << "OK" << endl; + return CUTOK; }