36 |
* with first_day and last_day expressed in the format YYMMDD |
* with first_day and last_day expressed in the format YYMMDD |
37 |
* ... |
* ... |
38 |
* where each row corresponds to a given time interval (first_day,last_day) |
* where each row corresponds to a given time interval (first_day,last_day) |
39 |
* |
* 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. |
40 |
* 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. |
* 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. |
41 |
* If the event day does not fall in any of the intervals of the calibration file, then the event is discarded. |
* If the event day does not fall in any of the intervals of the calibration file, then the event is discarded. |
42 |
* |
* |
48 |
/*! @brief Constructor. |
/*! @brief Constructor. |
49 |
* |
* |
50 |
* @param cutName The cut's name. |
* @param cutName The cut's name. |
51 |
* @param calibFile Path for the calibration text file. |
* @param calibFile_nHitX3 Path for the calibration text file, used for events with nHitX=3. |
52 |
* @param nPar Number of parameters used for the Chi2 function. Maximum allowed: 5. Default: 4. |
* @param calibFile_nHitX4 Path for the calibration text file, used for events with nHitX>=4. |
53 |
|
* @param nPar Number of parameters used for the Chi2 function. Maximum allowed: 5. Default: 5. |
54 |
*/ |
*/ |
55 |
TrkChi2DeflTimeCut(const char *cutName, const char *calibFile, int nPar=4) : |
TrkChi2DeflTimeCut(const char *cutName, const char *calibFile_nHitX3, const char *calibFile_nHitX4, int nPar=5) : |
56 |
PamCut(cutName), _calibFile(calibFile), _nPar(nPar) { |
PamCut(cutName), _calibFile_nHitX3(calibFile_nHitX3), _calibFile_nHitX4(calibFile_nHitX4), _nPar(nPar) { |
57 |
|
|
58 |
_chi2CutTable.open(_calibFile); |
_chi2CutTable_nHitX3.open(_calibFile_nHitX3); |
59 |
while (! _chi2CutTable.eof()) { |
while (! _chi2CutTable_nHitX3.eof()) { |
60 |
|
|
61 |
|
_chi2CutTable_nHitX3 >> _tstringtemp; |
62 |
|
_iDayFirst_nHitX3.push_back(_tstringtemp.Atoi()); |
63 |
|
|
64 |
|
_chi2CutTable_nHitX3 >> _tstringtemp; |
65 |
|
_iDayLast_nHitX3.push_back(_tstringtemp.Atoi()); |
66 |
|
|
67 |
|
if (_nPar>=0 && _nPar<=5) { |
68 |
|
for (int iPar=0; iPar<_nPar; iPar++) { |
69 |
|
|
70 |
|
_chi2CutTable_nHitX3 >> _tstringtemp; |
71 |
|
_p_nHitX3[iPar].push_back(_tstringtemp.Atof()); |
72 |
|
|
73 |
|
} |
74 |
|
} |
75 |
|
|
76 |
|
} |
77 |
|
_chi2CutTable_nHitX3.close(); |
78 |
|
|
79 |
|
_chi2CutTable_nHitX4.open(_calibFile_nHitX4); |
80 |
|
while (! _chi2CutTable_nHitX4.eof()) { |
81 |
|
|
82 |
_chi2CutTable >> _tstringtemp; |
_chi2CutTable_nHitX4 >> _tstringtemp; |
83 |
_iDayFirst.push_back(_tstringtemp.Atoi()); |
_iDayFirst_nHitX4.push_back(_tstringtemp.Atoi()); |
84 |
|
|
85 |
_chi2CutTable >> _tstringtemp; |
_chi2CutTable_nHitX4 >> _tstringtemp; |
86 |
_iDayLast.push_back(_tstringtemp.Atoi()); |
_iDayLast_nHitX4.push_back(_tstringtemp.Atoi()); |
87 |
|
|
88 |
if (_nPar>=0 && _nPar<=5) { |
if (_nPar>=0 && _nPar<=5) { |
89 |
for (int iPar=0; iPar<_nPar; iPar++) { |
for (int iPar=0; iPar<_nPar; iPar++) { |
90 |
|
|
91 |
_chi2CutTable >> _tstringtemp; |
_chi2CutTable_nHitX4 >> _tstringtemp; |
92 |
_p[iPar].push_back(_tstringtemp.Atof()); |
_p_nHitX4[iPar].push_back(_tstringtemp.Atof()); |
93 |
|
|
94 |
} |
} |
95 |
} |
} |
96 |
|
|
97 |
} |
} |
98 |
_chi2CutTable.close(); |
_chi2CutTable_nHitX4.close(); |
99 |
|
|
100 |
|
|
101 |
} |
} |
102 |
|
|
118 |
|
|
119 |
virtual double _GetChi2(PamLevel2 *event); |
virtual double _GetChi2(PamLevel2 *event); |
120 |
|
|
121 |
const char* _calibFile; |
const char* _calibFile_nHitX3; |
122 |
int _nPar; |
const char* _calibFile_nHitX4; |
123 |
|
Int_t _nPar; |
124 |
|
|
125 |
TString _tstringtemp; |
TString _tstringtemp; |
126 |
|
|
127 |
|
std::vector<Int_t> _iDayFirst_nHitX3; |
128 |
|
std::vector<Int_t> _iDayFirst_nHitX4; |
129 |
std::vector<Int_t> _iDayFirst; |
std::vector<Int_t> _iDayFirst; |
130 |
|
|
131 |
|
std::vector<Int_t> _iDayLast_nHitX3; |
132 |
|
std::vector<Int_t> _iDayLast_nHitX4; |
133 |
std::vector<Int_t> _iDayLast; |
std::vector<Int_t> _iDayLast; |
134 |
|
|
135 |
|
std::vector<Double_t> _p_nHitX3[5]; |
136 |
|
std::vector<Double_t> _p_nHitX4[5]; |
137 |
std::vector<Double_t> _p[5]; |
std::vector<Double_t> _p[5]; |
138 |
|
|
139 |
ifstream _chi2CutTable; |
ifstream _chi2CutTable_nHitX3; |
140 |
|
ifstream _chi2CutTable_nHitX4; |
141 |
|
|
142 |
Double_t _pSel[5]; |
Double_t _pSel[5]; |
143 |
|
|