BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TSegment.cxx
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TSegment.cxx,v 1.16 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TSegment.cc
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : yoshihito.iwasaki@kek.jp
8//-----------------------------------------------------------------------------
9// Description : A class to manage a group of TMLink's.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#include "TrkReco/TSegment.h"
14#include "TrkReco/TMDC.h"
15#include "TrkReco/TMDCUtil.h"
16#include "TrkReco/TMDCWire.h"
17#include "TrkReco/TMDCWireHit.h"
18#include "TrkReco/TMLink.h"
19#include "TrkReco/TTrack.h"
20// #include "cdc/Range.h"
21#include "TrkReco/Range.h"
22
23#include "CLHEP/Matrix/Vector.h"
24#include "CLHEP/Vector/ThreeVector.h"
25#include <math.h>
26
27TMDC* TSegment::_cdc = 0;
28
30 : TTrackBase()
31 , _innerWidth( 0 )
32 , _outerWidth( 0 )
33 , _nLayer( 0 )
34 , _clusterType( 0 )
35 , _duality( 0. )
36 , _nDual( 0 )
37 , _angle( 0. )
38 , _state( 0 )
39 , _lineTsf( 0., 0., 0. ) {
40 // _times = 4.0;
41 // if (_links[0]->wire()->stereo()) _times = 7.0;
42 _times[0] = 7;
43 _times[1] = 7;
44 _times[2] = 4;
45 _times[3] = 4;
46 _times[4] = 4;
47 _times[5] = 5;
48 _times[6] = 5;
49 _times[7] = 5;
50 _times[8] = 5;
51 _times[9] = 4;
52 _times[10] = 4;
53 _fitted = false;
54}
55
57 : TTrackBase( a )
58 , _innerWidth( 0 )
59 , _outerWidth( 0 )
60 , _nLayer( 0 )
61 , _clusterType( 0 )
62 , _duality( 0. )
63 , _nDual( 0 )
64 , _angle( 0. )
65 , _state( 0 )
66 , _lineTsf( 0., 0., 0. ) {
67 _links.sort( SortByWireId );
68 // _times = 4.0;
69 // if (_links[0]->wire()->stereo()) _times = 7.0;
70 _times[0] = 7;
71 _times[1] = 7;
72 _times[2] = 4;
73 _times[3] = 4;
74 _times[4] = 4;
75 _times[5] = 5;
76 _times[6] = 5;
77 _times[7] = 5;
78 _times[8] = 5;
79 _times[9] = 4;
80 _times[10] = 4;
81 _fitted = false;
82} // the above two innitial function are temporary for tsf!!!
83
84/*TSegment::TSegment()
85: TTrackBase(),
86 _innerWidth(0),
87 _outerWidth(0),
88 _nLayer(0),
89 _clusterType(0),
90 _duality(0.),
91 _nDual(0),
92 _angle(0.),
93 _state(0) {
94 _fitted = false;
95}
96
97TSegment::TSegment(const AList<TMLink> & a)
98: TTrackBase(a),
99 _innerWidth(0),
100 _outerWidth(0),
101 _nLayer(0),
102 _clusterType(0),
103 _duality(0.),
104 _nDual(0),
105 _angle(0.),
106 _state(0) {
107 _links.sort(SortByWireId);
108 _fitted = false;
109}
110*/
112
113void TSegment::dump( const std::string& msg, const std::string& pre ) const {
114 if ( !_fitted ) update();
115 bool def = false;
116 if ( msg == "" ) def = true;
117
118 if ( def || msg.find( "cluster" ) != std::string::npos ||
119 msg.find( "detail" ) != std::string::npos )
120 {
121 std::cout << pre;
122 std::cout << "#links=" << _links.length();
123 std::cout << "(" << _innerWidth << "," << _outerWidth << ":";
124 std::cout << clusterType() << ")," << _nDual << "," << _duality << ",";
125 std::cout << _angle << std::endl;
126 }
127 if ( def || msg.find( "vector" ) != std::string::npos ||
128 msg.find( "detail" ) != std::string::npos )
129 {
130 std::cout << pre;
131 std::cout << "pos" << _position << ","
132 << "dir" << _direction;
133 std::cout << std::endl;
134 }
135 if ( def || msg.find( "state" ) != std::string::npos ||
136 msg.find( "detail" ) != std::string::npos )
137 {
138 std::cout << pre;
139 std::cout << "state=" << _state << std::endl;
140 }
141 if ( def || msg.find( "link" ) != std::string::npos ||
142 msg.find( "detail" ) != std::string::npos )
143 {
144 std::cout << pre;
145 std::cout << "unique links=" << NUniqueLinks( *this );
146 std::cout << ",major links=" << NMajorLinks( *this );
147 std::cout << ",branches=" << NLinkBranches( *this );
148 std::cout << std::endl;
149 }
150 if ( !def ) TTrackBase::dump( msg, pre );
151}
152
153void TSegment::update( void ) const {
154 _clusterType = 0;
155 _position = ORIGIN;
156 _direction = ORIGIN;
157 _outerPosition = ORIGIN;
158 _inners.removeAll();
159 _outers.removeAll();
160
161 if ( _links.length() == 0 ) return; // tmp for tsf
162 // if (_links.length() < 3) return;
163
164 _innerMostLayer = _links[0]->wire()->layerId();
165 _outerMostLayer = _innerMostLayer;
166 for ( unsigned i = 1; i < _links.length(); i++ )
167 {
168 unsigned id = _links[i]->wire()->layerId();
169 if ( id < _innerMostLayer ) _innerMostLayer = id;
170 else if ( id > _outerMostLayer ) _outerMostLayer = id;
171 }
172 _nLayer = _outerMostLayer - _innerMostLayer + 1;
173
174 double centerX = _links[0]->position().x();
175 HepPoint3D inner = ORIGIN;
176 unsigned nInner = 0;
177 unsigned nOuter = 0;
178 unsigned n = _links.length();
179 for ( unsigned i = 0; i < n; i++ )
180 {
181 const HepPoint3D& tmp = _links[i]->position();
182 /*//--------------------------------tsf---------------------------------//
183 const HepPoint3D & p = _links[i]->positionD();
184 double d = _links[i]->cDrift();
185 HepPoint3D posOnLine = closestPoint(p, _lineTsf);
186 HepPoint3D v = (posOnLine - p).unit();
187 const HepPoint3D tmp = p + d*v;
188 *///--------------------------------tsf---------------------------------//
189 _position += tmp;
190 unsigned id = _links[i]->wire()->layerId();
191 if ( id == _innerMostLayer )
192 {
193 inner += tmp;
194 ++nInner;
195 _inners.append( _links[i] );
196 }
197 if ( id == _outerMostLayer )
198 {
199 _outerPosition += tmp;
200 ++nOuter;
201 _outers.append( _links[i] );
202 }
203 }
204 // TTrackBase::dump("hits");
205 // std::cout << "0:nin,nout=" << nInner << "," << nOuter << std::endl;
206 // std::cout << "0:in,out=" << inner << ", " << _outerPosition << std::endl;
207 // std::cout << "0:npos=" << n << std::endl;
208 // std::cout << "0:pos=" << _position << std::endl;
209
210 _innerWidth = Width( _inners );
211 _outerWidth = Width( _outers );
212 _position *= ( 1. / float( n ) ); // tmp for tsf
213
214 inner *= ( 1. / (float)nInner );
215 _outerPosition *= ( 1. / (float)nOuter );
216 _direction = ( inner - _outerPosition ).unit(); // tmp for tsf
217
218 /*//----------------------liuqg add for tsf-----------------------//
219 if (_links.length() > 3) {
220 _position = ORIGIN;
221 _direction = ORIGIN;
222 HepPoint3D nearLine;
223 nearLine = _lineTsf;
224 // nearLine = leastSquaresFitting1(_links, _lineTsf);
225 // _lineTsf = nearLine;
226 if (nearLine.z() != 0) {
227 HepPoint3D lineVector; //exchange line to vector.
228 lineVector.set(-nearLine.y()/nearLine.z(), nearLine.x()/nearLine.z(), 0.);
229 _direction = (lineVector).unit();
230 }
231 else cout<<"nearLine.z == 0"<<endl;
232 _position = positionTsf(_links, nearLine);
233 //cout<<"pos of seg .. = "<<_position<<endl;
234 //cout<<"dir of seg .. = "<<_direction<<endl;
235 }
236 *///----------------------liuqg add for tsf-----------------------//
237
238 // std::cout << "1:in,out=" << inner << ", " << _outerPosition << std::endl;
239 // std::cout << "1:dir=" << _direction << std::endl;
240 // std::cout << "1:pos=" << _position << std::endl;
241
242 _fitted = true;
243}
244
245double TSegment::distance( const TSegment& c ) const {
246 HepVector3D dir = c.position() - _position;
247 if ( dir.x() > M_PI ) dir.setX( dir.x() - 2. * M_PI );
248 else if ( dir.x() < -M_PI ) dir.setX( 2. * M_PI + dir.x() );
249
250 float radial = fabs( _direction.dot( dir ) );
251 float radial2 = radial * radial;
252
253 return ( dir.mag2() - radial2 ) > 0.0 ? sqrt( dir.mag2() - radial2 ) : 0.;
254}
255
256double TSegment::distance( const HepPoint3D& p, const HepVector3D& v ) const {
257 HepVector3D dir = _position - p;
258 if ( dir.x() > M_PI ) dir.setX( dir.x() - 2. * M_PI );
259 else if ( dir.x() < -M_PI ) dir.setX( 2. * M_PI + dir.x() );
260
261 float radial = fabs( v.unit().dot( dir ) );
262 float radial2 = radial * radial;
263
264 return ( dir.mag2() - radial2 ) > 0.0 ? sqrt( dir.mag2() - radial2 ) : 0.;
265}
266
267Range TSegment::rangeX( double min, double max ) const {
268#ifdef TRKRECO_DEBUG_DETAIL
269 if ( min > max )
270 {
271 std::cout << "TSegment::range !!! bad arguments:min,max=";
272 std::cout << min << "," << max << std::endl;
273 }
274#endif
275
276 unsigned n = _links.length();
277 if ( n == 0 ) return Range( 0., 0. );
278
279 //...Search for a center...
280 bool found = false;
281 double center;
282 for ( unsigned i = 0; i < n; i++ )
283 {
284 double x = _links[i]->position().x();
285 if ( x < min || x > max ) continue;
286 center = x;
287 found = true;
288 break;
289 }
290 if ( !found ) return Range( 0., 0. );
291
292#ifdef TRKRECO_DEBUG_DETAIL
293// std::cout << " center=" << center << std::endl;
294#endif
295
296 double distanceR = 0.;
297 double distanceL = 0.;
298 double distanceMax = max - min;
299 for ( unsigned i = 0; i < n; i++ )
300 {
301 double x = _links[i]->position().x();
302 if ( x < min || x > max ) continue;
303
304 double distance0, distance1;
305 if ( x > center )
306 {
307 distance0 = x - center;
308 distance1 = distanceMax - distance0;
309 }
310 else
311 {
312 distance1 = center - x;
313 distance0 = distanceMax - distance1;
314 }
315
316 if ( distance0 < distance1 )
317 {
318 if ( distance0 > distanceR ) distanceR = distance0;
319 }
320 else
321 {
322 if ( distance1 > distanceL ) distanceL = distance1;
323 }
324
325#ifdef TRKRECO_DEBUG_DETAIL
326// std::cout << " ";
327// std::cout << _links[i]->wire()->layerId() << "-";
328// std::cout << _links[i]->wire()->localId() << ",";
329// std::cout << _links[i]->position().x();
330// std::cout << ",0,1=" << distance0 << "," << distance1;
331// std::cout << ",l,r=" << distanceL << "," << distanceR;
332// std::cout << std::endl;
333#endif
334 }
335
336 double right = center + distanceR;
337 double left = center - distanceL;
338
339 return Range( left, right );
340}
341
342void TSegment::updateType( void ) const {
343 if ( !nLinks() ) return;
344 if ( !_fitted ) update();
345
346 //...Parameter...
347 unsigned fat = 3;
348 unsigned tall = 3;
349 // unsigned tall = 2;
350
351 //...Calculate
352 updateDuality();
353
354 //...Long or short...
355 if ( ( _innerWidth < fat ) && ( _outerWidth < fat ) )
356 {
357 _clusterType = 1;
358
359 //...Check length across a super layer...
360 if ( _nLayer > tall ) _clusterType = 2;
361 return;
362 }
363
364 //...A...
365 else if ( _outerWidth < fat )
366 {
367 _clusterType = 3;
368 return;
369 }
370
371 //...V...
372 else if ( _innerWidth < fat )
373 {
374 _clusterType = 4;
375 return;
376 }
377
378 //...X or parallel...
379 else
380 {
381 bool space = true;
382 for ( unsigned i = _innerMostLayer; i <= _outerMostLayer; i++ )
383 {
384 unsigned n = 0;
385 AList<TMLink> tmp;
386 for ( unsigned j = 0; j < _links.length(); j++ )
387 if ( _links[j]->wire()->layerId() == i )
388 {
389 ++n;
390 tmp.append( _links[j] );
391 }
392
393 if ( n == Width( tmp ) )
394 {
395 space = false;
396 break;
397 }
398 }
399
400 _clusterType = 5;
401 if ( space ) _clusterType = 6;
402 return;
403 }
404}
405
407 AList<TSegment> list;
408
409 //...Do not split if cluster type is 1, 2, or 7...
410 unsigned t = clusterType();
411#ifdef TRKRECO_DEBUG_DETAIL
412 std::cout << " ... splitting : type=" << t << std::endl;
413#endif
414 if ( t == 0 ) return list;
415 else if ( t == 2 )
416 {
417 // beta 5
418 // if (_nDual > 2 && _duality > 0.7 && _angle > 0.7) return splitDual();
419
420 // 1.67g
421 // if (_nDual > 2 && _duality > 0.7) return splitDual();
422
423 if ( _nDual > 2 && _duality > 0.7 && _angle > 0.7 ) return splitDual();
424 return list;
425 }
426 else if ( t == 1 ) return list;
427 else if ( t == 7 ) return list;
428
429 //...Parallel...
430 else if ( t == 6 ) return splitParallel();
431 // else if (t == 6) return list;
432
433 //...Avoid splitting of X or parallel...(future implementation)...
434 else if ( t > 4 ) return splitComplicated();
435
436 //...A or V...
437 return splitAV();
438}
439
440AList<TSegment> TSegment::splitAV( void ) const {
441 unsigned t = clusterType();
442 AList<TMLink> seeds[2];
443
444 //...Calculate corner of V or A...
445 const AList<TMLink>* corners;
446 if ( t == 3 ) corners = &_outers;
447 else corners = &_inners;
448 HepPoint3D corner;
449 for ( unsigned i = 0; i < corners->length(); i++ )
450 corner += ( *corners )[i]->wire()->xyPosition();
451 corner *= 1. / (float)corners->length();
452 seeds[0].append( *corners );
453 seeds[1].append( *corners );
454
455 //...Calculdate edges...
456 const AList<TMLink>* links;
457 if ( t == 3 ) links = &_inners;
458 else links = &_outers;
459 AList<TMLink> edge = Edges( *links );
460 HepPoint3D edgePos[2];
461 HepVector3D v[2];
462 for ( unsigned i = 0; i < 2; i++ )
463 {
464 edgePos[i] = edge[i]->wire()->xyPosition();
465 v[i] = ( edgePos[i] - corner ).unit();
466 }
467 seeds[0].append( edge[0] );
468 seeds[1].append( edge[1] );
469
470#ifdef TRKRECO_DEBUG_DETAIL
471 std::cout << " corner:" << corner << std::endl;
472 std::cout << " edge:" << edgePos[0] << "(";
473 std::cout << edge[0]->wire()->layerId() << "-";
474 std::cout << edge[0]->wire()->localId() << ")";
475 std::cout << v[0] << std::endl;
476 std::cout << " ";
477 std::cout << edgePos[1] << "(";
478 std::cout << edge[1]->wire()->layerId() << "-";
479 std::cout << edge[1]->wire()->localId() << ")";
480 std::cout << v[1] << std::endl;
481#endif
482
483 //...Examine each hits...
484 unsigned n = _links.length();
485 for ( unsigned i = 0; i < n; i++ )
486 {
487 TMLink* l = _links[i];
488 if ( edge.member( l ) ) continue;
489 if ( corners->member( l ) ) continue;
490
491 HepVector3D p = l->wire()->xyPosition() - corner;
492 double p2 = p.mag2();
493
494 double dist[2];
495 for ( unsigned j = 0; j < 2; j++ )
496 {
497 dist[j] = v[j].dot( p );
498 double d2 = dist[j] * dist[j];
499 dist[j] = ( p2 - d2 ) > 0. ? sqrt( p2 - d2 ) : 0.;
500 }
501 if ( dist[0] < dist[1] ) seeds[0].append( l );
502 else seeds[1].append( l );
503
504#ifdef TRKRECO_DEBUG_DETAIL
505 std::cout << " p:" << p << std::endl;
506 std::cout << " " << l->wire()->layerId() << "-";
507 std::cout << l->wire()->localId() << ":" << dist[0];
508 std::cout << "," << dist[1] << std::endl;
509#endif
510 }
511
512 AList<TSegment> list;
513 for ( unsigned i = 0; i < 2; i++ )
514 {
515 if ( seeds[i].length() )
516 {
517 TSegment* nc = new TSegment( seeds[i] );
518 AList<TSegment> ncx = nc->split();
519 if ( ncx.length() == 0 )
520 {
521 nc->solveDualHits();
522 list.append( nc );
523 }
524 else
525 {
526 list.append( ncx );
527 delete nc;
528 }
529 }
530 }
531 return list;
532}
533
534AList<TSegment> TSegment::splitComplicated( void ) const {
535
536 //...Select best hits...
537 AList<TSegment> newClusters;
538 AList<TMLink> goodHits;
539 unsigned n = _links.length();
540 for ( unsigned i = 0; i < n; i++ )
541 {
542 const TMDCWireHit* h = _links[i]->hit();
543 unsigned state = h->state();
544 if ( !( state & WireHitContinuous ) ) continue;
545 if ( !( state & WireHitIsolated ) ) continue;
546 if ( ( !( state & WireHitPatternLeft ) ) && ( !( state & WireHitPatternRight ) ) )
547 continue;
548 goodHits.append( _links[i] );
549 }
550 if ( goodHits.length() == 0 ) return newClusters;
551
552 //...Main loop...
553 goodHits.sort( SortByWireId );
554 AList<TMLink> original( _links );
555 while ( goodHits.length() )
556 {
557
558 //...Select an edge hit...
559 TMLink* seed = goodHits.last();
560 const TMDCWire* wire = seed->wire();
561 unsigned localId = wire->localId();
562 AList<TMLink> used;
563 unsigned nn = _links.length();
564 for ( unsigned i = 0; i < nn; i++ )
565 {
566 TMLink* t = _links[i];
567 const TMDCWire* w = t->wire();
568
569 //...Straight?...
570 if ( abs( (int)w->localId() - (int)localId ) < 2 ) used.append( t );
571 }
572
573#ifdef TRKRECO_DEBUG_DETAIL
574 std::cout << " seed is " << seed->wire()->name() << std::endl;
575 std::cout << " ";
576 for ( unsigned i = 0; i < used.length(); i++ )
577 { std::cout << used[i]->wire()->name() << ","; }
578 std::cout << std::endl;
579#endif
580
581 //...Create new cluster...
582 if ( used.length() == 0 ) continue;
583 if ( used.length() == nLinks() ) return newClusters;
584 TSegment* c = new TSegment( used );
585 AList<TSegment> cx = c->split();
586 if ( cx.length() == 0 )
587 {
588 c->solveDualHits();
589 newClusters.append( c );
590 }
591 else
592 {
593 newClusters.append( cx );
594 delete c;
595 }
596 goodHits.remove( used );
597 original.remove( used );
598 }
599
600 //...Remainings...
601 if ( ( original.length() ) && ( original.length() < nLinks() ) )
602 {
603 TSegment* c = new TSegment( original );
604 AList<TSegment> cx = c->split();
605 if ( cx.length() == 0 )
606 {
607 c->solveDualHits();
608 newClusters.append( c );
609 }
610 else
611 {
612 newClusters.append( cx );
613 delete c;
614 }
615 }
616
617 return newClusters;
618}
619
620AList<TSegment> TSegment::splitParallel( void ) const {
621 AList<TMLink> seeds[2];
622 AList<TSegment> newClusters;
623 for ( unsigned i = _innerMostLayer; i <= _outerMostLayer; i++ )
624 {
625 AList<TMLink> list = SameLayer( _links, i );
626 AList<TMLink> outerList = Edges( list );
627
628#ifdef TRKRECO_DEBUG_DETAIL
629 if ( outerList.length() != 2 )
630 {
631 std::cout << "TSegment::splitParallel !!! ";
632 std::cout << "This is not a parallel cluster" << std::endl;
633 }
634#endif
635
636 seeds[0].append( outerList[0] );
637 seeds[1].append( outerList[1] );
638 if ( list.length() == 2 ) continue;
639
640 const TMDCWire& wire0 = *outerList[0]->wire();
641 const TMDCWire& wire1 = *outerList[1]->wire();
642 for ( unsigned k = 0; k < list.length(); k++ )
643 {
644 TMLink* t = list[k];
645 if ( t == outerList[0] ) continue;
646 if ( t == outerList[1] ) continue;
647
648 if ( abs( wire0.localIdDifference( *t->wire() ) ) <
649 abs( wire1.localIdDifference( *t->wire() ) ) )
650 seeds[0].append( t );
651 else seeds[1].append( t );
652 }
653 }
654
655 if ( ( seeds[0].length() ) && ( seeds[0].length() < nLinks() ) )
656 {
657 TSegment* c0 = new TSegment( seeds[0] );
658 AList<TSegment> c0x = c0->split();
659 if ( c0x.length() )
660 {
661 newClusters.append( c0x );
662 delete c0;
663 }
664 else
665 {
666 c0->solveDualHits();
667 newClusters.append( c0 );
668 }
669 }
670
671 if ( ( seeds[1].length() ) && ( seeds[1].length() < nLinks() ) )
672 {
673 TSegment* c1 = new TSegment( seeds[1] );
674 AList<TSegment> c1x = c1->split();
675 if ( c1x.length() )
676 {
677 newClusters.append( c1x );
678 delete c1;
679 }
680 else
681 {
682 c1->solveDualHits();
683 newClusters.append( c1 );
684 }
685 }
686
687 return newClusters;
688}
689
690void TSegment::updateDuality( void ) const {
691 _duality = 0.;
692 _nDual = 0;
693 HepPoint3D x[2];
694 for ( unsigned i = _innerMostLayer; i <= _outerMostLayer; i++ )
695 {
696 AList<TMLink> list = SameLayer( _links, i );
697 if ( i == _innerMostLayer )
698 {
699 for ( unsigned j = 0; j < list.length(); j++ ) x[0] += list[j]->hit()->xyPosition();
700 x[0] *= 1. / float( list.length() );
701 }
702 else if ( i == _outerMostLayer )
703 {
704 for ( unsigned j = 0; j < list.length(); j++ ) x[1] += list[j]->hit()->xyPosition();
705 x[1] *= 1. / float( list.length() );
706 }
707
708 if ( list.length() == 2 )
709 {
710 if ( Width( list ) != 2 ) continue;
711 const TMDCWireHit* h0 = list[0]->hit();
712 const TMDCWireHit* h1 = list[1]->hit();
713
714 double distance = ( h0->xyPosition() - h1->xyPosition() ).mag();
715 distance = fabs( distance - list[0]->drift() - list[1]->drift() );
716 _duality += distance;
717 ++_nDual;
718 }
719 }
720 if ( _nDual > 0 ) _duality /= float( _nDual );
721 _angle = ( x[1] - x[0] ).unit().dot( x[0].unit() );
722}
723
724AList<TSegment> TSegment::splitDual( void ) const {
725#ifdef TRKRECO_DEBUG_DETAIL
726 std::cout << " TSegment::splitDual called" << std::endl;
727#endif
728 AList<TMLink> seeds[2];
729 AList<TMLink> unknown;
730 for ( unsigned i = _innerMostLayer; i <= _outerMostLayer; i++ )
731 {
732 AList<TMLink> list = SameLayer( _links, i );
733
734 if ( list.length() == 2 )
735 {
736 if ( Width( list ) == 2 )
737 {
738 seeds[0].append( list[0] );
739 seeds[1].append( list[1] );
740 continue;
741 }
742 }
743 unknown.append( list );
744 }
745
746 if ( unknown.length() > 0 )
747 {
748#ifdef TRKRECO_DEBUG_DETAIL
749 if ( seeds[0].length() == 0 )
750 std::cout << "TSegment::splitDual !!! no TMLink for seed 0" << std::endl;
751 if ( seeds[1].length() == 0 )
752 std::cout << "TSegment::splitDual !!! no TMLink for seed 1" << std::endl;
753#endif
754 const HepPoint3D& p0 = seeds[0][0]->xyPosition();
755 const HepPoint3D& p1 = seeds[1][0]->xyPosition();
756 HepVector3D v0 = ( seeds[0].last()->xyPosition() - p0 ).unit();
757 HepVector3D v1 = ( seeds[1].last()->xyPosition() - p1 ).unit();
758
759 for ( unsigned i = 0; i < unknown.length(); i++ )
760 {
761 TMLink* t = unknown[i];
762 HepVector3D x0 = t->xyPosition() - p0;
763 double d0 = ( x0 - ( x0.dot( v0 ) * v0 ) ).mag();
764 HepVector3D x1 = t->xyPosition() - p1;
765 double d1 = ( x1 - ( x1.dot( v0 ) * v0 ) ).mag();
766
767 if ( d0 < d1 ) seeds[0].append( t );
768 else seeds[1].append( t );
769 }
770 }
771
772 AList<TSegment> newClusters;
773 newClusters.append( new TSegment( seeds[0] ) );
774 newClusters.append( new TSegment( seeds[1] ) );
775 return newClusters;
776}
777
779 updateType();
780 if ( _clusterType == 0 ) return 0;
781 if ( _nDual == 0 ) return 0;
782 update();
783 return 0;
784
785 updateType();
786 if ( _clusterType == 0 ) return 0;
787 if ( _nDual == 0 ) return 0;
788
789 AList<TMLink> seeds;
790 AList<TMLink> duals;
791 for ( unsigned i = _innerMostLayer; i <= _outerMostLayer; i++ )
792 {
793 AList<TMLink> list = SameLayer( _links, i );
794
795 if ( list.length() == 1 ) { seeds.append( list[0] ); }
796 else if ( list.length() == 2 )
797 {
798 if ( Width( list ) > 1 )
799 {
800 const TMDCWireHit* h0 = list[0]->hit();
801 const TMDCWireHit* h1 = list[1]->hit();
802 double distance = ( h0->xyPosition() - h1->xyPosition() ).mag();
803 distance = fabs( distance - list[0]->drift() - list[1]->drift() );
804 if ( distance > 0.5 ) duals.append( list );
805#ifdef TRKRECO_DEBUG_DETAIL
806 h0->dump( "", " " );
807 h1->dump( "", " " );
808 std::cout << " lyr=" << i;
809 std::cout << ", duality distance = " << distance << std::endl;
810#endif
811 }
812 }
813 else if ( list.length() == 0 ) { continue; }
814#ifdef TRKRECO_DEBUG_DETAIL
815 else
816 {
817 std::cout << "TSegment::solveDualHits !!! this is not expected 2";
818 std::cout << std::endl;
819 this->dump( "cluster hits mc", " " );
820 }
821#endif
822 }
823
824 //...Solve them...
825 if ( seeds.length() < 2 ) return -1;
826 AList<TMLink> outers = InOut( seeds );
827 const HepPoint3D& p = outers[0]->xyPosition();
828 HepVector3D v = ( outers[1]->xyPosition() - p ).unit();
829 unsigned n = duals.length() / 2;
830 for ( unsigned i = 0; i < n; i++ )
831 {
832 TMLink* t0 = duals[i * 2 + 0];
833 TMLink* t1 = duals[i * 2 + 1];
834 HepVector3D x0 = t0->xyPosition() - p;
835 HepVector3D x1 = t1->xyPosition() - p;
836 double d0 = ( x0 - ( x0.dot( v ) * v ) ).mag();
837 double d1 = ( x1 - ( x1.dot( v ) * v ) ).mag();
838 if ( d0 < d1 ) _links.remove( t1 );
839 else _links.remove( t0 );
840 }
841 update();
842 return n;
843}
844
845/*
846//#include "tuple/BelleTupleManager.h"
847#include "BesKernel/BesHObject.h"
848#include "BesKernel/BesHistogramService.h"
849#include "BesKernel/BesModule.h"
850
851void
852CheckSegments(const CAList<TSegment> & list) {
853 static bool first = true;
854// static BelleHistogram * hError;
855// static BelleHistogram * hNHeps[11];
856// static BelleHistogram * hNHits[3];
857 BesHistogramService * svc = Framework()->HistogramSvc();
858 static BesHObject * hError;
859 static BesHObject * hNHeps[11];
860 static BesHObject * hNHits[3];
861
862 if (first) {
863 first = false;
864// extern BelleTupleManager * BASF_Histogram;
865// BelleTupleManager * m = BASF_Histogram;
866
867// hError = m->histogram("segment errors", 10, 0, 10, 20000);
868//
869// hNHeps[0] = m->histogram("segment nheps sl 0", 10, 0., 10.);
870// hNHeps[1] = m->histogram("segment nheps sl 1", 10, 0., 10.);
871// hNHeps[2] = m->histogram("segment nheps sl 2", 10, 0., 10.);
872// hNHeps[3] = m->histogram("segment nheps sl 3", 10, 0., 10.);
873// hNHeps[4] = m->histogram("segment nheps sl 4", 10, 0., 10.);
874// hNHeps[5] = m->histogram("segment nheps sl 5", 10, 0., 10.);
875// hNHeps[6] = m->histogram("segment nheps sl 6", 10, 0., 10.);
876// hNHeps[7] = m->histogram("segment nheps sl 7", 10, 0., 10.);
877// hNHeps[8] = m->histogram("segment nheps sl 8", 10, 0., 10.);
878// hNHeps[9] = m->histogram("segment nheps sl 9", 10, 0., 10.);
879// hNHeps[10] = m->histogram("segment nheps sl 10", 10, 0., 10.);
880//
881// hNHits[0] = m->histogram("segment nhits, nheps = 1", 20, 0., 20.);
882// hNHits[1] = m->histogram("segment nhits, nheps = 2", 20, 0., 20.);
883// hNHits[2] = m->histogram("segment nhits, nheps >= 3", 20, 0., 20.);
884//
885 hError = svc -> Book(1,"segment errors", 10, 0, 10, 20000);
886
887 hNHeps[0] = svc -> Book(1,"segment nheps sl 0", 10, 0., 10.);
888 hNHeps[1] = svc -> Book(1,"segment nheps sl 1", 10, 0., 10.);
889 hNHeps[2] = svc -> Book(1,"segment nheps sl 2", 10, 0., 10.);
890 hNHeps[3] = svc -> Book(1,"segment nheps sl 3", 10, 0., 10.);
891 hNHeps[4] = svc -> Book(1,"segment nheps sl 4", 10, 0., 10.);
892 hNHeps[5] = svc -> Book(1,"segment nheps sl 5", 10, 0., 10.);
893 hNHeps[6] = svc -> Book(1,"segment nheps sl 6", 10, 0., 10.);
894 hNHeps[7] = svc -> Book(1,"segment nheps sl 7", 10, 0., 10.);
895 hNHeps[8] = svc -> Book(1,"segment nheps sl 8", 10, 0., 10.);
896 hNHeps[9] = svc -> Book(1,"segment nheps sl 9", 10, 0., 10.);
897 hNHeps[10] = svc -> Book(1,"segment nheps sl 10", 10, 0., 10.);
898
899 hNHits[0] = svc -> Book(1,"segment nhits, nheps = 1", 20, 0., 20.);
900 hNHits[1] = svc -> Book(1,"segment nhits, nheps = 2", 20, 0., 20.);
901 hNHits[2] = svc -> Book(1,"segment nhits, nheps >= 3", 20, 0., 20.);
902
903 std::cout << "CheckSegments ... initialized" << std::endl;
904 return;
905 }
906
907 unsigned n = list.length();
908 for (unsigned i = 0; i < n; i++) {
909 const TSegment & s = * list[i];
910 const AList<TMLink> & links = s.links();
911 unsigned nLinks = links.length();
912 if (nLinks == 0) {
913// hError->accumulate(0.5);
914 hError->Fill(0.5);
915 continue;
916 }
917
918 unsigned sl = links[0]->wire()->superLayerId();
919 unsigned nHeps = s.nHeps();
920// hNHeps[sl]->accumulate((float) nHeps + .5);
921 hNHeps[sl]->Fill((float) nHeps + .5);
922// if (nHeps == 1) hNHits[0]->accumulate((float) nLinks + .5);
923// else if (nHeps == 2) hNHits[1]->accumulate((float) nLinks + .5);
924// else hNHits[2]->accumulate((float) nLinks + .5);
925 if (nHeps == 1) hNHits[0]->Fill((float) nLinks + .5);
926 else if (nHeps == 2) hNHits[1]->Fill((float) nLinks + .5);
927 else hNHits[2]->Fill((float) nLinks + .5);
928
929 }
930}
931
932void
933CheckSegmentLink(const TSegment & base,
934 const TSegment & next,
935 float distance,
936 float dirAngle) {
937
938 static bool first = true;
939 static BelleHistogram * hAngle[2];
940 static BelleHistogram * hAngle1[2];
941 static BelleHistogram * hDistance[2];
942 static BelleHistogram * hDirAngle[2];
943 static BelleHistogram * hDirAngle1[2];
944
945 if (first) {
946 first = false;
947 extern BelleTupleManager * BASF_Histogram;
948 BelleTupleManager * m = BASF_Histogram;
949
950 hAngle[0] = m->histogram("segment correct link, angle",
951 50, -1., 1., 21000);
952 hAngle[1] = m->histogram("segment wrong link, angle", 50, -1., 1.);
953 hAngle1[0] = m->histogram("segment correct link, angle, wide",
954 50, .8, 1.);
955 hAngle1[1] = m->histogram("segment wrong link, angle, wide",
956 50, .8, 1.);
957 hDistance[0] = m->histogram("segment correct link, dist", 50, 0., 1.);
958 hDistance[1] = m->histogram("segment wrong link, dist", 50, 0., 1.);
959 hDirAngle[0] = m->histogram("segment correct link, dir angle",
960 50, -1, 1.);
961 hDirAngle[1] = m->histogram("segment wrong link, dir angle",
962 50, -1, 1.);
963 hDirAngle1[0] = m->histogram("segment correct link, dir angle, wide",
964 50, .8, 1.);
965 hDirAngle1[1] = m->histogram("segment wrong link, dir angle, wide",
966 50, .8, 1.);
967
968 std::cout << "CheckSegmentLink ... initialized" << std::endl;
969 return;
970 }
971
972 const TTrackHEP * const hep0 = base.hep();
973 const TTrackHEP * const hep1 = next.hep();
974
975 float angle = base.direction().dot(next.direction());
976
977 unsigned id = 0;
978 if (hep0 != hep1) id = 1;
979 hAngle[id]->accumulate(angle);
980 hAngle1[id]->accumulate(angle);
981 hDistance[id]->accumulate(distance);
982 hDirAngle[id]->accumulate(dirAngle);
983 hDirAngle1[id]->accumulate(dirAngle);
984}
985*/
986
987unsigned NCoreLinks( const CAList<TSegment>& list ) {
988 unsigned n = 0;
989 unsigned nList = list.length();
990 for ( unsigned i = 0; i < nList; i++ )
991 {
992 const AList<TMLink>& links = list[i]->links();
993 for ( unsigned j = 0; j < links.length(); j++ )
994 {
995 unsigned state = links[j]->hit()->state();
996 if ( ( !( state & WireHitPatternLeft ) ) && ( !( state & WireHitPatternRight ) ) ) ++n;
997 }
998 }
999 return n;
1000}
1001
1003 AList<TMLink> a;
1004
1005 const AList<TMLink>& links = s.links();
1006 const AList<TMLink>& trackLinks = t.links();
1007 unsigned n = links.length();
1008 for ( unsigned i = 0; i < n; i++ )
1009 {
1010 if ( trackLinks.hasMember( links[i] ) ) a.append( links[i] );
1011 }
1012
1013 return a;
1014}
1015
1016unsigned NUniqueLinks( const TSegment& a ) {
1017 unsigned n = 0;
1018 const TSegment* s = &a;
1019 while ( s )
1020 {
1021 unsigned nLinks = s->innerLinks().length();
1022 if ( nLinks != 1 ) return n;
1023 ++n;
1024 s = s->innerLinks()[0];
1025 }
1026 return n;
1027}
1028
1030 AList<TSegment> links;
1031 const TSegment* s = &a;
1032 while ( s )
1033 {
1034 unsigned nLinks = s->innerLinks().length();
1035 if ( nLinks != 1 ) return links;
1036 const TSegment* t = s->innerLinks()[0];
1037 links.append( (TSegment*)t );
1038 s = t;
1039 }
1040 return links;
1041}
1042
1043unsigned NMajorLinks( const TSegment& a ) {
1044 unsigned n = 0;
1045 const TSegment* s = &a;
1046 while ( s )
1047 {
1048 unsigned nLinks = s->innerLinks().length();
1049 if ( nLinks == 0 ) return n;
1050 ++n;
1051 int tmp = 0, ii = 0;
1052 for ( int i = 0; i < nLinks; ++i )
1053 {
1054 if ( s->innerLinks()[i]->links().length() > tmp )
1055 {
1056 tmp = s->innerLinks()[i]->links().length();
1057 ii = i;
1058 }
1059 }
1060 s = s->innerLinks()[ii];
1061 // s = s->innerLinks()[0]; //tmp for tsf
1062 }
1063 return n;
1064}
1065
1067 AList<TSegment> links;
1068 const TSegment* s = &a;
1069 while ( s )
1070 {
1071 unsigned nLinks = s->innerLinks().length();
1072 if ( nLinks == 0 ) return links;
1073 int tmp = 0, ii = 0;
1074 for ( int i = 0; i < nLinks; ++i )
1075 {
1076 if ( s->innerLinks()[i]->links().length() > tmp )
1077 {
1078 tmp = s->innerLinks()[i]->links().length();
1079 ii = i;
1080 }
1081 }
1082 const TSegment* t = s->innerLinks()[ii];
1083 // const TSegment * t = s->innerLinks()[0]; //tmp for tsf
1084 links.append( (TSegment*)t );
1085 s = t;
1086 }
1087 return links;
1088}
1089
1090unsigned NLinkBranches( const TSegment& a ) {
1091 unsigned n = 0;
1092 const TSegment* s = &a;
1093 while ( s )
1094 {
1095 unsigned nLinks = s->innerLinks().length();
1096 if ( nLinks == 0 ) return n;
1097 if ( nLinks > 1 ) ++n;
1098 s = s->innerLinks()[0];
1099 }
1100 return n;
1101}
1102
1104 AList<TSegment>& crowded ) {
1105 unsigned n = in.length();
1106 if ( n == 0 ) return;
1107
1108 for ( unsigned i = 0; i < n; i++ )
1109 {
1110 TSegment& s = *in[i];
1111 if ( s.state() & TSegmentCrowd ) crowded.append( s );
1112 else isolated.append( s );
1113 }
1114}
1115
1116unsigned SuperLayer( const AList<TSegment>& list ) {
1117 unsigned sl = 0;
1118 unsigned n = list.length();
1119 for ( unsigned i = 0; i < n; i++ ) sl |= ( 1 << ( list[i]->superLayerId() ) );
1120 return sl;
1121}
1122
1124 const TSegment* o = &a;
1125 while ( o->outerLinks().length() == 1 ) o = o->outerLinks()[0];
1126 return (TSegment*)o;
1127}
1128
1130 AList<TMLink> links;
1131 unsigned n = list.length();
1132 for ( unsigned i = 0; i < n; i++ ) links.append( list[i]->links() );
1133 return links;
1134}
1135
1136unsigned TSegment::width( void ) const {
1137 unsigned maxWidth = 0;
1138 for ( unsigned i = innerMostLayer(); i <= outerMostLayer(); i++ )
1139 {
1140 AList<TMLink> tmp = SameLayer( links(), i );
1141 unsigned w = Width( tmp );
1142 if ( w > maxWidth ) maxWidth = w;
1143 }
1144 return maxWidth;
1145}
1146
1147// liuqg add for tsf...................//
1148double TSegment::maxdDistance( TMLink* l ) const {
1149 unsigned sl = l->wire()->superLayerId();
1150 unsigned lId = l->wire()->layerId();
1151 double _averR[11] = { 9.7, 14.5, 22.14, 28.62, 35.1, 42.39,
1152 48.87, 55.35, 61.83, 69.12, 74.79 };
1153 double _averR2[43] = {
1154 7.885, 9.07, 10.29, 11.525, 12.72, 13.875, 15.01, 16.16, 19.7, 21.3, 22.955,
1155 24.555, 26.215, 27.82, 29.465, 31.06, 32.69, 34.265, 35.875, 37.455, 39.975, 41.52,
1156 43.12, 44.76, 46.415, 48.02, 49.685, 51.37, 53.035, 54.595, 56.215, 57.855, 59.475,
1157 60.995, 62.565, 64.165, 66.68, 68.285, 69.915, 71.57, 73.21, 74.76, 76.345 };
1158 double radius = _averR2[lId];
1159 const double singleSigma = l->dDrift();
1160 return 2 * singleSigma / ( radius * radius );
1161}
1162
1164 // get links in each layer.
1165 AList<TSegment> list;
1166 AList<TMLink> links[4]; // links in each local layer.
1167 AList<TMLink> seeds2; // links in the outer layer.
1168 AList<TMLink> exTsf; // links in other local layers.
1169 TMLink* seed = nullptr; // link in the mostinner layer. add initialize 25-05-15
1170
1171 for ( unsigned i = 0; i < _links.length(); ++i )
1172 {
1173 TMLink* l = _links[i];
1174 links[l->wire()->localLayerId()].append( l );
1175 }
1176
1177 // prepare for segment finding.
1178 if ( links[0].length() == 0 )
1179 { // find in 234.
1180 if ( links[3].length() == 0 ) return list;
1181 if ( links[1].length() != 1 )
1182 {
1183 cout << "wrong in tsf, TSegment::splitTsf ...1" << endl;
1184 return list;
1185 }
1186 seed = links[1][0];
1187 seeds2.append( links[3] );
1188 exTsf.append( links[2] );
1189 }
1190 else if ( links[0].length() == 1 )
1191 { // find in 1234, 124, 134, 123.
1192 seed = links[0][0];
1193 if ( links[3].length() > 0 )
1194 { // 1..4
1195 seeds2.append( links[3] );
1196 exTsf.append( links[1] );
1197 exTsf.append( links[2] );
1198 }
1199 else if ( links[2].length() > 0 )
1200 { // 1..3
1201 seeds2.append( links[2] );
1202 exTsf.append( links[1] );
1203 }
1204 else return list;
1205 }
1206 else cout << "wrong in tsf, TSegment::splitTsf ...2" << endl;
1207 exTsf.append( seeds2 ); // add the outer layer...
1208
1209 // find segments
1210 for ( unsigned i = 0; i < seeds2.length(); ++i )
1211 {
1212 if ( seed->tsfTag() > 0 && seeds2[i]->tsfTag() > 0 ) continue;
1213 AList<TSegment> segments;
1214 HepPoint3D line[4];
1215 fitLine( seed, seeds2[i], line );
1216 segments = appendByLine( seed, seeds2[i], seedNeighbors, exTsf, line );
1217 list.append( segments );
1218 segments.removeAll();
1219 }
1220 if ( seed->wire()->localLayerId() == 0 )
1221 { // for 123
1222 exTsf.removeAll();
1223 seeds2.removeAll();
1224 exTsf.append( links[1] );
1225 exTsf.append( links[2] ); // add the outer layer...
1226 for ( int k = 0; k < links[2].length(); ++k )
1227 {
1228 if ( links[2][k]->tsfTag() == 0 ) seeds2.append( links[2][k] );
1229 }
1230 for ( unsigned i = 0; i < seeds2.length(); ++i )
1231 {
1232 if ( seed->tsfTag() > 0 && seeds2[i]->tsfTag() > 0 ) continue;
1233 AList<TSegment> segments2;
1234 HepPoint3D line2[4];
1235 fitLine( seed, seeds2[i], line2 );
1236 segments2 = appendByLine( seed, seeds2[i], seedNeighbors, exTsf, line2 );
1237 list.append( segments2 );
1238 segments2.removeAll();
1239 }
1240 }
1241
1242 return list;
1243}
1244
1245void TSegment::fitLine( TMLink* seed, TMLink* outer, HepPoint3D line[4] ) const {
1246 double ax = seed->positionD().x();
1247 double ay = seed->positionD().y();
1248 double ar = seed->cDrift();
1249 double bx = outer->positionD().x();
1250 double by = outer->positionD().y();
1251 double br = outer->cDrift();
1252 // calculate ...
1253 double dis = sqrt( ( ax - bx ) * ( ax - bx ) + ( ay - by ) * ( ay - by ) );
1254 double costheta = ( bx - ax ) / dis;
1255 double sintheta = ( by - ay ) / dis;
1256 double c1 = ( ax * ax - bx * bx + ay * ay - by * by ) / ( 2 * dis );
1257 double c2 = ( ax * by - bx * ay ) / dis;
1258 // cout<<"dis of circles = "<<dis<<" radius of circles N1 = "<<ar<<" N2 = "<<br<<endl;
1259 line[0].setX( ( br - ar ) * costheta +
1260 sqrt( dis * dis - ( ar - br ) * ( ar - br ) ) * sintheta );
1261 line[0].setY( ( br - ar ) * sintheta -
1262 sqrt( dis * dis - ( ar - br ) * ( ar - br ) ) * costheta );
1263 line[0].setZ( ( br - ar ) * c1 - sqrt( dis * dis - ( ar - br ) * ( ar - br ) ) * c2 +
1264 0.5 * dis * ( ar + br ) );
1265 line[1].setX( ( br - ar ) * costheta -
1266 sqrt( dis * dis - ( ar - br ) * ( ar - br ) ) * sintheta );
1267 line[1].setY( ( br - ar ) * sintheta +
1268 sqrt( dis * dis - ( ar - br ) * ( ar - br ) ) * costheta );
1269 line[1].setZ( ( br - ar ) * c1 + sqrt( dis * dis - ( ar - br ) * ( ar - br ) ) * c2 +
1270 0.5 * dis * ( ar + br ) );
1271 line[2].setX( ( br + ar ) * costheta +
1272 sqrt( dis * dis - ( ar + br ) * ( ar + br ) ) * sintheta );
1273 line[2].setY( ( br + ar ) * sintheta -
1274 sqrt( dis * dis - ( ar + br ) * ( ar + br ) ) * costheta );
1275 line[2].setZ( ( br + ar ) * c1 - sqrt( dis * dis - ( ar + br ) * ( ar + br ) ) * c2 +
1276 0.5 * dis * ( br - ar ) );
1277 line[3].setX( ( br + ar ) * costheta -
1278 sqrt( dis * dis - ( ar + br ) * ( ar + br ) ) * sintheta );
1279 line[3].setY( ( br + ar ) * sintheta +
1280 sqrt( dis * dis - ( ar + br ) * ( ar + br ) ) * costheta );
1281 line[3].setZ( ( br + ar ) * c1 + sqrt( dis * dis - ( ar + br ) * ( ar + br ) ) * c2 +
1282 0.5 * dis * ( br - ar ) );
1283 /* for (int i = 0; i < 4; ++i) {
1284 double d1 = distance2(seed, line[i]);
1285 double d2 = distance2(outer, line[i]);
1286 cout<<"dis of line to seed = "<<d1<<" dis to outer = "<<d2<<endl;
1287 cout<<"radius of seed = "<<ar<<" rad to outer = "<<br<<endl;
1288 }
1289 *///check the calculation of line. right!!
1290 return;
1291}
1292
1293AList<TSegment> TSegment::appendByLine( TMLink* seed, TMLink* outer,
1294 AList<TMLink>& seedNeighbors, AList<TMLink>& restHits,
1295 const HepPoint3D line[4] ) {
1296 AList<TSegment> list;
1297 list.removeAll();
1298
1299 const unsigned slId = seed->wire()->superLayerId();
1300
1301 // cout<<"seed: lId:"<<seed->wire()->layerId()<<" loId:"<<seed->wire()->localId()<<endl;
1302 // cout<<"outer: lId:"<<outer->wire()->layerId()<<" loId:"<<outer->wire()->localId()<<endl;
1303 for ( int i = 0; i < 4; ++i )
1304 {
1305 AList<TMLink> seeds;
1306 for ( int j = 0, size = restHits.length(); j < size; ++j )
1307 {
1308 TMLink* l = restHits[j];
1309 if ( l->wire()->id() == outer->wire()->id() ) continue;
1310 // cout<<"restHits: lId:"<<l->wire()->layerId()<<" loId:"<<l->wire()->localId()<<endl;
1311 double maxdis = maxdDistance( l ) * _times[slId];
1312 double dis = distance2( l, line[i] );
1313 // cout<<"maxdis: "<<maxdis<<" dis: "<<dis<<endl;
1314 if ( seeds.hasMember( l ) ) continue;
1315 if ( fabs( dis - l->cDrift() ) < maxdis ) seeds.append( l );
1316 else continue;
1317 }
1318 seeds.append( seed );
1319 seeds.append( outer );
1320 unsigned nHitsLayer[4] = { 0, 0, 0, 0 };
1321 unsigned nLayers = 0;
1322 // check...at least 3 layers.
1323 for ( int j = 0; j < seeds.length(); ++j ) ++nHitsLayer[seeds[j]->wire()->localLayerId()];
1324 for ( int j = 0; j < 4; ++j )
1325 if ( nHitsLayer[j] > 0 ) ++nLayers;
1326 if ( nLayers < 3 ) continue;
1327
1328 // check the neighbor hits in the first locallayer.
1329 for ( int k = 0; k < seedNeighbors.length(); ++k )
1330 {
1331 TMLink* l = seedNeighbors[k];
1332 // cout<<"seedNeighbors: lId:"<<l->wire()->layerId()<<"
1333 // loId:"<<l->wire()->localId()<<endl;
1334 double maxdis = maxdDistance( l ) * _times[slId];
1335 double dis = distance2( l, line[i] );
1336 // cout<<"maxdis: "<<maxdis<<" dis: "<<dis<<endl;
1337 if ( seeds.hasMember( l ) ) continue;
1338 if ( fabs( dis - l->cDrift() ) < maxdis ) seeds.append( l );
1339 else continue;
1340 }
1341
1342 // update tag of each link.
1343 for ( int k = 0; k < seeds.length(); ++k )
1344 {
1345 unsigned a = seeds[k]->tsfTag();
1346 ++a;
1347 seeds[k]->tsfTag( a );
1348 }
1349
1350 // creat segment and update.
1351 TSegment* seg = new TSegment( seeds );
1352 seg->lineTsf( line[i] );
1353 seg->update();
1354
1355 list.append( seg );
1356 }
1357
1358 // salvage in new line...after update
1359 // AList<TMLink> all;
1360 // all.removeAll();
1361 // all.append(restHits);
1362 // all.append(seedNeighbors);
1363 // for (int j = 0; j < list.length(); ++j)
1364 // list[j]->segSalvage(all);
1365
1366 // expand 3layers segment
1367 /* unsigned sl = seed->wire()->superLayerId();
1368 if(sl != 10) {
1369 for( int i = 0; i < list.length(); ++i) {
1370 AList<TMLink> segLinks = list[i]->links();
1371 unsigned nHits[4] = {0,0,0,0};
1372 int emptyLayer = -1;
1373 for(int j = 0; j < segLinks.length(); ++j)
1374 ++nHits[segLinks[j]->wire()->localLayerId()];
1375 for (int j = 0; j < 4; ++j) {
1376 if(nHits[j] == 0) emptyLayer = j;
1377 if (emptyLayer != -1) break;
1378 }
1379 if(emptyLayer == -1) continue;
1380
1381 for(int j = 0; j < all.length(); ++j){
1382 TMLink *l = all[j];
1383 if (l->wire()->localLayerId() == emptyLayer){
1384 double maxdis = maxdDistance(l) * _times;
1385 double dis = distance2(l, list[i]->lineTsf());
1386 cout<<"layer: "<<l->wire()->layerId()<<" local:
1387 "<<l->wire()->localId()<<endl; cout<<"maxdis: "<<maxdis<<" dis in empty layer: "<<dis<<endl;
1388 }
1389 }
1390
1391 // list[i]->expandSeg(emptyLayer, all);
1392 }
1393 }
1394 */
1395 return list;
1396}
1397
1398double TSegment::distance2( TMLink* hit, HepPoint3D line ) const {
1399 double x = hit->positionD().x();
1400 double y = hit->positionD().y();
1401 double a = line.x();
1402 double b = line.y();
1403 double c = line.z();
1404 return fabs( a * x + b * y + c ) / sqrt( a * a + b * b );
1405}
1406
1407HepPoint3D TSegment::positionTsf( const AList<TMLink>& links, const HepPoint3D line ) const {
1408 HepPoint3D sumPos( 0., 0., 0. );
1409 int n = 0;
1410 for ( int i = 0; i < links.length(); ++i )
1411 {
1412 const HepPoint3D& p = links[i]->positionD();
1413 double d = links[i]->cDrift();
1414 HepPoint3D posOnLine = closestPoint( p, _lineTsf );
1415 HepPoint3D v = ( posOnLine - p ).unit();
1416 const HepPoint3D p1 = p + d * v;
1417 sumPos += p1;
1418 ++n;
1419 }
1420 sumPos *= ( 1. / double( n ) );
1421 HepPoint3D posTsf = closestPoint( sumPos, line );
1422 return posTsf;
1423}
1424
1425HepPoint3D TSegment::leastSquaresFitting1( const AList<TMLink>& links,
1426 const HepPoint3D tsfLine ) const {
1427 HepPoint3D line0;
1428 line0.setX( tsfLine.x() / sqrt( tsfLine.x() * tsfLine.x() + tsfLine.y() * tsfLine.y() ) );
1429 line0.setY( tsfLine.y() / sqrt( tsfLine.x() * tsfLine.x() + tsfLine.y() * tsfLine.y() ) );
1430 line0.setZ( tsfLine.z() / sqrt( tsfLine.x() * tsfLine.x() + tsfLine.y() * tsfLine.y() ) );
1431
1432 HepPoint3D line;
1433 unsigned n = links.length();
1434 unsigned nTrial = 0;
1435 while ( 1 )
1436 {
1437 if ( nTrial > 10 ) break;
1438 double a = 0., b = 0.;
1439 double sumXSig = 0., sumYSig = 0., sumX2Sig = 0., sumXYSig = 0., sumSig = 0.;
1440 for ( unsigned i = 0; i < n; i++ )
1441 {
1442 const HepPoint3D& p = links[i]->positionD();
1443 double d = links[i]->cDrift();
1444 HepPoint3D posOnLine = closestPoint( p, _lineTsf );
1445 HepPoint3D v = ( posOnLine - p ).unit();
1446 const HepPoint3D p1 = p + d * v;
1447 double Sig = maxdDistance( links[i] );
1448 Sig = 1. / ( Sig * Sig );
1449 double X = p1.x();
1450 double Y = p1.y();
1451 sumXSig += X * Sig;
1452 sumYSig += Y * Sig;
1453 sumX2Sig += X * X * Sig;
1454 sumXYSig += X * Y * Sig;
1455 sumSig += Sig;
1456 }
1457
1458 b = ( sumXYSig * sumSig - sumXSig * sumYSig ) / ( sumX2Sig * sumSig - sumXSig * sumXSig );
1459 a = ( sumYSig - sumXSig * b ) / sumSig;
1460
1461 line.set( b / sqrt( 1 + b * b ), -1 / sqrt( 1 + b * b ), a / sqrt( 1 + b * b ) );
1462 // cout<<"n: "<<nTrial<<" line = "<<line<<endl;
1463
1464 double chi2 = 0.;
1465 for ( unsigned i = 0; i < n; i++ )
1466 {
1467 const HepPoint3D& p = links[i]->positionD();
1468 double d = links[i]->cDrift();
1469 double Sig = maxdDistance( links[i] );
1470 Sig = 1. / ( Sig * Sig );
1471 double dis = fabs( p.x() * line.x() + p.y() * line.y() + line.z() ) - d;
1472 chi2 += dis * dis * Sig;
1473 }
1474 if ( nTrial > 6 )
1475 {
1476 cout << "n = " << n << " nTrial = " << nTrial << " line0 = " << line0 << endl;
1477 cout << "chi2 in TSF = " << chi2 << endl;
1478 }
1479
1480 if ( fabs( line.x() - line0.x() ) < 0.0001 ) break;
1481
1482 line0 = line;
1483 ++nTrial;
1484 } // while...
1485 return line;
1486}
1487
1488HepPoint3D TSegment::leastSquaresFitting( const AList<TMLink>& links,
1489 const HepPoint3D tsfLine ) const {
1490 HepPoint3D line0;
1491 line0.setX( tsfLine.x() / sqrt( tsfLine.x() * tsfLine.x() + tsfLine.y() * tsfLine.y() ) );
1492 line0.setY( tsfLine.y() / sqrt( tsfLine.x() * tsfLine.x() + tsfLine.y() * tsfLine.y() ) );
1493 line0.setZ( tsfLine.z() / sqrt( tsfLine.x() * tsfLine.x() + tsfLine.y() * tsfLine.y() ) );
1494
1495 // cout<<"tsfLine = "<<tsfLine<<endl;
1496 HepPoint3D line;
1497 int n = links.length();
1498 int nTrial = 0;
1499
1500 while ( 1 )
1501 {
1502 if ( nTrial > 15 ) break;
1503 double a0 = line0.x();
1504 double b0 = line0.y();
1505 double c0 = line0.z();
1506 // cout<<"nTrial: "<<nTrial<<" line0"<<a0<<" "<<b0<<" "<<c0<<endl;
1507
1508 if ( b0 == 0 )
1509 {
1510 cout << "b0 == 0 TSegment::leastSquaresFitting!" << endl;
1511 break;
1512 }
1513
1514 double a = 0., b = 0., c = 0.;
1515 double sumSigX2 = 0., sumSigX = 0., sumSig = 0.;
1516 for ( int i = 0; i < n; ++i )
1517 {
1518 const HepPoint3D& p = links[i]->positionD();
1519 double X = p.x();
1520 double Y = p.y();
1521 double Sig = maxdDistance( links[i] );
1522 Sig = 1. / ( Sig * Sig );
1523 sumSigX2 += Sig * ( X - Y * a0 / b0 ) * ( X - Y * a0 / b0 );
1524 sumSigX += Sig * ( X - Y * a0 / b0 );
1525 sumSig += Sig;
1526 }
1527 double detM = sumSigX2 * sumSig - sumSigX * sumSigX;
1528 double M11 = sumSig / detM;
1529 double M12 = -sumSigX / detM;
1530 double M21 = M12;
1531 double M22 = sumSigX2 / detM;
1532 for ( int i = 0; i < n; ++i )
1533 {
1534 const HepPoint3D& p = links[i]->positionD();
1535 double X = p.x();
1536 double Y = p.y();
1537 double DRIFT = links[i]->cDrift();
1538 if ( a0 * p.x() + b0 * p.y() + c0 * p.z() < 0 ) DRIFT = ( -1 ) * DRIFT;
1539 double Sig = maxdDistance( links[i] );
1540 Sig = 1. / ( Sig * Sig );
1541 double D = DRIFT - Y / b0;
1542 a += ( ( X - Y * a0 / b0 ) * M11 + M12 ) * Sig * D;
1543 c += ( ( X - Y * a0 / b0 ) * M21 + M22 ) * Sig * D;
1544 }
1545
1546 b = ( 1 - a0 * a ) / b0;
1547
1548 line.setX( a / sqrt( a * a + b * b ) );
1549 line.setY( b / sqrt( a * a + b * b ) );
1550 line.setZ( c / sqrt( a * a + b * b ) );
1551 a = line.x();
1552 b = line.y();
1553 c = line.z();
1554 // cout<<"line = "<<line<<endl;
1555 double chi2 = 0.;
1556 for ( int i = 0; i < n; ++i )
1557 {
1558 const HepPoint3D& p = links[i]->positionD();
1559 double dis = fabs( a * p.x() + b * p.y() + c );
1560 double DRIFT = links[i]->cDrift();
1561 double Sig = maxdDistance( links[i] );
1562 // cout<<"dis: "<<dis<<" DRIFT: "<<DRIFT<<" Sig: "<<Sig<<endl;
1563 Sig = 1. / ( Sig * Sig );
1564 chi2 += ( dis - DRIFT ) * ( dis - DRIFT ) * Sig;
1565 }
1566 // cout<<"chi2 = "<<chi2<<endl;
1567
1568 // check...
1569 if ( fabs( a - a0 ) < 0.00001 ) break;
1570 // get line para...
1571 line0 = line;
1572 ++nTrial;
1573 /* if(nTrial>9){
1574 cout<<"length of links = "<<n<<endl;
1575 for(int i = 0; i<n; ++i){
1576 const HepPoint3D & p = links[i]->positionD();
1577 cout<<"layer: "<<links[i]->wire()->layerId()<<"
1578 localId:"<<links[i]->wire()->localId()<<endl; cout<<"drift: "<<links[i]->cDrift()<<"
1579 dis0: "<<a0*p.x() + b0*p.y() + c0*p.z()
1580 <<" dis1:"<<a*p.x() + b*p.y() + c*p.z()<<endl;
1581 }
1582 }*/
1583 }
1584 return line;
1585}
1586
1587void TSegment::segSalvage( AList<TMLink>& links ) {
1588 HepPoint3D line = _lineTsf;
1589 AList<TMLink> segLinks = _links;
1590 for ( int i = 0; i < links.length(); ++i )
1591 {
1592 TMLink* l = links[i];
1593 if ( segLinks.hasMember( l ) ) continue;
1594 const unsigned slId = l->wire()->superLayerId();
1595 double maxdis = maxdDistance( l ) * ( _times[slId] );
1596 double dis = distance2( l, line );
1597 if ( fabs( dis - l->cDrift() ) < maxdis )
1598 {
1599 _links.append( l );
1600 unsigned a = l->tsfTag();
1601 ++a;
1602 l->tsfTag( a );
1603 }
1604 else continue;
1605 }
1606 update();
1607}
1608
1609void TSegment::expandSeg( const int empty, AList<TMLink>& allLinks ) {
1610 if ( empty >= 4 || empty < 0 ) return;
1611 AList<TMLink> linksOnEmptyLayer;
1612 for ( int i = 0; i < allLinks.length(); ++i )
1613 if ( allLinks[i]->wire()->localLayerId() == empty )
1614 linksOnEmptyLayer.append( allLinks[i] );
1615
1616 if ( linksOnEmptyLayer.length() == 0 ) return;
1617
1618 if ( _cdc == 0 ) _cdc = TMDC::getTMDC();
1619 float maxPhi[4] = { 0., 0., 0., 0. };
1620 float minPhi[4] = { 999., 999., 999., 999. };
1621 float max = 0., min = 999.;
1622 for ( int i = 0; i < _links.length(); ++i )
1623 {
1624 TMLink* l = _links[i];
1625 unsigned lId = l->wire()->layerId();
1626 int local = l->wire()->localId();
1627 unsigned loId = l->wire()->localLayerId();
1628 float phi0 = _cdc->layer( lId )->offset();
1629 int nWir = (int)_cdc->layer( lId )->nWires();
1630 float phi = phi0 + local * 2 * pi / nWir;
1631
1632 if ( phi > maxPhi[loId] ) maxPhi[loId] = phi;
1633 if ( phi < minPhi[loId] ) minPhi[loId] = phi;
1634 if ( phi > max ) max = phi;
1635 if ( phi < min ) min = phi;
1636 }
1637
1638 AList<TMLink> tmpList;
1639 for ( int i = 0; i < linksOnEmptyLayer.length(); ++i )
1640 {
1641 TMLink* l = linksOnEmptyLayer[i];
1642 unsigned lId = l->wire()->layerId();
1643 int local = l->wire()->localId();
1644 float phi0 = _cdc->layer( lId )->offset();
1645 int nWir = (int)_cdc->layer( lId )->nWires();
1646 float phi = phi0 + local * 2 * pi / nWir;
1647
1648 if ( empty != 0 || empty != 3 )
1649 {
1650 if ( phi <= maxPhi[empty + 1] && phi >= minPhi[empty - 1] ) tmpList.append( l );
1651 else if ( phi <= maxPhi[empty - 1] && phi >= minPhi[empty + 1] ) tmpList.append( l );
1652 else if ( tmpList.length() == 0 && phi <= max && phi >= min ) tmpList.append( l );
1653 }
1654 if ( empty == 0 || empty == 3 )
1655 {
1656 if ( phi <= maxPhi[1] && phi >= minPhi[2] ) tmpList.append( l );
1657 else if ( phi <= maxPhi[2] && phi >= minPhi[1] ) tmpList.append( l );
1658 else if ( tmpList.length() == 0 && phi <= max && phi >= min ) tmpList.append( l );
1659 }
1660 }
1661
1662 for ( int i = 0; i < tmpList.length(); ++i )
1663 {
1664 TMLink* l = tmpList[i];
1665 _links.append( l );
1666 unsigned a = l->tsfTag();
1667 ++a;
1668 l->tsfTag( a );
1669 }
1670 update();
1671}
1672
1673void TSegment::solveLR( void ) {
1674 unsigned n = _links.length();
1675 // initial...
1676 if ( n <= 3 )
1677 {
1679 return;
1680 }
1681 for ( int i = 0; i < n; ++i )
1682 {
1683 TMLink* l = _links[i];
1684 if ( l->hit()->state() & WireHitPatternRight )
1685 {
1686 unsigned newState = l->hit()->state() & ( ~WireHitPatternRight );
1687 l->hit()->state( newState );
1688 }
1689 if ( l->hit()->state() & WireHitPatternLeft )
1690 {
1691 unsigned newState = l->hit()->state() & ( ~WireHitPatternLeft );
1692 l->hit()->state( newState );
1693 }
1694 }
1695
1696 HepPoint3D originCon( 0., 0., 0. );
1697 HepPoint3D dirZ( 0., 0., 1. );
1698 HepPoint3D center = closestPoint( originCon, _lineTsf );
1699 HepPoint3D v1 = ( center - originCon ).unit();
1700 HepPoint3D v2 = dirZ.cross( v1 );
1701 for ( int i = 0; i < n; ++i )
1702 {
1703 // cout<<"layerId: "<<_links[i]->wire()->layerId()<<" localId:
1704 //"<<_links[i]->wire()->localId()<<endl;
1705 const HepPoint3D& p = _links[i]->positionD();
1706 unsigned state = _links[i]->hit()->state();
1707
1708 double cosA = ( p - center ).unit().dot( v1.unit() );
1709 double cosB = ( p - center ).unit().dot( v2.unit() );
1710 if ( cosA * cosB < 0 ) state |= WireHitPatternLeft;
1711 else state |= WireHitPatternRight;
1712
1713 _links[i]->hit()->state( state );
1714 }
1715}
1716
1717HepPoint3D TSegment::closestPoint( const HepPoint3D& p, const HepPoint3D line ) const {
1718 HepPoint3D Dir( -line.y(), line.x(), 0 );
1719 Dir = Dir.unit();
1720 HepPoint3D PointOnLine( 1, -( line.x() + line.z() ) / line.y(), 0 );
1721 double dis = ( p - PointOnLine ).dot( Dir );
1722 HepPoint3D tmp( dis * Dir.x(), dis * Dir.y(), 0. );
1723 HepPoint3D closestPoint = PointOnLine + tmp;
1724
1725 double disPLine = fabs( p.x() * line.x() + p.y() * line.y() + line.z() ) /
1726 sqrt( line.x() * line.x() + line.y() * line.y() );
1727 double disP1P2 = sqrt( ( p.x() - closestPoint.x() ) * ( p.x() - closestPoint.x() ) +
1728 ( p.y() - closestPoint.y() ) * ( p.y() - closestPoint.y() ) );
1729 if ( fabs( disPLine - disP1P2 ) > 0.00001 )
1730 cout << "TSegment::closestPoint: dis p -> line = " << disPLine
1731 << " dis p -> pos = " << disP1P2 << endl;
1732 return closestPoint;
1733}
1734
1736 unsigned n = _links.length();
1737
1738 for ( unsigned i = 0; i < n; i++ )
1739 {
1740 const TMDCWireHit* h = _links[i]->hit();
1741 const TMDCWire* w = h->wire();
1742 unsigned state = h->state();
1743
1744 //...Cache pointers to a neighbor...
1745 const TMDCWire* neighbor[6];
1746 for ( unsigned j = 0; j < 6; j++ ) neighbor[j] = w->neighbor( j );
1747
1748 //...Decide hit pattern...
1749 unsigned pattern = 0;
1750 for ( unsigned j = 0; j < 6; j++ )
1751 {
1752 if ( neighbor[j] )
1753 if ( neighbor[j]->hit() ) pattern += ( 1 << j );
1754 }
1755 state |= ( pattern << WireHitNeighborHit );
1756
1757 //...Solve LR locally...
1758 if ( ( pattern == 34 ) || ( pattern == 42 ) || ( pattern == 40 ) || ( pattern == 10 ) ||
1759 ( pattern == 35 ) || ( pattern == 50 ) )
1761 else if ( ( pattern == 17 ) || ( pattern == 21 ) || ( pattern == 20 ) ||
1762 ( pattern == 5 ) || ( pattern == 19 ) || ( pattern == 49 ) )
1764
1765 //...Store it...
1766 h->state( state );
1767 }
1768}
1769
1770//............................tsf//
HepGeom::Vector3D< double > HepVector3D
double p2[4]
double p1[4]
HepGeom::Point3D< double > HepPoint3D
const Int_t n
Double_t x[10]
#define min(a, b)
#define max(a, b)
character *LEPTONflag integer iresonances real zeta5 real a0
double pi
double w
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per saves r n generator level $ !Flag for chat level in !Latex Output unit
Definition FoamA.h:90
XmlRpcServer s
const HepPoint3D ORIGIN
Constants.
Definition TMDCUtil.cxx:47
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35
HepGeom::Point3D< double > HepPoint3D
unsigned NMajorLinks(const TSegment &a)
returns # of links in the major link.
unsigned NUniqueLinks(const TSegment &a)
checks property of segments.
HepGeom::Vector3D< double > HepVector3D
unsigned NLinkBranches(const TSegment &a)
returns # of link branches in the major link.
#define M_PI
Definition TConstant.h:4
unsigned NMajorLinks(const TSegment &a)
returns # of links in the major link.
unsigned NUniqueLinks(const TSegment &a)
checks property of segments.
TSegment * OuterMostUniqueLink(const TSegment &a)
returns a segment to the outer-most unique segment.
unsigned NLinkBranches(const TSegment &a)
returns # of link branches in the major link.
unsigned NCoreLinks(const CAList< TSegment > &list)
returns # of core links in segments.
Definition TSegment.cxx:987
AList< TSegment > UniqueLinks(const TSegment &a)
returns a list of unique segments in links.
AList< TSegment > MajorLinks(const TSegment &a)
returns a list of segments in major links.
AList< TMLink > Links(const TSegment &s, const TTrack &t)
returns AList of TMLink used for a track.
unsigned SuperLayer(const AList< TSegment > &list)
returns super layer pattern.
void SeparateCrowded(const AList< TSegment > &in, AList< TSegment > &isolated, AList< TSegment > &crowded)
returns isolated and crowded list.
to specify 1-dim region or range by two floats
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
const HepPoint3D & xyPosition(void) const
returns drift time
unsigned localLayerId(void) const
returns local layer id in a super layer.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
const HepPoint3D & xyPosition(void) const
returns middle position of a wire. z componet is 0.
unsigned superLayerId(void) const
returns super layer id.
int localIdDifference(const TMDCWire &) const
returns local id difference.
Definition TMDCWire.cxx:575
std::string name(void) const
returns name.
static TMDC * getTMDC(void)
Definition TMDC.cxx:84
A class to relate TMDCWireHit and TTrack objects.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition TSegment.cxx:113
const TMLink & center(void) const
returns a TMLink which is the closest to the center.
const AList< TMLink > & outers(void) const
void solveThreeHits(void)
TSegment()
Constructor.
Definition TSegment.cxx:29
Range rangeX(double min, double max) const
returns Range of x-coordinate of TMLinks.
Definition TSegment.cxx:267
virtual ~TSegment()
Destructor.
Definition TSegment.cxx:111
AList< TSegment > split(void) const
Definition TSegment.cxx:406
AList< TSegment > splitTsf(AList< TMLink > &)
unsigned innerMostLayer(void) const
returns inner most layer.
void solveLR(void)
solve LR of hit in TSF.
int solveDualHits(void)
Definition TSegment.cxx:778
const HepPoint3D & position(void) const
returns position.
unsigned width(void) const
returns width.
double distance(const TSegment &) const
calculates distance between two clusters. Smaller value indicates closer.
Definition TSegment.cxx:245
unsigned outerMostLayer(void) const
returns outer most layer.
const HepPoint3D & lineTsf(void) const
return line of Tsf for pos and dir
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
const AList< TMLink > & links(unsigned mask=0) const
TTrackBase()
Constructor.
unsigned nLinks(unsigned mask=0) const
returns # of masked TMLinks assigned to this track object.
void update(void) const
update cache.
A class to represent a track in tracking.
int t()
Definition t.c:1