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

Annotation of /PamCut/TrkCuts/TrkChi2DeflTimeCut/TrkChi2DeflTimeCut.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Fri Sep 2 16:28:17 2011 UTC (13 years, 3 months ago) by pam-fi
Branch: MAIN
CVS Tags: V9
Changes since 1.5: +35 -1 lines
Calibration file for NX=3 added to constructor parameters.

1 pam-fi 1.1 /*
2     * TrkChi2DeflTimeCut.cpp
3     *
4     * Created on: 6-oct-2009
5     * Author: S. Ricciarini
6     */
7    
8     #include "TrkChi2DeflTimeCut.h"
9    
10 pam-fi 1.4 double TrkChi2DeflTimeCut::_GetChi2(PamLevel2 *event) {
11 pam-fi 1.2 return event->GetTrack(0)->GetTrkTrack()->chi2;
12     }
13    
14 pam-fi 1.1 int TrkChi2DeflTimeCut::Check(PamLevel2 *event) {
15    
16 pam-fi 1.2 double chi2 = _GetChi2(event);
17 pam-fi 1.1 if (chi2 < 0.)
18     return 0;
19 pam-fi 1.3 Double_t etaMod = fabs(event->GetTrack(0)->GetTrkTrack()->GetDeflection());
20 pam-fi 1.6 Int_t nHitX = event->GetTrack(0)->GetTrkTrack()->GetNX();
21    
22     // cout << " nHitX " << nHitX << endl;
23    
24     if (nHitX == 3) {
25     for (UInt_t i = 0; i < _iDayFirst_nHitX3.size(); i++) {
26     _iDayFirst.push_back(_iDayFirst_nHitX3[i]);
27     _iDayLast.push_back(_iDayLast_nHitX3[i]);
28     for (int iPar=0; iPar<_nPar; iPar++) {
29     _p[iPar].push_back(_p_nHitX3[iPar][i]);
30     }
31     }
32     }
33     else if (nHitX >= 4) {
34     for (UInt_t i = 0; i < _iDayFirst_nHitX4.size(); i++) {
35     _iDayFirst.push_back(_iDayFirst_nHitX4[i]);
36     _iDayLast.push_back(_iDayLast_nHitX4[i]);
37     for (int iPar=0; iPar<_nPar; iPar++) {
38     _p[iPar].push_back(_p_nHitX4[iPar][i]);
39     }
40     }
41     }
42     else {
43     return 0;
44     }
45 pam-fi 1.1
46     _time.Set(event->GetOrbitalInfo()->absTime, kFALSE, 0, kFALSE);
47     // TTimestamp::GetDate() returns date in format YYYYMMDD so to compare it
48 pam-fi 1.3 // with 6-digits dates (YYMMDD) we must subtract 20000000
49 pam-fi 1.1
50 pam-fi 1.3 Int_t iDaySel = (_time.GetDate(kFALSE) - 20000000); // note: GetDate returns an unsigned integer
51 pam-fi 1.6 // cout << "day " << iDaySel << endl;
52 pam-fi 1.4
53     bool found = false;
54     for (UInt_t i = 0; i < _iDayFirst.size(); i++) {
55     if (_iDayFirst[i] <= iDaySel && iDaySel <= _iDayLast[i]) {
56 pam-fi 1.5 for (int iPar=0; iPar<_nPar; iPar++) {
57     _pSel[iPar] = _p[iPar][i];
58     }
59    
60     // cout << "FOUND: day " << iDaySel << endl;
61     // cout << _iDayFirst[i] << " " << _iDayLast[i] << endl;
62     // cout << _pSel[0] << " " << _pSel[1] << " " << _pSel[2] << " " << _pSel[3] << endl;
63    
64 pam-fi 1.4 found = true;
65 pam-fi 1.1 break;
66     }
67 pam-fi 1.4 }
68    
69 pam-fi 1.6 if (!found) {
70     cout << "not found" << endl;
71     cout << endl;
72 pam-fi 1.3 return 0;
73 pam-fi 1.6 }
74    
75     // for (int iPar=0; iPar<_nPar; iPar++) {
76     // cout << " p" << iPar << ": " << _pSel[iPar] << endl;
77     // }
78     // cout << endl;
79 pam-fi 1.4
80 pam-fi 1.5 double chi2max;
81    
82     if (_nPar==4) {
83    
84     chi2max=_pSel[0] + _pSel[1] * pow(etaMod, _pSel[2]) * (1. + pow(_pSel[3] * etaMod, 2));
85    
86     // cout << "chi2max " << chi2max << endl;
87    
88     }
89     else if (_nPar==5) {
90     chi2max=_pSel[0] + _pSel[1] * pow(etaMod, _pSel[2]) * (1. + pow(_pSel[3] * etaMod, _pSel[4]));
91     }
92     else {
93     chi2max=-1;
94     }
95    
96     // cout << "chi2 " << chi2 << endl;
97    
98     if (chi2 > chi2max) {
99    
100     // cout << "KO" << endl;
101    
102 pam-fi 1.1 return 0;
103 pam-fi 1.5
104 pam-fi 1.1 }
105    
106 pam-fi 1.5 // cout << "OK" << endl;
107    
108 pam-fi 1.1 return CUTOK;
109    
110     }

  ViewVC Help
Powered by ViewVC 1.1.23