13#include "BesVisLib/BesView.h"
14#include "BesVisLib/BesGeometry.h"
15#include "BesVisLib/BesEvent.h"
16#include "BesVisLib/BesCursor.h"
31 if ( gDebug ) cout <<
"BesView normal ctor called" << endl;
34 fLabel =
new TPaveLabel(0.02,0.17,0.02,0.09,
"3D View");
35 fLabel->SetFillColor(42);
54 fStatusCurrent->Transfer(fStatus3D,1);
56 cout <<
"BesGeometry does not exist! " << endl;
63 fExtentDefault = GetExtent();
74 if ( gDebug ) cout <<
"BesView default dtor called" << endl;
81 delete fStatusCurrent;
89 SetRange(-1.0*m_BesR, -1.0*m_BesR, -0.5*m_BesZ, m_BesR, m_BesR, 0.5*m_BesZ);
101 fStatus3D->
Transfer(fStatusCurrent,0);
103 }
else if ( fViewType &
kXYView ) {
105 fStatusXY->
Transfer(fStatusCurrent,0);
107 }
else if ( fViewType &
kZRView ) {
109 fStatusZR->
Transfer(fStatusCurrent,0);
113 fViewType = ViewType;
124 Int_t iPerspective = 0;
129 fStatusCurrent->
Transfer(fStatus3D,1);
141 for (
int i = 0; i < 2; i++) this->
ZoomView(gPad, fZoomFactor);
149 cout <<
"is there any problem after update from root's version 4.03 to 4.04" << endl;
161 }
else if ( fViewType &
kXYView ) {
168 fStatusCurrent->
Transfer(fStatusXY,1);
180 for (
int i = 0; i < 2; i++) this->
ZoomView(gPad, fZoomFactor);
203 }
else if ( fViewType &
kZRView ) {
210 fStatusCurrent->
Transfer(fStatusZR,1);
222 for (
int i = 0; i < 2; i++) this->
ZoomView(gPad, fZoomFactor);
359 if ( gDebug ) cout <<
"BesView::ClearPad called" << endl;
360 if ( gPad->GetListOfPrimitives() ) gPad->GetListOfPrimitives()->Clear();
368 if ( gDebug ) cout <<
"BesView::ExecuteEvent called" << endl;
371 if (gROOT->GetEditorMode()) {
372 gPad->ExecuteEvent(event,px,py);
378 gPad->SetCursor(kMove);
379 static Double_t xmin, ymin, xmax, ymax, x0, y0;
380 Double_t dx, dy,
x, y;
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);
394 gPad->SetCursor(kMove);
398 x = gPad->AbsPixeltoX(px);
399 y = gPad->AbsPixeltoY(py);
403 gPad->Range(xmin+dx, ymin+dy, xmax+dx, ymax+dy);
409 gPad->SetCursor(kMove);
414 gPad->SetCursor(kPointer);
448 Double_t x1, y1, x2, y2, dx, dy,
x, y, x0, y0;
453 x0 = gPad->PixeltoX(0);
454 y0 = gPad->PixeltoY(0);
455 x = gPad->PixeltoX(px);
456 y = gPad->PixeltoY(py);
460 gPad->Range(x1+dx, y1+dy, x2+dx, y2+dy);
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);
488 fStatusCurrent->
fZoom = ratio;
489 fStatusXY->
fZoom = ratio;
490 fStatusZR->
fZoom = ratio;
498 fMarkerSize = fMarkerSize * fZoomFactor;
535 fMarkerSize = fMarkerSize / fZoomFactor;
569 Float_t Phi2 = (
Phi - 2*TMath::Pi()*Int_t(
Phi/(2*TMath::Pi())))
571 if ( Phi2 < 0 ) Phi2 += 360;
572 if ( Phi2 >= fStatusCurrent->
fPhiRangeMin && Phi2 < fStatusCurrent->fPhiRangeMax ) {
585 if ( gDebug ) cout <<
"BesView::SetPhiRange called" << endl;
625 fLabel->SetY2(-0.78);
629 fLabel->SetLabel(
"3D View");
632 fLabel->SetLabel(
"XY View");
635 fLabel->SetLabel(
"ZR View");
638 fLabel->Draw(
"BR,NDC,SAME");
668 if ( fStatusCurrent->
fFishEye == kTRUE ) {
671 Float_t pvWC[3], pvNDC[3];
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];
681 r = TMath::Sqrt(TMath::Power(pn[0],2)
682 +TMath::Power(pn[1],2));
683 s = TMath::Sqrt(r)/r;
700 if ( fStatusCurrent->
fFishEye == kTRUE ) {
703 Double_t pvWC[3], pvNDC[3];
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];
714 r = TMath::Sqrt(TMath::Power(pn[0],2)
715 +TMath::Power(pn[1],2));
716 s = TMath::Sqrt(r)/r;
733 if ( fStatusCurrent->
fFishEye == kTRUE ) {
736 Float_t pvWC[3], pvNDC[3];
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];
746 r = TMath::Sqrt(TMath::Power(p[0],2)
747 +TMath::Power(p[1],2));
765 if ( fStatusCurrent->
fFishEye == kTRUE ) {
768 Double_t pvWC[3], pvNDC[3];
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];
778 r = TMath::Sqrt(TMath::Power(p[0],2)
779 +TMath::Power(p[1],2));
804 Double_t Pndc[3] = { gPad->AbsPixeltoX(px), gPad->AbsPixeltoY(py), 0};
812 static char info[64];
814 sprintf(info,
"z=%-.3fmm, r=%-.3fmm", pw[2], pw[1]);
817 sprintf(info,
"x=%-.3fmm, y=%-.3fmm", pw[0], pw[1]);
835 fStatusCurrent->
Default(fViewType);
ClassImp(BesView) BesView
double Phi(RecMdcKalTrack *trk)
R__EXTERN BesCursor * gBesCursor
R__EXTERN BesEvent * gEvent
R__EXTERN BesGeometry * gBesGeometry
virtual void DrawHits(Option_t *option)
virtual void DrawTracks(Option_t *option)
virtual void Draw(Option_t *option="3D")
Bool_t fFishEye
visibility flag for Ext Tracks
Float_t fPhiRangeMin
flags for fish eye view
void Transfer(BesStatus *right, Bool_t set)
void Default(EBESViewType type)
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)
virtual void UnzoomView(TVirtualPad *pad=0, Double_t unZoomFactor=1.25)
virtual void NDCtoWC(const Float_t *pn, Float_t *pw)
virtual void ZoomView(TVirtualPad *pad=0, Double_t zoomFactor=1.25)
virtual void SetRange(const Double_t *min, const Double_t *max)
Bool_t IsPerspective() const
virtual void SetParallel()
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)
virtual void ExecuteRotateView(Int_t event, Int_t px, Int_t py)
virtual void SetPerspective()
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)
virtual Int_t GetRSign(Float_t Phi)
void Move(Int_t px, Int_t py)
virtual void UpdateView(Bool_t resetview=kFALSE)
virtual char * GetObjectInfo(Int_t px, Int_t py) const
void SetPhiRange(Float_t PhiMin=0, Float_t PhiMax=180)
virtual void SetViewTypeBare(EBESViewType ViewType, Bool_t resetview=kFALSE)
virtual void SetViewType(EBESViewType ViewType, Bool_t resetview=kFALSE)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual void NDCtoWC(const Float_t *pn, Float_t *pw)
virtual void DefaultRange()
void SetZoomRatio(Double_t ratio)