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 |
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 |
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 |
} |
75 |
currLayer++; |
76 |
auxLayer >>= 1; |
77 |
} |
78 |
|
79 |
dEdx /= nLayers; |
80 |
|
81 |
if (dEdx < _p[0]/ (_p[1] * beta + _p[2]) + _p[3] + _p[4] * beta) |
82 |
return 0; |
83 |
|
84 |
if (dEdx > _p[5] / (_p[6] * beta + _p[7]) + _p[8] + _p[9] * beta) |
85 |
return 0; |
86 |
|
87 |
return CUTOK; |
88 |
} |