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();
68 ViewCenter[0] = ViewCenter[1] = 0.0;
76 if ( gDebug ) cout <<
"BesView default dtor called" << endl;
83 delete fStatusCurrent;
90 SetRange(-1.0*m_BesR, -1.0*m_BesR, -0.5*m_BesZ, m_BesR, m_BesR, 0.5*m_BesZ);
102 else if (fViewType &
kXYView) { fStatusXY->
Transfer(fStatusCurrent, 0); }
103 else if (fViewType &
kZRView) { fStatusZR->
Transfer(fStatusCurrent, 0); }
105 fViewType = ViewType;
116 Int_t iPerspective = 0;
121 fStatusCurrent->
Transfer(fStatus3D,1);
158 }
else if ( fViewType &
kXYView ) {
165 fStatusCurrent->
Transfer(fStatusXY,1);
202 }
else if ( fViewType &
kZRView ) {
209 fStatusCurrent->
Transfer(fStatusZR,1);
360 if ( gDebug ) cout <<
"BesView::ClearPad called" << endl;
361 if ( gPad->GetListOfPrimitives() ) gPad->GetListOfPrimitives()->Clear();
369 if ( gDebug ) cout <<
"BesView::ExecuteEvent called" << endl;
372 if (gROOT->GetEditorMode()) {
373 gPad->ExecuteEvent(event,px,py);
379 gPad->SetCursor(kMove);
380 static Double_t xmin, ymin, xmax, ymax, x0, y0;
381 Double_t dx, dy,
x,
y;
386 xmin = gPad->GetX1();
387 ymin = gPad->GetY1();
388 xmax = gPad->GetX2();
389 ymax = gPad->GetY2();
390 x0 = gPad->AbsPixeltoX(px);
391 y0 = gPad->AbsPixeltoY(py);
395 gPad->SetCursor(kMove);
399 x = gPad->AbsPixeltoX(px);
400 y = gPad->AbsPixeltoY(py);
404 gPad->Range(xmin+dx, ymin+dy, xmax+dx, ymax+dy);
408 ViewCenter[0] = (xmin + xmax) / 2 + dx;
409 ViewCenter[1] = (ymin + ymax) / 2 + dy;
413 gPad->SetCursor(kMove);
418 gPad->SetCursor(kPointer);
453 Double_t x1, y1, x2, y2, dx, dy,
x,
y, x0, y0;
458 x0 = gPad->PixeltoX(0);
459 y0 = gPad->PixeltoY(0);
460 x = gPad->PixeltoX(px);
461 y = gPad->PixeltoY(py);
465 gPad->Range(x1+dx, y1+dy, x2+dx, y2+dy);
469 ViewCenter[0] = (x1 + x2) / 2 + dx;
470 ViewCenter[1] = (y1 + y2) / 2 + dy;
481 Double_t xrange, yrange;
482 xrange = gPad->GetX2() - gPad->GetX1();
483 yrange = gPad->GetY2() - gPad->GetY1();
484 gPad->Range(-xrange/2, -yrange/2, xrange/2, yrange/2);
488 ViewCenter[0] = ViewCenter[1] = 0.0;
497 Double_t dx = (ratio /
GetZoomRatio() - 1) * ViewCenter[0];
498 Double_t dy = (ratio /
GetZoomRatio() - 1) * ViewCenter[1];
501 fMarkerSize *= ratio;
505 Double_t newx1 = gPad->GetX1() + dx;
506 Double_t newy1 = gPad->GetY1() + dy;
507 Double_t newx2 = gPad->GetX2() + dx;
508 Double_t newy2 = gPad->GetY2() + dy;
509 gPad->Range(newx1, newy1, newx2, newy2);
511 ViewCenter[0] = (newx1 + newx2) / 2;
512 ViewCenter[1] = (newy1 + newy2) / 2;
515 fStatusCurrent->
fZoom = ratio;
516 fStatusXY->
fZoom = ratio;
517 fStatusZR->
fZoom = ratio;
518 fStatus3D->
fZoom = ratio;
527 Double_t dx = (fZoomFactor - 1) * ViewCenter[0];
528 Double_t dy = (fZoomFactor - 1) * ViewCenter[1];
530 fMarkerSize = fMarkerSize * fZoomFactor;
539 Double_t newx1 = gPad->GetX1() + dx;
540 Double_t newy1 = gPad->GetY1() + dy;
541 Double_t newx2 = gPad->GetX2() + dx;
542 Double_t newy2 = gPad->GetY2() + dy;
543 gPad->Range(newx1, newy1, newx2, newy2);
545 ViewCenter[0] = (newx1 + newx2) / 2;
546 ViewCenter[1] = (newy1 + newy2) / 2;
579 Double_t dx = (1 / fZoomFactor - 1) * ViewCenter[0];
580 Double_t dy = (1 / fZoomFactor - 1) * ViewCenter[1];
582 fMarkerSize = fMarkerSize / fZoomFactor;
591 Double_t newx1 = gPad->GetX1() + dx;
592 Double_t newy1 = gPad->GetY1() + dy;
593 Double_t newx2 = gPad->GetX2() + dx;
594 Double_t newy2 = gPad->GetY2() + dy;
595 gPad->Range(newx1, newy1, newx2, newy2);
597 ViewCenter[0] = (newx1 + newx2) / 2;
598 ViewCenter[1] = (newy1 + newy2) / 2;
628 Float_t Phi2 = (
Phi - 2*TMath::Pi()*Int_t(
Phi/(2*TMath::Pi())))
630 if ( Phi2 < 0 ) Phi2 += 360;
631 if ( Phi2 >= fStatusCurrent->
fPhiRangeMin && Phi2 < fStatusCurrent->fPhiRangeMax ) {
644 if ( gDebug ) cout <<
"BesView::SetPhiRange called" << endl;
684 fLabel->SetY2(-0.78);
688 fLabel->SetLabel(
"3D View");
691 fLabel->SetLabel(
"XY View");
694 fLabel->SetLabel(
"ZR View");
698 fLabel->SetLabel(
"CGEM Layer0");
701 fLabel->SetLabel(
"CGEM Layer1");
704 fLabel->SetLabel(
"CGEM Layer2");
707 fLabel->Draw(
"BR,NDC,SAME");
737 if ( fStatusCurrent->
fFishEye == kTRUE ) {
740 Float_t pvWC[3], pvNDC[3];
745 pn[0] = TMath::Sign(Double_t(TMath::Sqrt(TMath::Abs(pn[0] - pvNDC[0]))),
746 Double_t(pn[0] - pvNDC[0])) + pvNDC[0];
747 pn[1] = TMath::Sign(Double_t(TMath::Sqrt(TMath::Abs(pn[1] - pvNDC[1]))),
748 Double_t(pn[1] - pvNDC[1])) + pvNDC[1];
750 r = TMath::Sqrt(TMath::Power(pn[0],2)
751 +TMath::Power(pn[1],2));
752 s = TMath::Sqrt(r)/r;
769 if ( fStatusCurrent->
fFishEye == kTRUE ) {
772 Double_t pvWC[3], pvNDC[3];
777 pn[0] = TMath::Sign(TMath::Sqrt(TMath::Abs(pn[0] - pvNDC[0])),
778 pn[0] - pvNDC[0]) + pvNDC[0];
779 pn[1] = TMath::Sign(TMath::Sqrt(TMath::Abs(pn[1] - pvNDC[1])),
780 pn[1] - pvNDC[1]) + pvNDC[1];
783 r = TMath::Sqrt(TMath::Power(pn[0],2)
784 +TMath::Power(pn[1],2));
785 s = TMath::Sqrt(r)/r;
802 if ( fStatusCurrent->
fFishEye == kTRUE ) {
805 Float_t pvWC[3], pvNDC[3];
810 p[0] = TMath::Sign((pn[0] - pvNDC[0])*(pn[0] - pvNDC[0]),
811 pn[0] - pvNDC[0]) + pvNDC[0];
812 p[1] = TMath::Sign((pn[1] - pvNDC[1])*(pn[1] - pvNDC[1]),
813 pn[1] - pvNDC[1]) + pvNDC[1];
815 r = TMath::Sqrt(TMath::Power(p[0],2)
816 +TMath::Power(p[1],2));
834 if ( fStatusCurrent->
fFishEye == kTRUE ) {
837 Double_t pvWC[3], pvNDC[3];
842 p[0] = TMath::Sign((pn[0] - pvNDC[0])*(pn[0] - pvNDC[0]),
843 pn[0] - pvNDC[0]) + pvNDC[0];
844 p[1] = TMath::Sign((pn[1] - pvNDC[1])*(pn[1] - pvNDC[1]),
845 pn[1] - pvNDC[1]) + pvNDC[1];
847 r = TMath::Sqrt(TMath::Power(p[0],2)
848 +TMath::Power(p[1],2));
873 Double_t Pndc[3] = { gPad->AbsPixeltoX(px), gPad->AbsPixeltoY(py), 0};
875 if (view) view->
NDCtoWC(Pndc, pw);
882 static char info[64];
884 sprintf(info,
"z=%-.3fmm, r=%-.3fmm", pw[2], pw[1]);
887 sprintf(info,
"x=%-.3fmm, y=%-.3fmm", pw[0], pw[1]);
905 fStatusCurrent->
Default(fViewType);
926 fStatus3D->
Transfer(fStatusCurrent, 1);
929 fStatusXY->
Transfer(fStatusCurrent, 1);
932 fStatusZR->
Transfer(fStatusCurrent, 1);
R__EXTERN BesCursor * gBesCursor
R__EXTERN BesEvent * gEvent
R__EXTERN BesGeometry * gBesGeometry
ClassImp(BesView) BesView
double Phi(RecMdcKalTrack *trk)
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
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)