1 |
pam-fi |
1.1.2.2 |
/* |
2 |
|
|
* TofDedxVsRigHistoAction.cpp |
3 |
|
|
* |
4 |
|
|
* Created on: 22-jul-2011 |
5 |
|
|
* Author: Nicola Mori |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
/*! @file TofDedxVsRigHistoAction.cpp The TofDedxVsRigHistoAction class implementation file. */ |
9 |
|
|
|
10 |
|
|
#include "TofDedxVsRigHistoAction.h" |
11 |
|
|
|
12 |
|
|
TofDedxVsRigHistoAction::TofDedxVsRigHistoAction(const char *actionName, unsigned int layers, TString outFileBase, |
13 |
|
|
TString mode, bool outRoot, bool outText, TString title) : |
14 |
|
|
Histo2DAction<Int_t>(actionName, title, outFileBase, mode, outRoot, outText), _layers(layers), _nLayers(0), _badEvents( |
15 |
|
|
0) { |
16 |
|
|
|
17 |
|
|
bool buildTitle = false; |
18 |
|
|
if (title == "") { |
19 |
|
|
buildTitle = true; |
20 |
|
|
title = "TOF dE/dx ("; |
21 |
|
|
} |
22 |
|
|
if ((_layers & S11) == S11) { |
23 |
|
|
if (buildTitle) |
24 |
|
|
title += "S11"; |
25 |
|
|
_nLayers++; |
26 |
|
|
} |
27 |
|
|
if ((_layers & S12) == S12) { |
28 |
|
|
if (buildTitle) { |
29 |
|
|
if (_nLayers > 0) |
30 |
|
|
title += ","; |
31 |
|
|
title += "S12"; |
32 |
|
|
} |
33 |
|
|
_nLayers++; |
34 |
|
|
} |
35 |
|
|
if ((_layers & S21) == S21) { |
36 |
|
|
if (buildTitle) { |
37 |
|
|
if (_nLayers > 0) |
38 |
|
|
title += ","; |
39 |
|
|
title += "S21"; |
40 |
|
|
} |
41 |
|
|
_nLayers++; |
42 |
|
|
} |
43 |
|
|
if ((_layers & S22) == S22) { |
44 |
|
|
if (buildTitle) { |
45 |
|
|
if (_nLayers > 0) |
46 |
|
|
title += ","; |
47 |
|
|
title += "S22"; |
48 |
|
|
} |
49 |
|
|
_nLayers++; |
50 |
|
|
} |
51 |
|
|
if ((_layers & S31) == S31) { |
52 |
|
|
if (buildTitle) { |
53 |
|
|
if (_nLayers > 0) |
54 |
|
|
title += ","; |
55 |
|
|
title += "S31"; |
56 |
|
|
} |
57 |
|
|
_nLayers++; |
58 |
|
|
} |
59 |
|
|
if ((_layers & S32) == S32) { |
60 |
|
|
if (buildTitle) { |
61 |
|
|
if (_nLayers > 0) |
62 |
|
|
title += ","; |
63 |
|
|
title += "S32"; |
64 |
|
|
} |
65 |
|
|
_nLayers++; |
66 |
|
|
} |
67 |
|
|
if (buildTitle) |
68 |
|
|
title += ") Vs Beta"; |
69 |
|
|
|
70 |
|
|
SetTitle(title); |
71 |
|
|
|
72 |
|
|
} |
73 |
|
|
|
74 |
|
|
void TofDedxVsRigHistoAction::OnGood(PamLevel2 *event) { |
75 |
|
|
|
76 |
|
|
static float dEdx; |
77 |
|
|
static float dEdxLayer; |
78 |
|
|
static unsigned int badLayers; |
79 |
|
|
|
80 |
pam-fi |
1.1.2.3 |
static int trkSeqNo; |
81 |
|
|
static int idx; |
82 |
|
|
trkSeqNo = event->GetTrack(0)->GetTrkTrack()->GetSeqNo(); |
83 |
pam-fi |
1.1.2.2 |
for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { |
84 |
pam-fi |
1.1.2.3 |
if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkSeqNo) |
85 |
|
|
idx = i; |
86 |
pam-fi |
1.1.2.2 |
} |
87 |
|
|
|
88 |
|
|
dEdx = 0.; |
89 |
|
|
badLayers = 0; |
90 |
|
|
if ((_layers & S11) == S11) { |
91 |
pam-fi |
1.1.2.3 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 0, 100); |
92 |
pam-fi |
1.1.2.2 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
93 |
|
|
dEdx += dEdxLayer; |
94 |
|
|
else |
95 |
|
|
badLayers++; |
96 |
|
|
} |
97 |
|
|
if ((_layers & S12) == S12) { |
98 |
pam-fi |
1.1.2.3 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 1, 100); |
99 |
pam-fi |
1.1.2.2 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
100 |
|
|
dEdx += dEdxLayer; |
101 |
|
|
else |
102 |
|
|
badLayers++; |
103 |
|
|
} |
104 |
|
|
if ((_layers & S21) == S21) { |
105 |
pam-fi |
1.1.2.3 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 2, 100); |
106 |
pam-fi |
1.1.2.2 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
107 |
|
|
dEdx += dEdxLayer; |
108 |
|
|
else |
109 |
|
|
badLayers++; |
110 |
|
|
} |
111 |
|
|
if ((_layers & S22) == S22) { |
112 |
pam-fi |
1.1.2.3 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 3, 100); |
113 |
pam-fi |
1.1.2.2 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
114 |
|
|
dEdx += dEdxLayer; |
115 |
|
|
else |
116 |
|
|
badLayers++; |
117 |
|
|
} |
118 |
|
|
if ((_layers & S31) == S31) { |
119 |
pam-fi |
1.1.2.3 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 4, 100); |
120 |
pam-fi |
1.1.2.2 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
121 |
|
|
dEdx += dEdxLayer; |
122 |
|
|
else |
123 |
|
|
badLayers++; |
124 |
|
|
} |
125 |
|
|
if ((_layers & S32) == S32) { |
126 |
pam-fi |
1.1.2.3 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 5, 100); |
127 |
pam-fi |
1.1.2.2 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
128 |
|
|
dEdx += dEdxLayer; |
129 |
|
|
else |
130 |
|
|
badLayers++; |
131 |
|
|
} |
132 |
|
|
if (badLayers == 0) { |
133 |
|
|
dEdx /= _nLayers; |
134 |
|
|
Fill(event->GetTrack(0)->GetTrkTrack()->GetRigidity(), dEdx); |
135 |
|
|
} |
136 |
|
|
else |
137 |
|
|
_badEvents++; |
138 |
|
|
} |
139 |
|
|
|