1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* TofDedxS1Cut.cpp |
3 |
|
|
* |
4 |
|
|
* Created on: 13-mar-2009 |
5 |
|
|
* Author: Sergio Ricciarini, Nicola Mori |
6 |
pam-fi |
1.2 |
* Reworked on: 21-jul-2011 |
7 |
|
|
* Author: Nicola Mori, Valeria Di Felice |
8 |
pam-fi |
1.1 |
*/ |
9 |
|
|
|
10 |
|
|
/*! @file TofDedxS1Cut.cpp The TofDedxS1Cut class implementation file */ |
11 |
|
|
|
12 |
|
|
#include "TofDedxS1Cut.h" |
13 |
|
|
|
14 |
|
|
int TofDedxS1Cut::Check(PamLevel2 *event) { |
15 |
|
|
|
16 |
pam-fi |
1.2 |
int trkSeqNo = 0; |
17 |
|
|
for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { |
18 |
|
|
if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo()) |
19 |
|
|
trkSeqNo = i; |
20 |
|
|
} |
21 |
|
|
|
22 |
|
|
float dEdx = 0; |
23 |
|
|
int nLayers = 0; |
24 |
|
|
float dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 0, 100); |
25 |
|
|
|
26 |
|
|
// Patch to exclude S115b |
27 |
|
|
ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo); |
28 |
|
|
bool has8 = false, has9 = false; |
29 |
|
|
float dedx9 = 0.; |
30 |
|
|
for (Int_t ib = 0; ib < tofTrk->npmtadc; ib++) { |
31 |
|
|
if (tofTrk->pmtadc[ib] == 8) { |
32 |
|
|
has8 = true; |
33 |
pam-fi |
1.1 |
} |
34 |
pam-fi |
1.2 |
if (tofTrk->pmtadc[ib] == 9) { |
35 |
|
|
has9 = true; |
36 |
|
|
dedx9 = tofTrk->dedx[ib]; |
37 |
|
|
} |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
if (has9){ |
41 |
|
|
dEdxLayer -= (dedx9 / ((int) has8 + 1)); |
42 |
|
|
dEdxLayer *= 2.; |
43 |
|
|
} |
44 |
|
|
//End of patch |
45 |
|
|
|
46 |
|
|
if (dEdxLayer > 0. && dEdxLayer < 4090) { |
47 |
|
|
dEdx += dEdxLayer; |
48 |
|
|
nLayers++; |
49 |
|
|
} |
50 |
|
|
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 1, 100); |
51 |
|
|
if (dEdxLayer > 0. && dEdxLayer < 4090) { |
52 |
|
|
dEdx += dEdxLayer; |
53 |
|
|
nLayers++; |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
if (nLayers > 0) { |
57 |
|
|
dEdx /= nLayers; |
58 |
|
|
|
59 |
|
|
float R = event->GetTrack(0)->GetTrkTrack()->GetRigidity(); |
60 |
pam-fi |
1.1 |
|
61 |
pam-fi |
1.2 |
if (dEdx >= (3.102 - 2.6 * TMath::Log(R)) * (R < 1.05) + 3. * (R >= 1.05)) |
62 |
|
|
return 0; |
63 |
|
|
|
64 |
|
|
return CUTOK; |
65 |
|
|
// if (dEdx < (3.102 - 2.6 * TMath::Log(R)) * (R < 1.05) + 3. * (R >= 1.05)) |
66 |
|
|
// return 0; |
67 |
|
|
// |
68 |
|
|
// return CUTOK; |
69 |
|
|
} |
70 |
|
|
else { |
71 |
|
|
return 0; |
72 |
pam-fi |
1.1 |
} |
73 |
|
|
|
74 |
|
|
} |