1 |
pam-fi |
1.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 |
|
|
TofDedxHCut::TofDedxHCut(const char *cutName, unsigned int layer, bool standAlone) : |
20 |
pam-fi |
1.3 |
PamCut(cutName), _layer(layer), _standAlone(standAlone), _p(NULL) { |
21 |
pam-fi |
1.1 |
|
22 |
|
|
switch (_layer) { |
23 |
|
|
case S11: |
24 |
|
|
_p = _S11_SA_params; |
25 |
|
|
break; |
26 |
|
|
case S12: |
27 |
|
|
_p = _S12_SA_params; |
28 |
|
|
break; |
29 |
|
|
case S21: |
30 |
|
|
_p = _S21_SA_params; |
31 |
|
|
break; |
32 |
|
|
case S22: |
33 |
|
|
_p = _S22_SA_params; |
34 |
|
|
break; |
35 |
|
|
case S31: |
36 |
|
|
_p = _S31_SA_params; |
37 |
|
|
break; |
38 |
|
|
case S32: |
39 |
|
|
_p = _S32_SA_params; |
40 |
|
|
break; |
41 |
|
|
default: |
42 |
|
|
_p = _S21_SA_params; |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
int TofDedxHCut::Check(PamLevel2 *event) { |
48 |
|
|
|
49 |
|
|
static int trkSeqNo; |
50 |
|
|
if (_standAlone) |
51 |
|
|
trkSeqNo = 0; |
52 |
|
|
else { |
53 |
|
|
for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { |
54 |
|
|
if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo()) |
55 |
|
|
trkSeqNo = i; |
56 |
|
|
} |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
float beta = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12]; |
60 |
|
|
|
61 |
|
|
static unsigned int auxLayer; |
62 |
|
|
static float dEdx; |
63 |
|
|
static unsigned int currLayer; |
64 |
|
|
static unsigned int nLayers; |
65 |
|
|
|
66 |
|
|
auxLayer = _layer; |
67 |
|
|
dEdx = 0; |
68 |
|
|
currLayer = 0; |
69 |
|
|
nLayers = 0; |
70 |
|
|
while (auxLayer > 0) { |
71 |
|
|
if ((auxLayer & 0x1) == 1) { |
72 |
|
|
dEdx += event->GetToFLevel2()->GetdEdx(trkSeqNo, currLayer, 100); |
73 |
|
|
nLayers++; |
74 |
pam-fi |
1.3 |
// Patch to exclude S115b |
75 |
|
|
if (currLayer == 0) { |
76 |
|
|
ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo); |
77 |
|
|
bool has8 = false, has9 = false; |
78 |
|
|
float dedx9 = 0.; |
79 |
|
|
for (Int_t ib = 0; ib < tofTrk->npmtadc; ib++) { |
80 |
|
|
if (tofTrk->pmtadc[ib] == 8) { |
81 |
|
|
has8 = true; |
82 |
|
|
} |
83 |
|
|
if (tofTrk->pmtadc[ib] == 9) { |
84 |
|
|
has9 = true; |
85 |
|
|
dedx9 = tofTrk->dedx[ib]; |
86 |
|
|
} |
87 |
|
|
} |
88 |
|
|
|
89 |
|
|
if (has9) { |
90 |
|
|
dEdx -= (dedx9 / ((int) has8 + 1)); |
91 |
|
|
dEdx *= 2.; |
92 |
|
|
} |
93 |
|
|
} |
94 |
|
|
//End of patch |
95 |
pam-fi |
1.1 |
} |
96 |
|
|
currLayer++; |
97 |
|
|
auxLayer >>= 1; |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
dEdx /= nLayers; |
101 |
|
|
|
102 |
pam-fi |
1.3 |
if (dEdx < _p[0] / (_p[1] * beta + _p[2]) + _p[3] + _p[4] * beta) |
103 |
pam-fi |
1.1 |
return 0; |
104 |
|
|
|
105 |
pam-fi |
1.2 |
if (dEdx > _p[5] / (_p[6] * beta + _p[7]) + _p[8] + _p[9] * beta) |
106 |
pam-fi |
1.1 |
return 0; |
107 |
|
|
|
108 |
|
|
return CUTOK; |
109 |
|
|
} |