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