--- PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.h 2011/05/27 14:01:39 1.4 +++ PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.h 2011/09/02 16:28:17 1.5 @@ -36,7 +36,7 @@ * with first_day and last_day expressed in the format YYMMDD * ... * where each row corresponds to a given time interval (first_day,last_day) - * + * The calibration text file can vary with nHitX of the event: in the current implementation, a text file must be specified for events with nHitX=3 and for events with nHitX>=4. * For a given event the associated day is determined; the FIRST (starting from first row) time interval of the calibration file, which contains the event day, gives the parameters to be inserted in the Chi2(|eta|) for the given event. * If the event day does not fall in any of the intervals of the calibration file, then the event is discarded. * @@ -48,32 +48,55 @@ /*! @brief Constructor. * * @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. + * @param calibFile_nHitX3 Path for the calibration text file, used for events with nHitX=3. + * @param calibFile_nHitX4 Path for the calibration text file, used for events with nHitX>=4. + * @param nPar Number of parameters used for the Chi2 function. Maximum allowed: 5. Default: 5. */ - TrkChi2DeflTimeCut(const char *cutName, const char *calibFile, int nPar=4) : - PamCut(cutName), _calibFile(calibFile), _nPar(nPar) { + TrkChi2DeflTimeCut(const char *cutName, const char *calibFile_nHitX3, const char *calibFile_nHitX4, int nPar=5) : + PamCut(cutName), _calibFile_nHitX3(calibFile_nHitX3), _calibFile_nHitX4(calibFile_nHitX4), _nPar(nPar) { - _chi2CutTable.open(_calibFile); - while (! _chi2CutTable.eof()) { + _chi2CutTable_nHitX3.open(_calibFile_nHitX3); + while (! _chi2CutTable_nHitX3.eof()) { + + _chi2CutTable_nHitX3 >> _tstringtemp; + _iDayFirst_nHitX3.push_back(_tstringtemp.Atoi()); + + _chi2CutTable_nHitX3 >> _tstringtemp; + _iDayLast_nHitX3.push_back(_tstringtemp.Atoi()); + + if (_nPar>=0 && _nPar<=5) { + for (int iPar=0; iPar<_nPar; iPar++) { + + _chi2CutTable_nHitX3 >> _tstringtemp; + _p_nHitX3[iPar].push_back(_tstringtemp.Atof()); + + } + } + + } + _chi2CutTable_nHitX3.close(); + + _chi2CutTable_nHitX4.open(_calibFile_nHitX4); + while (! _chi2CutTable_nHitX4.eof()) { - _chi2CutTable >> _tstringtemp; - _iDayFirst.push_back(_tstringtemp.Atoi()); + _chi2CutTable_nHitX4 >> _tstringtemp; + _iDayFirst_nHitX4.push_back(_tstringtemp.Atoi()); - _chi2CutTable >> _tstringtemp; - _iDayLast.push_back(_tstringtemp.Atoi()); + _chi2CutTable_nHitX4 >> _tstringtemp; + _iDayLast_nHitX4.push_back(_tstringtemp.Atoi()); if (_nPar>=0 && _nPar<=5) { for (int iPar=0; iPar<_nPar; iPar++) { - _chi2CutTable >> _tstringtemp; - _p[iPar].push_back(_tstringtemp.Atof()); + _chi2CutTable_nHitX4 >> _tstringtemp; + _p_nHitX4[iPar].push_back(_tstringtemp.Atof()); } } } - _chi2CutTable.close(); + _chi2CutTable_nHitX4.close(); + } @@ -95,16 +118,26 @@ virtual double _GetChi2(PamLevel2 *event); - const char* _calibFile; - int _nPar; + const char* _calibFile_nHitX3; + const char* _calibFile_nHitX4; + Int_t _nPar; TString _tstringtemp; + std::vector _iDayFirst_nHitX3; + std::vector _iDayFirst_nHitX4; std::vector _iDayFirst; + + std::vector _iDayLast_nHitX3; + std::vector _iDayLast_nHitX4; std::vector _iDayLast; + + std::vector _p_nHitX3[5]; + std::vector _p_nHitX4[5]; std::vector _p[5]; - - ifstream _chi2CutTable; + + ifstream _chi2CutTable_nHitX3; + ifstream _chi2CutTable_nHitX4; Double_t _pSel[5];