78 |
static unsigned int badLayers; |
static unsigned int badLayers; |
79 |
|
|
80 |
static int trkSeqNo; |
static int trkSeqNo; |
81 |
|
static int idx; |
82 |
if (_standAlone) |
if (_standAlone) |
83 |
trkSeqNo = 0; |
trkSeqNo = -1; |
84 |
else |
else |
85 |
for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { |
trkSeqNo = event->GetTrack(0)->GetTrkTrack()->GetSeqNo(); |
86 |
if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo()) |
|
87 |
trkSeqNo = i; |
for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { |
88 |
} |
if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkSeqNo) |
89 |
|
idx = i; |
90 |
|
} |
91 |
|
|
92 |
dEdx = 0.; |
dEdx = 0.; |
93 |
badLayers = 0; |
badLayers = 0; |
94 |
if ((_layers & S11) == S11) { |
if ((_layers & S11) == S11) { |
95 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 0, 100); |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 0, 100); |
96 |
// Patch to exclude S115b |
// Patch to exclude S115b |
97 |
ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo); |
ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(idx); |
98 |
bool has8 = false, has9 = false; |
bool has8 = false, has9 = false; |
99 |
float dedx9 = 0.; |
float dedx9 = 0.; |
100 |
for (Int_t ib = 0; ib < tofTrk->npmtadc; ib++) { |
for (Int_t ib = 0; ib < tofTrk->npmtadc; ib++) { |
118 |
badLayers++; |
badLayers++; |
119 |
} |
} |
120 |
if ((_layers & S12) == S12) { |
if ((_layers & S12) == S12) { |
121 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 1, 100); |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 1, 100); |
122 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
123 |
dEdx += dEdxLayer; |
dEdx += dEdxLayer; |
124 |
else |
else |
125 |
badLayers++; |
badLayers++; |
126 |
} |
} |
127 |
if ((_layers & S21) == S21) { |
if ((_layers & S21) == S21) { |
128 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 2, 100); |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 2, 100); |
129 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
130 |
dEdx += dEdxLayer; |
dEdx += dEdxLayer; |
131 |
else |
else |
132 |
badLayers++; |
badLayers++; |
133 |
} |
} |
134 |
if ((_layers & S22) == S22) { |
if ((_layers & S22) == S22) { |
135 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 3, 100); |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 3, 100); |
136 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
137 |
dEdx += dEdxLayer; |
dEdx += dEdxLayer; |
138 |
else |
else |
139 |
badLayers++; |
badLayers++; |
140 |
} |
} |
141 |
if ((_layers & S31) == S31) { |
if ((_layers & S31) == S31) { |
142 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 4, 100); |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 4, 100); |
143 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
144 |
dEdx += dEdxLayer; |
dEdx += dEdxLayer; |
145 |
else |
else |
146 |
badLayers++; |
badLayers++; |
147 |
} |
} |
148 |
if ((_layers & S32) == S32) { |
if ((_layers & S32) == S32) { |
149 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 5, 100); |
dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 5, 100); |
150 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
151 |
dEdx += dEdxLayer; |
dEdx += dEdxLayer; |
152 |
else |
else |
154 |
} |
} |
155 |
if (badLayers == 0) { |
if (badLayers == 0) { |
156 |
dEdx /= _nLayers; |
dEdx /= _nLayers; |
157 |
Fill(event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12], dEdx); |
Fill(event->GetToFLevel2()->GetToFTrkVar(idx)->beta[12], dEdx); |
158 |
} |
} |
159 |
else |
else |
160 |
_badEvents++; |
_badEvents++; |