/[PAMELA software]/PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.h
ViewVC logotype

Contents of /PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Thu Nov 12 16:41:43 2009 UTC (15 years ago) by pam-fi
Branch: MAIN
Changes since 1.1: +3 -0 lines
File MIME type: text/plain
Support for chi2 retrieval via private function added (useful to derive children for chi2X and chi2Y).

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 /*! @brief The tracker chi2 vs deflection cut.
19 *
20 * Events whose track has been fitted with a chi2 greater than Chi2(eta) are discarded.
21 * Chi2(eta) is a function which gives the maximum value of chi2 associated to a certain
22 * deflection eta; in current implementation it is parameterized as:
23 *
24 * Chi2(eta) = p0 + p1 * eta^2 + p2 * eta ^4
25 *
26 * where p0, p1 and p2 are parameters. These are read from a file, and are supposed to be
27 * computed month by month.
28 *
29 */
30
31 class TrkChi2DeflTimeCut: public PamCut {
32
33 public:
34 /*! @brief Constructor.
35 *
36 * @param cutName The cut's name.
37 * @param calibFile Path for the calibration file. The format of the file's rows is:
38 * YYMM efficiency p0 p1 p2
39 */
40 TrkChi2DeflTimeCut(const char *cutName, const char *calibFile) :
41 PamCut(cutName), _calibFile(calibFile) {
42
43 _chi2CutTable.open(_calibFile);
44 while (! _chi2CutTable.eof()) {
45
46 _chi2CutTable >> _tstringtemp;
47 _iMonth.push_back(_tstringtemp.Atoi());
48
49 _chi2CutTable >> _tstringtemp;
50
51 _chi2CutTable >> _tstringtemp;
52 _p0.push_back(_tstringtemp.Atof());
53
54 _chi2CutTable >> _tstringtemp;
55 _p1.push_back(_tstringtemp.Atof());
56
57 _chi2CutTable >> _tstringtemp;
58 _p2.push_back(_tstringtemp.Atof());
59
60 }
61 _chi2CutTable.close();
62
63 #ifdef DEBUGPAMCUT
64
65 TString hId;
66 TString hTitle;
67
68 for (UInt_t j = 0; j < 2; j++) {
69 hId.Form("h_trk_chi2_vs_defl_%i_", j);
70 hId.Append(TString(cutName));
71 hTitle.Form("TRK chi2 vs defl (%i)", j);
72 h_trk_chi2_defl[j] = new TH2F(hId.Data(), hTitle.Data(), 50, 0, 2.5, 50, 0, 20);
73 }
74
75 #endif
76
77 }
78
79 /*! @brief Destructor. */
80 ~TrkChi2DeflTimeCut() {
81
82 #ifdef DEBUGPAMCUT
83
84 for (UInt_t j = 0; j < 2; j++) {
85 h_trk_chi2_defl[j]->Write();
86 }
87
88 #endif
89
90 }
91
92 /*! @brief The tracker chi2 vs deflection check.
93 *
94 *
95 * @param event The event to analyze.
96 * @return #CUTOK if chi2 < Chi2(eta).
97 * @return 0 if not
98 */
99 int Check(PamLevel2 *event);
100
101 private:
102
103 #ifdef DEBUGPAMCUT
104
105 TH2F* h_trk_chi2_defl[2];
106
107 #endif
108
109
110 virtual double _GetChi2(PamLevel2 *event);
111
112 const char* _calibFile;
113
114 TString _tstringtemp;
115
116 std::vector<Int_t> _iMonth;
117 std::vector<Double_t> _p0;
118 std::vector<Double_t> _p1;
119 std::vector<Double_t> _p2;
120
121 ifstream _chi2CutTable;
122
123 Double_t _p0sel, _p1sel, _p2sel;
124
125 TTimeStamp _time;
126
127 };
128 #endif /* TRKCHI2DEFLTIMECUT_H_ */

  ViewVC Help
Powered by ViewVC 1.1.23