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