--- PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.h 2010/02/19 15:14:37 1.3 +++ PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.h 2011/05/27 14:01:39 1.4 @@ -18,15 +18,21 @@ /*! @brief The tracker chi2 vs |deflection| cut. * * Events whose track has been fitted with a chi2 greater than Chi2(|eta|) are discarded. - * Chi2(eta) is a function which gives the maximum value of chi2 associated to a certain - * |deflection| (|eta|); in current implementation it is parameterized as: + * Chi2(|eta|) is a function which gives the value of chi2 distribution, corresponding to a given quantile (depending on the calibration text file), as a function of |deflection| (|eta|); in current implementation it is parameterized as: + * + * 4 parameters p0...p3: * * Chi2(|eta|) = p0 + ( p1 * |eta|^p2 * (1 + (p3 * |eta|)^2) ) * with eta expressed in GV^-1 * - * where p0, p1 and p2 are parameters. These are read from a calibration text file, whose format must be: + * 5 parameters p0..p4 + * + * Chi2(|eta|) = p0 + ( p1 * |eta|^p2 * (1 + (p3 * |eta|)^p4) ) + * with eta expressed in GV^-1 + * + * The parameters are read from a calibration text file (prepared for a given quantile, e.g. 95%), whose format must be: * ... - * first_day last_day p0 p1 p2 p3 + * first_day last_day p0 p1 p2 ... * with first_day and last_day expressed in the format YYMMDD * ... * where each row corresponds to a given time interval (first_day,last_day) @@ -43,9 +49,10 @@ * * @param cutName The cut's name. * @param calibFile Path for the calibration text file. + * @param nPar Number of parameters used for the Chi2 function. Maximum allowed: 5. Default: 4. */ - TrkChi2DeflTimeCut(const char *cutName, const char *calibFile) : - PamCut(cutName), _calibFile(calibFile) { + TrkChi2DeflTimeCut(const char *cutName, const char *calibFile, int nPar=4) : + PamCut(cutName), _calibFile(calibFile), _nPar(nPar) { _chi2CutTable.open(_calibFile); while (! _chi2CutTable.eof()) { @@ -56,18 +63,15 @@ _chi2CutTable >> _tstringtemp; _iDayLast.push_back(_tstringtemp.Atoi()); - _chi2CutTable >> _tstringtemp; - _p0.push_back(_tstringtemp.Atof()); - - _chi2CutTable >> _tstringtemp; - _p1.push_back(_tstringtemp.Atof()); - - _chi2CutTable >> _tstringtemp; - _p2.push_back(_tstringtemp.Atof()); - - _chi2CutTable >> _tstringtemp; - _p3.push_back(_tstringtemp.Atof()); + if (_nPar>=0 && _nPar<=5) { + for (int iPar=0; iPar<_nPar; iPar++) { + _chi2CutTable >> _tstringtemp; + _p[iPar].push_back(_tstringtemp.Atof()); + + } + } + } _chi2CutTable.close(); @@ -92,19 +96,17 @@ virtual double _GetChi2(PamLevel2 *event); const char* _calibFile; + int _nPar; TString _tstringtemp; std::vector _iDayFirst; std::vector _iDayLast; - std::vector _p0; - std::vector _p1; - std::vector _p2; - std::vector _p3; + std::vector _p[5]; ifstream _chi2CutTable; - Double_t _p0sel, _p1sel, _p2sel, _p3sel; + Double_t _pSel[5]; TTimeStamp _time;