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