BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TSegment0.cxx
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TSegment0.cxx,v 1.7 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TSegment0.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/TSegment0.h"
14#include "TrkReco/TMDCUtil.h"
15#include "TrkReco/TMDCWire.h"
16#include "TrkReco/TMDCWireHit.h"
17#include "TrkReco/TMLink.h"
18#include "TrkReco/TTrack.h"
19// #include "cdc/Range.h"
20#include "TrkReco/Range.h"
21
23 : TTrackBase()
24 , _innerWidth( 0 )
25 , _outerWidth( 0 )
26 , _nLayer( 0 )
27 , _clusterType( 0 )
28 , _duality( 0. )
29 , _nDual( 0 )
30 , _angle( 0. ) {
31 _fitted = false;
32}
33
35 : TTrackBase( a )
36 , _innerWidth( 0 )
37 , _outerWidth( 0 )
38 , _nLayer( 0 )
39 , _clusterType( 0 )
40 , _duality( 0. )
41 , _nDual( 0 )
42 , _angle( 0. ) {
43 _links.sort( SortByWireId );
44 _fitted = false;
45}
46
48
49void TSegment0::dump( const std::string& msg, const std::string& pre ) const {
50 if ( !_fitted ) update();
51 bool def = false;
52 if ( msg == "" ) def = true;
53
54 if ( def || msg.find( "cluster" ) != std::string::npos ||
55 msg.find( "detail" ) != std::string::npos )
56 {
57 std::cout << pre;
58 std::cout << "#links=" << _links.length();
59 std::cout << "(" << _innerWidth << "," << _outerWidth << ":";
60 std::cout << clusterType() << ")," << _nDual << "," << _duality << ",";
61 std::cout << _angle << std::endl;
62 }
63 if ( def || msg.find( "vector" ) != std::string::npos ||
64 msg.find( "detail" ) != std::string::npos )
65 {
66 std::cout << pre;
67 std::cout << "pos" << _position << ","
68 << "dir" << _direction;
69 std::cout << std::endl;
70 }
71 if ( !def ) TTrackBase::dump( msg, pre );
72}
73
74void TSegment0::update( void ) const {
75 _clusterType = 0;
76 _position = ORIGIN;
77 _direction = ORIGIN;
78 _inners.removeAll();
79 _outers.removeAll();
80
81 if ( _links.length() == 0 ) return;
82
83 _innerMostLayer = _links[0]->wire()->layerId();
84 _outerMostLayer = _innerMostLayer;
85 for ( unsigned i = 1; i < _links.length(); i++ )
86 {
87 unsigned id = _links[i]->wire()->layerId();
88 if ( id < _innerMostLayer ) _innerMostLayer = id;
89 else if ( id > _outerMostLayer ) _outerMostLayer = id;
90 }
91 _nLayer = _outerMostLayer - _innerMostLayer + 1;
92
93 double centerX = _links[0]->position().x();
94 HepPoint3D inner = ORIGIN;
95 HepPoint3D outer = ORIGIN;
96 unsigned nInner = 0;
97 unsigned nOuter = 0;
98 for ( unsigned i = 0; i < _links.length(); i++ )
99 {
100 HepPoint3D tmp = _links[i]->position();
101 double diff = tmp.x() - centerX;
102 if ( diff > M_PI ) { tmp.setX( centerX - 2. * M_PI + diff ); }
103 else if ( diff < -M_PI ) { tmp.setX( centerX + 2. * M_PI + diff ); }
104
105 _links[i]->conf( tmp );
106 _position += tmp;
107 unsigned id = _links[i]->wire()->layerId();
108 if ( id == _innerMostLayer )
109 {
110 inner += tmp;
111 ++nInner;
112 _inners.append( _links[i] );
113 }
114 if ( id == _outerMostLayer )
115 {
116 outer += tmp;
117 ++nOuter;
118 _outers.append( _links[i] );
119 }
120 }
121 _innerWidth = Width( _inners );
122 _outerWidth = Width( _outers );
123 _position *= ( 1. / (float)_links.length() );
124
125 inner *= ( 1. / (float)nInner );
126 outer *= ( 1. / (float)nOuter );
127 _direction = ( inner - outer ).unit();
128
129 _fitted = true;
130}
131
132double TSegment0::distance( const TSegment0& c ) const {
133 HepVector3D dir = c.position() - _position;
134 if ( dir.x() > M_PI ) dir.setX( dir.x() - 2. * M_PI );
135 else if ( dir.x() < -M_PI ) dir.setX( 2. * M_PI + dir.x() );
136
137 float radial = fabs( _direction.dot( dir ) );
138 float radial2 = radial * radial;
139
140 return ( dir.mag2() - radial2 ) > 0.0 ? sqrt( dir.mag2() - radial2 ) : 0.;
141}
142
143double TSegment0::distance( const HepPoint3D& p, const HepVector3D& v ) const {
144 HepVector3D dir = _position - p;
145 if ( dir.x() > M_PI ) dir.setX( dir.x() - 2. * M_PI );
146 else if ( dir.x() < -M_PI ) dir.setX( 2. * M_PI + dir.x() );
147
148 float radial = fabs( v.unit().dot( dir ) );
149 float radial2 = radial * radial;
150
151 return ( dir.mag2() - radial2 ) > 0.0 ? sqrt( dir.mag2() - radial2 ) : 0.;
152}
153
154Range TSegment0::rangeX( double min, double max ) const {
155#ifdef TRKRECO_DEBUG_DETAIL
156 if ( min > max )
157 {
158 std::cout << "TSegment0::range !!! bad arguments:min,max=";
159 std::cout << min << "," << max << std::endl;
160 }
161#endif
162
163 unsigned n = _links.length();
164 if ( n == 0 ) return Range( 0., 0. );
165
166 //...Search for a center...
167 bool found = false;
168 double center;
169 for ( unsigned i = 0; i < n; i++ )
170 {
171 double x = _links[i]->position().x();
172 if ( x < min || x > max ) continue;
173 center = x;
174 found = true;
175 break;
176 }
177 if ( !found ) return Range( 0., 0. );
178
179#ifdef TRKRECO_DEBUG_DETAIL
180// std::cout << " center=" << center << std::endl;
181#endif
182
183 double distanceR = 0.;
184 double distanceL = 0.;
185 double distanceMax = max - min;
186 for ( unsigned i = 0; i < n; i++ )
187 {
188 double x = _links[i]->position().x();
189 if ( x < min || x > max ) continue;
190
191 double distance0, distance1;
192 if ( x > center )
193 {
194 distance0 = x - center;
195 distance1 = distanceMax - distance0;
196 }
197 else
198 {
199 distance1 = center - x;
200 distance0 = distanceMax - distance1;
201 }
202
203 if ( distance0 < distance1 )
204 {
205 if ( distance0 > distanceR ) distanceR = distance0;
206 }
207 else
208 {
209 if ( distance1 > distanceL ) distanceL = distance1;
210 }
211
212#ifdef TRKRECO_DEBUG_DETAIL
213// std::cout << " ";
214// std::cout << _links[i]->wire()->layerId() << "-";
215// std::cout << _links[i]->wire()->localId() << ",";
216// std::cout << _links[i]->position().x();
217// std::cout << ",0,1=" << distance0 << "," << distance1;
218// std::cout << ",l,r=" << distanceL << "," << distanceR;
219// std::cout << std::endl;
220#endif
221 }
222
223 double right = center + distanceR;
224 double left = center - distanceL;
225
226 return Range( left, right );
227}
228
229void TSegment0::updateType( void ) const {
230 if ( !nLinks() ) return;
231 if ( !_fitted ) update();
232
233 //...Parameter...
234 unsigned fat = 3;
235 unsigned tall = 3;
236
237 //...Calculate
238 updateDuality();
239
240 //...Long or short...
241 if ( ( _innerWidth < fat ) && ( _outerWidth < fat ) )
242 {
243 _clusterType = 1;
244
245 //...Check length across a super layer...
246 if ( _nLayer > tall ) _clusterType = 2;
247 return;
248 }
249
250 //...A...
251 else if ( _outerWidth < fat )
252 {
253 _clusterType = 3;
254 return;
255 }
256
257 //...V...
258 else if ( _innerWidth < fat )
259 {
260 _clusterType = 4;
261 return;
262 }
263
264 //...X or parallel...
265 else
266 {
267 bool space = true;
268 for ( unsigned i = _innerMostLayer; i <= _outerMostLayer; i++ )
269 {
270 unsigned n = 0;
271 AList<TMLink> tmp;
272 for ( unsigned j = 0; j < _links.length(); j++ )
273 if ( _links[j]->wire()->layerId() == i )
274 {
275 ++n;
276 tmp.append( _links[j] );
277 }
278
279 if ( n == Width( tmp ) )
280 {
281 space = false;
282 break;
283 }
284 }
285
286 _clusterType = 5;
287 if ( space ) _clusterType = 6;
288 return;
289 }
290}
291
293 AList<TSegment0> list;
294
295 //...Do not split if cluster type is 1, 2, or 7...
296 unsigned t = clusterType();
297#ifdef TRKRECO_DEBUG_DETAIL
298 std::cout << " ... splitting : type=" << t << std::endl;
299#endif
300 if ( t == 0 ) return list;
301 else if ( t == 2 )
302 {
303 // beta 5 if (_nDual > 2 && _duality > 0.7 && _angle > 0.7)
304 // return splitDual();
305 if ( _nDual > 2 && _duality > 0.7 ) return splitDual();
306 return list;
307 }
308 else if ( t == 1 ) return list;
309 else if ( t == 7 ) return list;
310
311 //...Parallel...
312 else if ( t == 6 ) return splitParallel();
313
314 //...Avoid splitting of X or parallel...(future implementation)...
315 else if ( t > 4 ) return splitComplicated();
316
317 //...A or V...
318 return splitAV();
319}
320
321AList<TSegment0> TSegment0::splitAV( void ) const {
322 unsigned t = clusterType();
323 AList<TMLink> seeds[2];
324
325 //...Calculate corner of V or A...
326 const AList<TMLink>* corners;
327 if ( t == 3 ) corners = &_outers;
328 else corners = &_inners;
329 HepPoint3D corner;
330 for ( unsigned i = 0; i < corners->length(); i++ )
331 corner += ( *corners )[i]->wire()->xyPosition();
332 corner *= 1. / (float)corners->length();
333 seeds[0].append( *corners );
334 seeds[1].append( *corners );
335
336 //...Calculdate edges...
337 const AList<TMLink>* links;
338 if ( t == 3 ) links = &_inners;
339 else links = &_outers;
340 AList<TMLink> edge = Edges( *links );
341 HepPoint3D edgePos[2];
342 HepVector3D v[2];
343 for ( unsigned i = 0; i < 2; i++ )
344 {
345 edgePos[i] = edge[i]->wire()->xyPosition();
346 v[i] = ( edgePos[i] - corner ).unit();
347 }
348 seeds[0].append( edge[0] );
349 seeds[1].append( edge[1] );
350
351#ifdef TRKRECO_DEBUG_DETAIL
352 std::cout << " corner:" << corner << std::endl;
353 std::cout << " edge:" << edgePos[0] << "(";
354 std::cout << edge[0]->wire()->layerId() << "-";
355 std::cout << edge[0]->wire()->localId() << ")";
356 std::cout << v[0] << std::endl;
357 std::cout << " ";
358 std::cout << edgePos[1] << "(";
359 std::cout << edge[1]->wire()->layerId() << "-";
360 std::cout << edge[1]->wire()->localId() << ")";
361 std::cout << v[1] << std::endl;
362#endif
363
364 //...Examine each hits...
365 unsigned n = _links.length();
366 for ( unsigned i = 0; i < n; i++ )
367 {
368 TMLink* l = _links[i];
369 if ( edge.member( l ) ) continue;
370 if ( corners->member( l ) ) continue;
371
372 HepVector3D p = l->wire()->xyPosition() - corner;
373 double p2 = p.mag2();
374
375 double dist[2];
376 for ( unsigned j = 0; j < 2; j++ )
377 {
378 dist[j] = v[j].dot( p );
379 double d2 = dist[j] * dist[j];
380 dist[j] = ( p2 - d2 ) > 0. ? sqrt( p2 - d2 ) : 0.;
381 }
382 if ( dist[0] < dist[1] ) seeds[0].append( l );
383 else seeds[1].append( l );
384
385#ifdef TRKRECO_DEBUG_DETAIL
386 std::cout << " p:" << p << std::endl;
387 std::cout << " " << l->wire()->layerId() << "-";
388 std::cout << l->wire()->localId() << ":" << dist[0];
389 std::cout << "," << dist[1] << std::endl;
390#endif
391 }
392
393 AList<TSegment0> list;
394 for ( unsigned i = 0; i < 2; i++ )
395 {
396 if ( seeds[i].length() )
397 {
398 TSegment0* nc = new TSegment0( seeds[i] );
399 AList<TSegment0> ncx = nc->split();
400 if ( ncx.length() == 0 )
401 {
402 nc->solveDualHits();
403 list.append( nc );
404 }
405 else
406 {
407 list.append( ncx );
408 delete nc;
409 }
410 }
411 }
412 return list;
413}
414
415AList<TSegment0> TSegment0::splitComplicated( void ) const {
416
417 //...Select best hits...
418 AList<TSegment0> newClusters;
419 AList<TMLink> goodHits;
420 unsigned n = _links.length();
421 for ( unsigned i = 0; i < n; i++ )
422 {
423 const TMDCWireHit* h = _links[i]->hit();
424 unsigned state = h->state();
425 if ( !( state & WireHitContinuous ) ) continue;
426 if ( !( state & WireHitIsolated ) ) continue;
427 if ( ( !( state & WireHitPatternLeft ) ) && ( !( state & WireHitPatternRight ) ) )
428 continue;
429 goodHits.append( _links[i] );
430 }
431 if ( goodHits.length() == 0 ) return newClusters;
432
433 //...Main loop...
434 goodHits.sort( SortByWireId );
435 AList<TMLink> original( _links );
436 while ( goodHits.length() )
437 {
438
439 //...Select an edge hit...
440 TMLink* seed = goodHits.last();
441 const TMDCWire* wire = seed->wire();
442 unsigned localId = wire->localId();
443 AList<TMLink> used;
444 unsigned nn = _links.length();
445 for ( unsigned i = 0; i < nn; i++ )
446 {
447 TMLink* t = _links[i];
448 const TMDCWire* w = t->wire();
449
450 //...Straight?...
451 if ( abs( (int)w->localId() - (int)localId ) < 2 ) used.append( t );
452 }
453
454#ifdef TRKRECO_DEBUG_DETAIL
455 std::cout << " seed is " << seed->wire()->name() << std::endl;
456 std::cout << " ";
457 for ( unsigned i = 0; i < used.length(); i++ )
458 { std::cout << used[i]->wire()->name() << ","; }
459 std::cout << std::endl;
460#endif
461
462 //...Create new cluster...
463 if ( used.length() == 0 ) continue;
464 if ( used.length() == nLinks() ) return newClusters;
465 TSegment0* c = new TSegment0( used );
466 AList<TSegment0> cx = c->split();
467 if ( cx.length() == 0 )
468 {
469 c->solveDualHits();
470 newClusters.append( c );
471 }
472 else
473 {
474 newClusters.append( cx );
475 delete c;
476 }
477 goodHits.remove( used );
478 original.remove( used );
479 }
480
481 //...Remainings...
482 if ( ( original.length() ) && ( original.length() < nLinks() ) )
483 {
484 TSegment0* c = new TSegment0( original );
485 AList<TSegment0> cx = c->split();
486 if ( cx.length() == 0 )
487 {
488 c->solveDualHits();
489 newClusters.append( c );
490 }
491 else
492 {
493 newClusters.append( cx );
494 delete c;
495 }
496 }
497
498 return newClusters;
499}
500
501AList<TSegment0> TSegment0::splitParallel( void ) const {
502 AList<TMLink> seeds[2];
503 AList<TSegment0> newClusters;
504 for ( unsigned i = _innerMostLayer; i <= _outerMostLayer; i++ )
505 {
506 AList<TMLink> list = SameLayer( _links, i );
507 AList<TMLink> outerList = Edges( list );
508
509#ifdef TRKRECO_DEBUG_DETAIL
510 if ( outerList.length() != 2 )
511 {
512 std::cout << "TSegment0::splitParallel !!! ";
513 std::cout << "This is not a parallel cluster" << std::endl;
514 }
515#endif
516
517 seeds[0].append( outerList[0] );
518 seeds[1].append( outerList[1] );
519 if ( list.length() == 2 ) continue;
520
521 const TMDCWire& wire0 = *outerList[0]->wire();
522 const TMDCWire& wire1 = *outerList[1]->wire();
523 for ( unsigned k = 0; k < list.length(); k++ )
524 {
525 TMLink* t = list[k];
526 if ( t == outerList[0] ) continue;
527 if ( t == outerList[1] ) continue;
528
529 if ( abs( wire0.localIdDifference( *t->wire() ) ) <
530 abs( wire1.localIdDifference( *t->wire() ) ) )
531 seeds[0].append( t );
532 else seeds[1].append( t );
533 }
534 }
535
536 if ( ( seeds[0].length() ) && ( seeds[0].length() < nLinks() ) )
537 {
538 TSegment0* c0 = new TSegment0( seeds[0] );
539 AList<TSegment0> c0x = c0->split();
540 if ( c0x.length() )
541 {
542 newClusters.append( c0x );
543 delete c0;
544 }
545 else
546 {
547 c0->solveDualHits();
548 newClusters.append( c0 );
549 }
550 }
551
552 if ( ( seeds[1].length() ) && ( seeds[1].length() < nLinks() ) )
553 {
554 TSegment0* c1 = new TSegment0( seeds[1] );
555 AList<TSegment0> c1x = c1->split();
556 if ( c1x.length() )
557 {
558 newClusters.append( c1x );
559 delete c1;
560 }
561 else
562 {
563 c1->solveDualHits();
564 newClusters.append( c1 );
565 }
566 }
567
568 return newClusters;
569}
570
571void TSegment0::updateDuality( void ) const {
572 _duality = 0.;
573 _nDual = 0;
574 HepPoint3D x[2];
575 for ( unsigned i = _innerMostLayer; i <= _outerMostLayer; i++ )
576 {
577 AList<TMLink> list = SameLayer( _links, i );
578 if ( i == _innerMostLayer )
579 {
580 for ( unsigned j = 0; j < list.length(); j++ ) x[0] += list[j]->hit()->xyPosition();
581 x[0] *= 1. / double( list.length() );
582 }
583 else if ( i == _outerMostLayer )
584 {
585 for ( unsigned j = 0; j < list.length(); j++ ) x[1] += list[j]->hit()->xyPosition();
586 x[1] *= 1. / double( list.length() );
587 }
588
589 if ( list.length() == 2 )
590 {
591 if ( Width( list ) != 2 ) continue;
592 const TMDCWireHit* h0 = list[0]->hit();
593 const TMDCWireHit* h1 = list[1]->hit();
594
595 double distance = ( h0->xyPosition() - h1->xyPosition() ).mag();
596 distance = fabs( distance - h0->drift() - h1->drift() );
597 _duality += distance;
598 ++_nDual;
599 }
600 }
601 if ( _nDual > 0 ) _duality /= float( _nDual );
602 _angle = ( x[1] - x[0] ).unit().dot( x[0].unit() );
603}
604
605AList<TSegment0> TSegment0::splitDual( void ) const {
606#ifdef TRKRECO_DEBUG_DETAIL
607 std::cout << " TSegment0::splitDual called" << std::endl;
608#endif
609 AList<TMLink> seeds[2];
610 AList<TMLink> unknown;
611 for ( unsigned i = _innerMostLayer; i <= _outerMostLayer; i++ )
612 {
613 AList<TMLink> list = SameLayer( _links, i );
614
615 if ( list.length() == 2 )
616 {
617 if ( Width( list ) == 2 )
618 {
619 seeds[0].append( list[0] );
620 seeds[1].append( list[1] );
621 continue;
622 }
623 }
624 unknown.append( list );
625 }
626
627 if ( unknown.length() > 0 )
628 {
629#ifdef TRKRECO_DEBUG_DETAIL
630 if ( seeds[0].length() == 0 )
631 std::cout << "TSegment0::splitDual !!! no TMLink for seed 0" << std::endl;
632 if ( seeds[1].length() == 0 )
633 std::cout << "TSegment0::splitDual !!! no TMLink for seed 1" << std::endl;
634#endif
635 const HepPoint3D& p0 = seeds[0][0]->xyPosition();
636 const HepPoint3D& p1 = seeds[1][0]->xyPosition();
637 HepVector3D v0 = ( seeds[0].last()->xyPosition() - p0 ).unit();
638 HepVector3D v1 = ( seeds[1].last()->xyPosition() - p1 ).unit();
639
640 for ( unsigned i = 0; i < unknown.length(); i++ )
641 {
642 TMLink* t = unknown[i];
643 HepVector3D x0 = t->xyPosition() - p0;
644 double d0 = ( x0 - ( x0.dot( v0 ) * v0 ) ).mag();
645 HepVector3D x1 = t->xyPosition() - p1;
646 double d1 = ( x1 - ( x1.dot( v0 ) * v0 ) ).mag();
647
648 if ( d0 < d1 ) seeds[0].append( t );
649 else seeds[1].append( t );
650 }
651 }
652
653 AList<TSegment0> newClusters;
654 newClusters.append( new TSegment0( seeds[0] ) );
655 newClusters.append( new TSegment0( seeds[1] ) );
656 return newClusters;
657}
658
660 updateType();
661 if ( _clusterType == 0 ) return 0;
662 if ( _nDual == 0 ) return 0;
663
664 AList<TMLink> seeds;
665 AList<TMLink> duals;
666 for ( unsigned i = _innerMostLayer; i <= _outerMostLayer; i++ )
667 {
668 AList<TMLink> list = SameLayer( _links, i );
669
670 if ( list.length() == 1 ) { seeds.append( list[0] ); }
671 else if ( list.length() == 2 )
672 {
673 if ( Width( list ) > 1 )
674 {
675 const TMDCWireHit* h0 = list[0]->hit();
676 const TMDCWireHit* h1 = list[1]->hit();
677 double distance = ( h0->xyPosition() - h1->xyPosition() ).mag();
678 distance = fabs( distance - h0->drift() - h1->drift() );
679 if ( distance > 0.5 ) duals.append( list );
680#ifdef TRKRECO_DEBUG_DETAIL
681// h0->dump();
682// h1->dump();
683// std::cout << "duality distance = " << distance << std::endl;
684// std::cout << "i = " << i << std::endl;
685#endif
686 }
687 }
688 else if ( list.length() == 0 ) { continue; }
689#ifdef TRKRECO_DEBUG_DETAIL
690 else
691 {
692 std::cout << "TSegment0::solveDualHits !!! this is not expected 2";
693 std::cout << std::endl;
694 this->dump( "cluster hits mc", " " );
695 }
696#endif
697 }
698
699 //...Solve them...
700 if ( seeds.length() < 2 ) return -1;
701 AList<TMLink> outers = InOut( seeds );
702 const HepPoint3D& p = outers[0]->xyPosition();
703 HepVector3D v = ( outers[1]->xyPosition() - p ).unit();
704 unsigned n = duals.length() / 2;
705 for ( unsigned i = 0; i < n; i++ )
706 {
707 TMLink* t0 = duals[i * 2 + 0];
708 TMLink* t1 = duals[i * 2 + 1];
709 HepVector3D x0 = t0->xyPosition() - p;
710 HepVector3D x1 = t1->xyPosition() - p;
711 double d0 = ( x0 - ( x0.dot( v ) * v ) ).mag();
712 double d1 = ( x1 - ( x1.dot( v ) * v ) ).mag();
713 if ( d0 < d1 ) _links.remove( t1 );
714 else _links.remove( t0 );
715 }
716 return n;
717}
718
719/*
720#include "tuple/BelleTupleManager.h"
721
722void
723CheckSegments(const CAList<TSegment0> & list) {
724 static bool first = true;
725 static BelleHistogram * hError;
726 static BelleHistogram * hNHeps[11];
727 static BelleHistogram * hNHits[3];
728
729 if (first) {
730 first = false;
731 extern BelleTupleManager * BASF_Histogram;
732 BelleTupleManager * m = BASF_Histogram;
733
734 hError = m->histogram("segment errors", 10, 0, 10, 20000);
735
736 hNHeps[0] = m->histogram("segment nheps sl 0", 10, 0., 10.);
737 hNHeps[1] = m->histogram("segment nheps sl 1", 10, 0., 10.);
738 hNHeps[2] = m->histogram("segment nheps sl 2", 10, 0., 10.);
739 hNHeps[3] = m->histogram("segment nheps sl 3", 10, 0., 10.);
740 hNHeps[4] = m->histogram("segment nheps sl 4", 10, 0., 10.);
741 hNHeps[5] = m->histogram("segment nheps sl 5", 10, 0., 10.);
742 hNHeps[6] = m->histogram("segment nheps sl 6", 10, 0., 10.);
743 hNHeps[7] = m->histogram("segment nheps sl 7", 10, 0., 10.);
744 hNHeps[8] = m->histogram("segment nheps sl 8", 10, 0., 10.);
745 hNHeps[9] = m->histogram("segment nheps sl 9", 10, 0., 10.);
746 hNHeps[10] = m->histogram("segment nheps sl 10", 10, 0., 10.);
747
748 hNHits[0] = m->histogram("segment nhits, nheps = 1", 20, 0., 20.);
749 hNHits[1] = m->histogram("segment nhits, nheps = 2", 20, 0., 20.);
750 hNHits[2] = m->histogram("segment nhits, nheps >= 3", 20, 0., 20.);
751
752 std::cout << "CheckSegments ... initialized" << std::endl;
753 return;
754 }
755
756 unsigned n = list.length();
757 for (unsigned i = 0; i < n; i++) {
758 const TSegment0 & s = * list[i];
759 const AList<TMLink> & links = s.links();
760 unsigned nLinks = links.length();
761 if (nLinks == 0) {
762 hError->accumulate(0.5);
763 continue;
764 }
765
766 unsigned sl = links[0]->wire()->superLayerId();
767 unsigned nHeps = s.nHeps();
768 hNHeps[sl]->accumulate((float) nHeps + .5);
769 if (nHeps == 1) hNHits[0]->accumulate((float) nLinks + .5);
770 else if (nHeps == 2) hNHits[1]->accumulate((float) nLinks + .5);
771 else hNHits[2]->accumulate((float) nLinks + .5);
772 }
773}
774
775void
776CheckSegmentLink(const TSegment0 & base,
777 const TSegment0 & next,
778 float distance,
779 float dirAngle) {
780 static bool first = true;
781 static BelleHistogram * hAngle[2];
782 static BelleHistogram * hAngle1[2];
783 static BelleHistogram * hDistance[2];
784 static BelleHistogram * hDirAngle[2];
785 static BelleHistogram * hDirAngle1[2];
786
787 if (first) {
788 first = false;
789 extern BelleTupleManager * BASF_Histogram;
790 BelleTupleManager * m = BASF_Histogram;
791
792 hAngle[0] = m->histogram("segment correct link, angle",
793 50, -1., 1., 21000);
794 hAngle[1] = m->histogram("segment wrong link, angle", 50, -1., 1.);
795 hAngle1[0] = m->histogram("segment correct link, angle, wide",
796 50, .8, 1.);
797 hAngle1[1] = m->histogram("segment wrong link, angle, wide",
798 50, .8, 1.);
799 hDistance[0] = m->histogram("segment correct link, dist", 50, 0., 1.);
800 hDistance[1] = m->histogram("segment wrong link, dist", 50, 0., 1.);
801 hDirAngle[0] = m->histogram("segment correct link, dir angle",
802 50, -1, 1.);
803 hDirAngle[1] = m->histogram("segment wrong link, dir angle",
804 50, -1, 1.);
805 hDirAngle1[0] = m->histogram("segment correct link, dir angle, wide",
806 50, .8, 1.);
807 hDirAngle1[1] = m->histogram("segment wrong link, dir angle, wide",
808 50, .8, 1.);
809
810 std::cout << "CheckSegmentLink ... initialized" << std::endl;
811 return;
812 }
813
814 const TTrackHEP * const hep0 = base.hep();
815 const TTrackHEP * const hep1 = next.hep();
816
817 float angle = base.direction().dot(next.direction());
818
819 unsigned id = 0;
820 if (hep0 != hep1) id = 1;
821 hAngle[id]->accumulate(angle);
822 hAngle1[id]->accumulate(angle);
823 hDistance[id]->accumulate(distance);
824 hDirAngle[id]->accumulate(dirAngle);
825 hDirAngle1[id]->accumulate(dirAngle);
826}
827*/
828
829unsigned NCoreLinks( const CAList<TSegment0>& list ) {
830 unsigned n = 0;
831 unsigned nList = list.length();
832 for ( unsigned i = 0; i < nList; i++ )
833 {
834 const AList<TMLink>& links = list[i]->links();
835 for ( unsigned j = 0; j < links.length(); j++ )
836 {
837 unsigned state = links[j]->hit()->state();
838 if ( ( !( state & WireHitPatternLeft ) ) && ( !( state & WireHitPatternRight ) ) ) ++n;
839 }
840 }
841 return n;
842}
843
846
847 const AList<TMLink>& links = s.links();
848 const AList<TMLink>& trackLinks = t.links();
849 unsigned n = links.length();
850 for ( unsigned i = 0; i < n; i++ )
851 {
852 if ( trackLinks.hasMember( links[i] ) ) a.append( links[i] );
853 }
854
855 return a;
856}
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)
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
HepGeom::Vector3D< double > HepVector3D
#define M_PI
Definition TConstant.h:4
unsigned NCoreLinks(const CAList< TSegment0 > &list)
returns # of core links in segments.
AList< TMLink > Links(const TSegment0 &s, const TTrack &t)
returns AList of TMLink used for a track.
to specify 1-dim region or range by two floats
float drift(unsigned) const
returns drift distance.
const HepPoint3D & xyPosition(void) const
returns drift time
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.
int localIdDifference(const TMDCWire &) const
returns local id difference.
Definition TMDCWire.cxx:575
std::string name(void) const
returns name.
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 TSegment0.cxx:49
int solveDualHits(void)
double distance(const TSegment0 &) const
calculates distance between two clusters. Smaller value indicates closer.
Range rangeX(double min, double max) const
returns Range of x-coordinate of TMLinks.
AList< TSegment0 > split(void) const
TSegment0()
Constructor.
Definition TSegment0.cxx:22
virtual ~TSegment0()
Destructor.
Definition TSegment0.cxx:47
const HepPoint3D & position(void) const
returns position.
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