Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveCaloLegoGL.h
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#ifndef ROOT_TEveCaloLegoGL
13#define ROOT_TEveCaloLegoGL
14
15#include "TGLObject.h"
16#include "TGLAxisPainter.h"
17
18#include "TEveCaloData.h"
19#include "TEveVector.h"
20#include "TEveCalo.h"
21
22#include <map>
23#include <vector>
24
25class TEveCaloLego;
26
28{
29 friend class TEveCaloLegoOverlay;
30
31private:
32 struct Cell2D_t
33 {
37
39
40 Cell2D_t(Int_t id, Float_t sumVal, Int_t maxSlice)
41 {
42 fId = id;
43 fSumVal = sumVal;
44 fMaxSlice = maxSlice;
45 fX0 = fX1 = fY0 = fY1 = 0;
46 }
47
49 {
50 fX0 = x0; fX1 = x1;
51 fY0 = y0; fY1 = y1;
52 }
53
54 Float_t MinSize() { return TMath::Min(fX1- fX0, fY1 - fY0); }
55 Float_t X() { return 0.5*(fX0 + fX1); }
56 Float_t Y() { return 0.5*(fY0 + fY1); }
57 };
58
59 typedef std::vector<Cell2D_t> vCell2D_t;
60 typedef std::vector<Cell2D_t>::iterator vCell2D_i;
61
62 typedef std::map<Int_t, UInt_t> SliceDLMap_t;
63 typedef std::map<Int_t, UInt_t>::iterator SliceDLMap_i;
64
65 // histogram base
68
69 mutable TAxis *fEtaAxis;
70 mutable TAxis *fPhiAxis;
71 mutable TAxis *fZAxis;
77
79
80 // cached
84
87 mutable Float_t fValToPixel; // top logaritmic viewview
89
92
93 mutable Int_t fBinStep;
94
95 TEveCaloLegoGL(const TEveCaloLegoGL&); // Stop default
96 TEveCaloLegoGL& operator=(const TEveCaloLegoGL&); // Stop default
97
98private:
99 void GetScaleForMatrix(Float_t& sx, Float_t& sy, Float_t& sz) const;
100 Int_t GetGridStep(TGLRnrCtx &rnrCtx) const;
101 void RebinAxis(TAxis *orig, TAxis *curr) const;
102
103 void SetAxis3DTitlePos(TGLRnrCtx &rnrCtx, Float_t x0, Float_t x1, Float_t y0, Float_t y1) const;
104 void DrawAxis3D(TGLRnrCtx &rnrCtx) const;
105 void DrawAxis2D(TGLRnrCtx &rnrCtx) const;
106 void DrawHistBase(TGLRnrCtx &rnrCtx) const;
107
108 // highlight
109 void DrawSelectedCells(TGLRnrCtx & rnrCtx, TEveCaloData::vCellId_t cells) const;
110
111 // top view
112 void PrepareCell2DData(TEveCaloData::vCellId_t& cellList, vCell2D_t& cells2D) const;
113 void PrepareCell2DDataRebin(TEveCaloData::RebinData_t& rebinData, vCell2D_t& cells2D) const;
114 void DrawCells2D(TGLRnrCtx & rnrCtx, vCell2D_t& cells2D) const;
115
116 // 3D view
117 void DrawCells3D(TGLRnrCtx & rnrCtx) const;
118 void MakeQuad(Float_t x, Float_t y, Float_t z, Float_t xw, Float_t yw, Float_t zh) const;
119 void Make3DDisplayList(TEveCaloData::vCellId_t& cellList, SliceDLMap_t& map, Bool_t select) const;
120 void Make3DDisplayListRebin(TEveCaloData::RebinData_t& rebinData, SliceDLMap_t& map, Bool_t select) const;
121
122 void WrapTwoPi(Float_t &min, Float_t &max) const;
123
124public:
126 ~TEveCaloLegoGL() override;
127
128 Bool_t SetModel(TObject* obj, const Option_t* opt = nullptr) override;
129
130 void SetBBox() override;
131
132 void DLCacheDrop() override;
133 void DLCachePurge() override;
134
135 void DirectDraw(TGLRnrCtx & rnrCtx) const override;
136 void DrawHighlight(TGLRnrCtx& rnrCtx, const TGLPhysicalShape* ps, Int_t lvl=-1) const override;
137
138 Bool_t SupportsSecondarySelect() const override { return kTRUE; }
139 Bool_t AlwaysSecondarySelect() const override { return kTRUE; }
140 void ProcessSelection(TGLRnrCtx & rnrCtx, TGLSelectRecord & rec) override;
141
142 ClassDefOverride(TEveCaloLegoGL, 0); // GL renderer class for TEveCaloLego.
143};
144
145//______________________________________________________________________________
146inline void TEveCaloLegoGL::WrapTwoPi(Float_t &min, Float_t &max) const
147{
148 if (fM->GetData()->GetWrapTwoPi())
149 {
150 if (fM->GetPhiMax()>TMath::Pi() && max<=fM->GetPhiMin())
151 {
152 min += TMath::TwoPi();
153 max += TMath::TwoPi();
154 }
155 else if (fM->GetPhiMin()<-TMath::Pi() && min>=fM->GetPhiMax())
156 {
157 min -= TMath::TwoPi();
158 max -= TMath::TwoPi();
159 }
160 }
161}
162#endif
short Color_t
Definition RtypesCore.h:92
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y1
Class to manage histogram axis.
Definition TAxis.h:31
std::vector< CellId_t > vCellId_t
Bool_t GetWrapTwoPi() const
OpenGL renderer class for TEveCaloLego.
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]
Bool_t AlwaysSecondarySelect() const override
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.
Bool_t SupportsSecondarySelect() const override
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.
TEveCaloLegoGL & operator=(const TEveCaloLegoGL &)
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.
TEveCaloLegoGL(const TEveCaloLegoGL &)
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
GL-overlay control GUI for TEveCaloLego.
Visualization of calorimeter data as eta/phi histogram.
Definition TEveCalo.h:251
TEveCaloData * GetData() const
Definition TEveCalo.h:87
Float_t GetPhiMax() const
Definition TEveCalo.h:146
Float_t GetPhiMin() const
Definition TEveCalo.h:145
Utility class to paint axis in GL.
Base-class for direct OpenGL renderers.
Definition TGLObject.h:22
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...
Mother of all ROOT objects.
Definition TObject.h:41
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:198
constexpr Double_t Pi()
Definition TMath.h:37
constexpr Double_t TwoPi()
Definition TMath.h:44
void SetGeom(Float_t x0, Float_t x1, Float_t y0, Float_t y1)
Cell2D_t(Int_t id, Float_t sumVal, Int_t maxSlice)