/[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.4 - (show annotations) (download)
Tue Nov 29 10:20:16 2011 UTC (13 years ago) by pam-fi
Branch: MAIN
Changes since 1.3: +55 -23 lines
Option for strict check added. Bug fixed in double inclusion protection.

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 if (_standAlone)
83 trkSeqNo = 0;
84 else {
85 for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) {
86 if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo())
87 trkSeqNo = i;
88 }
89 }
90
91 float beta = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12];
92
93 static unsigned int auxLayer;
94 static float dEdx;
95 static unsigned int currLayer;
96 static unsigned int nLayers;
97
98 auxLayer = _layer;
99 dEdx = 0;
100 currLayer = 0;
101 nLayers = 0;
102 while (auxLayer > 0) {
103 if ((auxLayer & 0x1) == 1) {
104 dEdx += event->GetToFLevel2()->GetdEdx(trkSeqNo, currLayer, 100);
105 nLayers++;
106 // Patch to exclude S115b
107 if (currLayer == 0) {
108 ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo);
109 bool has8 = false, has9 = false;
110 float dedx9 = 0.;
111 for (Int_t ib = 0; ib < tofTrk->npmtadc; ib++) {
112 if (tofTrk->pmtadc[ib] == 8) {
113 has8 = true;
114 }
115 if (tofTrk->pmtadc[ib] == 9) {
116 has9 = true;
117 dedx9 = tofTrk->dedx[ib];
118 }
119 }
120
121 if (has9) {
122 dEdx -= (dedx9 / ((int) has8 + 1));
123 dEdx *= 2.;
124 }
125 }
126 //End of patch
127 }
128 currLayer++;
129 auxLayer >>= 1;
130 }
131
132 dEdx /= nLayers;
133
134 if (dEdx < _p[0] / (_p[1] * beta + _p[2]) + _p[3] + _p[4] * beta)
135 return 0;
136
137 if (dEdx > _p[5] / (_p[6] * beta + _p[7]) + _p[8] + _p[9] * beta)
138 return 0;
139
140 return CUTOK;
141 }

  ViewVC Help
Powered by ViewVC 1.1.23