BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
BesView.cxx
Go to the documentation of this file.
1//
2// BesView.cxx
3//
4
5#include <TROOT.h>
6#include <TCanvas.h>
7#include <TPad.h>
8#include <TPaveLabel.h>
9#include <iostream>
10#include "math.h"
11#include "TMath.h"
12
13#include "BesVisLib/BesView.h"
14#include "BesVisLib/BesGeometry.h"
15#include "BesVisLib/BesEvent.h"
16#include "BesVisLib/BesCursor.h"
17
18using namespace std;
19
20#ifndef __CINT__
22#endif
23
24//_____________________________________________________
25// BesView
26// View class designed for the BesVis display
27//
29 //
30 // BesView normal constructor
31 if ( gDebug ) cout << "BesView normal ctor called" << endl;
32
33 // init Label
34 fLabel = new TPaveLabel(0.02,0.17,0.02,0.09,"3D View");
35 fLabel->SetFillColor(42);
36
37 // init status of 3D view
38 fStatus3D = new BesStatus();
39 fStatus3D->Default(k3DView);
40
41 // init status of XY view
42 fStatusXY = new BesStatus();
43 fStatusXY->Default(kXYView);
44
45 // init status of ZR view
46 fStatusZR = new BesStatus();
47 fStatusZR->Default(kZRView);
48
49 // init status of current view
50 fStatusCurrent = new BesStatus();
51
52 // Init
53 fViewType = k3DView;
54 fStatusCurrent->Transfer(fStatus3D,1);
55 if ( !gBesGeometry ) {
56 cout << "BesGeometry does not exist! " << endl;
57 return;
58 }
59
60 m_BesR = gBesGeometry->GetBesR();
61 m_BesZ = gBesGeometry->GetBesZ();
62 DefaultRange();
63 fExtentDefault = GetExtent();
64
65 fZoomFactor = 1.2;
66 fMarkerSize = 0.1;
67}
68
69//_____________________________________________________
70
72 //
73 // BesView default destructor
74 if ( gDebug ) cout << "BesView default dtor called" << endl;
75
76 delete fLabel;
77
78 delete fStatus3D;
79 delete fStatusXY;
80 delete fStatusZR;
81 delete fStatusCurrent;
82
83}
84
85//_____________________________________________________
86
88{
89 SetRange(-1.0*m_BesR, -1.0*m_BesR, -0.5*m_BesZ, m_BesR, m_BesR, 0.5*m_BesZ);
90}
91
92//_____________________________________________________
93
94void BesView::SetViewType(EBESViewType ViewType, Bool_t resetview) {
95 //
96 // Set type of view
97
98 // check the state of the component before change and copy current status to respective status
99 if ( fViewType & k3DView ){
100
101 fStatus3D->Transfer(fStatusCurrent,0);
102
103 } else if ( fViewType & kXYView ) {
104
105 fStatusXY->Transfer(fStatusCurrent,0);
106
107 } else if ( fViewType & kZRView ) {
108
109 fStatusZR->Transfer(fStatusCurrent,0);
110
111 }
112
113 fViewType = ViewType;
114 ClearPad();
115
116 // Set view direction properly
117 Int_t iret;
118 if ( fViewType & k3DView ) {
119 //cout << "SetViewType 3D" << endl;
120 //
121 // 3D view
122
123 // remember my previous state, set parallel first anyway, then choose perspective or not
124 Int_t iPerspective = 0;
125
126 if (IsPerspective()) iPerspective = 1;
127
128 // copy 3D status to current status
129 fStatusCurrent->Transfer(fStatus3D,1);
130
131 // Geometry exist ?
132 if ( !gBesGeometry ) return;
133
134 // set view
135 if ( resetview ) {
136 //SetView(0, 90, 270, iret);
137 this->Front();
138 this->Center();
139
140 DefaultRange();
141 for (int i = 0; i < 2; i++) this->ZoomView(gPad, fZoomFactor);
142
143 // reset marker size
144 fMarkerSize = 0.1;
145 }
146
147 // Draw geometry
148
149 cout << "is there any problem after update from root's version 4.03 to 4.04" << endl;
150 gBesGeometry->Draw("3D,SAME");
151 //this->SetParralel(); //comment out 2007.5.1 try to use ROOT-5.10.00
152 this->SetParallel();
153 //old version 4.0.3 have a spell mistake BesTView::SetParralel()=>SetParallel()
154 //changed by tianhl at Mon Aug 20 2007
155 if (iPerspective == 1) this->SetPerspective();
156
157 // Draw tracks
158 if ( gEvent ) gEvent->DrawTracks("");
159 //else cout << "3D gEvent does not exist " << endl;
160
161 } else if ( fViewType & kXYView ) {
162 //cout << "SetViewType XY" << endl;
163 //
164 // XY view
165 // =======
166
167 // copy XY status to current status
168 fStatusCurrent->Transfer(fStatusXY,1);
169
170 // Geometry exist ?
171 if ( !gBesGeometry ) return;
172
173 // set view
174 if ( resetview ) {
175 SetView(0, 0, 270, iret);
176 this->Center();
177
178 DefaultRange();
179 DefaultRange();
180 for (int i = 0; i < 2; i++) this->ZoomView(gPad, fZoomFactor);
181
182 // reset marker size
183 fMarkerSize = 0.1;
184
185 }
186
187 /*
188 // Draw event
189 if ( gEvent ) gEvent->SetHits("XY");
190 else cout << "XY : gEvent does not exist " << endl;
191 */
192
193 // Draw geometry
194 gBesGeometry->Draw("XY,SAME");
195
196 // Draw 2D hits and tracks
197 if ( gEvent ) {
198 gEvent->DrawHits("");
199 gEvent->DrawTracks("");
200 }
201 //else cout << "XY : gEvent does not exist " << endl;
202
203 } else if ( fViewType & kZRView ) {
204 //cout << "SetViewType ZR" << endl;
205 //
206 // ZR view
207 // =======
208
209 // copy ZR status to current status
210 fStatusCurrent->Transfer(fStatusZR,1);
211
212 // Geometry exist ?
213 if ( !gBesGeometry ) return;
214
215 // set view
216 if ( resetview ) {
217 SetView(180,90,90,iret);
218 this->Center();
219
220 DefaultRange();
221 DefaultRange();
222 for (int i = 0; i < 2; i++) this->ZoomView(gPad, fZoomFactor);
223
224 // reset marker size
225 fMarkerSize = 0.1;
226
227 }
228
229 /*
230 // Draw event
231 if ( gEvent ) gEvent->SetHits("ZR");
232 else cout << "ZR : gEvent does not exist " << endl;
233 */
234
235 // Draw geometry
236 gBesGeometry->Draw("ZR,SAME");
237
238 // Draw hits and tracks
239 if ( gEvent ) {
240 gEvent->DrawHits("");
241 gEvent->DrawTracks("");
242 }
243 //else cout << "ZR : gEvent does not exist " << endl;
244
245 }
246
247 // Draw label
248 DrawLabel();
249}
250
251void BesView::SetViewTypeBare(EBESViewType ViewType, Bool_t resetview) {
252 /*
253 //
254 // Set type of view
255
256 cout << "setviewtypeBare: start..." << endl;
257 // check the state of the component before change and copy current status to respective status
258 if ( fViewType & k3DView ){
259
260 fStatus3D->Transfer(fStatusCurrent,0);
261
262 } else if ( fViewType & kXYView ) {
263
264 fStatusXY->Transfer(fStatusCurrent,0);
265
266 } else if ( fViewType & kZRView ) {
267
268
269 fStatusZR->Transfer(fStatusCurrent,0);
270
271 }
272
273 fViewType = ViewType;
274 ClearPad();
275
276 // Set view direction properly
277 Int_t iret;
278 cout << "fViewType=" << fViewType << endl;
279 if ( fViewType & k3DView ) {
280 //
281 // 3D view
282
283 // copy 3D status to current status
284 fStatusCurrent->Transfer(fStatus3D,1);
285 // Geometry exist ?
286 if ( !gGeometry ) return;
287
288 // set view
289 if ( resetview ) {
290 SetView(0, 90, 270, iret);
291 SetRange(-600,-600,-400,600,600,800);
292
293 // reset marker size
294 fMarkerSize = 0.1;
295
296 }
297
298 } else if ( fViewType & kXYView ) {
299 //
300 // XY view
301 // =======
302
303 // copy XY status to current status
304 fStatusCurrent->Transfer(fStatusXY,1);
305
306 // Geometry exist ?
307 if ( !gGeometry ) return;
308
309 // set view
310 if ( resetview ) {
311 SetView(270, 0, 0, iret);
312 // SetRange(-200,-200,-200,200,200,200);
313 SetRange(-310,-310,-310,310,310,310);
314 // reset marker size
315 fMarkerSize = 0.1;
316
317 }
318
319 } else if ( fViewType & kZRView ) {
320
321 //
322 // ZR view
323 // =======
324
325 // copy ZR status to current status
326 cout << "fViewType & kZRView: before transfer..." << endl;
327 fStatusCurrent->Transfer(fStatusZR,1);
328 cout << "fViewType & kZRView: after transfer..." << endl;
329
330 // Geometry exist ?
331 if ( !gGeometry ) return;
332
333 // set view
334 if ( resetview ) {
335 SetView(90, 180, 0, iret);
336 // SetRange(-130,-200,-200,270,200,200);
337 SetRange(-160,-400,-400,740,400,400);
338 // reset marker size
339 fMarkerSize = 0.1;
340
341 }
342
343 }
344
345 // Draw label
346 cout << "SetViewTypeBare: no drawlabel" << endl;
347 //DrawLabel();
348 */
349}
350
351//_____________________________________________________
352
354 //
355 // Clear current without deleting this view
356 //
357 // Probably this doesn't work for the postscript output
358 // Look at TPad::Clear() for more details
359 if ( gDebug ) cout << "BesView::ClearPad called" << endl;
360 if ( gPad->GetListOfPrimitives() ) gPad->GetListOfPrimitives()->Clear();
361}
362
363//_____________________________________________________
364
365void BesView::ExecuteEvent(Int_t event, Int_t px, Int_t py) {
366 //
367 // Execute mouse events
368 if ( gDebug ) cout << "BesView::ExecuteEvent called" << endl;
369
370 // Editor mode
371 if (gROOT->GetEditorMode()) {
372 gPad->ExecuteEvent(event,px,py);
373 return;
374 }
375
376 if (gBesCursor->GetType() == kBesHand) {
377
378 gPad->SetCursor(kMove);
379 static Double_t xmin, ymin, xmax, ymax, x0, y0;
380 Double_t dx, dy, x, y;
381 switch (event) {
382
383 case kButton1Down:
384 // Remember position of pointer
385 xmin = gPad->GetX1();
386 ymin = gPad->GetY1();
387 xmax = gPad->GetX2();
388 ymax = gPad->GetY2();
389 x0 = gPad->AbsPixeltoX(px);
390 y0 = gPad->AbsPixeltoY(py);
391 break;
392
393 case kButton1Motion:
394 gPad->SetCursor(kMove);
395
396 case kButton1Up:
397 // Set new pad range
398 x = gPad->AbsPixeltoX(px);
399 y = gPad->AbsPixeltoY(py);
400 dx = -(x - x0);
401 dy = -(y - y0);
402 //((ZPad*)gPad)->SetNoAspect(kTRUE);
403 gPad->Range(xmin+dx, ymin+dy, xmax+dx, ymax+dy);
404 //((ZPad*)gPad)->SetNoAspect(kFALSE);
405 gPad->Modified();
406 break;
407
408 default:
409 gPad->SetCursor(kMove);
410 }
411 }
412 else if (gBesCursor->GetType() == kBesPick){
413
414 gPad->SetCursor(kPointer);
415
416 if ( fViewType & k3DView ) {
417 ExecuteRotateView(event, px, py);
418 }
419 }
420}
421
422//_____________________________________________________
423
424void BesView::Move(Int_t px, Int_t py) {
425
426 /*
427 Double_t p[3], pw[3];
428 for (Int_t i = 0; i < 3; i++) {
429 pw[i] = 0.5*(fRmin[i]+fRmax[i]);
430 }
431 cout << "pw " << pw[0] << " " << pw[1] << " " << pw[2] << endl;
432 WCtoNDC(pw, p);
433 cout << "p " << p[0] << " " << p[1] << " " << p[2] << endl;
434
435 p[0] += (gPad->PixeltoX(0) - gPad->PixeltoX(px));
436 p[1] += (gPad->PixeltoY(0) - gPad->PixeltoY(py));
437 cout << "p " << p[0] << " " << p[1] << " " << p[2] << endl;
438 NDCtoWC(p, pw);
439 cout << "pw " << pw[0] << " " << pw[1] << " " << pw[2] << endl;
440
441 MoveFocus(&pw[0], fRmax[0]-fRmin[0], fRmax[1]-fRmin[1], fRmax[2]-fRmin[2]);
442 gPad->Modified();
443 gPad->Update();
444 */
445
446 //
447 // Move (px, py in pixel coordinates)
448 Double_t x1, y1, x2, y2, dx, dy, x, y, x0, y0;
449 x1 = gPad->GetX1();
450 y1 = gPad->GetY1();
451 x2 = gPad->GetX2();
452 y2 = gPad->GetY2();
453 x0 = gPad->PixeltoX(0);
454 y0 = gPad->PixeltoY(0);
455 x = gPad->PixeltoX(px);
456 y = gPad->PixeltoY(py);
457 dx = -(x - x0);
458 dy = -(y - y0);
459
460 gPad->Range(x1+dx, y1+dy, x2+dx, y2+dy);
461 gPad->Modified();
462}
463
464//_____________________________________________________
465
467 //
468 // Center view
469 //if ( fViewType & k3DView ){
470 //this->Centered();
471 //} else {
472 Double_t xrange, yrange;
473 xrange = gPad->GetX2() - gPad->GetX1();
474 yrange = gPad->GetY2() - gPad->GetY1();
475 gPad->Range(-xrange/2, -yrange/2, xrange/2, yrange/2);
476 gPad->Modified();
477 //}
478}
479
480//_____________________________________________________
481
482void BesView::SetZoomRatio(Double_t ratio)
483{
484 DefaultRange();
485 ZoomView(gPad, ratio);
486
487 //yzhang TEMP FIXME
488 fStatusCurrent->fZoom = ratio;
489 fStatusXY->fZoom = ratio;
490 fStatusZR->fZoom = ratio;
491}
492
493//_____________________________________________________
494
496 //
497 // Magnify
498 fMarkerSize = fMarkerSize * fZoomFactor;
499 ZoomView(gPad, fZoomFactor); // dont use ZoomView as it is not base on center
500
501
502 fStatusCurrent->fZoom = this->GetZoomRatio();
503 fStatusXY->fZoom = this->GetZoomRatio();
504 fStatusZR->fZoom = this->GetZoomRatio();
505 //Double_t scale[3], center[3];
506 //Int_t irep;
507 //FindScope(&scale[0], &center[0], irep);
508 //cout << "scale " << scale[0] << " " << scale[1] << " " << scale[2] << endl;
509 //cout << "center " << center[0] << " " << center[1] << " " << center[2] << endl;
510
511 //Double_t extent = GetExtent();
512 //cout << extent << endl;
513 //cout << GetZoomRatio() << endl;
514
515 /*
516 Double_t x1, y1, x2, y2;
517 x1 = gPad->GetX1();
518 y1 = gPad->GetY1();
519 x2 = gPad->GetX2();
520 y2 = gPad->GetY2();
521
522 Double_t dx = (gPad->GetX2() - gPad->GetX1())*(1-1/fZoomFactor);
523 Double_t dy = (gPad->GetY2() - gPad->GetY1())*(1-1/fZoomFactor);
524
525 gPad->Range(x1+dx/2, y1+dy/2, x2-dx/2, y2-dy/2);
526 gPad->Modified();
527 */
528}
529
530//_____________________________________________________
531
533 //
534 // Demagnify
535 fMarkerSize = fMarkerSize / fZoomFactor;
536 UnzoomView(gPad, fZoomFactor); // dont use ZoomView as it is not base on center
537
538 fStatusCurrent->fZoom = this->GetZoomRatio();
539 fStatusXY->fZoom = this->GetZoomRatio();
540 fStatusZR->fZoom = this->GetZoomRatio();
541 //Double_t extent = GetExtent();
542 //cout << extent << endl;
543 //cout << GetZoomRatio() << endl;
544
545 /*
546 Double_t x1, y1, x2, y2;
547 x1 = gPad->GetX1();
548 y1 = gPad->GetY1();
549 x2 = gPad->GetX2();
550 y2 = gPad->GetY2();
551
552 Double_t dx = (gPad->GetX2() - gPad->GetX1())*(fZoomFactor-1);
553 Double_t dy = (gPad->GetY2() - gPad->GetY1())*(fZoomFactor-1);
554
555 gPad->Range(x1-dx/2, y1-dy/2, x2+dx/2, y2+dy/2);
556 gPad->Modified();
557 */
558}
559
560//_____________________________________________________
561
562Int_t BesView::GetRSign(Float_t Phi) {
563 //
564 // Get sign of the R coordinate (ZR view)
565 // for a given phi (in radians)
566 Int_t Sign;
567
568 // Convert to deg, because phi range is given in degrees
569 Float_t Phi2 = (Phi - 2*TMath::Pi()*Int_t(Phi/(2*TMath::Pi())))
570 * 180./TMath::Pi();
571 if ( Phi2 < 0 ) Phi2 += 360;
572 if ( Phi2 >= fStatusCurrent->fPhiRangeMin && Phi2 < fStatusCurrent->fPhiRangeMax ) {
573 Sign = 1;
574 } else {
575 Sign = -1;
576 }
577 return Sign;
578}
579
580//_____________________________________________________
581
582void BesView::SetPhiRange(Float_t PhiMin, Float_t PhiMax) {
583 //
584 // Set phi range for ZR view
585 if ( gDebug ) cout << "BesView::SetPhiRange called" << endl;
586
587 fStatusCurrent->fPhiRangeMin = PhiMin;
588 fStatusCurrent->fPhiRangeMax = PhiMax;
589
590 // Update view
591 if ( !gBesGeometry ) return;
592 //gEvent->AddBACPadTowerZR();
593 UpdateView(0);
594}
595
596//_____________________________________________________
597
598void BesView::UpdateView(Bool_t resetview) {
599 //
600 // Update current view
601 if ( !gBesGeometry ) return;
602
603 // Redraw
604 SetViewType(fViewType,resetview);
605}
606
607
608// void BesView::Plot_Et_Eta_Phi() {
609// //
610// // View Et_eta_phi histogram
611// static TCanvas *c_hist = new TCanvas("c_eta_phi", "Eta Phi Histogram",
612// 400, 300);
613// c_hist->cd();
614// gEvent->GetHistEt_eta_phi()->Draw("Lego2");
615// }
616
617
619 //
620 // Draw label for current view
621
622 fLabel->SetX1(-0.9);
623 fLabel->SetX2(-0.6);
624 fLabel->SetY1(-0.9);
625 fLabel->SetY2(-0.78);
626
627 switch (fViewType) {
628 case k3DView:
629 fLabel->SetLabel("3D View");
630 break;
631 case kXYView:
632 fLabel->SetLabel("XY View");
633 break;
634 case kZRView:
635 fLabel->SetLabel("ZR View");
636 break;
637 }
638 fLabel->Draw("BR,NDC,SAME");
639
640
641 /*
642 switch (fViewType) {
643 case k3DView:
644 fLabel->DrawPaveLabel(0.02,0.02,0.17,0.09, "3D View", "BR,NDC,SAME");
645 break;
646 case kXYView:
647 //fLabel->SetLabel("XY View");
648 fLabel->DrawPaveLabel(0.02,0.02,0.17,0.09, "XY View", "BR,NDC,SAME");
649 break;
650 case kZRView:
651 fLabel->DrawPaveLabel(0.02,0.02,0.17,0.09, "ZR View", "BR,NDC,SAME");
652 break;
653 }
654 */
655}
656
657//_____________________________________________________
658
659void BesView::WCtoNDC(const Float_t *pw, Float_t *pn) {
660 //
661 // Transform world coordinates to
662 // normalised device coordinates.
663 // This method was taken from BesTView
664 // and extended by FishEye view
665 BesTView::WCtoNDC(pw, pn);
666 //cout << "fFishEye " << fFishEye << endl;
667
668 if ( fStatusCurrent->fFishEye == kTRUE ) {
669 Float_t r, s;
670 if ( fViewType & kZRView ) {
671 Float_t pvWC[3], pvNDC[3];
672 pvWC[0] = +4;
673 pvWC[1] = 0;
674 pvWC[2] = 0;
675 BesTView::WCtoNDC(pvWC, pvNDC);
676 pn[0] = TMath::Sign(Double_t(TMath::Sqrt(TMath::Abs(pn[0] - pvNDC[0]))),
677 Double_t(pn[0] - pvNDC[0])) + pvNDC[0];
678 pn[1] = TMath::Sign(Double_t(TMath::Sqrt(TMath::Abs(pn[1] - pvNDC[1]))),
679 Double_t(pn[1] - pvNDC[1])) + pvNDC[1];
680 } else {
681 r = TMath::Sqrt(TMath::Power(pn[0],2)
682 +TMath::Power(pn[1],2));
683 s = TMath::Sqrt(r)/r;
684 pn[0] *= s;
685 pn[1] *= s;
686 }
687 }
688}
689
690//_____________________________________________________
691
692void BesView::WCtoNDC(const Double_t *pw, Double_t *pn) {
693 //
694 // Transform world coordinates to
695 // normalised device coordinates.
696 // This method was taken from BesTView
697 // and extended by FishEye view
698 BesTView::WCtoNDC(pw, pn);
699
700 if ( fStatusCurrent->fFishEye == kTRUE ) {
701 Double_t r, s;
702 if ( fViewType & kZRView ) {
703 Double_t pvWC[3], pvNDC[3];
704 pvWC[0] = +4;
705 pvWC[1] = 0;
706 pvWC[2] = 0;
707 BesTView::WCtoNDC(pvWC, pvNDC);
708 pn[0] = TMath::Sign(TMath::Sqrt(TMath::Abs(pn[0] - pvNDC[0])),
709 pn[0] - pvNDC[0]) + pvNDC[0];
710 pn[1] = TMath::Sign(TMath::Sqrt(TMath::Abs(pn[1] - pvNDC[1])),
711 pn[1] - pvNDC[1]) + pvNDC[1];
712 } else {
713
714 r = TMath::Sqrt(TMath::Power(pn[0],2)
715 +TMath::Power(pn[1],2));
716 s = TMath::Sqrt(r)/r;
717 pn[0] *= s;
718 pn[1] *= s;
719 }
720 }
721}
722
723//_____________________________________________________
724
725void BesView::NDCtoWC(const Float_t* pn, Float_t* pw) {
726 //
727 // Transform back from NDCs
728 Float_t p[3];
729 p[0] = pn[0];
730 p[1] = pn[1];
731 p[2] = pn[2];
732
733 if ( fStatusCurrent->fFishEye == kTRUE ) {
734 Float_t r;
735 if ( fViewType & kZRView ) {
736 Float_t pvWC[3], pvNDC[3];
737 pvWC[0] = +4;
738 pvWC[1] = 0;
739 pvWC[2] = 0;
740 BesTView::WCtoNDC(pvWC, pvNDC);
741 p[0] = TMath::Sign((pn[0] - pvNDC[0])*(pn[0] - pvNDC[0]),
742 pn[0] - pvNDC[0]) + pvNDC[0];
743 p[1] = TMath::Sign((pn[1] - pvNDC[1])*(pn[1] - pvNDC[1]),
744 pn[1] - pvNDC[1]) + pvNDC[1];
745 } else {
746 r = TMath::Sqrt(TMath::Power(p[0],2)
747 +TMath::Power(p[1],2));
748 p[0] *= r;
749 p[1] *= r;
750 }
751 }
752 BesTView::NDCtoWC(p, pw);
753}
754
755//_____________________________________________________
756
757void BesView::NDCtoWC(const Double_t* pn, Double_t* pw) {
758 //
759 // Transform back from NDCs
760 Double_t p[3];
761 p[0] = pn[0];
762 p[1] = pn[1];
763 p[2] = pn[2];
764
765 if ( fStatusCurrent->fFishEye == kTRUE ) {
766 Double_t r;
767 if ( fViewType & kZRView ) {
768 Double_t pvWC[3], pvNDC[3];
769 pvWC[0] = +4;
770 pvWC[1] = 0;
771 pvWC[2] = 0;
772 BesTView::WCtoNDC(pvWC, pvNDC);
773 p[0] = TMath::Sign((pn[0] - pvNDC[0])*(pn[0] - pvNDC[0]),
774 pn[0] - pvNDC[0]) + pvNDC[0];
775 p[1] = TMath::Sign((pn[1] - pvNDC[1])*(pn[1] - pvNDC[1]),
776 pn[1] - pvNDC[1]) + pvNDC[1];
777 } else {
778 r = TMath::Sqrt(TMath::Power(p[0],2)
779 +TMath::Power(p[1],2));
780 p[0] *= r;
781 p[1] *= r;
782 }
783 }
784 BesTView::NDCtoWC(p, pw);
785}
786
787//_____________________________________________________
788
790 //
791 // set side view for 3D
792
793 this->SetViewType(k3DView,1);
794 Int_t iret;
795 this->SetView(0,90,270,iret);
796}
797
798//_____________________________________________________
799
800char *BesView::GetObjectInfo(Int_t px, Int_t py) const {
801 //
802 // Returns string containing info about the object at position (px,py).
803 Double_t pw[3];
804 Double_t Pndc[3] = { gPad->AbsPixeltoX(px), gPad->AbsPixeltoY(py), 0};
805 ((BesView*)gPad->GetView())->NDCtoWC(Pndc, pw);
806 //cout << gPad->GetName() << endl;
807
808 //
809 // Converts from pixel coordinates to world
810 // coordinates of according view
811
812 static char info[64];
813 if ( fViewType & kZRView ) {
814 sprintf(info, "z=%-.3fmm, r=%-.3fmm", pw[2], pw[1]);
815 return info;
816 } else {
817 sprintf(info, "x=%-.3fmm, y=%-.3fmm", pw[0], pw[1]);
818 return info;
819 }
820}
821
822//_____________________________________________________
823
825 //
826 // reset view to default values
827
828 // reset status instances of views
829 fStatus3D->Default(k3DView);
830 fStatusXY->Default(kXYView);
831 fStatusZR->Default(kZRView);
832 fZoomFactor = 1.2;
833
834 // reset current status instance tp fViewType
835 fStatusCurrent->Default(fViewType);
836
837 // reset phirange
838 // this->SetPhiRange(0,180);
839 this->UpdateView(1);
840 gPad->Update();
841}
ClassImp(BesView) BesView
Definition: BesView.cxx:21
double Phi(RecMdcKalTrack *trk)
Double_t x[10]
XmlRpcServer s
Definition: HelloServer.cpp:11
virtual void DrawHits(Option_t *option)
Definition: BesEvent.cxx:1034
virtual void DrawTracks(Option_t *option)
Definition: BesEvent.cxx:1045
virtual void Draw(Option_t *option="3D")
void Transfer(BesStatus *right, Bool_t set)
Definition: BesStatus.cxx:243
void Default(EBESViewType type)
Definition: BesStatus.cxx:38
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)
Definition: BesTView.cxx:1606
virtual void UnzoomView(TVirtualPad *pad=0, Double_t unZoomFactor=1.25)
Definition: BesTView.cxx:1769
virtual void NDCtoWC(const Float_t *pn, Float_t *pw)
Definition: BesTView.cxx:1176
virtual void ZoomView(TVirtualPad *pad=0, Double_t zoomFactor=1.25)
Definition: BesTView.cxx:1777
virtual void SetRange(const Double_t *min, const Double_t *max)
Definition: BesTView.cxx:1453
virtual void SetParallel()
Definition: BesTView.cxx:1432
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)
Definition: BesTView.cxx:1525
virtual void ExecuteRotateView(Int_t event, Int_t px, Int_t py)
Definition: BesTView.cxx:745
virtual void SetPerspective()
Definition: BesTView.cxx:1442
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)
Definition: BesView.cxx:659
void ZoomIn()
Definition: BesView.cxx:495
virtual ~BesView()
Definition: BesView.cxx:71
virtual Int_t GetRSign(Float_t Phi)
Definition: BesView.cxx:562
void Move(Int_t px, Int_t py)
Definition: BesView.cxx:424
virtual void UpdateView(Bool_t resetview=kFALSE)
Definition: BesView.cxx:598
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Definition: BesView.cxx:800
virtual void ClearPad()
Definition: BesView.cxx:353
void Center()
Definition: BesView.cxx:466
void SetPhiRange(Float_t PhiMin=0, Float_t PhiMax=180)
Definition: BesView.cxx:582
virtual void SetViewTypeBare(EBESViewType ViewType, Bool_t resetview=kFALSE)
Definition: BesView.cxx:251
void Side3D()
Definition: BesView.cxx:789
void ZoomOut()
Definition: BesView.cxx:532
virtual void SetViewType(EBESViewType ViewType, Bool_t resetview=kFALSE)
Definition: BesView.cxx:94
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Definition: BesView.cxx:365
virtual void NDCtoWC(const Float_t *pn, Float_t *pw)
Definition: BesView.cxx:725
virtual void DefaultRange()
Definition: BesView.cxx:87
void SetZoomRatio(Double_t ratio)
Definition: BesView.cxx:482
void Reset()
Definition: BesView.cxx:824
virtual void DrawLabel()
Definition: BesView.cxx:618