1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* TrkChi2DeflTimeCut.h |
3 |
|
|
* |
4 |
|
|
* Created on: 6-oct-2009 |
5 |
|
|
* Author: S. Ricciarini |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
/*! @file TrkChi2DeflTimeCut.h The TrkChi2DeflTimeCut class definition file */ |
9 |
|
|
|
10 |
|
|
#ifndef TRKCHI2DEFLTIMECUT_H_ |
11 |
|
|
#define TRKCHI2DEFLTIMECUT_H_ |
12 |
|
|
|
13 |
|
|
#include "../../PamCutBase/PamCutBase.h" |
14 |
|
|
|
15 |
|
|
#include <TH2F.h> |
16 |
|
|
#include <TTimeStamp.h> |
17 |
|
|
|
18 |
pam-fi |
1.3 |
/*! @brief The tracker chi2 vs |deflection| cut. |
19 |
pam-fi |
1.1 |
* |
20 |
pam-fi |
1.3 |
* Events whose track has been fitted with a chi2 greater than Chi2(|eta|) are discarded. |
21 |
pam-fi |
1.1 |
* Chi2(eta) is a function which gives the maximum value of chi2 associated to a certain |
22 |
pam-fi |
1.3 |
* |deflection| (|eta|); in current implementation it is parameterized as: |
23 |
pam-fi |
1.1 |
* |
24 |
pam-fi |
1.3 |
* Chi2(|eta|) = p0 + ( p1 * |eta|^p2 * (1 + (p3 * |eta|)^2) ) |
25 |
|
|
* with eta expressed in GV^-1 |
26 |
pam-fi |
1.1 |
* |
27 |
pam-fi |
1.3 |
* where p0, p1 and p2 are parameters. These are read from a calibration text file, whose format must be: |
28 |
|
|
* ... |
29 |
|
|
* first_day last_day p0 p1 p2 p3 |
30 |
|
|
* with first_day and last_day expressed in the format YYMMDD |
31 |
|
|
* ... |
32 |
|
|
* where each row corresponds to a given time interval (first_day,last_day) |
33 |
|
|
* |
34 |
|
|
* 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. |
35 |
|
|
* If the event day does not fall in any of the intervals of the calibration file, then the event is discarded. |
36 |
pam-fi |
1.1 |
* |
37 |
|
|
*/ |
38 |
|
|
|
39 |
|
|
class TrkChi2DeflTimeCut: public PamCut { |
40 |
|
|
|
41 |
|
|
public: |
42 |
|
|
/*! @brief Constructor. |
43 |
|
|
* |
44 |
|
|
* @param cutName The cut's name. |
45 |
pam-fi |
1.3 |
* @param calibFile Path for the calibration text file. |
46 |
pam-fi |
1.1 |
*/ |
47 |
|
|
TrkChi2DeflTimeCut(const char *cutName, const char *calibFile) : |
48 |
|
|
PamCut(cutName), _calibFile(calibFile) { |
49 |
|
|
|
50 |
|
|
_chi2CutTable.open(_calibFile); |
51 |
|
|
while (! _chi2CutTable.eof()) { |
52 |
|
|
|
53 |
|
|
_chi2CutTable >> _tstringtemp; |
54 |
pam-fi |
1.3 |
_iDayFirst.push_back(_tstringtemp.Atoi()); |
55 |
|
|
|
56 |
pam-fi |
1.1 |
_chi2CutTable >> _tstringtemp; |
57 |
pam-fi |
1.3 |
_iDayLast.push_back(_tstringtemp.Atoi()); |
58 |
pam-fi |
1.1 |
|
59 |
|
|
_chi2CutTable >> _tstringtemp; |
60 |
|
|
_p0.push_back(_tstringtemp.Atof()); |
61 |
|
|
|
62 |
|
|
_chi2CutTable >> _tstringtemp; |
63 |
|
|
_p1.push_back(_tstringtemp.Atof()); |
64 |
|
|
|
65 |
|
|
_chi2CutTable >> _tstringtemp; |
66 |
|
|
_p2.push_back(_tstringtemp.Atof()); |
67 |
pam-fi |
1.3 |
|
68 |
|
|
_chi2CutTable >> _tstringtemp; |
69 |
|
|
_p3.push_back(_tstringtemp.Atof()); |
70 |
pam-fi |
1.1 |
|
71 |
|
|
} |
72 |
|
|
_chi2CutTable.close(); |
73 |
|
|
|
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
/*! @brief Destructor. */ |
77 |
|
|
~TrkChi2DeflTimeCut() { |
78 |
|
|
|
79 |
|
|
} |
80 |
|
|
|
81 |
pam-fi |
1.3 |
/*! @brief The tracker chi2 vs |deflection| check. |
82 |
pam-fi |
1.1 |
* |
83 |
|
|
* |
84 |
|
|
* @param event The event to analyze. |
85 |
pam-fi |
1.3 |
* @return #CUTOK if chi2 < Chi2(|eta|). |
86 |
pam-fi |
1.1 |
* @return 0 if not |
87 |
|
|
*/ |
88 |
|
|
int Check(PamLevel2 *event); |
89 |
|
|
|
90 |
|
|
private: |
91 |
|
|
|
92 |
pam-fi |
1.2 |
virtual double _GetChi2(PamLevel2 *event); |
93 |
|
|
|
94 |
pam-fi |
1.1 |
const char* _calibFile; |
95 |
|
|
|
96 |
|
|
TString _tstringtemp; |
97 |
|
|
|
98 |
pam-fi |
1.3 |
std::vector<Int_t> _iDayFirst; |
99 |
|
|
std::vector<Int_t> _iDayLast; |
100 |
pam-fi |
1.1 |
std::vector<Double_t> _p0; |
101 |
|
|
std::vector<Double_t> _p1; |
102 |
|
|
std::vector<Double_t> _p2; |
103 |
pam-fi |
1.3 |
std::vector<Double_t> _p3; |
104 |
pam-fi |
1.1 |
|
105 |
|
|
ifstream _chi2CutTable; |
106 |
|
|
|
107 |
pam-fi |
1.3 |
Double_t _p0sel, _p1sel, _p2sel, _p3sel; |
108 |
pam-fi |
1.1 |
|
109 |
|
|
TTimeStamp _time; |
110 |
|
|
|
111 |
|
|
}; |
112 |
|
|
#endif /* TRKCHI2DEFLTIMECUT_H_ */ |