Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveCaloLegoGL.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 "TAxis.h"
13#include "THLimitsFinder.h"
14
15#include "TGLViewer.h"
16#include "TGLIncludes.h"
17#include "TGLPhysicalShape.h"
18#include "TGLRnrCtx.h"
19#include "TGLSelectRecord.h"
20#include "TGLScene.h"
21#include "TGLCamera.h"
22#include "TGLUtil.h"
23#include "TColor.h"
24#include "TROOT.h"
25
26
27#include "TEveCaloLegoGL.h"
28#include "TEveCalo.h"
29#include "TEveManager.h"
30#include "TEveRGBAPalette.h"
31
32#include <algorithm>
33
34/** \class TEveCaloLegoGL
35\ingroup TEve
36OpenGL renderer class for TEveCaloLego.
37*/
38
39
40////////////////////////////////////////////////////////////////////////////////
41/// Constructor.
42
44 TGLObject(),
45
46 fGridColor(-1),
47 fFontColor(-1),
48
49 fEtaAxis(nullptr),
50 fPhiAxis(nullptr),
51 fZAxis(nullptr),
52 fM(nullptr),
53 fDLCacheOK(kFALSE),
54 fMaxVal(0),
55 fValToPixel(0),
56 fCurrentPixelsPerBin(0),
57 fCells3D(kTRUE),
58 fBinStep(-1)
59{
61
62 fEtaAxis = new TAxis();
63 fPhiAxis = new TAxis();
64 fZAxis = new TAxis();
65
67}
68
69////////////////////////////////////////////////////////////////////////////////
70/// Destructor.
71
73{
75
76 delete fEtaAxis;
77 delete fPhiAxis;
78 delete fZAxis;
79}
80
81////////////////////////////////////////////////////////////////////////////////
82/// Set model object.
83
85{
87 return kTRUE;
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Set bounding box.
92
97
98////////////////////////////////////////////////////////////////////////////////
99/// Drop all display-list definitions.
100
102{
104 for (SliceDLMap_i i = fDLMap.begin(); i != fDLMap.end(); ++i)
105 i->second = 0;
106
108}
109
110////////////////////////////////////////////////////////////////////////////////
111/// Unregister all display-lists.
112
114{
115 // all lego cells
117 if (! fDLMap.empty()) {
118 for (SliceDLMap_i i = fDLMap.begin(); i != fDLMap.end(); ++i) {
119 if (i->second) {
120 PurgeDLRange(i->second, 1);
121 i->second = 0;
122 }
123 }
124 }
126}
127
128////////////////////////////////////////////////////////////////////////////////
129/// Draw an axis-aligned box using quads.
130/// ~~~ {.cpp}
131/// z
132/// |
133/// |
134/// |________y
135/// / 6-------7
136/// / /| /|
137/// x 5-------4 |
138/// | 2-----|-3
139/// |/ |/
140/// 1-------0
141/// ~~~
142
144 Float_t xw, Float_t yw, Float_t h) const
145{
146 Float_t x2 = x1 + xw;
147 Float_t y2 = y1 + yw;
148 Float_t z2 = z1 + h;
149
150 if (x1 < fM->GetEtaMin()) x1 = fM->GetEtaMin();
151 if (x2 > fM->GetEtaMax()) x2 = fM->GetEtaMax();
152
153 if (y1 < fM->GetPhiMin()) y1 = fM->GetPhiMin();
154 if (y2 > fM->GetPhiMax()) y2 = fM->GetPhiMax();
155
157 {
158 // bottom 0123
159 glNormal3f(0, 0, -1);
160 glVertex3f(x2, y2, z1);
161 glVertex3f(x2, y1, z1);
162 glVertex3f(x1, y1, z1);
163 glVertex3f(x1, y2, z1);
164 // top 4765
165 glNormal3f(0, 0, 1);
166 glVertex3f(x2, y2, z2);
167 glVertex3f(x1, y2, z2);
168 glVertex3f(x1, y1, z2);
169 glVertex3f(x2, y1, z2);
170
171 // back 0451
172 glNormal3f(1, 0, 0);
173 glVertex3f(x2, y2, z1);
174 glVertex3f(x2, y2, z2);
175 glVertex3f(x2, y1, z2);
176 glVertex3f(x2, y1, z1);
177 // front 3267
178 glNormal3f(-1, 0, 0);
179 glVertex3f(x1, y2, z1);
180 glVertex3f(x1, y1, z1);
181 glVertex3f(x1, y1, z2);
182 glVertex3f(x1, y2, z2);
183
184 // left 0374
185 glNormal3f(0, 1, 0);
186 glVertex3f(x2, y2, z1);
187 glVertex3f(x1, y2, z1);
188 glVertex3f(x1, y2, z2);
189 glVertex3f(x2, y2, z2);
190 // right 1562
191 glNormal3f(0, -1, 0);
192 glVertex3f(x2, y1, z1);
193 glVertex3f(x2, y1, z2);
194 glVertex3f(x1, y1, z2);
195 glVertex3f(x1, y1, z1);
196 }
197 glEnd();
198}
199
200////////////////////////////////////////////////////////////////////////////////
201/// Create display-list that draws histogram bars for non-rebinned data.
202/// It is used for filled and outline passes.
203
205{
207 Int_t prevTower = 0;
208 Float_t offset = 0;
209
210 // ids in eta phi rng
212 for (Int_t s = 0; s < nSlices; ++s)
213 {
214 if (dlMap.empty() || dlMap[s] == 0)
215 dlMap[s] = glGenLists(1);
216
218
219 for (UInt_t i = 0; i < cellList.size(); ++i)
220 {
221 if (cellList[i].fSlice > s) continue;
222 if (cellList[i].fTower != prevTower) {
223 offset = 0;
224 prevTower = cellList[i].fTower;
225 }
226
228 if (s == cellList[i].fSlice)
229 {
230 if (selection) glLoadName(i);
231
232 WrapTwoPi(cellData.fPhiMin, cellData.fPhiMax);
233 MakeQuad(cellData.EtaMin(), cellData.PhiMin(), offset,
234 cellData.EtaDelta(), cellData.PhiDelta(), cellData.Value(fM->fPlotEt));
235 }
236 offset += cellData.Value(fM->fPlotEt);
237 }
238 glEndList();
239 }
240}
241
242////////////////////////////////////////////////////////////////////////////////
243/// Create display-list that draws histogram bars for rebinned data.
244/// It is used for filled and outline passes.
245
247{
249 Float_t *vals;
251 Float_t y0, y1;
252
253 for (Int_t s = 0; s < nSlices; ++s)
254 {
255 if (dlMap.empty() || dlMap[s] == 0)
256 dlMap[s] = glGenLists(1);
257
259
260 for (Int_t i = 1; i <= fEtaAxis->GetNbins(); ++i)
261 {
262 for (Int_t j = 1; j <= fPhiAxis->GetNbins(); ++j)
263 {
264 const Int_t bin = (i)+(j)*(fEtaAxis->GetNbins()+2);
265
266 if (rebinData.fBinData[bin] !=-1)
267 {
268 vals = rebinData.GetSliceVals(bin);
269 offset =0;
270 for (Int_t t = 0; t < s; ++t)
271 offset += vals[t];
272
275 WrapTwoPi(y0, y1);
276
277 if (selection) glLoadName(bin);
278
280 fEtaAxis->GetBinWidth(i), y1-y0, vals[s]);
281 }
282 }
283 }
284 glEndList();
285 }
286}
287
288////////////////////////////////////////////////////////////////////////////////
289/// Set the axis 3D title position.
290
292{
293 const GLdouble *pm = rnrCtx.RefCamera().RefLastNoPickProjM().CArr();
294 GLdouble mm[16];
295 GLint vp[4];
298 GLdouble projX[4], projY[4], projZ[4];
299
300 GLdouble cornerX[4];
301 GLdouble cornerY[4];
302 cornerX[0] = x0; cornerY[0] = y0;
303 cornerX[1] = x1; cornerY[1] = y0;
304 cornerX[2] = x1; cornerY[2] = y1;
305 cornerX[3] = x0; cornerY[3] = y1;
306
307 gluProject(cornerX[0], cornerY[0], 0, mm, pm, vp, &projX[0], &projY[0], &projZ[0]);
308 gluProject(cornerX[1], cornerY[1], 0, mm, pm, vp, &projX[1], &projY[1], &projZ[1]);
309 gluProject(cornerX[2], cornerY[2], 0, mm, pm, vp, &projX[2], &projY[2], &projZ[2]);
310 gluProject(cornerX[3], cornerY[3], 0, mm, pm, vp, &projX[3], &projY[3], &projZ[3]);
311
312
313 // Z axis location (left most corner)
314 //
315 Int_t idxLeft = 0;
316 Float_t xt = projX[0];
317 for (Int_t i = 1; i < 4; ++i) {
318 if (projX[i] < xt) {
319 xt = projX[i];
320 idxLeft = i;
321 }
322 }
324
325
326 // XY axis location (closest to eye) first
327 //
328 Float_t zt = 1.f;
329 Float_t zMin = 0.f;
330 Int_t idxFront = 0;
331 for (Int_t i = 0; i < 4; ++i) {
332 if (projZ[i] < zt) {
333 zt = projZ[i];
334 idxFront = i;
335 }
336 if (projZ[i] > zMin) zMin = projZ[i];
337 }
338
339
341 if (zMin - zt < 1e-2) xyIdx = 0; // avoid flipping in front view
342
343
344 switch (xyIdx) {
345 case 0:
348 fYAxisTitlePos.fX = x0;
350 break;
351 case 1:
352 fXAxisTitlePos.fX = x0;
356 break;
357 case 2:
358 fXAxisTitlePos.fX = x0;
362 break;
363 case 3:
366 fYAxisTitlePos.fX = x0;
368 break;
369 }
370
371 // move title 5% over the axis length
372 Float_t off = 0.05;
373 Float_t tOffX = (x1-x0) * off; if (fYAxisTitlePos.fX > x0) tOffX = -tOffX;
374 Float_t tOffY = (y1-y0) * off; if (fXAxisTitlePos.fY > y0) tOffY = -tOffY;
377
378
379 // frame box
380 //
381 if (fM->fBoxMode)
382 {
383 // get corner closest to eye excluding left corner
384 Double_t zm = 1.f;
385 Int_t idxDepthT = 0;
386 for (Int_t i = 0; i < 4; ++i)
387 {
388 if (projZ[i] < zm && projZ[i] >= zt && i != idxFront )
389 {
390 zm = projZ[i];
391 idxDepthT = i;
392 }
393 }
395
396 switch (idxFront)
397 {
398 case 0:
400 fBackPlaneYConst[0].Set(x0, y1, 0); fBackPlaneYConst[1].Set(x1, y1, 0);
401 break;
402 case 1:
403 fBackPlaneXConst[0].Set(x0, y0, 0); fBackPlaneXConst[1].Set(x0, y1, 0);
404 fBackPlaneYConst[0].Set(x0, y1, 0); fBackPlaneYConst[1].Set(x1, y1, 0);
405 break;
406 case 2:
407 fBackPlaneXConst[0].Set(x0, y0, 0); fBackPlaneXConst[1].Set(x0, y1, 0);
408 fBackPlaneYConst[0].Set(x0, y0, 0); fBackPlaneYConst[1].Set(x1, y0, 0);
409 break;
410 case 3:
412 fBackPlaneYConst[0].Set(x0, y0, 0); fBackPlaneYConst[1].Set(x1, y0, 0);
413 break;
414 }
415 }
416}
417
418////////////////////////////////////////////////////////////////////////////////
419/// Draw z-axis and z-box at the appropriate grid corner-point including
420/// tick-marks and labels.
421
423{
424 // set font size first depending on size of projected axis
425
426 TGLMatrix mm;
427 GLdouble pm[16];
430 Int_t* vp = rnrCtx.RefCamera().RefViewport().CArr();
431 GLdouble dn[3];
432 GLdouble up[3];
435 Float_t len = TMath::Sqrt((up[0] - dn[0]) * (up[0] - dn[0])
436 + (up[1] - dn[1]) * (up[1] - dn[1])
437 + (up[2] - dn[2]) * (up[2] - dn[2]));
438 len = TMath::Min(len, rnrCtx.RefCamera().RefViewport().Diagonal()*0.7f);
439 len /= TMath::Sqrt2();
440
442 fAxisPainter.RefTMOff(0) = rnrCtx.RefCamera().ViewportDeltaToWorld(worldRef, -len, 0, &mm);
445
446 Float_t tickLength = TMath::Max(fM->GetData()->GetEtaBins()->GetTickLength(), 0.02f);
447 Float_t labelOffset = TMath::Max(fM->GetData()->GetEtaBins()->GetLabelOffset(), 0.02f);
448
449 // Z axis
450 //
451 if (fM->fData->Empty() == kFALSE)
452 {
453 Int_t ondiv;
454 Double_t omin=0, omax=0, bw1;
457 TGLVector3 zto = rnrCtx.RefCamera().ViewportDeltaToWorld(worldRef, 0, fAxisPainter.GetLabelPixelFontSize(), &mm);
458 // check z axis title does not overalp with label
460 fZAxisTitlePos.fZ = omax + zto.Z();
461
462
466 fZAxis->SetNdivisions(fM->fNZSteps*100 + 10);
468 fZAxis->SetTitle(fM->GetPlotEt() ? "Et[GeV]" : "E[GeV]");
469
471 fAxisPainter.RefDir().Set(0., 0., 1.);
473 glPushMatrix();
475
476 // tickmark vector = 10 pixels left
481 glPopMatrix();
482
483 // draw box frame
484 //
485 if (fM->fBoxMode) {
486
488
489 // box verticals
491 glBegin(GL_LINES);
493
498
499
504
505 // box top
510
511 glEnd();
512
513 // box horizontals stippled
515 glLineStipple(1, 0x5555);
516 glBegin(GL_LINES);
517 Float_t hz = bw1;
518 for (Int_t i = 1; i <= ondiv; ++i, hz += bw1) {
523 }
524 glEnd();
525
526 glPopAttrib();
527 }
528 }
529
530 // XY Axis
531 //
532
534 if (fXAxisTitlePos.fY < fM->GetPhiMax()) yOff = -yOff;
535
537 if (fYAxisTitlePos.fX < fM->GetEtaMax()) xOff = -xOff;
538
539 TAxis ax;
540 ax.SetAxisColor(fGridColor);
541 ax.SetLabelColor(fFontColor);
542 ax.SetTitleColor(fFontColor);
543 ax.SetTitleFont(fM->GetData()->GetEtaBins()->GetTitleFont());
544 ax.SetLabelOffset(labelOffset);
545 ax.SetTickLength(tickLength);
547 fAxisPainter.RefTMOff(1).Set(0, 0, -fMaxVal);
549
550 // eta
551 glPushMatrix();
552 fAxisPainter.RefDir().Set(1, 0, 0);
553 fAxisPainter.RefTMOff(0).Set(0, yOff, 0);
555
556 ax.SetNdivisions(fM->GetData()->GetEtaBins()->GetNdivisions());
557 ax.SetLimits(fM->GetEtaMin(), fM->GetEtaMax());
558 ax.SetTitle(fM->GetData()->GetEtaBins()->GetTitle());
559 fAxisPainter.RefTitlePos().Set(fXAxisTitlePos.fX, yOff*1.5*ax.GetTickLength(), -fMaxVal*ax.GetTickLength());
561 glPopMatrix();
562
563 // phi
564 fAxisPainter.RefDir().Set(0, 1, 0);
565 fAxisPainter.RefTMOff(0).Set(xOff, 0, 0);
566 ax.SetNdivisions(fM->GetData()->GetPhiBins()->GetNdivisions());
567 ax.SetLimits(fM->GetPhiMin(), fM->GetPhiMax());
568 ax.SetTitle(fM->GetData()->GetPhiBins()->GetTitle());
569 glPushMatrix();
571 fAxisPainter.RefTitlePos().Set( xOff*1.5*ax.GetTickLength(), fYAxisTitlePos.fY, -fMaxVal*ax.GetTickLength());
573 glPopMatrix();
574
575} // DrawAxis3D
576
577////////////////////////////////////////////////////////////////////////////////
578/// Get scale for matrix.
579
581{
582 Double_t em, eM, pm, pM;
585 Double_t unit = ((eM - em) < (pM - pm)) ? (eM - em) : (pM - pm);
586 sx = (eM - em) / (fM->GetEtaRng() * unit);
587 sy = (pM - pm) / (fM->GetPhiRng() * unit);
588
589 sz = 1;
590 if (fM->fScaleAbs)
591 {
593 }
594 else if (!fM->fData->Empty())
595 {
596 sz = fM->GetMaxTowerH() / fMaxVal;
597 }
598}
599
600////////////////////////////////////////////////////////////////////////////////
601/// Draw XY axis.
602
604{
605 if (fM->GetData()->Empty())
607
608 TGLCamera& cam = rnrCtx.RefCamera();
609
610 TAxis ax;
611 ax.SetAxisColor(fGridColor);
612 ax.SetLabelColor(fFontColor);
613 ax.SetTitleColor(fFontColor);
614 ax.SetTitleFont(fM->GetData()->GetEtaBins()->GetTitleFont());
615 ax.SetTitleSize(TMath::Max(fM->GetData()->GetEtaBins()->GetTitleSize(), 0.02f));
616 ax.SetLabelOffset(TMath::Max(fM->GetData()->GetEtaBins()->GetLabelOffset(), 0.02f));
617 ax.SetTickLength(TMath::Max(fM->GetData()->GetEtaBins()->GetTickLength(), 0.05f));
618
619 // set fonts
621
622 // get projected length of diagonal to determine
623 TGLMatrix mm;
624 GLdouble pm[16];
625 GLint vp[4];
629
630 GLdouble dn[3];
631 GLdouble up[3];
632 gluProject(fM->GetEtaMin(), fM->GetPhiMin(), 0, mm.Arr(), pm, vp, &dn[0], &dn[1], &dn[2]);
633 gluProject(fM->GetEtaMax(), fM->GetPhiMax(), 0, mm.Arr(), pm, vp, &up[0], &up[1], &up[2]);
634 Double_t len = TMath::Sqrt((up[0] - dn[0]) * (up[0] - dn[0])
635 + (up[1] - dn[1]) * (up[1] - dn[1])
636 + (up[2] - dn[2]) * (up[2] - dn[2]));
637
638 // lock upper limit to of relative font size relative to viewport diagonal
639 Double_t vpLimit = cam.RefViewport().Diagonal()*0.5/TMath::Sqrt2();
641
642 // eta
645 ax.SetNdivisions(fM->GetData()->GetEtaBins()->GetNdivisions());
646 ax.SetLimits(fM->GetEtaMin(), fM->GetEtaMax());
647 ax.SetTitle(fM->GetData()->GetEtaBins()->GetTitle());
648 fAxisPainter.RefTitlePos().Set(fM->GetEtaMax(), -fM->GetPhiRng()*(ax.GetTickLength()+ ax.GetLabelOffset()), 0 );
649 fAxisPainter.RefDir().Set(1, 0, 0);
650
651 Float_t tmOffFrustX = cam.FrustumPlane(TGLCamera::kRight).D() + cam.FrustumPlane(TGLCamera::kLeft).D();
654
655 glPushMatrix();
656 glTranslatef(0, fM->GetPhiMin(), 0);
658 glPopMatrix();
659
660 // phi
661 ax.SetNdivisions(fM->GetData()->GetPhiBins()->GetNdivisions());
662 ax.SetLimits(fM->GetPhiMin(), fM->GetPhiMax());
663 ax.SetTitle(fM->GetData()->GetPhiBins()->GetTitle());
664 fAxisPainter.RefTitlePos().Set(-fM->GetEtaRng()*(ax.GetTickLength()+ ax.GetLabelOffset()), fM->GetPhiMax(), 0);
665 fAxisPainter.RefDir().Set(0, 1, 0);
666 Float_t tmOffFrustY = cam.FrustumPlane(TGLCamera::kTop).D() + cam.FrustumPlane(TGLCamera::kBottom).D();
669
670 glPushMatrix();
671 glTranslatef(fM->GetEtaMin(), 0, 0);
673 glPopMatrix();
674
676}
677
678////////////////////////////////////////////////////////////////////////////////
679/// Calculate view-dependent grid density.
680
682{
683 TGLCamera &camera = rnrCtx.RefCamera();
684 Float_t l = -camera.FrustumPlane(TGLCamera::kLeft).D();
685 Float_t r = camera.FrustumPlane(TGLCamera::kRight).D();
686 Float_t t = camera.FrustumPlane(TGLCamera::kTop).D();
687 Float_t b = -camera.FrustumPlane(TGLCamera::kBottom).D();
689
691 Float_t viewportD = TMath::Sqrt((vp[1] - vp[0]) * (vp[1] - vp[0]) + (vp[3] - vp[1]) * (vp[3] - vp[1]));
693
694 // average bin width
695 GLdouble em, eM, pm, pM;
698 Int_t i0 = fM->fData->GetEtaBins()->FindBin(fM->GetEtaMin());
699 Int_t i1 = fM->fData->GetEtaBins()->FindBin(fM->GetEtaMax());
700 Int_t j0 = fM->fData->GetPhiBins()->FindBin(fM->GetPhiMin());
701 Int_t j1 = fM->fData->GetPhiBins()->FindBin(fM->GetPhiMax());
702
703 Float_t averageBinWidth = TMath::Hypot(eM - em, pM - pm)/TMath::Sqrt((i0 - i1) * (i0 - i1) + (j0 - j1) * (j0 - j1));
704 Float_t ppb = deltaToViewport*averageBinWidth;
705
706 Int_t ngroup = 1;
707 if (fM->fAutoRebin && fM->fPixelsPerBin > ppb)
708 {
709 // limit rebin realtive to number of axis bins
710 Int_t maxGroup = TMath::Min(fM->fData->GetEtaBins()->GetNbins(), fM->fData->GetPhiBins()->GetNbins())/4;
711 if (maxGroup > 1) {
712 ngroup = TMath::Nint(fM->fPixelsPerBin*0.5/ppb); // symetrical rebin factor 2
714 }
715 }
717
718 return ngroup;
719}
720
721////////////////////////////////////////////////////////////////////////////////
722/// Rebin eta, phi axis.
723
725{
726 Double_t center = 0.5 * (orig->GetXmin() + orig->GetXmax());
727 Int_t idx0 = orig->FindBin(center);
728 Double_t bc = orig->GetBinCenter(idx0);
729 if (bc > center) --idx0;
730
733 std::vector<Double_t> bins(nbR + 1);
734 for (Int_t i = 0; i <= nbR; ++i)
735 {
736 bins[i] = orig->GetBinUpEdge(off + i*fBinStep);
737 }
738 curr->Set(nbR, &bins[0]);
739}
740
741////////////////////////////////////////////////////////////////////////////////
742/// Draw basic histogram components: x-y grid
743
745{
750
751 // XY grid
752 //
755 glBegin(GL_LINES);
760
765
766 // eta grid
767 Float_t val;
769 for (Int_t i = 0; i<= neb; i++)
770 {
771 val = fEtaAxis->GetBinUpEdge(i);
772 if (val > eta0 && val < eta1 )
773 {
774 glVertex2f(val, phi0);
775 glVertex2f(val, phi1);
776 }
777 }
778
779 // phi grid
781 for (Int_t i = 1; i <= npb; i++) {
782 val = fPhiAxis->GetBinUpEdge(i);
783 if (val > phi0 && val < phi1)
784 {
785 glVertex2f(eta0, val);
786 glVertex2f(eta1, val);
787 }
788 }
789
790 glEnd();
791
792 // XYZ axes
793 //
796 if (fCells3D)
797 {
800 }
801 else
802 {
804 }
805 glPopAttrib();
806}
807
808////////////////////////////////////////////////////////////////////////////////
809/// Render the calo lego-plot with OpenGL.
810
812{
813 // quads
814 {
815 for (SliceDLMap_i i = fDLMap.begin(); i != fDLMap.end(); ++i) {
817 glLoadName(i->first);
818 glPushName(0);
819 glCallList(i->second);
820 glPopName();
821 }
822 }
823 // outlines
824 {
825 if (rnrCtx.SceneStyle() == TGLRnrCtx::kFill) {
829 for (SliceDLMap_i i = fDLMap.begin(); i != fDLMap.end(); ++i)
830 glCallList(i->second);
831 }
832 }
833}
834
835////////////////////////////////////////////////////////////////////////////////
836/// Prepare cells 2D data non-rebinned for drawing.
837
839{
842
843 TEveCaloData::vCellId_t::iterator currentCell = cellList.begin();
844 TEveCaloData::vCellId_t::iterator nextCell = currentCell;
845 ++nextCell;
846
847 while (true)
848 {
851
855 while (nextCell != cellList.end() && currentCell->fTower == nextCell->fTower)
856 {
858 Float_t energy = nextCellData.Value(fM->fPlotEt);
859 sum += energy;
860 if (energy > max_energy)
861 {
862 max_energy = energy;
863 max_energy_slice = nextCell->fSlice;
864 }
865 ++nextCell;
866 ++cellID;
867 }
868
869 WrapTwoPi(currentCellData.fPhiMin, currentCellData.fPhiMax);
871 cells2D.back().SetGeom(currentCellData.fEtaMin, currentCellData.fEtaMax,
872 currentCellData.fPhiMin, currentCellData.fPhiMax);
873
874 if (nextCell == cellList.end())
875 break;
876
878 ++nextCell;
879 ++cellID;
880 }
881}
882
883////////////////////////////////////////////////////////////////////////////////
884/// Prepare cells 2D rebinned data for drawing.
885
887{
888 const Int_t nEta = fEtaAxis->GetNbins();
889 const Int_t nPhi = fPhiAxis->GetNbins();
890 std::vector<Float_t> vec;
891 vec.assign((nEta + 2)*(nPhi + 2), 0.f);
892 std::vector<Float_t> max_e;
893 std::vector<Int_t> max_e_slice;
894 max_e.assign((nEta + 2) * (nPhi + 2), 0.f);
895 max_e_slice.assign((nEta + 2) * (nPhi + 2), -1);
896
897 for (UInt_t bin = 0; bin < rebinData.fBinData.size(); ++bin) {
898 Float_t ssum = 0;
899 if (rebinData.fBinData[bin] != -1) {
900 Float_t *val = rebinData.GetSliceVals(bin);
901 for (Int_t s = 0; s < rebinData.fNSlices; ++s) {
902 ssum += val[s];
903 if (val[s] > max_e[bin]) {
904 max_e[bin] = val[s];
905 max_e_slice[bin] = s;
906 }
907 }
908 }
909 vec[bin] = ssum;
910 }
911
912 // smallest threshold
914 for (Int_t s = 1; s < fM->fData->GetNSlices(); ++s) {
917 }
918
919 // write cells
920 for (Int_t i = 1; i <= fEtaAxis->GetNbins(); ++i) {
921 for (Int_t j = 1; j <= fPhiAxis->GetNbins(); ++j) {
922 const Int_t bin = j * (nEta + 2) + i;
923 if (vec[bin] > threshold && rebinData.fBinData[bin] != -1) {
924 cells2D.push_back(Cell2D_t(bin, vec[bin], max_e_slice[bin]));
925 cells2D.back().SetGeom(fEtaAxis->GetBinLowEdge(i), fEtaAxis->GetBinUpEdge(i),
927 }
928 }
929 }
930}
931
932////////////////////////////////////////////////////////////////////////////////
933/// Draw cells in top view.
934
936{
937 Float_t bws = -1; //smallest bin
938 Float_t logMax = -1;
939
941
943 {
944 fM->AssertPalette();
945 UChar_t col[4];
946
947 for (vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i)
948 {
949 if (rnrCtx.SecSelection()) glLoadName(i->fId);
951 fM->fPalette->ColorFromValue(TMath::FloorNint(i->fSumVal), col);
952 col[3] = fM->GetData()->GetSliceTransparency(i->fMaxSlice);
954 Float_t z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
955 glVertex3f(i->fX0, i->fY0, z);
956 glVertex3f(i->fX1, i->fY0, z);
957 glVertex3f(i->fX1, i->fY1, z);
958 glVertex3f(i->fX0, i->fY1, z);
959 glEnd();
960 }
961 }
962 else
963 {
964 Float_t maxv = 0;
965 bws = 1e5;
966 for (vCell2D_i i = fCells2D.begin(); i != fCells2D.end(); ++i)
967 {
968 if (i->MinSize() < bws) bws = i->MinSize();
969 if (i->fSumVal > maxv) maxv = i->fSumVal;
970 }
971 bws *= 0.5f;
972 logMax = TMath::Log10(maxv + 1);
974
975 if (rnrCtx.SecSelection())
976 {
977 // Special draw for name stack.
978
979 for (vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i)
980 {
981 glLoadName(i->fMaxSlice);
982 glPushName(i->fId);
983
985 Float_t z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
986 glVertex3f(i->fX0, i->fY0, z);
987 glVertex3f(i->fX1, i->fY0, z);
988 glVertex3f(i->fX1, i->fY1, z);
989 glVertex3f(i->fX0, i->fY1, z);
990 glEnd();
991
992 glPopName();
993 }
994 }
995 else
996 {
997 // Optimised draw without name stack.
998
999 if ( ! rnrCtx.Highlight())
1000 {
1001 glBegin(GL_POINTS);
1002 for (vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i)
1003 {
1005 Float_t z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
1006 glVertex3f(i->X(), i->Y() , z);
1007 }
1008 glEnd();
1009 }
1010
1012 for (vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i)
1013 {
1015 Float_t bw = fValToPixel*TMath::Log10(i->fSumVal+1);
1016 Float_t x = i->X();
1017 Float_t y = i->Y();
1018 Float_t z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
1019 glVertex3f(x - bw, y - bw, z);
1020 glVertex3f(x + bw, y - bw, z);
1021 glVertex3f(x + bw, y + bw, z);
1022 glVertex3f(x - bw, y + bw, z);
1023 }
1024 glEnd();
1025
1027 {
1029 Float_t z = 0;
1030 Float_t zOff = fMaxVal*0.001 ; // avoid polygon stipling
1032 for ( vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i) {
1033 Char_t transp = TMath::Min(100, 80 + fM->fData->GetSliceTransparency(i->fMaxSlice) / 5);
1035 z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
1036 z -= zOff;
1037 glVertex3f(i->fX0, i->fY0, z);
1038 glVertex3f(i->fX1, i->fY0, z);
1039 glVertex3f(i->fX1, i->fY1, z);
1040 glVertex3f(i->fX0, i->fY1, z);
1041 }
1042 glEnd();
1043
1046 for ( vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i) {
1047 TGLUtil::ColorTransparency(fM->fData->GetSliceColor(i->fMaxSlice), 60);
1048 z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
1049 z += zOff;
1050 glVertex3f(i->fX0, i->fY0, z);
1051 glVertex3f(i->fX1, i->fY0, z);
1052 glVertex3f(i->fX1, i->fY1, z);
1053 glVertex3f(i->fX0, i->fY1, z);
1054 }
1055 glEnd();
1056 glPopAttrib();
1057 }
1058 }
1059 }
1060
1061 // text
1063 ! rnrCtx.Selection() && ! rnrCtx.Highlight())
1064 {
1065 TGLUtil::Color(rnrCtx.ColorSet().Markup().GetColorIndex());
1066 TGLFont font;
1067 rnrCtx.RegisterFontNoScale(fM->fCellPixelFontSize, "arial", TGLFont::kPixmap, font);
1068 const char* txt;
1069 for (vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i) {
1070
1071 Float_t val = i->fSumVal;
1072 if (val > 10)
1073 txt = Form("%d", TMath::Nint(val));
1074 else if (val > 1 )
1075 txt = Form("%.1f", val);
1076 else if (val > 0.01 )
1077 txt = Form("%.2f", 0.01*TMath::Nint(val*100));
1078 else
1079 txt = Form("~1e%d", TMath::Nint(TMath::Log10(val)));
1080
1081 font.Render(txt, i->X(), i->Y(), val*1.2, TGLFont::kCenterH, TGLFont::kCenterV);
1082 }
1083 }
1084}
1085
1086////////////////////////////////////////////////////////////////////////////////
1087/// Draw highligted cells.
1088
1090{
1091 if (fM->fData->GetCellsSelected().empty() && fM->fData->GetCellsHighlighted().empty())
1092 {
1093 return;
1094 }
1095
1096 // modelview matrix
1097 glPushMatrix();
1098 Float_t sx, sy, sz;
1100 glScalef(sx, sy, sz);
1101 glTranslatef(-fM->GetEta(), -fM->fPhi, 0);
1102
1103 if (fCells3D)
1104 {
1110 }
1111
1113 if (!fM->fData->GetCellsHighlighted().empty())
1114 {
1115 glColor4ubv(rnrCtx.ColorSet().Selection(3).CArr());
1117 }
1118 if (!fM->fData->GetCellsSelected().empty())
1119 {
1120 glColor4ubv(rnrCtx.ColorSet().Selection(1).CArr());
1122 }
1124
1125 if (fCells3D)
1126 {
1127 glPopAttrib();
1128 }
1129
1130 glPopMatrix();
1131}
1132
1133
1134////////////////////////////////////////////////////////////////////////////////
1135/// Draw selected cells in highlight mode.
1136
1138{
1139 // check eta&phi range of selected cells
1143 {
1144 fM->fData->GetCellData((*i), cellData);
1146 cellsSelected.push_back(*i);
1147 }
1148
1149 // prepare rebin for 2D or 3D if necessary
1151 if (fBinStep > 1)
1152 {
1154 if (fM->fNormalizeRebin) {
1155 Float_t scale = 1.f / (fBinStep * fBinStep);
1156 for (std::vector<Float_t>::iterator it = rebinDataSelected.fSliceData.begin();
1157 it != rebinDataSelected.fSliceData.end(); ++it)
1158 (*it) *= scale;
1159 }
1160 }
1161
1162 if (fCells3D)
1163 {
1164 Float_t offset = 0;
1165 if (fBinStep == 1)
1166 {
1168 {
1169 offset = 0;
1170 {
1171 Int_t orig_slice = j->fSlice;
1172 for (Int_t s = 0; s < orig_slice; ++s)
1173 {
1174 j->fSlice = s;
1176 offset += cellData.Value(fM->fPlotEt);
1177 }
1178 j->fSlice = orig_slice;
1179 }
1181 WrapTwoPi(cellData.fPhiMin, cellData.fPhiMax);
1182 MakeQuad(cellData.EtaMin(), cellData.PhiMin(), offset,
1183 cellData.EtaDelta(), cellData.PhiDelta(), cellData.Value(fM->fPlotEt));
1184 }
1185 }
1186 else
1187 {
1188 Float_t *vals;
1190 Float_t y0, y1;
1192 for (Int_t i = 1; i <= fEtaAxis->GetNbins(); ++i)
1193 {
1194 for (Int_t j = 1; j <= fPhiAxis->GetNbins(); ++j)
1195 {
1196 const Int_t bin = (i)+(j)*(fEtaAxis->GetNbins()+2);
1197 if (rebinDataSelected.fBinData[bin] !=-1)
1198 {
1199 offset = 0;
1200 vals = rebinDataSelected.GetSliceVals(bin);
1202 for (Int_t s = 0; s < nSlices; ++s)
1203 {
1204 if (vals[s] > 0)
1205 {
1208 WrapTwoPi(y0, y1);
1210 fEtaAxis->GetBinWidth(i), y1-y0, vals[s]);
1211 }
1212 offset += valsRef[s];
1213 }
1214 }
1215 }
1216 }
1217 }
1218 }
1219 else
1220 {
1222 if (fBinStep == 1)
1223 {
1224 // but is confusing since top view does not draw all slices at same time
1227 std::set<Int_t> towers;
1228 while (j != jEnd)
1229 {
1230 towers.insert(j->fTower);
1231 ++j;
1232 }
1233 for (vCell2D_i i = fCells2D.begin(); i != fCells2D.end(); ++i)
1234 {
1236 // std::set<Int_t>::iterator ti = towers.find(cell.fTower);
1237 if (towers.find(cell.fTower) != towers.end())
1238 {
1239 cells2DSelected.push_back(*i);
1240 }
1241 }
1242 }
1243 else
1244 {
1246 }
1248 }
1249}
1250
1251////////////////////////////////////////////////////////////////////////////////
1252/// Draw the object.
1253
1255{
1256 if (! fM->fData || ! fM->fData->GetEtaBins() || ! fM->fData->GetPhiBins())
1257 return;
1258
1259 // projection type
1261 fCells3D = (!(rnrCtx.RefCamera().IsOrthographic() && rnrCtx.RefCamera().GetCamBase().GetBaseVec(1).Z()));
1262 else if (fM->fProjection == TEveCaloLego::k2D)
1263 fCells3D = kFALSE;
1264 else if (fM->fProjection == TEveCaloLego::k3D)
1265 fCells3D = kTRUE;
1266
1267 // rebin axsis , check limits, fix TwoPi cycling
1269
1270 // rebin data
1272 {
1275 fRebinData.Clear();
1276
1279
1280 if (fBinStep > 1)
1281 {
1283
1284 fMaxVal = 0;
1285 for (UInt_t i = 0; i < fRebinData.fSliceData.size(); i += fRebinData.fNSlices)
1286 {
1287 Double_t sum = 0;
1288 for (Int_t s = 0; s < fRebinData.fNSlices; s++)
1289 {
1290 sum += fRebinData.fSliceData[i+s];
1291 }
1292 if (sum > fMaxVal) fMaxVal = sum;
1293 }
1294
1295 if (fM->fNormalizeRebin)
1296 {
1297 Float_t scale = 1.f / (fBinStep * fBinStep);
1298 for (std::vector<Float_t>::iterator it = fRebinData.fSliceData.begin(); it != fRebinData.fSliceData.end();
1299 ++it) {
1300 (*it) *= scale;
1301 }
1302 fMaxVal *= scale;
1303 }
1304 }
1305 else
1306 {
1307 fMaxVal = fM->GetMaxVal();
1308 }
1309 }
1310
1311 // modelview matrix
1312 glPushMatrix();
1313 Float_t sx, sy, sz;
1315 glScalef(sx, sy, sz);
1316 glTranslatef(-fM->GetEta(), -fM->fPhi, 0);
1317
1320 if (fGridColor < 0 || fFontColor < 0)
1321 {
1322 TColor* c1 = gROOT->GetColor(rnrCtx.ColorSet().Markup().GetColorIndex());
1323 TColor* c2 = gROOT->GetColor(rnrCtx.ColorSet().Background().GetColorIndex());
1324 Float_t f1, f2;
1325 if (fFontColor < 0) {
1326 f1 = 0.8; f2 = 0.2;
1327 fFontColor = TColor::GetColor(c1->GetRed() *f1 + c2->GetRed() *f2,
1328 c1->GetGreen()*f1 + c2->GetGreen()*f2,
1329 c1->GetBlue() *f1 + c2->GetBlue() *f2);
1330 }
1331 if (fGridColor < 0) {
1332 f1 = 0.3; f2 = 0.3;
1333 fGridColor = TColor::GetColor(c1->GetRed() *f1 + c2->GetRed() *f2,
1334 c1->GetGreen()*f1 + c2->GetGreen()*f2,
1335 c1->GetBlue() *f1 + c2->GetBlue() *f2);
1336 }
1337 }
1338
1343 if (!fM->fData->Empty())
1344 {
1345 glPushName(0);
1346 if (fCells3D)
1347 {
1348 if (fDLCacheOK == kFALSE)
1349 {
1350 if (fBinStep == 1)
1352 else
1354 fDLCacheOK = kTRUE;
1355 }
1358 glPolygonOffset(0.8, 1);
1359
1361 }
1362 else
1363 {
1365
1366 fCells2D.clear();
1367 if (fBinStep == 1)
1369 else
1371
1373 }
1374 glPopName();
1375 }
1376 glPopAttrib();
1377
1378 // draw histogram base
1379 if (rnrCtx.Selection() == kFALSE && rnrCtx.IsDrawPassFilled())
1380 {
1384 if (fM->fDrawHPlane) {
1395 glEnd();
1396 }
1397 glPopAttrib();
1398 }
1399
1400 glPopMatrix();
1401}
1402
1403////////////////////////////////////////////////////////////////////////////////
1404/// Processes tower selection from TGLViewer.
1405
1407{
1409 if (rec.GetN() > 2)
1410 {
1411 Int_t slice = rec.GetItem(1);
1412 Int_t cell = rec.GetItem(2);
1413
1414 if (fBinStep == 1)
1415 {
1416 Int_t tower = fM->fCellList[cell].fTower;
1417 while (cell > 0 && tower == fM->fCellList[cell].fTower)
1418 {
1419 sel.push_back(fM->fCellList[cell]);
1420 if (fCells3D) break;
1421 --cell;
1422 }
1423 }
1424 else
1425 {
1426 if (cell > 0)
1427 {
1429 Int_t phiBin = Int_t(cell/(nEta+2));
1430 Int_t etaBin = cell - phiBin*(nEta+2);
1434 sl);
1435
1436 for (TEveCaloData::vCellId_i it = sl.begin(); it != sl.end(); ++it)
1437 {
1438 if (fCells3D) {
1439 if ((*it).fSlice == slice ) sel.push_back(*it);
1440 } else {
1441 if ((*it).fSlice <= slice ) sel.push_back(*it);
1442 }
1443 }
1444 }
1445 }
1446 }
1447 fM->fData->ProcessSelection(sel, rec);
1448}
#define b(i)
Definition RSha256.hxx:100
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:51
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:411
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2495
const_iterator begin() const
const_iterator end() const
virtual void SetAxisColor(Color_t color=1, Float_t alpha=1.)
Set color of the line axis and tick marks.
Definition TAttAxis.cxx:141
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
Definition TAttAxis.cxx:172
virtual void SetTitleColor(Color_t color=1)
Set color of axis title.
Definition TAttAxis.cxx:299
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
Definition TAttAxis.cxx:265
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Definition TAttAxis.cxx:214
virtual void SetLabelColor(Color_t color=1, Float_t alpha=1.)
Set color of labels.
Definition TAttAxis.cxx:151
Class to manage histogram axis.
Definition TAxis.h:32
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Definition TAxis.cxx:481
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition TAxis.cxx:521
virtual void SetLimits(Double_t xmin, Double_t xmax)
Definition TAxis.h:166
Int_t GetNbins() const
Definition TAxis.h:127
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition TAxis.cxx:545
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition TAxis.cxx:531
The color creation and management class.
Definition TColor.h:22
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1926
virtual void GetEtaLimits(Double_t &min, Double_t &max) const =0
std::vector< CellId_t > vCellId_t
Bool_t Empty() const
virtual void GetCellList(Float_t etaMin, Float_t etaMax, Float_t phi, Float_t phiRng, vCellId_t &out) const =0
void ProcessSelection(vCellId_t &sel_cells, TGLSelectRecord &rec)
Process newly selected cells with given select-record.
virtual void GetCellData(const CellId_t &id, CellData_t &data) const =0
Char_t GetSliceTransparency(Int_t slice) const
Get transparency for given slice.
virtual TAxis * GetEtaBins() const
Color_t GetSliceColor(Int_t slice) const
Get color for given slice.
Int_t GetNSlices() const
vCellId_t & GetCellsHighlighted()
virtual void GetPhiLimits(Double_t &min, Double_t &max) const =0
virtual TAxis * GetPhiBins() const
vCellId_t & GetCellsSelected()
virtual void Rebin(TAxis *ax, TAxis *ay, vCellId_t &in, Bool_t et, RebinData_t &out) const =0
std::vector< CellId_t >::iterator vCellId_i
std::vector< Cell2D_t > vCell2D_t
void MakeQuad(Float_t x, Float_t y, Float_t z, Float_t xw, Float_t yw, Float_t zh) const
Draw an axis-aligned box using quads.
TEveVector fBackPlaneYConst[2]
TEveVector fZAxisTitlePos
void WrapTwoPi(Float_t &min, Float_t &max) const
void PrepareCell2DData(TEveCaloData::vCellId_t &cellList, vCell2D_t &cells2D) const
Prepare cells 2D data non-rebinned for drawing.
void DLCacheDrop() override
Drop all display-list definitions.
Int_t fCurrentPixelsPerBin
void DrawSelectedCells(TGLRnrCtx &rnrCtx, TEveCaloData::vCellId_t cells) const
Draw selected cells in highlight mode.
void DrawCells3D(TGLRnrCtx &rnrCtx) const
Render the calo lego-plot with OpenGL.
void DrawHistBase(TGLRnrCtx &rnrCtx) const
Draw basic histogram components: x-y grid.
TEveVector fXAxisTitlePos
void DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t &cells2D) const
Draw cells in top view.
void DrawAxis3D(TGLRnrCtx &rnrCtx) const
Draw z-axis and z-box at the appropriate grid corner-point including tick-marks and labels.
Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr) override
Set model object.
void RebinAxis(TAxis *orig, TAxis *curr) const
Rebin eta, phi axis.
void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec) override
Processes tower selection from TGLViewer.
Int_t GetGridStep(TGLRnrCtx &rnrCtx) const
Calculate view-dependent grid density.
void DLCachePurge() override
Unregister all display-lists.
void DirectDraw(TGLRnrCtx &rnrCtx) const override
Draw the object.
std::vector< Cell2D_t >::iterator vCell2D_i
vCell2D_t fCells2D
void GetScaleForMatrix(Float_t &sx, Float_t &sy, Float_t &sz) const
Get scale for matrix.
TEveVector fBackPlaneXConst[2]
~TEveCaloLegoGL() override
Destructor.
void SetBBox() override
Set bounding box.
void Make3DDisplayListRebin(TEveCaloData::RebinData_t &rebinData, SliceDLMap_t &map, Bool_t select) const
Create display-list that draws histogram bars for rebinned data.
void DrawHighlight(TGLRnrCtx &rnrCtx, const TGLPhysicalShape *ps, Int_t lvl=-1) const override
Draw highligted cells.
void SetAxis3DTitlePos(TGLRnrCtx &rnrCtx, Float_t x0, Float_t x1, Float_t y0, Float_t y1) const
Set the axis 3D title position.
TEveCaloLegoGL()
Constructor.
TEveCaloLego * fM
void DrawAxis2D(TGLRnrCtx &rnrCtx) const
Draw XY axis.
void Make3DDisplayList(TEveCaloData::vCellId_t &cellList, SliceDLMap_t &map, Bool_t select) const
Create display-list that draws histogram bars for non-rebinned data.
TGLAxisPainter fAxisPainter
std::map< Int_t, UInt_t > SliceDLMap_t
TEveVector fYAxisTitlePos
std::map< Int_t, UInt_t >::iterator SliceDLMap_i
void PrepareCell2DDataRebin(TEveCaloData::RebinData_t &rebinData, vCell2D_t &cells2D) const
Prepare cells 2D rebinned data for drawing.
SliceDLMap_t fDLMap
TEveCaloData::RebinData_t fRebinData
Visualization of calorimeter data as eta/phi histogram.
Definition TEveCalo.h:251
EProjection_e fProjection
Definition TEveCalo.h:279
Bool_t fNormalizeRebin
Definition TEveCalo.h:277
Char_t fPlaneTransparency
Definition TEveCalo.h:270
Color_t fPlaneColor
Definition TEveCalo.h:269
EBoxMode_e fBoxMode
Definition TEveCalo.h:281
Int_t fDrawNumberCellPixels
Definition TEveCalo.h:289
E2DMode_e f2DMode
Definition TEveCalo.h:280
Float_t fHPlaneVal
Definition TEveCalo.h:284
float GetFixedHeightValIn2DMode() const
Definition TEveCalo.h:334
TEveCaloData::vCellId_t fCellList
Definition TEveCalo.h:265
Color_t fFontColor
Definition TEveCalo.h:267
Bool_t fDrawHPlane
Definition TEveCalo.h:283
Bool_t fAutoRebin
Definition TEveCalo.h:275
bool GetHasFixedHeightIn2DMode() const
Definition TEveCalo.h:331
Int_t fCellPixelFontSize
Definition TEveCalo.h:290
Color_t fGridColor
Definition TEveCalo.h:268
Int_t fNZSteps
Definition TEveCalo.h:272
Int_t fPixelsPerBin
Definition TEveCalo.h:276
Color_t GetDataSliceColor(Int_t slice) const
Get slice color from data.
Definition TEveCalo.cxx:120
Float_t GetEtaMin() const
Definition TEveCalo.h:137
Bool_t AssertCellIdCache() const
Assert cell id cache is ok.
Definition TEveCalo.cxx:292
Float_t fPlotEt
Definition TEveCalo.h:55
Float_t GetDataSliceThreshold(Int_t slice) const
Get threshold for given slice.
Definition TEveCalo.cxx:85
Float_t GetMaxTowerH() const
Definition TEveCalo.h:113
Float_t GetPhiRng() const
Definition TEveCalo.h:147
TEveRGBAPalette * fPalette
Definition TEveCalo.h:62
Double_t fEtaMax
Definition TEveCalo.h:44
Float_t GetMaxVal() const
Definition TEveCalo.cxx:158
TEveCaloData * GetData() const
Definition TEveCalo.h:87
Float_t GetEta() const
Definition TEveCalo.h:136
TEveRGBAPalette * AssertPalette()
Make sure the TEveRGBAPalette pointer is not null.
Definition TEveCalo.cxx:377
Bool_t GetPlotEt() const
Definition TEveCalo.h:109
Float_t GetEtaMax() const
Definition TEveCalo.h:138
Bool_t fScaleAbs
Definition TEveCalo.h:58
Double_t fPhi
Definition TEveCalo.h:46
TEveCaloData * fData
Definition TEveCalo.h:40
Float_t GetPhiMax() const
Definition TEveCalo.h:146
Double_t fEtaMin
Definition TEveCalo.h:43
Float_t GetEtaRng() const
Definition TEveCalo.h:139
Float_t fMaxValAbs
Definition TEveCalo.h:59
Bool_t CellInEtaPhiRng(TEveCaloData::CellData_t &) const
Returns true if given cell is in the ceta phi range.
Definition TEveCalo.cxx:306
Float_t GetPhiMin() const
Definition TEveCalo.h:145
const UChar_t * ColorFromValue(Int_t val) const
void Set(const Float_t *v)
Definition TEveVector.h:82
TGLVector3 & RefDir()
void SetLabelAlign(TGLFont::ETextAlignH_e, TGLFont::ETextAlignV_e)
Set label align.
TGLVector3 & RefTitlePos()
void SetAttAxis(TAttAxis *a)
void SetLabelPixelFontSize(Int_t fs)
void SetTMNDim(Int_t x)
TGLVector3 & RefTMOff(Int_t i)
void SetFontMode(TGLFont::EMode m)
Int_t GetLabelPixelFontSize() const
void PaintAxis(TGLRnrCtx &ctx, TAxis *ax)
GL render TAxis.
void SetTitlePixelFontSize(Int_t fs)
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition TGLCamera.h:44
A wrapper class for FTFont.
void Render(const char *txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
virtual void DLCachePurge()
Purge all entries for all LODs for this drawable from the display list cache, returning the reserved ...
TObject * fExternalObj
first replica
virtual void DLCacheDrop()
Drop all entries for all LODs for this drawable from the display list cache, WITHOUT returning the re...
void PurgeDLRange(UInt_t base, Int_t size) const
External object is a fake.
Bool_t fDLCache
display-list validity bit-field
16 component (4x4) transform matrix - column MAJOR as per GL.
Definition TGLUtil.h:598
Double_t * Arr()
Definition TGLUtil.h:665
Base-class for direct OpenGL renderers.
Definition TGLObject.h:22
void SetAxisAlignedBBox(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax)
Set axis-aligned bounding-box.
Definition TGLObject.cxx:85
Concrete physical shape - a GL drawable.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition TGLRnrCtx.h:41
Standard selection record including information about containing scene and details ob out selected ob...
static void Color4ubv(const UChar_t *rgba)
Wrapper for glColor4ubv.
Definition TGLUtil.cxx:1770
static UInt_t LockColor()
Prevent further color changes.
Definition TGLUtil.cxx:1660
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:1732
static UInt_t UnlockColor()
Allow color changes.
Definition TGLUtil.cxx:1668
static void Color(const TGLColor &color)
Set color from TGLColor.
Definition TGLUtil.cxx:1688
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
Definition TGLUtil.cxx:1934
3 component (x/y/z) vector class.
Definition TGLUtil.h:248
3 component (x/y/z) vertex class.
Definition TGLUtil.h:84
Double_t X() const
Definition TGLUtil.h:119
void Set(Double_t x, Double_t y, Double_t z)
Definition TGLUtil.h:210
Double_t Y() const
Definition TGLUtil.h:121
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.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
Mother of all ROOT objects.
Definition TObject.h:41
Double_t y[n]
Definition legend1.C:17
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
TF1 * f1
Definition legend1.C:11
return c2
Definition legend2.C:14
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Definition TMath.h:704
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:251
constexpr Double_t Sqrt2()
Definition TMath.h:89
Int_t FloorNint(Double_t x)
Returns the nearest integer of TMath::Floor(x).
Definition TMath.h:697
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:199
Double_t Hypot(Double_t x, Double_t y)
Returns sqrt(x*x + y*y)
Definition TMath.cxx:59
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Definition TMath.h:773
Cell data inner structure.
std::vector< Float_t > fSliceData
Float_t * GetSliceVals(Int_t bin)
TLine l
Definition textangle.C:4
static uint64_t sum(uint64_t i)
Definition Factory.cxx:2339