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);
62 fStatusCurrent->Transfer(fStatus3D,1);
64 cout <<
"BesGeometry does not exist! " << endl;
71 fExtentDefault = GetExtent();
76 ViewCenter[0] = ViewCenter[1] = 0.0;
84 if ( gDebug ) cout <<
"BesView default dtor called" << endl;
91 delete fStatusCurrent;
94 delete fStatusCgemUF[0];
95 delete fStatusCgemUF[1];
96 delete fStatusCgemUF[2];
103 SetRange(-1.0*m_BesR, -1.0*m_BesR, -0.5*m_BesZ, m_BesR, m_BesR, 0.5*m_BesZ);
115 else if (fViewType &
kXYView) { fStatusXY->
Transfer(fStatusCurrent, 0); }
116 else if (fViewType &
kZRView) { fStatusZR->
Transfer(fStatusCurrent, 0); }
122 fViewType = ViewType;
133 Int_t iPerspective = 0;
138 fStatusCurrent->
Transfer(fStatus3D,1);
177 }
else if ( fViewType &
kXYView ) {
184 fStatusCurrent->
Transfer(fStatusXY,1);
223 }
else if ( fViewType &
kZRView ) {
230 fStatusCurrent->
Transfer(fStatusZR,1);
274 fStatusCurrent->
Transfer(fStatusCgemUF[0], 1);
294 fStatusCurrent->
Transfer(fStatusCgemUF[1], 1);
314 fStatusCurrent->
Transfer(fStatusCgemUF[2], 1);
445 if ( gDebug ) cout <<
"BesView::ClearPad called" << endl;
446 if ( gPad->GetListOfPrimitives() ) gPad->GetListOfPrimitives()->Clear();
454 if ( gDebug ) cout <<
"BesView::ExecuteEvent called" << endl;
457 if (gROOT->GetEditorMode()) {
458 gPad->ExecuteEvent(event,px,py);
464 gPad->SetCursor(kMove);
465 static Double_t xmin, ymin, xmax, ymax, x0, y0;
466 Double_t dx, dy,
x, y;
471 xmin = gPad->GetX1();
472 ymin = gPad->GetY1();
473 xmax = gPad->GetX2();
474 ymax = gPad->GetY2();
475 x0 = gPad->AbsPixeltoX(px);
476 y0 = gPad->AbsPixeltoY(py);
480 gPad->SetCursor(kMove);
484 x = gPad->AbsPixeltoX(px);
485 y = gPad->AbsPixeltoY(py);
489 gPad->Range(xmin+dx, ymin+dy, xmax+dx, ymax+dy);
493 ViewCenter[0] = (xmin + xmax) / 2 + dx;
494 ViewCenter[1] = (ymin + ymax) / 2 + dy;
498 gPad->SetCursor(kMove);
503 gPad->SetCursor(kPointer);
537 Double_t x1, y1, x2, y2, dx, dy,
x, y, x0, y0;
542 x0 = gPad->PixeltoX(0);
543 y0 = gPad->PixeltoY(0);
544 x = gPad->PixeltoX(px);
545 y = gPad->PixeltoY(py);
549 gPad->Range(x1+dx, y1+dy, x2+dx, y2+dy);
553 ViewCenter[0] = (x1 + x2) / 2 + dx;
554 ViewCenter[1] = (y1 + y2) / 2 + dy;
565 Double_t xrange, yrange;
566 xrange = gPad->GetX2() - gPad->GetX1();
567 yrange = gPad->GetY2() - gPad->GetY1();
568 gPad->Range(-xrange/2, -yrange/2, xrange/2, yrange/2);
572 ViewCenter[0] = ViewCenter[1] = 0.0;
581 Double_t dx = (ratio /
GetZoomRatio() - 1) * ViewCenter[0];
582 Double_t dy = (ratio /
GetZoomRatio() - 1) * ViewCenter[1];
585 fMarkerSize *= ratio;
589 Double_t newx1 = gPad->GetX1() + dx;
590 Double_t newy1 = gPad->GetY1() + dy;
591 Double_t newx2 = gPad->GetX2() + dx;
592 Double_t newy2 = gPad->GetY2() + dy;
593 gPad->Range(newx1, newy1, newx2, newy2);
595 ViewCenter[0] = (newx1 + newx2) / 2;
596 ViewCenter[1] = (newy1 + newy2) / 2;
599 fStatusCurrent->
fZoom = ratio;
600 fStatusXY->
fZoom = ratio;
601 fStatusZR->
fZoom = ratio;
603 fStatus3D->
fZoom = ratio;
604 fStatusCgemUF[0]->
fZoom = ratio;
605 fStatusCgemUF[1]->
fZoom = ratio;
606 fStatusCgemUF[2]->
fZoom = ratio;
615 Double_t dx = (fZoomFactor - 1) * ViewCenter[0];
616 Double_t dy = (fZoomFactor - 1) * ViewCenter[1];
618 fMarkerSize = fMarkerSize * fZoomFactor;
631 Double_t newx1 = gPad->GetX1() + dx;
632 Double_t newy1 = gPad->GetY1() + dy;
633 Double_t newx2 = gPad->GetX2() + dx;
634 Double_t newy2 = gPad->GetY2() + dy;
635 gPad->Range(newx1, newy1, newx2, newy2);
637 ViewCenter[0] = (newx1 + newx2) / 2;
638 ViewCenter[1] = (newy1 + newy2) / 2;
671 Double_t dx = (1 / fZoomFactor - 1) * ViewCenter[0];
672 Double_t dy = (1 / fZoomFactor - 1) * ViewCenter[1];
674 fMarkerSize = fMarkerSize / fZoomFactor;
687 Double_t newx1 = gPad->GetX1() + dx;
688 Double_t newy1 = gPad->GetY1() + dy;
689 Double_t newx2 = gPad->GetX2() + dx;
690 Double_t newy2 = gPad->GetY2() + dy;
691 gPad->Range(newx1, newy1, newx2, newy2);
693 ViewCenter[0] = (newx1 + newx2) / 2;
694 ViewCenter[1] = (newy1 + newy2) / 2;
724 Float_t Phi2 = (
Phi - 2*TMath::Pi()*Int_t(
Phi/(2*TMath::Pi())))
726 if ( Phi2 < 0 ) Phi2 += 360;
727 if ( Phi2 >= fStatusCurrent->
fPhiRangeMin && Phi2 < fStatusCurrent->fPhiRangeMax ) {
740 if ( gDebug ) cout <<
"BesView::SetPhiRange called" << endl;
780 fLabel->SetY2(-0.78);
784 fLabel->SetLabel(
"3D View");
787 fLabel->SetLabel(
"XY View");
790 fLabel->SetLabel(
"ZR View");
794 fLabel->SetLabel(
"CGEM Layer0");
797 fLabel->SetLabel(
"CGEM Layer1");
800 fLabel->SetLabel(
"CGEM Layer2");
803 fLabel->Draw(
"BR,NDC,SAME");
833 if ( fStatusCurrent->
fFishEye == kTRUE ) {
841 pn[0] = TMath::Sign(Double_t(TMath::Sqrt(TMath::Abs(pn[0] - pvNDC[0]))),
842 Double_t(pn[0] - pvNDC[0])) + pvNDC[0];
843 pn[1] = TMath::Sign(Double_t(TMath::Sqrt(TMath::Abs(pn[1] - pvNDC[1]))),
844 Double_t(pn[1] - pvNDC[1])) + pvNDC[1];
846 r = TMath::Sqrt(TMath::Power(pn[0],2)
847 +TMath::Power(pn[1],2));
848 s = TMath::Sqrt(r)/r;
865 if ( fStatusCurrent->
fFishEye == kTRUE ) {
868 Double_t pvWC[3], pvNDC[3];
873 pn[0] = TMath::Sign(TMath::Sqrt(TMath::Abs(pn[0] - pvNDC[0])),
874 pn[0] - pvNDC[0]) + pvNDC[0];
875 pn[1] = TMath::Sign(TMath::Sqrt(TMath::Abs(pn[1] - pvNDC[1])),
876 pn[1] - pvNDC[1]) + pvNDC[1];
879 r = TMath::Sqrt(TMath::Power(pn[0],2)
880 +TMath::Power(pn[1],2));
881 s = TMath::Sqrt(r)/r;
898 if ( fStatusCurrent->
fFishEye == kTRUE ) {
906 p[0] = TMath::Sign((pn[0] - pvNDC[0])*(pn[0] - pvNDC[0]),
907 pn[0] - pvNDC[0]) + pvNDC[0];
908 p[1] = TMath::Sign((pn[1] - pvNDC[1])*(pn[1] - pvNDC[1]),
909 pn[1] - pvNDC[1]) + pvNDC[1];
911 r = TMath::Sqrt(TMath::Power(p[0],2)
912 +TMath::Power(p[1],2));
930 if ( fStatusCurrent->
fFishEye == kTRUE ) {
933 Double_t pvWC[3], pvNDC[3];
938 p[0] = TMath::Sign((pn[0] - pvNDC[0])*(pn[0] - pvNDC[0]),
939 pn[0] - pvNDC[0]) + pvNDC[0];
940 p[1] = TMath::Sign((pn[1] - pvNDC[1])*(pn[1] - pvNDC[1]),
941 pn[1] - pvNDC[1]) + pvNDC[1];
943 r = TMath::Sqrt(TMath::Power(p[0],2)
944 +TMath::Power(p[1],2));
969 Double_t Pndc[3] = { gPad->AbsPixeltoX(px), gPad->AbsPixeltoY(py), 0};
971 if (view) view->
NDCtoWC(Pndc, pw);
978 static char info[64];
980 sprintf(info,
"z=%-.3fmm, r=%-.3fmm", pw[2], pw[1]);
983 sprintf(info,
"x=%-.3fmm, y=%-.3fmm", pw[0], pw[1]);
1005 fStatusCurrent->
Default(fViewType);
1029 fStatus3D->
Transfer(fStatusCurrent, 1);
1032 fStatusXY->
Transfer(fStatusCurrent, 1);
1035 fStatusZR->
Transfer(fStatusCurrent, 1);
1038 fStatusCgemUF[0]->
Transfer(fStatusCurrent, 1);
1041 fStatusCgemUF[1]->
Transfer(fStatusCurrent, 1);
1044 fStatusCgemUF[2]->
Transfer(fStatusCurrent, 1);
R__EXTERN BesCursor * gBesCursor
R__EXTERN BesEvent * gEvent
R__EXTERN BesGeometry * gBesGeometry
ClassImp(BesView) BesView
double Phi(RecMdcKalTrack *trk)
virtual void DrawCgem3DHits(Option_t *option)
virtual void DrawCgemUFHits(Option_t *option)
virtual void DrawCgemUFClusters(int layer, Option_t *option)
virtual void DrawCgemClusters(Option_t *option)
virtual void DrawMcParticles(Option_t *option)
virtual void DrawHits(Option_t *option)
virtual void DrawTracks(Option_t *option)
virtual void DrawCgemUF(int layer)
virtual void Draw(Option_t *option="3D")
Bool_t fFishEye
visibility flag for MC truth 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)