--- PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.cpp 2010/02/19 15:14:37 1.3 +++ PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.cpp 2010/02/20 12:56:45 1.4 @@ -7,7 +7,7 @@ #include "TrkChi2DeflTimeCut.h" -double TrkChi2DeflTimeCut::_GetChi2(PamLevel2 *event){ +double TrkChi2DeflTimeCut::_GetChi2(PamLevel2 *event) { return event->GetTrack(0)->GetTrkTrack()->chi2; } @@ -23,21 +23,26 @@ // with 6-digits dates (YYMMDD) we must subtract 20000000 Int_t iDaySel = (_time.GetDate(kFALSE) - 20000000); // note: GetDate returns an unsigned integer - - 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; + + 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; + found = true; break; } - return 0; } - if (chi2 > _p0sel + _p1sel * pow(etaMod,_p2sel) * (1.+ pow(_p3sel*etaMod,2) ) ){ + + if (!found) + return 0; + + if (chi2 > _p0sel + _p1sel * pow(etaMod, _p2sel) * (1. + pow(_p3sel * etaMod, 2))) { return 0; }