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 |
|
|
PamCut(cutName), _layer(layer), _standAlone(standAlone), _p(NULL) { |
21 |
|
|
|
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 |
|
|
if (_standAlone) |
51 |
pam-fi |
1.2 |
trkSeqNo = 0; |
52 |
pam-fi |
1.3 |
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 |
pam-fi |
1.2 |
|
59 |
|
|
float beta = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12]; |
60 |
|
|
|
61 |
pam-fi |
1.3 |
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 |
|
|
//cout << auxLayer << " " << currLayer << endl; |
73 |
|
|
dEdx += event->GetToFLevel2()->GetdEdx(trkSeqNo, currLayer, 100); |
74 |
|
|
nLayers++; |
75 |
|
|
} |
76 |
|
|
currLayer++; |
77 |
|
|
auxLayer >>= 1; |
78 |
|
|
} |
79 |
pam-fi |
1.1 |
|
80 |
pam-fi |
1.3 |
dEdx /= nLayers; |
81 |
|
|
|
82 |
|
|
if (dEdx < 1. / (_p[0] * pow(beta, _p[4]) + _p[1]) + _p[2] + _p[3] * beta) |
83 |
pam-fi |
1.1 |
return 0; |
84 |
|
|
|
85 |
pam-fi |
1.3 |
if (dEdx > 1. / (_p[5] * pow(beta, _p[9]) + _p[6]) + _p[7] + _p[8] * beta) |
86 |
|
|
return 0; |
87 |
pam-fi |
1.1 |
|
88 |
|
|
return CUTOK; |
89 |
|
|
} |