/[PAMELA software]/PamCut/TofCuts/TofDedxHCut/TofDedxHCut.cpp
ViewVC logotype

Contents of /PamCut/TofCuts/TofDedxHCut/TofDedxHCut.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Tue Jan 3 08:57:21 2012 UTC (12 years, 10 months ago) by pam-fi
Branch: MAIN
CVS Tags: V9, HEAD
Changes since 1.4: +11 -9 lines
Fix in Tof track handling.

1 /*
2 * TofDedxHCut.cpp
3 *
4 * Created on: 5 apr 2011
5 * Author: Nicola Mori
6 */
7
8 /*! @file TofDedxHCut.cpp The TofDedxHCut class implementation file. */
9
10 #include "TofDedxHCut.h"
11
12 const float TofDedxHCut::_S11_SA_params[] = { 1.5, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 };
13 const float TofDedxHCut::_S12_SA_params[] = { 1.5, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 };
14 const float TofDedxHCut::_S21_SA_params[] = { 1.6, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 };
15 const float TofDedxHCut::_S22_SA_params[] = { 1.6, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 };
16 const float TofDedxHCut::_S31_SA_params[] = { 1.6, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 };
17 const float TofDedxHCut::_S32_SA_params[] = { 1.6, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 };
18
19 const float TofDedxHCut::_S11_SA_params_strict[] = { 1.5, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
20 const float TofDedxHCut::_S12_SA_params_strict[] = { 1.5, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
21 const float TofDedxHCut::_S21_SA_params_strict[] = { 1.6, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
22 const float TofDedxHCut::_S22_SA_params_strict[] = { 1.6, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
23 const float TofDedxHCut::_S31_SA_params_strict[] = { 1.6, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
24 const float TofDedxHCut::_S32_SA_params_strict[] = { 1.6, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
25
26 TofDedxHCut::TofDedxHCut(const char *cutName, unsigned int layer, bool standAlone, bool strict) :
27 PamCut(cutName), _layer(layer), _standAlone(standAlone), _p(NULL) {
28
29 if (strict) {
30 switch (_layer) {
31 case S11:
32 _p = _S11_SA_params_strict;
33 break;
34 case S12:
35 _p = _S12_SA_params_strict;
36 break;
37 case S21:
38 _p = _S21_SA_params_strict;
39 break;
40 case S22:
41 _p = _S22_SA_params_strict;
42 break;
43 case S31:
44 _p = _S31_SA_params_strict;
45 break;
46 case S32:
47 _p = _S32_SA_params_strict;
48 break;
49 default:
50 _p = _S21_SA_params_strict;
51 }
52 }
53 else {
54 switch (_layer) {
55 case S11:
56 _p = _S11_SA_params;
57 break;
58 case S12:
59 _p = _S12_SA_params;
60 break;
61 case S21:
62 _p = _S21_SA_params;
63 break;
64 case S22:
65 _p = _S22_SA_params;
66 break;
67 case S31:
68 _p = _S31_SA_params;
69 break;
70 case S32:
71 _p = _S32_SA_params;
72 break;
73 default:
74 _p = _S21_SA_params;
75 }
76 }
77 }
78
79 int TofDedxHCut::Check(PamLevel2 *event) {
80
81 static int trkSeqNo;
82 static int idx;
83 if (_standAlone)
84 trkSeqNo = -1;
85 else
86 trkSeqNo = event->GetTrack(0)->GetTrkTrack()->GetSeqNo();
87
88 for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) {
89 if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkSeqNo)
90 idx = i;
91 }
92
93 float beta = event->GetToFLevel2()->GetToFTrkVar(idx)->beta[12];
94
95 static unsigned int auxLayer;
96 static float dEdx;
97 static unsigned int currLayer;
98 static unsigned int nLayers;
99
100 auxLayer = _layer;
101 dEdx = 0;
102 currLayer = 0;
103 nLayers = 0;
104 while (auxLayer > 0) {
105 if ((auxLayer & 0x1) == 1) {
106 dEdx += event->GetToFLevel2()->GetdEdx(idx, currLayer, 100);
107 nLayers++;
108 // Patch to exclude S115b
109 if (currLayer == 0) {
110 ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(idx);
111 bool has8 = false, has9 = false;
112 float dedx9 = 0.;
113 for (Int_t ib = 0; ib < tofTrk->npmtadc; ib++) {
114 if (tofTrk->pmtadc[ib] == 8) {
115 has8 = true;
116 }
117 if (tofTrk->pmtadc[ib] == 9) {
118 has9 = true;
119 dedx9 = tofTrk->dedx[ib];
120 }
121 }
122
123 if (has9) {
124 dEdx -= (dedx9 / ((int) has8 + 1));
125 dEdx *= 2.;
126 }
127 }
128 //End of patch
129 }
130 currLayer++;
131 auxLayer >>= 1;
132 }
133
134 dEdx /= nLayers;
135
136 if (dEdx < _p[0] / (_p[1] * beta + _p[2]) + _p[3] + _p[4] * beta)
137 return 0;
138
139 if (dEdx > _p[5] / (_p[6] * beta + _p[7]) + _p[8] + _p[9] * beta)
140 return 0;
141
142 return CUTOK;
143 }

  ViewVC Help
Powered by ViewVC 1.1.23