9#include "BesVisLib/Bes2DView.h"
24#ifndef ROOT_TPaveLabel
25#include <TPaveLabel.h>
50 if ( gDebug ) cout <<
"Bes2DView normal ctor called" << endl;
53 fLabel =
new TPaveLabel(0.02,0.17,0.02,0.09,
"3D View");
54 fLabel->SetFillColor(42);
74 fStatusCurrent->Transfer(fStatus3D,1);
75 SetRange(-200,-200,-200,200,200,200);
86 if ( gDebug ) cout <<
"Bes2DView default dtor called" << endl;
93 delete fStatusCurrent;
105 if ( gDebug ) cout <<
"Bes2DView::ClearPad called" << endl;
106 if ( gPad->GetListOfPrimitives() ) gPad->GetListOfPrimitives()->Clear();
114 if ( gDebug ) cout <<
"Bes2DView::ExecuteEvent called" << endl;
124 if (gROOT->GetEditorMode()) {
125 cout <<
"ROOT" << endl;
126 gPad->ExecuteEvent(event,px,py);
130 static Double_t xmin, ymin, xmax, ymax, x0, y0;
131 Double_t dx, dy,
x,
y;
135 gPad->SetCursor(kMove);
137 xmin = gPad->GetX1();
138 ymin = gPad->GetY1();
139 xmax = gPad->GetX2();
140 ymax = gPad->GetY2();
141 x0 = gPad->AbsPixeltoX(px);
142 y0 = gPad->AbsPixeltoY(py);
146 gPad->SetCursor(kMove);
150 x = gPad->AbsPixeltoX(px);
151 y = gPad->AbsPixeltoY(py);
155 gPad->Range(xmin+dx, ymin+dy, xmax+dx, ymax+dy);
161 gPad->SetCursor(kCross);
170 Double_t x1, y1, x2, y2, dx, dy,
x,
y, x0, y0;
175 x0 = gPad->PixeltoX(0);
176 y0 = gPad->PixeltoY(0);
177 x = gPad->PixeltoX(px);
178 y = gPad->PixeltoY(py);
182 gPad->Range(x1+dx, y1+dy, x2+dx, y2+dy);
197 Double_t xrange, yrange;
198 xrange = gPad->GetX2() - gPad->GetX1();
199 yrange = gPad->GetY2() - gPad->GetY1();
200 gPad->Range(-xrange/2, -yrange/2, xrange/2, yrange/2);
209 fMarkerSize = fMarkerSize * fZoomFactor;
218 fMarkerSize = fMarkerSize / fZoomFactor;
231 Float_t Phi2 = (
Phi - 2*TMath::Pi()*Int_t(
Phi/(2*TMath::Pi())))
233 if ( Phi2 < 0 ) Phi2 += 360;
234 if ( Phi2 >= fStatusCurrent->
fPhiRangeMin && Phi2 < fStatusCurrent->fPhiRangeMax ) {
248 if ( !gGeometry )
return;
261 fLabel->SetX1NDC(0.05);
262 fLabel->SetX2NDC(0.20);
263 fLabel->SetY1NDC(0.05);
264 fLabel->SetY2NDC(0.12);
266 switch (f2DViewType) {
271 fLabel->SetLabel(
"XY View");
274 fLabel->SetLabel(
"ZR View");
277 fLabel->Draw(
"BR,NDC,SAME");
291 if ( fStatusCurrent->
fFishEye == kTRUE ) {
293 if ( f2DViewType == 1) {
294 Float_t pvWC[3], pvNDC[3];
299 pn[0] = TMath::Sign(Double_t(TMath::Sqrt(TMath::Abs(pn[0] - pvNDC[0]))),
300 Double_t(pn[0] - pvNDC[0])) + pvNDC[0];
301 pn[1] = TMath::Sign(Double_t(TMath::Sqrt(TMath::Abs(pn[1] - pvNDC[1]))),
302 Double_t(pn[1] - pvNDC[1])) + pvNDC[1];
304 r = TMath::Sqrt(TMath::Power(pn[0],2)
305 +TMath::Power(pn[1],2));
306 s = TMath::Sqrt(r)/r;
323 if ( fStatusCurrent->
fFishEye == kTRUE ) {
325 if ( f2DViewType == 1 ) {
326 Double_t pvWC[3], pvNDC[3];
331 pn[0] = TMath::Sign(TMath::Sqrt(TMath::Abs(pn[0] - pvNDC[0])),
332 pn[0] - pvNDC[0]) + pvNDC[0];
333 pn[1] = TMath::Sign(TMath::Sqrt(TMath::Abs(pn[1] - pvNDC[1])),
334 pn[1] - pvNDC[1]) + pvNDC[1];
337 r = TMath::Sqrt(TMath::Power(pn[0],2)
338 +TMath::Power(pn[1],2));
339 s = TMath::Sqrt(r)/r;
352 if (f2DViewType == 0) {
363 if ( fStatusCurrent->
fFishEye == kTRUE ) {
365 if ( f2DViewType == 1 ) {
366 Float_t pvWC[3], pvNDC[3];
371 p[0] = TMath::Sign((pn[0] - pvNDC[0])*(pn[0] - pvNDC[0]),
372 pn[0] - pvNDC[0]) + pvNDC[0];
373 p[1] = TMath::Sign((pn[1] - pvNDC[1])*(pn[1] - pvNDC[1]),
374 pn[1] - pvNDC[1]) + pvNDC[1];
376 r = TMath::Sqrt(TMath::Power(p[0],2)
377 +TMath::Power(p[1],2));
391 if (f2DViewType == 0) {
402 if ( fStatusCurrent->
fFishEye == kTRUE ) {
404 if ( f2DViewType == 1 ) {
405 Double_t pvWC[3], pvNDC[3];
410 p[0] = TMath::Sign((pn[0] - pvNDC[0])*(pn[0] - pvNDC[0]),
411 pn[0] - pvNDC[0]) + pvNDC[0];
412 p[1] = TMath::Sign((pn[1] - pvNDC[1])*(pn[1] - pvNDC[1]),
413 pn[1] - pvNDC[1]) + pvNDC[1];
415 r = TMath::Sqrt(TMath::Power(p[0],2)
416 +TMath::Power(p[1],2));
432 static char info[64];
433 if ( f2DViewType == 1 ) {
434 sprintf(info,
"z=%-.3fcm, r=%-.3fcm", pw[0], pw[1]);
437 sprintf(info,
"x=%-.3fcm, y=%-.3fcm", pw[0], pw[1]);
459 this->
SetRange(-2635,-2635,-2875,2635,2635,2875);
ClassImp(Bes2DView) Bes2DView
double Phi(RecMdcKalTrack *trk)
virtual char * GetObjectInfo(Int_t px, Int_t py) const
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)
virtual void NDCtoWC(const Float_t *pn, Float_t *pw)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual Int_t GetRSign(Float_t Phi)
virtual void UpdateView(Bool_t resetview=kFALSE)
void Move(Int_t px, Int_t py)
Bool_t fFishEye
visibility flag for Ext Tracks
Float_t fPhiRangeMin
flags for fish eye view
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)
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)