finds segments.
199 {
200 _all.removeAll();
201 _all.append(links);
202
205 for (int i=0; i<_all.length(); ++i) {
206 if (_all[i]->wire()->localLayerId() == 0) seeds1.append(_all[i]);
207 else if (_all[i]->wire()->localLayerId() == 1) seeds2.append(_all[i]);
208 else continue;
209 }
211 unsigned n = list.length();
214 for (
unsigned i = 0; i <
n; ++i) {
215 seedNeighbors.removeAll();
217
218
219 for (
int j=0; j<c->
links().length(); ++j){
220 if (c->
links()[j]->wire()->localLayerId() > 0)
continue;
221 unsigned seedId = c->
links()[j]->wire()->localId();
222 for (int k=0; k<seeds1.length(); ++k){
223 if (seeds1[k]->wire()->localIdForPlus()+1 == seedId
224 || seeds1[k]->wire()->localIdForMinus()-1 == seedId) seedNeighbors.append(seeds1[k]);
225 }
226 break;
227 }
228
230
231 splitted.append(c);
232 if (newClusters.length() == 0) continue;
233 list.append(newClusters);
234 }
235 list.remove(splitted);
236 HepAListDeleteAll(splitted);
237
238
242
243 for (
unsigned i = 0; i <
n; ++i) {
244 seedNeighbors.removeAll();
246
247
248 for (
int j=0; j<c->
links().length(); ++j){
249 if (c->
links()[j]->wire()->localLayerId() != 1)
continue;
250 unsigned seedId = c->
links()[j]->wire()->localId();
251 for (int k=0; k<seeds2.length(); ++k){
252 if (seeds2[k]->wire()->localIdForPlus()+1 == seedId
253 || seeds2[k]->wire()->localIdForMinus()-1 == seedId) seedNeighbors.append(seeds2[k]);
254 }
255 break;
256 }
257
259
260 splitted2.append(c);
261 if (newClusters2.length() == 0) continue;
262 list2.append(newClusters2);
263 }
264 list2.remove(splitted2);
265 HepAListDeleteAll(splitted2);
266
267
268 list.append(list2);
269
270
272 for(int i = 0; i < list.length(); ++i){
273 for(int j = i+1; j < list.length(); ++j){
276 for (int k = 0; k < links.length(); ++k){
278 if (list[i]->links().hasMember(l)) multiLinks.append(l);
279 }
280 if (multiLinks.length() < 2) continue;
281 unsigned minLength = links.length();
282 if (links.length() > list[i]->links().length()) minLength = list[i]->links().length();
283 if (minLength - multiLinks.length() > 1) continue;
284 int nHits[4]={0};
285 int multiLayers = 0;
286 for (int k = 0; k < multiLinks.length(); ++k)
287 ++nHits[multiLinks[k]->hit()->wire()->localLayerId()];
288 for (int k = 0; k < 4; ++k)
289 if (nHits[k] > 0) ++multiLayers;
290 if(multiLayers >= 2 && (links.length() > list[i]->links().length())) badList.append(list[i]);
291 else if (multiLayers >= 2) badList.append(list[j]);
292 else continue;
293 }
294 }
295 list.remove(badList);
296
297
298 for (int i = 0; i < badList.length(); ++i) {
300 for (int j = 0; j < bads.length(); ++j) {
301 unsigned n = bads[j]->tsfTag();
303 else {
306 }
307 }
308 }
309 HepAListDeleteAll(badList);
310
311 return list;
312}
AList< TSegment > createTsf(unsigned) const
AList< TSegment > splitTsf(AList< TMLink > &)
const AList< TMLink > & links(unsigned mask=0) const
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.