BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TWindow.cxx
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TWindow.cxx,v 1.7 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TWindow.cc
5// Section : Tracking MDC
6// Owner : Yoshi Iwasaki
7// Email : yoshihito.iwasaki@kek.jp
8//-----------------------------------------------------------------------------
9// Description : A class to display tracking object.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifdef TRKRECO_WINDOW
14
15# include <time.h>
16// #include "belle.h"
17// #include BELLETDF_H
18// #include "tables/bestdf.h"
19// #include "CLHEP/String/Strings.h"
20# include "TrkReco/TConformalFinder0.h"
21# include "TrkReco/TMDC.h"
22# include "TrkReco/TMDCWireHitMC.h"
23# include "TrkReco/TMLine.h"
24# include "TrkReco/TMLink.h"
25# include "TrkReco/TSegment.h"
26# include "TrkReco/TTrack.h"
27# include "TrkReco/TTrackHEP.h"
28# include "TrkReco/TWindow.h"
29
30extern struct {
31 int unpack_truncate;
32 int unpackAll;
33} calcdc_unpack_;
34
35bool TWindow::_skipAllWindow = false;
36
37TWindow::TWindow( const TWindow& a )
38 : _name( "copy of " + a._name )
39 , _window( 600, 600, _name.c_str() )
40 , _wireName( a._wireName )
41 , _coordinate( a._coordinate )
42 , _xmin( a._xmin )
43 , _xmax( a._xmax )
44 , _ymin( a._ymin )
45 , _display( false )
46 , _objects( a._objects )
47 , _colors( a._colors )
48 , _targetRun( a._targetRun )
49 , _targetEvent( a._targetEvent )
50 , _mode( a._mode )
51 , _axial( a._axial )
52 , _stereo( a._stereo )
53 , _skip( false )
54 , _segmentLink( a._segmentLink )
55 , _segmentProperty( a._segmentProperty )
56 , _text( a._text )
57 , _canDelete( false )
58 , _nEvents( a._nEvents ) {
59 for ( unsigned i = 0; i < 4; i++ ) _zoomHistory[i] = a._zoomHistory[i];
60 _window.set_show_coordinates( _coordinate );
61 _window.buttons_per_line( 7 );
62 _closeButton = _window.button( "next" );
63 _wireNameButton = _window.button( "wire #" );
64 _axialButton = _window.button( "axial" );
65 _stereoButton = _window.button( "stereo" );
66 _coordinateButton = _window.button( "coordinate" );
67 _zoomInButton = _window.button( "zoom in" );
68 _zoomOutButton = _window.button( "zoom out" );
69 _skipButton = _window.button( "skip" );
70 _skipAllButton = _window.button( "skip all" );
71 _szButton = _window.button( "rphi/sz" );
72 _confButton = _window.button( "conformal" );
73 _segmentLinkButton = _window.button( "sgmt link" );
74 _segmentPropertyButton = _window.button( "sgmt vec" );
75 _copyButton = _window.button( "window cp" );
76 _window.init( _xmin, _xmax, _ymin );
77}
78
79TWindow::TWindow( const std::string& name )
80 : _name( name )
81 , _window( 600, 600, name.c_str() )
82 , _wireName( false )
83 , _coordinate( false )
84 , _xmin( -100 )
85 , _xmax( 100 )
86 , _ymin( -100 )
87 , _display( false )
88 , _targetRun( 0 )
89 , _targetEvent( 0 )
90 , _mode( 0 )
91 , _axial( true )
92 , _stereo( false )
93 , _skip( false )
94 , _segmentLink( false )
95 , _segmentProperty( false )
96 , _canDelete( true )
97 , _nEvents( 0 ) {
98 _window.set_show_coordinates( _coordinate );
99 _window.buttons_per_line( 7 );
100 _closeButton = _window.button( "next" );
101 _wireNameButton = _window.button( "wire #" );
102 _axialButton = _window.button( "axial" );
103 _stereoButton = _window.button( "stereo" );
104 _coordinateButton = _window.button( "coordinate" );
105 _zoomInButton = _window.button( "zoom in" );
106 _zoomOutButton = _window.button( "zoom out" );
107 _skipButton = _window.button( "skip" );
108 _skipAllButton = _window.button( "skip all" );
109 _szButton = _window.button( "rphi/sz" );
110 _confButton = _window.button( "conformal" );
111 _segmentLinkButton = _window.button( "sgmt link" );
112 _segmentPropertyButton = _window.button( "sgmt vec" );
113 _copyButton = _window.button( "window cp" );
114 _window.init( _xmin, _xmax, _ymin );
115 _zoomHistory[0].push( HepVector3D( _xmin, _xmax, _ymin ) );
116 _zoomHistory[1].push( HepVector3D( 0., 7., 0. ) );
117 _zoomHistory[2].push( HepVector3D( _xmin, _xmax, _ymin ) );
118 _zoomHistory[3].push( HepVector3D( -0.28, 0.28, -0.28 ) );
119}
120
121TWindow::~TWindow() { clear(); }
122
123void TWindow::wait( void ) {
124 if ( _skip ) return;
125 if ( _skipAllWindow ) return;
126 if ( !target() ) return;
127 draw();
128
129 bool loop = true;
130 bool zoom = false;
131
132 while ( loop )
133 {
134
135 //...Read input...
136 double x0, y0;
137 int b = _window.read_mouse( x0, y0 );
138
139 //...Close...
140 if ( b == _closeButton ) loop = false;
141 else if ( b == _szButton )
142 {
143 if ( _mode != 0 ) _mode = 0;
144 else if ( _mode != 2 ) _mode = 2;
145 draw();
146 }
147 else if ( b == _confButton )
148 {
149 if ( _mode != 3 ) _mode = 3;
150 else if ( _mode != 1 ) _mode = 1;
151 draw();
152 }
153 else if ( b == _segmentLinkButton )
154 {
155 _segmentLink = !_segmentLink;
156 draw();
157 }
158 else if ( b == _segmentPropertyButton )
159 {
160 _segmentProperty = !_segmentProperty;
161 draw();
162 }
163 else if ( b == _skipButton )
164 {
165 loop = false;
166 _skip = true;
167 }
168 else if ( b == _skipAllButton )
169 {
170 loop = false;
171 _skipAllWindow = true;
172 }
173 else if ( b == _coordinateButton )
174 {
175 _coordinate = !_coordinate;
176 _window.set_show_coordinates( _coordinate );
177 draw();
178 }
179 else if ( b == _wireNameButton )
180 {
181 _wireName = !_wireName;
182 draw();
183 }
184 else if ( b == _axialButton )
185 {
186 _axial = !_axial;
187 draw();
188 }
189 else if ( b == _stereoButton )
190 {
191 _stereo = !_stereo;
192 draw();
193 }
194 else if ( b == _copyButton )
195 {
196 TWindow tmp = *this;
197 tmp.wait();
198 }
199 else if ( b == _zoomInButton ) { zoom = true; }
200 else if ( b == _zoomOutButton )
201 {
202 if ( zoom ) continue;
203 if ( _zoomHistory[_mode].size() > 1 ) { _zoomHistory[_mode].pop(); }
204 else
205 {
206 _zoomHistory[_mode].pop();
207 _xmin *= 2.;
208 _xmax *= 2.;
209 _ymin *= 2.;
210 _zoomHistory[_mode].push( HepVector3D( _xmin, _xmax, _ymin ) );
211 }
212 zoom = false;
213 draw();
214 }
215 else if ( b == MOUSE_BUTTON( 1 ) )
216 {
217 if ( zoom )
218 {
219 double x, y;
220 int bb = _window.read_mouse_rect( x0, y0, x, y );
221 double xx( x0 < x ? x0 : x );
222 double xxx( x0 < x ? x : x0 );
223 double yy( y0 < y ? y0 : y );
224 _zoomHistory[_mode].push( HepVector3D( xx, xxx, yy ) );
225 draw();
226 zoom = false;
227 }
228 }
229 }
230}
231
232void TWindow::draw( void ) {
233 if ( !target() ) return;
234 if ( !_display ) open();
235
236 _window.clear();
237 _nYLine = 0;
238 HepVector3D z( _zoomHistory[_mode].top() );
239 _window.init( z.x(), z.y(), z.z() );
240
241 double xmin = _window.xmin();
242 double xmax = _window.xmax();
243 double ymin = _window.ymin();
244 double ymax = _window.ymax();
245 double x = xmin + ( xmax - xmin ) * .05;
246 double y = ymin + ( ymax - ymin ) * .03;
247 _xPositionText = x;
248 _yPositionText = y;
249 _yPositionStep = ( ymax - ymin ) * .03;
250
251 drawCdc();
252 drawAxes();
253 drawHeader();
254
255 unsigned n = _objects.length();
256 for ( unsigned i = 0; i < n; i++ )
257 {
258 const TTrackBase& track = *_objects[i];
259 if ( track.objectType() == Line ) drawLine( (const TMLine&)track, *_colors[i] );
260 else if ( track.objectType() == TrackBase ) drawBase( track, *_colors[i] );
261 else if ( track.objectType() == Track ) drawTrack( (const TTrack&)track, *_colors[i] );
262 else if ( track.objectType() == Segment )
263 drawSegment( (const TSegment&)track, *_colors[i] );
264 else std::cout << "TWindow::draw !!! can't display" << std::endl;
265 }
266
267 //...Text...
268 _window.draw_text( _xPositionText, _yPositionText, _text.c_str() );
269 // _window.draw_text(_xPositionText, _yPositionText, (const char *) _text);
270}
271
272void TWindow::drawBase( const TTrackBase& base, leda_color c ) {
273 const AList<TMLink>& links = base.links();
274 unsigned n = links.length();
275 for ( unsigned i = 0; i < n; i++ )
276 {
277 if ( links[i]->wire() == NULL ) continue;
278 if ( !_stereo )
279 if ( links[i]->wire()->stereo() ) continue;
280 if ( !_axial )
281 if ( links[i]->wire()->axial() ) continue;
282
283 //...s-z mode...
284 if ( _mode == 2 )
285 {
286
287 //...Points...
288 HepPoint3D x = links[i]->position();
289 _window.draw_point( x.x(), x.y(), c );
290 if ( _wireName )
291 {
292 std::string n = links[i]->wire()->name() + ":";
293
294 if ( links[i]->hit()->mc() )
295 n += "(" + std::to_string( links[i]->hit()->mc()->hep()->id() ) + ")";
296
297 n += std::to_string( links[i]->leftRight() );
298 _window.draw_text( x.x(), x.y(), n.c_str() );
299 }
300 }
301
302 //...Rphi mode...
303 else if ( _mode == 0 )
304 {
305
306 //...Points...
307 HepPoint3D x = links[i]->wire()->forwardPosition();
308 double radius = links[i]->hit()->drift();
309 _window.draw_circle( x.x(), x.y(), radius, c );
310 if ( _wireName ) _window.draw_text( x.x(), x.y(), wireName( *links[i] ).c_str() );
311 }
312
313 //...Conformal mode...
314 else if ( _mode == 1 )
315 {
316
317 //...Transformation...
319 list.append( (TMDCWireHit*)links[i]->hit() );
320 AList<TMLink> list2;
322
323 //...Points...
324 HepPoint3D x = list2[0]->position();
325 _window.draw_point( x.x(), x.y(), c );
326 if ( _wireName )
327 {
328 std::string n = links[i]->wire()->name();
329 _window.draw_text( x.x(), x.y(), n.c_str() );
330 }
331 }
332
333 //...Conformal mode...
334 else if ( _mode == 3 )
335 {
336
337 //...Points...
338 HepPoint3D x = links[i]->position();
339 _window.draw_point( x.x(), x.y(), c );
340 if ( _wireName )
341 {
342 std::string n = links[i]->wire()->name();
343 _window.draw_text( x.x(), x.y(), n.c_str() );
344 }
345 }
346 }
347}
348
349void TWindow::drawSegment( const TSegment& base, leda_color c ) {
350 AList<TMLink> links = base.links();
351 links.sort( SortByWireId );
352 unsigned n = links.length();
353 HepPoint3D x;
354 HepPoint3D y;
355 for ( unsigned i = 0; i < n; i++ )
356 {
357 if ( !_stereo )
358 if ( links[i]->wire()->stereo() ) return;
359 if ( !_axial )
360 if ( links[i]->wire()->axial() ) return;
361
362 //...s-z mode...
363 if ( _mode == 2 )
364 {
365 x = links[i]->position();
366 _window.draw_point( x.x(), x.y(), c );
367 if ( _wireName )
368 {
369 std::string n =
370 links[i]->wire()->name() + ":" + std::to_string( links[i]->leftRight() );
371 _window.draw_text( x.x(), x.y(), n.c_str() );
372 }
373 if ( i ) _window.draw_segment( y.x(), y.y(), x.x(), x.y(), c );
374 y = x;
375 }
376
377 //...Rphi mode...
378 else if ( _mode == 0 )
379 {
380 x = links[i]->wire()->forwardPosition();
381 double radius = links[i]->hit()->drift();
382 _window.draw_circle( x.x(), x.y(), radius, c );
383 if ( _wireName )
384 _window.draw_text( x.x(), x.y(), (const char*)wireName( *links[i] ).c_str() );
385 if ( i ) _window.draw_segment( y.x(), y.y(), x.x(), x.y(), c );
386 y = x;
387 }
388
389 //...Conformal mode...
390 else if ( _mode == 1 )
391 {
392
393 //...Transformation...
395 list.append( (TMDCWireHit*)links[i]->hit() );
396 AList<TMLink> list2;
398
399 //...Points...
400 HepPoint3D x = list2[0]->position();
401 _window.draw_point( x.x(), x.y(), c );
402 if ( _wireName )
403 {
404 std::string n = links[i]->wire()->name();
405 _window.draw_text( x.x(), x.y(), n.c_str() );
406 }
407 if ( i ) _window.draw_segment( y.x(), y.y(), x.x(), x.y(), c );
408 y = x;
409 delete list2[0];
410 }
411
412 //...Conformal mode...
413 else if ( _mode == 3 )
414 {
415
416 //...Transformation...
418 list.append( (TMDCWireHit*)links[i]->hit() );
419 AList<TMLink> list2;
421
422 //...Points...
423 HepPoint3D x = list2[0]->position();
424 _window.draw_point( x.x(), x.y(), c );
425 if ( _wireName )
426 {
427 std::string n = links[i]->wire()->name();
428 _window.draw_text( x.x(), x.y(), n.c_str() );
429 }
430 if ( i ) _window.draw_segment( y.x(), y.y(), x.x(), x.y(), c );
431 y = x;
432 delete list2[0];
433 }
434 }
435
436 if ( _segmentProperty )
437 {
438 if ( _mode == 3 )
439 {
440 float in = links.first()->position().mag();
441 float out = links.last()->position().mag();
442 float length = out - in;
443 HepPoint3D x = base.position() - 0.5 * length * base.direction();
444 HepPoint3D y = base.position() + 0.5 * length * base.direction();
445 _window.draw_segment( y.x(), y.y(), x.x(), x.y(), c );
446 _window.draw_point( base.position().x(), base.position().y(), c );
447 }
448 }
449
450 //...Links to other segments...
451 if ( !_segmentLink ) return;
452 const AList<TSegment>& innerLinks = base.innerLinks();
453 unsigned nLinks = innerLinks.length();
454 for ( unsigned i = 0; i < nLinks; i++ )
455 {
456 if ( i == 0 ) c = leda_blue;
457 else c = leda_pink;
458
459 AList<TMLink> innerTLinks = innerLinks[i]->links();
460 innerTLinks.sort( SortByWireId );
461
462 //...s-z mode...
463 if ( _mode == 2 ) {}
464
465 //...Rphi mode...
466 else if ( _mode == 0 )
467 {
468 x = links[0]->wire()->forwardPosition();
469 y = innerTLinks.last()->wire()->forwardPosition();
470 _window.draw_segment( y.x(), y.y(), x.x(), x.y(), c );
471 // if (base.state() & TSegmentCrowd)
472 // _window.draw_text(x.x(), x.y(), "c");
473 }
474
475 //...Conformal mode...
476 else if ( _mode == 1 )
477 {
478
479 //...Transformation...
481 list.append( (TMDCWireHit*)links[0]->hit() );
482 list.append( (TMDCWireHit*)innerTLinks.last()->hit() );
483 AList<TMLink> list2;
485
486 x = list2[0]->position();
487 y = list2[1]->position();
488 _window.draw_segment( y.x(), y.y(), x.x(), x.y(), c );
489 // if (base.state() & TSegmentCrowd)
490 // _window.draw_text(x.x(), x.y(), "c");
491 }
492
493 //...Conformal mode...
494 else if ( _mode == 3 )
495 {
496
497 //...Transformation...
499 list.append( (TMDCWireHit*)links[0]->hit() );
500 list.append( (TMDCWireHit*)innerTLinks.last()->hit() );
501 AList<TMLink> list2;
503
504 x = list2[0]->position();
505 y = list2[1]->position();
506 _window.draw_segment( y.x(), y.y(), x.x(), x.y(), c );
507 // if (base.state() & TSegmentCrowd)
508 // _window.draw_text(x.x(), x.y(), "c");
509 }
510 }
511}
512
513void TWindow::drawLine( const TMLine& line, leda_color c ) {
514 drawAxes();
515 drawBase( (const TTrackBase&)line, c );
516
517 //...Line...
518 double xmin = _window.xmin();
519 double xmax = _window.xmax();
520 double ymin = xmin * line.a() + line.b();
521 double ymax = xmax * line.a() + line.b();
522 _window.draw_segment( xmin, ymin, xmax, ymax, c );
523}
524
525bool TWindow::target( void ) const {
526 struct belle_event* ev = (struct belle_event*)BsGetEnt( BELLE_EVENT, 1, BBS_No_Index );
527 if ( _targetRun == 0 && _targetEvent == 0 ) return true;
528 if ( ev->m_RunNo == _targetRun && ev->m_EvtNo == _targetEvent ) return true;
529 return false;
530}
531
532void TWindow::target( unsigned run, unsigned farm, unsigned event ) {
533 _targetRun = run;
534 _targetEvent = ( farm << 28 ) + event;
535}
536
537void TWindow::drawTrack( const TTrack& t, leda_color c ) {
538 std::string p = TrackKinematics( t.helix() ) + " " + TrackLayerUsage( t );
539 _window.draw_text( _xPositionText, _yPositionText, p.c_str(), c );
540 _yPositionText += _yPositionStep;
541
542 const AList<TMLink>& links = t.links();
543 unsigned n = links.length();
544 for ( unsigned i = 0; i < n; i++ )
545 {
546 if ( !_stereo )
547 if ( links[i]->wire()->stereo() ) continue;
548 if ( !_axial )
549 if ( links[i]->wire()->axial() ) continue;
550
551 if ( _mode == 0 )
552 {
553 HepPoint3D x = links[i]->wire()->forwardPosition();
554 double radius = links[i]->hit()->drift();
555 _window.draw_circle( x.x(), x.y(), radius, c );
556 if ( _wireName )
557 _window.draw_text( x.x(), x.y(), (const char*)wireName( *links[i] ).c_str() );
558 }
559
560 else if ( _mode == 2 )
561 {
562 HepPoint3D x = links[i]->positionOnTrack();
563 HepPoint3D sz;
564 t.szPosition( x, sz );
565 _window.draw_point( sz.x(), sz.y(), c );
566 if ( _wireName )
567 {
568 std::string n =
569 links[i]->wire()->name() + ":" + std::to_string( links[i]->leftRight() );
570 _window.draw_text( sz.x(), sz.y(), n.c_str() );
571 }
572 x = links[i]->positionOnWire();
573 sz;
574 t.szPosition( x, sz );
575 _window.draw_point( sz.x(), sz.y(), c );
576 if ( _wireName )
577 {
578 std::string n =
579 links[i]->wire()->name() + ":" + std::to_string( links[i]->leftRight() );
580 _window.draw_text( sz.x(), sz.y(), n.c_str() );
581 }
582 }
583
584 //...Conformal mode...
585 else if ( _mode == 1 )
586 {
587
588 //...Transformation...
590 list.append( (TMDCWireHit*)links[i]->hit() );
591 AList<TMLink> list2;
593
594 //...Points...
595 HepPoint3D x = list2[0]->position();
596 _window.draw_point( x.x(), x.y(), c );
597 if ( _wireName )
598 {
599 std::string n = links[i]->wire()->name();
600 _window.draw_text( x.x(), x.y(), n.c_str() );
601 }
602 delete list2[0];
603 }
604
605 //...Conformal mode...
606 else if ( _mode == 3 )
607 {
608
609 //...Transformation...
611 list.append( (TMDCWireHit*)links[i]->hit() );
612 AList<TMLink> list2;
614
615 //...Points...
616 HepPoint3D x = list2[0]->position();
617 _window.draw_point( x.x(), x.y(), c );
618 if ( _wireName )
619 {
620 std::string n = links[i]->wire()->name();
621 _window.draw_text( x.x(), x.y(), n.c_str() );
622 }
623 delete list2[0];
624 }
625 }
626
627 if ( !n )
628 {
629 _window.draw_text( 0., 0., (const char*)"can't display a track" );
630 return;
631 }
632
633 if ( _mode == 0 )
634 {
635
636 //...Parameters...
637 Helix hIp = t.helix();
638 hIp.pivot( ORIGIN );
639 leda_point ip( hIp.x( 0. ).x(), hIp.x( 0. ).y() );
640 const HepPoint3D& pIn = InnerMost( t.cores() )->positionOnTrack();
641 const HepPoint3D& pOut = OuterMost( t.cores() )->positionOnTrack();
642 leda_point in( pIn.x(), pIn.y() );
643 leda_point out( pOut.x(), pOut.y() );
644 if ( in == out )
645 {
646 _window.draw_text( 0., 0., (const char*)"can't display a track" );
647 return;
648 }
649 _window.draw_arc( ip, in, out, c );
650 _window.draw_text( pOut.x(), pOut.y(), t.name().c_str() );
651 }
652
653 else if ( _mode == 2 )
654 {
655 Helix hIp = t.helix();
656 hIp.pivot( ORIGIN );
657
658 double xmin = _window.xmin();
659 double xmax = _window.xmax();
660 double ymin = xmin * hIp.tanl() * t.charge() + hIp.dz();
661 double ymax = xmax * hIp.tanl() * t.charge() + hIp.dz();
662 _window.draw_segment( xmin, ymin, xmax, ymax, c );
663 }
664}
665
666void TWindow::drawAxes( void ) {
667 double xmin = _window.xmin();
668 double xmax = _window.xmax();
669 _window.draw_segment( xmin, 0., xmax, 0., leda_grey2 );
670 double ymin = _window.ymin();
671 double ymax = _window.ymax();
672 _window.draw_segment( 0., ymin, 0., ymax, leda_grey2 );
673}
674
675void TWindow::drawCdc( void ) {
676
677 //...Rphi mode...
678 if ( _mode == 0 )
679 {
680 double r = 8.4;
681 _window.draw_circle( 0., 0., r );
682 r = 88.;
683 _window.draw_circle( 0., 0., r );
684 r = 2.;
685 _window.draw_circle( 0., 0., r );
686 }
687}
688
689void TWindow::clear( void ) {
690 ++_nEvents;
691 // _skip = false;
692 _objects.removeAll();
693 if ( _canDelete )
694 {
695 HepAListDeleteAll( _colors );
696 HepAListDeleteAll( _selfObjects );
697 HepAListDeleteAll( _selfTLinks );
698 }
699}
700
701void TWindow::append( const AList<TMLink>& list, leda_color c ) {
702 TTrackBase* t = new TTrackBase( list );
703 _objects.append( t );
704 _colors.append( new leda_color( c ) );
705 _selfObjects.append( t );
706}
707
708std::string TWindow::wireName( const TMLink& l ) const {
709 unsigned state = l.hit()->state();
710 std::string flag;
711 if ( state & WireHitFindingValid ) flag += "o";
712 if ( state & WireHitFittingValid ) flag += "+";
713 if ( state & WireHitInvalidForFit ) flag += "x";
714 if ( l.hit()->mc() ) flag += "(" + std::to_string( l.hit()->mc()->hep()->id() ) + ")";
715 return l.wire()->name() + flag;
716}
717
718void TWindow::oneShot( const TTrackBase& t, leda_color c ) {
719 append( t, c );
720 wait();
721 unsigned id = _objects.length() - 1;
722 _objects.remove( id );
723 leda_color* b = _colors[id];
724 _colors.remove( id );
725 delete b;
726}
727
728void TWindow::oneShot( const AList<TSegment>& t, leda_color c ) {
729 TTrackBase tmp;
730 for ( unsigned i = 0; i < t.length(); i++ )
731 {
732 const TSegment& s = *t[i];
733 for ( unsigned j = 0; j < s.links().length(); j++ ) tmp.append( *s.links()[j] );
734 }
735
736 append( tmp, c );
737 wait();
738 unsigned id = _objects.length() - 1;
739 _objects.remove( id );
740 leda_color* b = _colors[id];
741 _colors.remove( id );
742 delete b;
743}
744
745void TWindow::appendSz( const TTrack& t, const AList<TMLink>& list, leda_color c ) {
746 unsigned n = list.length();
747 for ( unsigned i = 0; i < n; i++ )
748 {
749 TMLink* l0 = new TMLink( *list[i] );
750 TMLink* l1 = new TMLink( *list[i] );
751 TMLink* l2 = new TMLink( *list[i] );
752 l0->leftRight( WireHitLeft );
753 l1->leftRight( WireHitRight );
754 l2->leftRight( 2 );
755 int err = t.szPosition( *l0 );
756 err = t.szPosition( *l1 );
757 err = t.szPosition( *l2 );
758 AList<TMLink> links;
759 links.append( l0 );
760 links.append( l1 );
761 links.append( l2 );
762 TTrackBase* b = new TTrackBase( links );
763 _objects.append( b );
764 _colors.append( new leda_color( c ) );
765 _selfTLinks.append( l0 );
766 _selfTLinks.append( l1 );
767 _selfTLinks.append( l2 );
768 _selfObjects.append( b );
769 }
770}
771
772void TWindow::appendSz( const TTrack& t, const AList<TSegment>& list, leda_color c ) {
773 unsigned n = list.length();
774 for ( unsigned i = 0; i < n; i++ )
775 {
776 TSegment& s = *list[i];
777 TMLink* l = new TMLink();
778 t.szPosition( s, *l );
779 AList<TMLink> links;
780 links.append( l );
781 TTrackBase* b = new TTrackBase( links );
782 _objects.append( b );
783 _colors.append( new leda_color( c ) );
784 _selfTLinks.append( l );
785 _selfObjects.append( b );
786 }
787}
788
789void TWindow::draw( const TPoint2D& p, leda_color c ) {
790 _window.draw_point( p.x(), p.y(), c );
791}
792
793void TWindow::drawHeader( void ) {
794 struct belle_event* h = (struct belle_event*)BsGetEnt( BELLE_EVENT, 1, BBS_No_Index );
795 if ( !h ) return;
796
797 // static const Hepstd::string sp = " ";
798 static const std::string sp = " ";
799 std::string mc = "mc:" + std::to_string( h->m_ExpMC );
800 std::string exp = "exp:" + std::to_string( h->m_ExpNo );
801 std::string run = "run:" + std::to_string( h->m_RunNo );
802 std::string frm = "frm:" + std::to_string( ( h->m_EvtNo >> 28 ) );
803 std::string evt = "evt:" + std::to_string( ( h->m_EvtNo & 268435455 ) );
804 std::string dat = "dat:" + std::string( ctime( (const time_t*)&h->m_Time ) );
805 std::string fld = "fld:" + dtostring( h->m_BField );
806 std::string ler = "ler:" + dtostring( h->m_ELER );
807 std::string her = "her:" + dtostring( h->m_EHER );
808
809 std::string s0 = "";
810 if ( calcdc_unpack_.unpack_truncate ) s0 += "truncated event";
811 std::string head0 = exp + sp + run + sp + frm + sp + evt;
812 std::string head1 = dat;
813 std::string head2 = fld + sp + ler + sp + her;
814
815 double xmin = _window.xmin();
816 double xmax = _window.xmax();
817 double ymin = _window.ymin();
818 double ymax = _window.ymax();
819 double x0 = xmin + ( xmax - xmin ) * .7;
820 double x1 = xmin + ( xmax - xmin ) * .6;
821 double y0 = ymin + ( ymax - ymin ) * .92;
822 double y1 = ymin + ( ymax - ymin ) * .95;
823 double y2 = ymin + ( ymax - ymin ) * .98;
824 double y3 = ymin + ( ymax - ymin ) * -.90;
825
826 _window.draw_text( x0, y2, head2.c_str() );
827 _window.draw_text( x0, y1, head1.c_str() );
828 _window.draw_text( x0, y0, head0.c_str() );
829
830 _window.draw_text( x1, y3, s0.c_str() );
831}
832
833#endif // TRKRECO_WINDOW
HepGeom::Vector3D< double > HepVector3D
HepGeom::Point3D< double > HepPoint3D
const Int_t n
m_outputFile open("YYYY/m_txt_dir/LumTau_XXXX.txt", ios_base::app)
EvtComplex exp(const EvtComplex &c)
XmlRpcServer s
const HepPoint3D ORIGIN
Constants.
Definition TMDCUtil.cxx:47
std::string TrackLayerUsage(const TTrack &)
Definition TTrack.cxx:3911
std::string TrackKinematics(const TTrack &)
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
const HepPoint3D & pivot(void) const
returns pivot position.
static void conformalTransformationRphi(const HepPoint3D &center, const AList< TMDCWireHit > &hits, AList< TMLink > &links)
static void conformalTransformation(const HepPoint3D &center, const AList< TMDCWireHit > &hits, AList< TMLink > &links)
const TTrackHEP *const hep(void) const
returns a pointer to a GEN_HEPEVT.
const TMDCWireHitMC *const mc(void) const
returns a pointer to TMDCWireHitMC.
std::string name(void) const
returns name.
A class to represent a track in tracking.
double a(void) const
returns coefficient a.
double b(void) const
returns coefficient b.
A class to relate TMDCWireHit and TTrack objects.
const HepVector3D & direction(void) const
returns direction.
const HepPoint3D & position(void) const
returns position.
A virtual class for a track class in tracking.
void append(TMLink &)
appends a TMLink.
const AList< TMLink > & links(unsigned mask=0) const
virtual unsigned objectType(void) const
returns object type.
unsigned id(void) const
returns an id started from 0.
A class to represent a track in tracking.
char * append(const char *str, EvtCyclic3::Index i)
char * c_str(Index i)
int t()
Definition t.c:1