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 |
if (title == "") { |
18 |
title = "TOF dE/dx ("; |
19 |
if ((_layers & S11) == S11) { |
20 |
title += "S11"; |
21 |
_nLayers++; |
22 |
} |
23 |
if ((_layers & S12) == S12) { |
24 |
if (_nLayers > 0) |
25 |
title += ","; |
26 |
title += "S12"; |
27 |
_nLayers++; |
28 |
} |
29 |
if ((_layers & S21) == S21) { |
30 |
if (_nLayers > 0) |
31 |
title += ","; |
32 |
title += "S21"; |
33 |
_nLayers++; |
34 |
} |
35 |
if ((_layers & S22) == S22) { |
36 |
if (_nLayers > 0) |
37 |
title += ","; |
38 |
title += "S22"; |
39 |
_nLayers++; |
40 |
} |
41 |
if ((_layers & S31) == S31) { |
42 |
if (_nLayers > 0) |
43 |
title += ","; |
44 |
title += "S31"; |
45 |
_nLayers++; |
46 |
} |
47 |
if ((_layers & S32) == S32) { |
48 |
if (_nLayers > 0) |
49 |
title += ","; |
50 |
title += "S32"; |
51 |
_nLayers++; |
52 |
} |
53 |
title += ") Vs Beta"; |
54 |
|
55 |
SetTitle(title); |
56 |
} |
57 |
|
58 |
} |
59 |
|
60 |
void TofDedxVsBetaHistoAction::OnGood(PamLevel2 *event) { |
61 |
|
62 |
static float dEdx; |
63 |
static float dEdxLayer; |
64 |
static unsigned int badLayers; |
65 |
|
66 |
static int trkSeqNo; |
67 |
if (_standAlone) |
68 |
trkSeqNo = 0; |
69 |
else |
70 |
for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { |
71 |
if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo()) |
72 |
trkSeqNo = i; |
73 |
} |
74 |
|
75 |
dEdx = 0.; |
76 |
badLayers = 0; |
77 |
if ((_layers & S11) == S11) { |
78 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 0, 100); |
79 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
80 |
dEdx += dEdxLayer; |
81 |
else |
82 |
badLayers++; |
83 |
} |
84 |
if ((_layers & S12) == S12) { |
85 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 1, 100); |
86 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
87 |
dEdx += dEdxLayer; |
88 |
else |
89 |
badLayers++; |
90 |
} |
91 |
if ((_layers & S21) == S21) { |
92 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 2, 100); |
93 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
94 |
dEdx += dEdxLayer; |
95 |
else |
96 |
badLayers++; |
97 |
} |
98 |
if ((_layers & S22) == S22) { |
99 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 3, 100); |
100 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
101 |
dEdx += dEdxLayer; |
102 |
else |
103 |
badLayers++; |
104 |
} |
105 |
if ((_layers & S31) == S31) { |
106 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 4, 100); |
107 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
108 |
dEdx += dEdxLayer; |
109 |
else |
110 |
badLayers++; |
111 |
} |
112 |
if ((_layers & S32) == S32) { |
113 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 5, 100); |
114 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
115 |
dEdx += dEdxLayer; |
116 |
else |
117 |
badLayers++; |
118 |
} |
119 |
if (badLayers == 0) { |
120 |
dEdx /= _nLayers - badLayers; |
121 |
Fill(event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12], dEdx); |
122 |
} |
123 |
else |
124 |
_badEvents++; |
125 |
} |
126 |
|