/[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.7 - (hide annotations) (download)
Wed Mar 25 17:38:08 2015 UTC (9 years, 8 months ago) by pam-fi
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +6 -3 lines
Port to 10th reduction.

Some cuts have been modified to use the extended track objects introduced with 10th reduction software. Some others have still to be ported.
Git ref: 4bd0c70baf73c56bddc08dca365cbff243ad8bc8
(Nicola)

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

  ViewVC Help
Powered by ViewVC 1.1.23