1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* TofDedxHeCut.cpp |
3 |
|
|
* |
4 |
|
|
* Created on: 03/ago/2009 |
5 |
|
|
* Author: Nicola Mori |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
/*! @file TofDedxHeCut.cpp The TofDedxHeCut class implementation file. */ |
9 |
|
|
|
10 |
|
|
#include "TofDedxHeCut.h" |
11 |
|
|
|
12 |
pam-fi |
1.3 |
const float TofDedxHeCut::_S11_SA_params[] = { 0.27, 0.045, -4.9, 4.7, 2.6, 0.38, 0.045, 1.7, 2., 2.5 }; |
13 |
|
|
const float TofDedxHeCut::_S12_SA_params[] = { 0.27, 0.043, -4.9, 4.7, 2.6, 0.38, 0.042, 1.7, 2., 2.5 }; |
14 |
|
|
const float TofDedxHeCut::_S21_SA_params[] = { 0.29, 0.037, -4.52, 4.4, 2.4, 0.28, 0.031, 1., 2.2, 2. }; |
15 |
|
|
const float TofDedxHeCut::_S22_SA_params[] = { 0.31, 0.033, -4.52, 4.4, 2.4, 0.29, 0.02, 1., 2.4, 1.9 }; |
16 |
|
|
const float TofDedxHeCut::_S31_SA_params[] = { 0.44, 0.029, -2.4, 3.2, 2.5, 0.56, 0.008, 3.2, 1.2, 2.3 }; |
17 |
|
|
const float TofDedxHeCut::_S32_SA_params[] = { 0.48, 0.024, -2.4, 3.4, 2.5, 0.64, -0.0071, 3.2, 1.3, 2.3 }; |
18 |
|
|
|
19 |
|
|
TofDedxHeCut::TofDedxHeCut(const char *cutName, unsigned int layer, bool standAlone) : |
20 |
pam-fi |
1.4 |
PamCut(cutName), _layer(layer), _standAlone(standAlone), _p(NULL) { |
21 |
pam-fi |
1.3 |
|
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 |
pam-fi |
1.1 |
int TofDedxHeCut::Check(PamLevel2 *event) { |
48 |
|
|
|
49 |
pam-fi |
1.3 |
static int trkSeqNo; |
50 |
pam-fi |
1.4 |
static int idx; |
51 |
pam-fi |
1.3 |
if (_standAlone) |
52 |
pam-fi |
1.4 |
trkSeqNo = -1; |
53 |
|
|
else |
54 |
|
|
trkSeqNo = event->GetTrack(0)->GetTrkTrack()->GetSeqNo(); |
55 |
|
|
|
56 |
|
|
for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { |
57 |
|
|
if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkSeqNo) |
58 |
|
|
idx = i; |
59 |
pam-fi |
1.3 |
} |
60 |
pam-fi |
1.2 |
|
61 |
pam-fi |
1.4 |
float beta = event->GetToFLevel2()->GetToFTrkVar(idx)->beta[12]; |
62 |
pam-fi |
1.2 |
|
63 |
pam-fi |
1.3 |
static unsigned int auxLayer; |
64 |
|
|
static float dEdx; |
65 |
|
|
static unsigned int currLayer; |
66 |
|
|
static unsigned int nLayers; |
67 |
|
|
|
68 |
|
|
auxLayer = _layer; |
69 |
|
|
dEdx = 0; |
70 |
|
|
currLayer = 0; |
71 |
|
|
nLayers = 0; |
72 |
|
|
while (auxLayer > 0) { |
73 |
|
|
if ((auxLayer & 0x1) == 1) { |
74 |
|
|
//cout << auxLayer << " " << currLayer << endl; |
75 |
pam-fi |
1.4 |
dEdx += event->GetToFLevel2()->GetdEdx(idx, currLayer, 100); |
76 |
pam-fi |
1.3 |
nLayers++; |
77 |
|
|
} |
78 |
|
|
currLayer++; |
79 |
|
|
auxLayer >>= 1; |
80 |
|
|
} |
81 |
pam-fi |
1.1 |
|
82 |
pam-fi |
1.3 |
dEdx /= nLayers; |
83 |
|
|
|
84 |
|
|
if (dEdx < 1. / (_p[0] * pow(beta, _p[4]) + _p[1]) + _p[2] + _p[3] * beta) |
85 |
pam-fi |
1.1 |
return 0; |
86 |
|
|
|
87 |
pam-fi |
1.3 |
if (dEdx > 1. / (_p[5] * pow(beta, _p[9]) + _p[6]) + _p[7] + _p[8] * beta) |
88 |
|
|
return 0; |
89 |
pam-fi |
1.1 |
|
90 |
|
|
return CUTOK; |
91 |
|
|
} |