/[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.5 - (hide annotations) (download)
Fri May 27 14:01:39 2011 UTC (13 years, 6 months ago) by pam-fi
Branch: MAIN
Changes since 1.4: +33 -8 lines
New function with 5 parameters added.

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.1
21     _time.Set(event->GetOrbitalInfo()->absTime, kFALSE, 0, kFALSE);
22     // TTimestamp::GetDate() returns date in format YYYYMMDD so to compare it
23 pam-fi 1.3 // with 6-digits dates (YYMMDD) we must subtract 20000000
24 pam-fi 1.1
25 pam-fi 1.3 Int_t iDaySel = (_time.GetDate(kFALSE) - 20000000); // note: GetDate returns an unsigned integer
26 pam-fi 1.4
27     bool found = false;
28     for (UInt_t i = 0; i < _iDayFirst.size(); i++) {
29     if (_iDayFirst[i] <= iDaySel && iDaySel <= _iDayLast[i]) {
30 pam-fi 1.5 for (int iPar=0; iPar<_nPar; iPar++) {
31     _pSel[iPar] = _p[iPar][i];
32     }
33    
34     // cout << "FOUND: day " << iDaySel << endl;
35     // cout << _iDayFirst[i] << " " << _iDayLast[i] << endl;
36     // cout << _pSel[0] << " " << _pSel[1] << " " << _pSel[2] << " " << _pSel[3] << endl;
37    
38 pam-fi 1.4 found = true;
39 pam-fi 1.1 break;
40     }
41 pam-fi 1.4 }
42    
43     if (!found)
44 pam-fi 1.3 return 0;
45 pam-fi 1.4
46 pam-fi 1.5 double chi2max;
47    
48     if (_nPar==4) {
49    
50     chi2max=_pSel[0] + _pSel[1] * pow(etaMod, _pSel[2]) * (1. + pow(_pSel[3] * etaMod, 2));
51    
52     // cout << "chi2max " << chi2max << endl;
53    
54     }
55     else if (_nPar==5) {
56     chi2max=_pSel[0] + _pSel[1] * pow(etaMod, _pSel[2]) * (1. + pow(_pSel[3] * etaMod, _pSel[4]));
57     }
58     else {
59     chi2max=-1;
60     }
61    
62     // cout << "chi2 " << chi2 << endl;
63    
64     if (chi2 > chi2max) {
65    
66     // cout << "KO" << endl;
67    
68 pam-fi 1.1 return 0;
69 pam-fi 1.5
70 pam-fi 1.1 }
71    
72 pam-fi 1.5 // cout << "OK" << endl;
73    
74 pam-fi 1.1 return CUTOK;
75    
76     }

  ViewVC Help
Powered by ViewVC 1.1.23