Logo ROOT   6.10/09
Reference Guide
TEveCaloLegoOverlay.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Author: Alja Mrak-Tadel 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TEveCaloLegoOverlay.h"
13 #include "TEveCaloLegoGL.h"
14 
15 #include "TAxis.h"
16 #include "TColor.h"
17 #include "TROOT.h"
18 #include "THLimitsFinder.h"
19 
20 #include "TGLRnrCtx.h"
21 #include "TGLIncludes.h"
22 #include "TGLSelectRecord.h"
23 #include "TGLUtil.h"
24 #include "TGLViewerBase.h"
25 #include "TGLCamera.h"
26 #include "TGLAxisPainter.h"
27 #include "TGLFontManager.h"
28 
29 #include "TEveCalo.h"
30 #include "TEveCaloData.h"
31 #include "TEveRGBAPalette.h"
32 
33 #include <KeySymbols.h>
34 
35 
36 /** \class TEveCaloLegoOverlay
37 \ingroup TEve
38 GL-overlay control GUI for TEveCaloLego.
39 */
40 
42 
43 ////////////////////////////////////////////////////////////////////////////////
44 /// Constructor.
45 
48 
49  fCalo(0),
50 
51  fShowScales(kTRUE),
52  fScaleColor(-1), fScaleTransparency(0),
53  fScaleCoordX(0.85), fScaleCoordY(0.65),
54  fScaleW(0), fScaleH(0),
55  fCellX(-1), fCellY(-1),
56 
57  fFrameColor(-1), fFrameLineTransp(70), fFrameBgTransp(90),
58 
59  fMouseX(0), fMouseY(0),
60  fInDrag(kFALSE),
61 
62  fHeaderSelected(kFALSE),
63 
64  fPlaneAxis(0), fAxisPlaneColor(kGray),
65  fShowPlane(kFALSE),
66 
67  fMenuW(0.08),
68  fButtonW(0.5),
69  fShowSlider(kFALSE),
70  fSliderH(0.6),
71  fSliderPosY(0.15),
72  fSliderVal(0),
73 
74  fActiveID(-1), fActiveCol(kRed-4)
75 {
76  fPlaneAxis = new TAxis();
77 }
78 
79 /******************************************************************************/
80 // Virtual event handlers from TGLOverlayElement
81 /******************************************************************************/
82 
84 {
85  // Set height of horizontal plane in the calorimeter.
86 
87  TGLRect& wprt = rnrCtx.RefCamera().RefViewport();
88  fSliderVal = (1 -event->fY*1./wprt.Height() -fSliderPosY)/fSliderH;
89 
90  if (fSliderVal < 0 )
91  fSliderVal = 0;
92  else if (fSliderVal > 1)
93  fSliderVal = 1;
94 
96 
97  return kTRUE;
98 }
99 
100 ////////////////////////////////////////////////////////////////////////////////
101 /// Handle overlay event.
102 /// Return TRUE if event was handled.
103 
105  TGLOvlSelectRecord & selRec,
106  Event_t * event)
107 {
108  if (selRec.GetN() < 2) return kFALSE;
109 
110 
111  if (rnrCtx.RefCamera().IsOrthographic())
112  {
113  switch (event->fType)
114  { case kButtonPress:
115  {
116  fMouseX = event->fX;
117  fMouseY = event->fY;
118  fInDrag = kTRUE;
119  return kTRUE;
120  }
121  case kButtonRelease:
122  {
123  fInDrag = kFALSE;
124  return kTRUE;
125  }
126  case kMotionNotify:
127  {
128  if (fInDrag)
129  {
130  const TGLRect& vp = rnrCtx.RefCamera().RefViewport();
131  fScaleCoordX += (Float_t)(event->fX - fMouseX) / vp.Width();
132  fScaleCoordY -= (Float_t)(event->fY - fMouseY) / vp.Height();
133  fMouseX = event->fX;
134  fMouseY = event->fY;
135  // Make sure we don't go offscreen (use fDraw variables set in draw)
136  if (fScaleCoordX < 0)
137  fScaleCoordX = 0;
138  else if (fScaleCoordX + fScaleW > 1.0f)
139  fScaleCoordX = 1.0f - fScaleW;
140  if (fScaleCoordY < 0)
141  fScaleCoordY = 0;
142  else if (fScaleCoordY + fScaleH > 1.0f)
143  fScaleCoordY = 1.0f - fScaleH;
144  }
145  return kTRUE;
146  }
147  default:
148  break;
149  }
150  }
151 
152  else
153  {
154  switch (event->fType)
155  {
156  case kMotionNotify:
157  {
158  Int_t item = selRec.GetN() < 2 ? -1 : (Int_t)selRec.GetItem(1);
159  if (fActiveID != item) {
160  fActiveID = item;
161  return kTRUE;
162  } else {
163  if (fActiveID == 2 && event->fState == 256)
164  return SetSliderVal(event, rnrCtx);
165 
166  return kFALSE;
167  }
168  break;
169  }
170  case kButtonPress:
171  {
172  if (event->fCode != kButton1) {
173  return kFALSE;
174  }
175  switch (selRec.GetItem(1))
176  {
177  case 1:
180  break;
181  case 2:
182  return SetSliderVal(event, rnrCtx);
183  case 3:
185  default:
186  break;
187  }
188  }
189  default:
190  break;
191  }
192  }
193 
194  return kFALSE;
195 }
196 
197 ////////////////////////////////////////////////////////////////////////////////
198 /// Mouse has entered overlay area.
199 
201 {
202  return kTRUE;
203 }
204 
205 ////////////////////////////////////////////////////////////////////////////////
206 /// Mouse has left overlay area.
207 
209 {
210  fActiveID = -1;
211 }
212 
213 ////////////////////////////////////////////////////////////////////////////////
214 /// Set color and transparency of scales.
215 
217 {
218  fScaleColor = colIdx;
219  fScaleTransparency = transp;
220 }
221 
222 ////////////////////////////////////////////////////////////////////////////////
223 /// Set scale coordinates in range [0,1].
224 
226 {
227  fScaleCoordX = x;
228  fScaleCoordY = y;
229 }
230 
231 ////////////////////////////////////////////////////////////////////////////////
232 /// Set frame attributes.
233 
234 void TEveCaloLegoOverlay:: SetFrameAttribs(Color_t frameColor, Char_t lineTransp, Char_t bgTransp)
235 {
236  fFrameColor = frameColor;
237  fFrameLineTransp = lineTransp;
238  fFrameBgTransp = bgTransp;
239 }
240 
241 //==============================================================================
243 {
244  // Render text on top right corner of the screen.
245 
246  TGLRect &vp = rnrCtx.GetCamera()->RefViewport();
247 
248  TGLFont font;
249  Int_t fs = TMath::Max(TMath::Nint(vp.Height()*0.035), 12);
250  rnrCtx.RegisterFontNoScale(fs, "arial", TGLFont::kPixmap, font);
251  font.PreRender();
252  Float_t off = fs*0.2;
253  Float_t bb[6];
254  font.BBox(fHeaderTxt.Data(), bb[0], bb[1], bb[2], bb[3], bb[4], bb[5]);
255  Float_t x = vp.Width() -bb[3] -off;
256  Float_t y = vp.Height() -bb[4] -off;
257  if (rnrCtx.Selection())
258  {
259  glPushName(0);
260  glLoadName(3);
261  glBegin(GL_QUADS);
262  glVertex2f(x/vp.Width(), y/ vp.Height());
263  glVertex2f(1, y/ vp.Height());
264  glVertex2f(1, 1);
265  glVertex2f(x/vp.Width(), 1);
266  glEnd();
267  glPopName();
268  }
269  else
270  {
272  glRasterPos2i(0, 0);
273  glBitmap(0, 0, 0, 0, x, y, 0);
274  font.Render(fHeaderTxt.Data());
275  }
276  font.PostRender();
277 }
278 
279 ////////////////////////////////////////////////////////////////////////////////
280 /// Render menu for plane-value and the plane if marked.
281 
283 {
284  glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT | GL_POINT_BIT);
285  glEnable(GL_POINT_SMOOTH);
286  glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
287  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
288  glEnable(GL_POLYGON_OFFSET_FILL);
289  glPolygonOffset(0.1, 1);
290  glDisable(GL_CULL_FACE);
291  glEnable(GL_BLEND);
292  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
293 
294  // move to the center of menu
295  Double_t maxVal = fCalo->GetMaxVal();
296 
297  // button
298  glPushMatrix();
299  glTranslatef(1 -fMenuW, (1-fButtonW )*fMenuW*0.8, 0);
300 
301  glPushName(0);
302  glLoadName(1);
303  Float_t a=0.6;
304  (fActiveID == 1) ? TGLUtil::Color(fActiveCol):TGLUtil::Color4f(0, 1, 0, a);
305  Float_t bw = fButtonW*fMenuW*0.5;
306  Float_t bwt = bw*0.8;
307  Float_t bh = fButtonW*fMenuW;
308  glBegin(GL_QUADS);
309  glVertex2f(-bw, 0);
310  glVertex2f( bw, 0);
311  glVertex2f( bwt, bh);
312  glVertex2f(-bwt, bh);
313  glEnd();
314 
315 
317  glBegin(GL_LINES);
318  TGLUtil::Color(4);
319  glVertex2f(0, 0); glVertex2f(0, bh);
320  glVertex2f((bw+bwt)*0.5, bh*0.5); glVertex2f(-(bw+bwt)*0.5, bh*0.5);
321  glEnd();
322 
324  glBegin(GL_LINE_LOOP);
325  glVertex2f(-bw, 0);
326  glVertex2f( bw, 0);
327  glVertex2f( bwt, bh);
328  glVertex2f(-bwt, bh);
329  glEnd();
331 
332  glTranslatef(0, fSliderPosY, 0.5);
333 
334  if (fShowSlider)
335  {
336  // event handler
337  if (rnrCtx.Selection())
338  {
339  glLoadName(2);
340  Float_t w = fButtonW*fMenuW*0.5f;
341  glBegin(GL_QUADS);
342  glVertex2f(-w, 0);
343  glVertex2f( w, 0);
344  glVertex2f( w, fSliderH);
345  glVertex2f(-w, fSliderH);
346  glEnd();
347  }
348 
349  // slider axis
351  fAxisPainter->RefDir().Set(0, 1, 0);
352  fAxisPainter->RefTMOff(0).Set(1, 0, 0);
354  fPlaneAxis->SetRangeUser(0, maxVal);
355  fPlaneAxis->SetLimits(0, maxVal);
357  fPlaneAxis->SetTickLength(0.02*maxVal);
358  fPlaneAxis->SetLabelOffset(0.02*maxVal);
359  fPlaneAxis->SetLabelSize(0.05);
360 
361  glPushMatrix();
362  glScalef(fSliderH/(maxVal), fSliderH/maxVal, 1.);
364  glPopMatrix();
365 
366  // marker
367  TGLUtil::Color((fActiveID == 2) ? fActiveCol : 3);
369  glBegin(GL_POINTS);
370  glVertex3f(0, fSliderVal*fSliderH, -0.1);
371  glEnd();
372  }
373 
374  glPopName();
375  glPopMatrix();
376  glPopAttrib();
377 }
378 
379 /******************************************************************************/
381 {
382  // Draw slider of calo 2D in mode TEveCalo:fValSize.
383 
384  TGLRect &vp = rnrCtx.GetCamera()->RefViewport();
385 
386  Double_t maxVal = fCalo->GetMaxVal();
387  Int_t maxe = TMath::CeilNint(TMath::Log10(maxVal+1)); // max round exponent
388  Double_t sqv = TMath::Power(10, maxe)+1; // starting max square value
390  Double_t cellX = fCellX*fc;
391  Double_t cellY = fCellY*fc;
392 
393  Double_t scaleStepY = 0.1; // step is 10% of screen
394  Double_t scaleStepX = scaleStepY*vp.Height()/vp.Width(); // step is 10% of screen
395 
396  Double_t frameOff = 0.01;
397 
398  // define max starting exponent not to take more than scalStepY height
399  while(cellY > scaleStepY)
400  {
401  fc = TMath::Log10(TMath::Power(10, maxe-1)+1)/TMath::Log10(TMath::Power(10, maxe)+1);
402  maxe --;
403  cellX *= fc;
404  cellY *= fc;
405  }
406 
407  sqv = TMath::Power(10, maxe)+1;
408  glPushMatrix();
409  glTranslatef(fScaleCoordX + 0.5*scaleStepX + frameOff, fScaleCoordY + 0.5*scaleStepY + frameOff, 0); // translate to lower left corner
410 
411  glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT | GL_POINT_BIT);
412  glEnable(GL_BLEND);
413  glDisable(GL_CULL_FACE);
414  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
415  glEnable(GL_POLYGON_OFFSET_FILL);
416  glPolygonOffset(0.1, 1);
417 
418  glPushName(0);
419  glLoadName(1);
420 
421  // draw cells
422  Color_t color = fScaleColor > -1 ? fScaleColor : rnrCtx.ColorSet().Markup().GetColorIndex();
424 
425  Float_t pos, dx, dy;
426  glBegin(GL_QUADS);
427  Int_t ne = 3; // max number of columns
428  for (Int_t i=0; i < ne; ++i)
429  {
430  Float_t valFac = TMath::Log10(TMath::Power(10, maxe-i)+1)/TMath::Log10(sqv);
431  dx = 0.5* cellX * valFac;
432  dy = 0.5* cellY * valFac;
433  pos = i* scaleStepY;
434  glVertex2f( - dx, pos - dy);
435  glVertex2f( - dx, pos + dy);
436  glVertex2f( + dx, pos + dy);
437  glVertex2f( + dx, pos - dy);
438  }
439  glEnd();
440 
441  // draw points in case square is below pixels
442  glBegin(GL_POINTS);
443  for (Int_t i=0; i < ne; ++i)
444  glVertex2f(0, i* scaleStepY);
445  glEnd();
446 
447  // draw numbers
448  TGLFont fontB;
449  Int_t fsb = TMath::Max(TMath::Nint(vp.Height()*0.03), 12);
450  rnrCtx.RegisterFontNoScale(fsb, "arial", TGLFont::kPixmap, fontB);
451  TGLFont fontE;
452  Int_t fsE = TMath::Max(TMath::Nint(vp.Height()*0.01), 8);
453  rnrCtx.RegisterFontNoScale(fsE, "arial", TGLFont::kPixmap, fontE);
454 
455  Float_t llx, lly, llz, urx, ury, urz;
456  fontB.BBox("10", llx, lly, llz, urx, ury, urz);
457  Float_t expX = urx/vp.Width();
458  Float_t expY = (ury-lly)*0.5/vp.Height();
459  Float_t expOff = 1;
460  fontB.PreRender();
461  fontE.PreRender();
462  glPushMatrix();
463  glTranslatef(0.5*scaleStepX, 0, 0.1);
464  for (Int_t i = 0; i < ne; ++i)
465  {
466  if (i == maxe)
467  {
468  fontB.Render("1", 0, i*scaleStepY, 0, TGLFont::kLeft, TGLFont::kCenterV);
469  }
470  else if ( i == (maxe -1))
471  {
472  fontB.Render("10", 0, i*scaleStepY, 0, TGLFont::kLeft, TGLFont::kCenterV);
473  }
474  else
475  {
476  fontB.Render("10", 0, i*scaleStepY, 0, TGLFont::kLeft, TGLFont::kCenterV);
477  fontB.BBox(Form("%d", maxe-i), llx, lly, llz, urx, ury, urz);
478  if (expOff > urx/vp.Width()) expOff = urx/vp.Width();
479  fontE.Render(Form("%d", maxe-i), expX , i*scaleStepY+expY, 0, TGLFont::kLeft, TGLFont::kCenterV);
480  }
481  }
482  glPopMatrix();
483  fontB.PostRender();
484  fontE.PostRender();
485  if (expOff < 1) expX += expOff;
486  glPopMatrix();
487 
488  // draw frame
489  {
490  fScaleW = scaleStepX + expX+ frameOff*2;
491  fScaleH = scaleStepY * ne + frameOff*2;
492  Double_t x0 = fScaleCoordX;
493  Double_t x1 = x0 + fScaleW;
494  Double_t y0 = fScaleCoordY;
495  Double_t y1 = y0 + fScaleH;
496  Double_t zf = +0.2;
497 
498  color = fFrameColor > -1 ? fFrameColor : rnrCtx.ColorSet().Markup().GetColorIndex();
500 
501  glBegin(GL_LINE_LOOP);
502  glVertex3f(x0, y0, zf); glVertex3f(x1, y0, zf);
503  glVertex3f(x1, y1, zf); glVertex3f(x0, y1, zf);
504  glEnd();
505 
507  glBegin(GL_QUADS);
508  glVertex2f(x0, y0); glVertex2f(x1, y0);
509  glVertex2f(x1, y1); glVertex2f(x0, y1);
510  glEnd();
511  }
512  glPopName();
513 
514  glPopAttrib();
515 } // end draw scales
516 
517 ////////////////////////////////////////////////////////////////////////////////
518 
520 {
521  // Draw slider of calo 2D in mode TEveCalo:fValColor.
522 
523  glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT);
524  glEnable(GL_BLEND);
525  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
526  glEnable(GL_POLYGON_OFFSET_FILL);
527  glPolygonOffset(0.1, 1);
528 
529  TGLRect& vp = rnrCtx.RefCamera().RefViewport();
530  Double_t maxVal = fCalo->GetMaxVal();
531  Int_t bn = 0;
532  Double_t bw = 0; // bin with first second order
533  Double_t bl = 0, bh = 0; // bin low, high first
534  THLimitsFinder::Optimize(0, maxVal, 10, bl, bh, bn, bw);
535  bn = TMath::CeilNint(maxVal/bw) + 1;
536 
537  fScaleH = 0.25; // relative height of the scale
538  fScaleW = fScaleH*1.5/(bn*vp.Aspect());
539  Float_t h = 0.5 * bw ;
540  Float_t w = h * 1.5/ vp.Aspect();
541 
542  glPushMatrix();
543  glTranslatef(fScaleCoordX + fScaleW*0.5, fScaleCoordY + fScaleH/bn*0.5, 0); // translate to lower left corner
544  glScalef(fScaleH/(bn*bw), fScaleH/(bn*bw), 1.);
545 
546  glPushName(0);
547  glLoadName(1);
549  labVec.clear();
550  Float_t val = 0;
551  for (Int_t l= 0; l<bn; l++) {
552  labVec.push_back( TGLAxisPainter::Lab_t(val, val));
553  val += bw;
554  }
555 
557  fAxisPainter->RefDir().Set(0, 1, 0);
558  Int_t fs = TMath::CeilNint(rnrCtx.GetCamera()->RefViewport().Height()*0.02);
559  fAxisPainter->SetLabelFont(rnrCtx, "arial", fs);
560  fAxisPainter->SetTextFormat(0, maxVal, bw);
562  TAttAxis att;
563  fAxisPainter->SetAttAxis(&att);
565 
566  UChar_t c[4];
567  Float_t y;
568  Double_t zf = +0.2;
569  glBegin(GL_QUADS);
570  for (TGLAxisPainter::LabVec_t::iterator it = labVec.begin(); it != labVec.end(); ++it)
571  {
572  fCalo->GetPalette()->ColorFromValue((Int_t)((*it).first), c);
573  glColor4ub( c[0], c[1], c[2], c[3]);
574 
575  y = (*it).second;
576  glVertex3f( -w, y - h, zf); glVertex3f( +w, y - h, zf);
577  glVertex3f( +w, y + h, zf); glVertex3f( -w, y + h, zf);
578  }
579  glEnd();
580 
582  glBegin(GL_LINE_LOOP);
583  for (TGLAxisPainter::LabVec_t::iterator it = labVec.begin(); it != labVec.end(); ++it)
584  {
585  y = (*it).second;
586  glVertex3f( -w, y - h, zf); glVertex3f( +w, y - h, zf);
587  glVertex3f( +w, y + h, zf); glVertex3f( -w, y + h, zf);
588  }
589  glEnd();
590 
591  glPopName();
592  glPopMatrix();
593  glPopAttrib();
594 }
595 
596 ////////////////////////////////////////////////////////////////////////////////
597 
599 {
600  // Draw calorimeter scale info and plane interface.
601 
602  if ( fCalo == 0 || fCalo->GetData()->Empty()) return;
603 
604  Float_t old_depth_range[2];
605  glGetFloatv(GL_DEPTH_RANGE, old_depth_range);
606  glDepthRange(0, 0.001);
607 
608  glMatrixMode(GL_PROJECTION);
609  glPushMatrix();
610  glLoadIdentity();
611  if (rnrCtx.Selection())
612  {
613  TGLRect rect(*rnrCtx.GetPickRectangle());
614  rnrCtx.GetCamera()->WindowToViewport(rect);
615  gluPickMatrix(rect.X(), rect.Y(), rect.Width(), rect.Height(),
616  (Int_t*) rnrCtx.GetCamera()->RefViewport().CArr());
617  }
618  glMatrixMode(GL_MODELVIEW);
619  glPushMatrix();
620  glLoadIdentity();
621 
622  glTranslatef(-1, -1, 0);
623  glScalef(2, 2, 1);
624 
625 
626  TGLCapabilitySwitch lights_off(GL_LIGHTING, kFALSE);
627  TGLCamera& cam = rnrCtx.RefCamera();
628  Bool_t drawOverlayAxis = kTRUE;
629 
630  if (cam.IsOrthographic())
631  {
632  // in 2D need pixel cell dimension
633  // project lego eta-phi boundaries
634  TGLVector3 rng(fCalo->GetEtaRng(), fCalo->GetPhiRng(), 0);
635  TGLVertex3 p;
636  TGLVector3 res = cam.WorldDeltaToViewport(p, rng);
637 
638  TEveCaloLegoGL* lgl = dynamic_cast<TEveCaloLegoGL*>(rnrCtx.RefViewer().FindLogicalInScenes(fCalo));
639  if (fShowScales && lgl)
640  {
641 
642  // get smallest bin
643  Double_t sq = 1e4;
644  if (lgl->fBinStep == 1)
645  {
646  TEveCaloData::CellData_t cellData;
647  for ( TEveCaloData::vCellId_t::iterator i = fCalo->fCellList.begin(); i != fCalo->fCellList.end(); ++i)
648  {
649  fCalo->fData->GetCellData(*i, cellData);
650  if (sq > cellData.EtaDelta()) sq = cellData.EtaDelta();
651  if (sq > cellData.PhiDelta()) sq = cellData.PhiDelta();
652  }
653  }
654  else
655  {
656  TAxis* a;
657  Int_t nb;
658  a = fCalo->GetData()->GetEtaBins();
659  nb = a->GetNbins();
660  for (Int_t i=1 ; i<=nb; i++)
661  {
662  if (sq > a->GetBinWidth(i)) sq = a->GetBinWidth(i);
663  }
664 
665  a = fCalo->GetData()->GetPhiBins();
666  nb = a->GetNbins();
667  for (Int_t i=1 ; i<=nb; i++)
668  {
669  if (sq > a->GetBinWidth(i)) sq = a->GetBinWidth(i);
670  }
671 
672  sq *= lgl->fBinStep;
673  }
674  fCellX = (res.X()*sq)/(fCalo->GetEtaRng()*1.*cam.RefViewport().Width());
675  fCellY = (res.Y()*sq)/(fCalo->GetPhiRng()*1.*cam.RefViewport().Height());
676  // printf("bin width %f cells size %f %f\n", sq, fCellX, fCellY);
678  RenderLogaritmicScales(rnrCtx);
679  else if (fCalo->GetPalette())
680  RenderPaletteScales(rnrCtx);
681  }
682 
683  // draw camera overlay if projected lego bbox to large
684  SetFrustum(cam);
685  if ( fCalo->GetEtaMin() > fFrustum[0] && fCalo->GetEtaMax() < fFrustum[2]
686  && fCalo->GetPhiMin() > fFrustum[1] && fCalo->GetPhiMax() < fFrustum[3])
687  drawOverlayAxis = kFALSE;
688  }
689 
690  if (cam.IsPerspective() && fShowPlane)
691  {
692  RenderPlaneInterface(rnrCtx);
693  }
694 
695  // draw info text on top right corner
696  if (fHeaderTxt.Length())
697  {
698  RenderHeader(rnrCtx);
699  }
700 
701  glPopMatrix();
702  glMatrixMode(GL_PROJECTION);
703  glPopMatrix();
704  glMatrixMode(GL_MODELVIEW);
705 
706  glDepthRange(old_depth_range[0], old_depth_range[1]);
707 
708  if (drawOverlayAxis) TGLCameraOverlay::Render(rnrCtx);
709 }
TEveCaloData * GetData() const
Definition: TEveCalo.h:86
TGLAxisPainter * fAxisPainter
A GL overlay element which displays camera furstum.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:40
virtual void PreRender(Bool_t autoLight=kTRUE, Bool_t lightOn=kFALSE) const
Set-up GL state before FTFont rendering.
virtual Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event)
Handle overlay event.
virtual TAxis * GetEtaBins() const
Definition: TEveCaloData.h:218
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition: TGLCamera.h:43
static void Color(const TGLColor &color)
Set color from TGLColor.
Definition: TGLUtil.cxx:1658
void Render(const char *txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
virtual void SetLimits(Double_t xmin, Double_t xmax)
Definition: TAxis.h:154
static void ColorTransparency(Color_t color_index, Char_t transparency=0)
Set color from color_index and ROOT-style transparency (default 0).
Definition: TGLUtil.cxx:1702
float Float_t
Definition: RtypesCore.h:53
Definition: Rtypes.h:56
OpenGL renderer class for TEveCaloLego.
Bool_t Selection() const
Definition: TGLRnrCtx.h:222
void BBox(const char *txt, Float_t &llx, Float_t &lly, Float_t &llz, Float_t &urx, Float_t &ury, Float_t &urz) const
Get bounding box.
TH1 * h
Definition: legend2.C:5
E2DMode_e Get2DMode()
Definition: TEveCalo.h:328
TGLCamera & RefCamera()
Definition: TGLRnrCtx.h:157
Bool_t SetSliderVal(Event_t *event, TGLRnrCtx &rnrCtx)
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Definition: TAttAxis.cxx:229
Definition: Rtypes.h:55
Float_t GetPhiMax() const
Definition: TEveCalo.h:145
static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BWID, Option_t *option="")
static function to compute reasonable axis limits
void RenderLogaritmicScales(TGLRnrCtx &rnrCtx)
Int_t fY
Definition: GuiTypes.h:177
void SetFrustum(TGLCamera &cam)
Set frustum values from given camera.
void SetScalePosition(Double_t x, Double_t y)
Set scale coordinates in range [0,1].
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
TGLVector3 & RefDir()
void RegisterFontNoScale(Int_t size, Int_t file, Int_t mode, TGLFont &out)
Get font in the GL rendering context.
Definition: TGLRnrCtx.cxx:367
TGLRect & RefViewport()
Definition: TGLCamera.h:128
virtual Float_t GetLabelSize() const
Definition: TAttAxis.h:41
TGLColor & Markup()
Definition: TGLUtil.h:852
Manages histogram axis attributes.
Definition: TAttAxis.h:18
void Set(Double_t x, Double_t y, Double_t z)
Definition: TGLUtil.h:209
virtual void Render(TGLRnrCtx &rnrCtx)
Display coordinates info of current frustum.
Double_t Aspect() const
Definition: TGLUtil.h:501
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels The distance is expressed in per cent of the pad width...
Definition: TAttAxis.cxx:193
TGLRect * GetPickRectangle()
Return current pick rectangle.
Definition: TGLRnrCtx.cxx:249
Float_t GetEtaRng() const
Definition: TEveCalo.h:138
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition: TMath.h:628
Float_t GetEtaMin() const
Definition: TEveCalo.h:136
virtual void Render(TGLRnrCtx &rnrCtx)
Display coordinates info of current frustum.
TGLVector3 & RefTMOff(Int_t i)
Bool_t fInDrag
last mouse position
Float_t EtaDelta() const
Definition: TEveCaloData.h:93
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates).
Definition: TAxis.cxx:927
virtual Bool_t IsPerspective() const
Definition: TGLCamera.h:119
static struct mg_connection * fc(struct mg_context *ctx)
Definition: civetweb.c:1956
std::pair< Float_t, Float_t > Lab_t
std::vector< Lab_t > LabVec_t
Double_t x[n]
Definition: legend1.C:17
Float_t PhiDelta() const
Definition: TEveCaloData.h:98
3 component (x/y/z) vertex class.
Definition: TGLUtil.h:82
TEveCaloLegoOverlay()
Constructor.
Bool_t Empty() const
Definition: TEveCaloData.h:216
TGLCamera * GetCamera()
Definition: TGLRnrCtx.h:156
Double_t Log10(Double_t x)
Definition: TMath.h:652
Float_t GetPhiMin() const
Definition: TEveCalo.h:144
Viewport (pixel base) 2D rectangle class.
Definition: TGLUtil.h:422
virtual void MouseLeave()
Mouse has left overlay area.
3 component (x/y/z) vector class.
Definition: TGLUtil.h:246
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered overlay area.
void RenderPlaneInterface(TGLRnrCtx &rnrCtx)
Render menu for plane-value and the plane if marked.
TEveRGBAPalette * GetPalette() const
Definition: TEveCalo.h:124
const UChar_t * ColorFromValue(Int_t val) const
short Color_t
Definition: RtypesCore.h:79
void PaintAxis(TGLRnrCtx &ctx, TAxis *ax)
GL render TAxis.
Double_t fFrustum[4]
TGLLogicalShape * FindLogicalInScenes(TObject *id)
Find logical-shape representing object id in the list of scenes.
void WindowToViewport(Int_t &, Int_t &y) const
Definition: TGLCamera.h:198
Class to manage histogram axis.
Definition: TAxis.h:30
EGEventType fType
Definition: GuiTypes.h:174
static void Color4f(Float_t r, Float_t g, Float_t b, Float_t a)
Wrapper for glColor4f.
Definition: TGLUtil.cxx:1756
char * Form(const char *fmt,...)
Ssiz_t Length() const
Definition: TString.h:388
void RnrLabels() const
Render label reading prepared list ov value-pos pairs.
TEveCaloData::vCellId_t fCellList
Definition: TEveCalo.h:264
virtual void GetCellData(const CellId_t &id, CellData_t &data) const =0
TLine * l
Definition: textangle.C:4
static Float_t PointSize()
Get the point-size, taking the global scaling into account.
Definition: TGLUtil.cxx:1896
Color_t GetFontColor() const
Definition: TEveCalo.h:300
void SetHPlaneVal(Float_t s)
Definition: TEveCalo.h:343
void SetLabelAlign(TGLFont::ETextAlignH_e, TGLFont::ETextAlignV_e)
Set label align.
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels The size is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:204
TGLViewerBase & RefViewer()
Definition: TGLRnrCtx.h:155
virtual Bool_t IsOrthographic() const
Definition: TGLCamera.h:118
void RenderPaletteScales(TGLRnrCtx &rnrCtx)
void SetFrameAttribs(Color_t frameCol, Char_t lineTransp, Char_t bgTransp)
Set frame attributes.
void SetScaleColorTransparency(Color_t colIdx, Char_t transp)
Set color and transparency of scales.
Int_t Width() const
Definition: TGLUtil.h:451
void RenderHeader(TGLRnrCtx &rnrCtx)
const Bool_t kFALSE
Definition: RtypesCore.h:92
static const double x1[5]
#define ClassImp(name)
Definition: Rtypes.h:336
double f(double x)
double Double_t
Definition: RtypesCore.h:55
TGLVector3 WorldDeltaToViewport(const TGLVertex3 &worldRef, const TGLVector3 &worldDelta) const
Convert a 3D vector worldDelta (shift) about vertex worldRef to a viewport (screen) &#39;3D&#39; vector...
Definition: TGLCamera.cxx:426
UInt_t fCode
Definition: GuiTypes.h:179
Float_t GetEtaMax() const
Definition: TEveCalo.h:137
UInt_t GetItem(Int_t i) const
Double_t y[n]
Definition: legend1.C:17
Color_t GetColorIndex() const
Returns color-index representing the color.
Definition: TGLUtil.cxx:1240
virtual TAxis * GetPhiBins() const
Definition: TEveCaloData.h:221
LabVec_t & RefLabVec()
char Char_t
Definition: RtypesCore.h:29
Float_t GetMaxVal() const
Definition: TEveCalo.cxx:159
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition: TAxis.cxx:526
virtual void PostRender() const
Reset GL state after FTFont rendering.
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:200
Int_t GetN() const
Float_t GetPhiRng() const
Definition: TEveCalo.h:146
void SetLabelPixelFontSize(Int_t fs)
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length The length is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:249
UInt_t fState
Definition: GuiTypes.h:180
Cell data inner structure.
Definition: TEveCaloData.h:114
void SetLabelFont(TGLRnrCtx &rnrCtx, const char *fontName, Int_t pixelSize=64, Double_t font3DSize=-1)
Set label font derived from TAttAxis.
void SetDrawHPlane(Bool_t s)
Definition: TEveCalo.h:340
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
Definition: TGLUtil.cxx:1904
unsigned char UChar_t
Definition: RtypesCore.h:34
A wrapper class for FTFont.
Selection record for overlay objects.
void SetTextFormat(Double_t min, Double_t max, Double_t binWidth)
Construct print format from given primary bin width.
Int_t Height() const
Definition: TGLUtil.h:453
Int_t GetNbins() const
Definition: TAxis.h:121
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
Definition: TGLRnrCtx.cxx:278
GL-overlay control GUI for TEveCaloLego.
Double_t Y() const
Definition: TGLUtil.h:120
TEveCaloData * fData
Definition: TEveCalo.h:39
const Bool_t kTRUE
Definition: RtypesCore.h:91
Int_t Nint(T x)
Definition: TMath.h:607
Int_t fX
Definition: GuiTypes.h:177
Int_t CeilNint(Double_t x)
Definition: TMath.h:597
TAttAxis * GetAttAxis()
Get axis attributes.
void SetAttAxis(TAttAxis *a)
const Int_t * CArr() const
Definition: TGLUtil.h:444
const char * Data() const
Definition: TString.h:347
Double_t X() const
Definition: TGLUtil.h:118