Logo ROOT   6.18/05
Reference Guide
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
24class TEveCaloLego;
25
27{
28 friend class TEveCaloLegoOverlay;
29
30private:
31 struct Cell2D_t
32 {
36
38
39 Cell2D_t(Int_t id, Float_t sumVal, Int_t maxSlice)
40 {
41 fId = id;
42 fSumVal = sumVal;
43 fMaxSlice = maxSlice;
44 fX0 = fX1 = fY0 = fY1 = 0;
45 }
46
48 {
49 fX0 = x0; fX1 = x1;
50 fY0 = y0; fY1 = y1;
51 }
52
53 Float_t MinSize() { return TMath::Min(fX1- fX0, fY1 - fY0); }
54 Float_t X() { return 0.5*(fX0 + fX1); }
55 Float_t Y() { return 0.5*(fY0 + fY1); }
56 };
57
58 typedef std::vector<Cell2D_t> vCell2D_t;
59 typedef std::vector<Cell2D_t>::iterator vCell2D_i;
60
61 typedef std::map<Int_t, UInt_t> SliceDLMap_t;
62 typedef std::map<Int_t, UInt_t>::iterator SliceDLMap_i;
63
64 // histogram base
67
68 mutable TAxis *fEtaAxis;
69 mutable TAxis *fPhiAxis;
70 mutable TAxis *fZAxis;
76
78
79 // cached
83
86 mutable Float_t fValToPixel; // top logaritmic viewview
88
91
92 mutable Int_t fBinStep;
93
94 TEveCaloLegoGL(const TEveCaloLegoGL&); // Stop default
95 TEveCaloLegoGL& operator=(const TEveCaloLegoGL&); // Stop default
96
97private:
98 void GetScaleForMatrix(Float_t& sx, Float_t& sy, Float_t& sz) const;
99 Int_t GetGridStep(TGLRnrCtx &rnrCtx) const;
100 void RebinAxis(TAxis *orig, TAxis *curr) const;
101
102 void SetAxis3DTitlePos(TGLRnrCtx &rnrCtx, Float_t x0, Float_t x1, Float_t y0, Float_t y1) const;
103 void DrawAxis3D(TGLRnrCtx &rnrCtx) const;
104 void DrawAxis2D(TGLRnrCtx &rnrCtx) const;
105 void DrawHistBase(TGLRnrCtx &rnrCtx) const;
106
107 // highlight
108 void DrawSelectedCells(TGLRnrCtx & rnrCtx, TEveCaloData::vCellId_t cells) const;
109
110 // top view
111 void PrepareCell2DData(TEveCaloData::vCellId_t& cellList, vCell2D_t& cells2D) const;
112 void PrepareCell2DDataRebin(TEveCaloData::RebinData_t& rebinData, vCell2D_t& cells2D) const;
113 void DrawCells2D(TGLRnrCtx & rnrCtx, vCell2D_t& cells2D) const;
114
115 // 3D view
116 void DrawCells3D(TGLRnrCtx & rnrCtx) const;
117 void MakeQuad(Float_t x, Float_t y, Float_t z, Float_t xw, Float_t yw, Float_t zh) const;
118 void Make3DDisplayList(TEveCaloData::vCellId_t& cellList, SliceDLMap_t& map, Bool_t select) const;
119 void Make3DDisplayListRebin(TEveCaloData::RebinData_t& rebinData, SliceDLMap_t& map, Bool_t select) const;
120
121 void WrapTwoPi(Float_t &min, Float_t &max) const;
122
123public:
125 virtual ~TEveCaloLegoGL();
126
127 virtual Bool_t SetModel(TObject* obj, const Option_t* opt = 0);
128
129 virtual void SetBBox();
130
131 virtual void DLCacheDrop();
132 virtual void DLCachePurge();
133
134 virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;
135 virtual void DrawHighlight(TGLRnrCtx& rnrCtx, const TGLPhysicalShape* ps, Int_t lvl=-1) const;
136
137 virtual Bool_t SupportsSecondarySelect() const { return kTRUE; }
138 virtual Bool_t AlwaysSecondarySelect() const { return kTRUE; }
139 virtual void ProcessSelection(TGLRnrCtx & rnrCtx, TGLSelectRecord & rec);
140
141 ClassDef(TEveCaloLegoGL, 0); // GL renderer class for TEveCaloLego.
142};
143
144//______________________________________________________________________________
145inline void TEveCaloLegoGL::WrapTwoPi(Float_t &min, Float_t &max) const
146{
147 if (fM->GetData()->GetWrapTwoPi())
148 {
149 if (fM->GetPhiMax()>TMath::Pi() && max<=fM->GetPhiMin())
150 {
151 min += TMath::TwoPi();
152 max += TMath::TwoPi();
153 }
154 else if (fM->GetPhiMin()<-TMath::Pi() && min>=fM->GetPhiMax())
155 {
156 min -= TMath::TwoPi();
157 max -= TMath::TwoPi();
158 }
159 }
160}
161#endif
static const double x1[5]
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
short Color_t
Definition: RtypesCore.h:79
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
XFontStruct * id
Definition: TGX11.cxx:108
Class to manage histogram axis.
Definition: TAxis.h:30
std::vector< CellId_t > vCellId_t
Definition: TEveCaloData.h:146
Bool_t GetWrapTwoPi() const
Definition: TEveCaloData.h:227
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]
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
Draw the object.
Color_t fFontColor
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.
Int_t fCurrentPixelsPerBin
void DrawSelectedCells(TGLRnrCtx &rnrCtx, TEveCaloData::vCellId_t cells) const
Draw selected cells in highlight mode.
virtual Bool_t AlwaysSecondarySelect() const
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.
virtual void DrawHighlight(TGLRnrCtx &rnrCtx, const TGLPhysicalShape *ps, Int_t lvl=-1) const
Draw highligted cells.
void RebinAxis(TAxis *orig, TAxis *curr) const
Rebin eta, phi axis.
Int_t GetGridStep(TGLRnrCtx &rnrCtx) const
Calculate view-dependent grid density.
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.
virtual void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec)
Processes tower selection from TGLViewer.
TEveVector fBackPlaneXConst[2]
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.
virtual void SetBBox()
Set bounding box.
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)
Set model object.
Float_t fValToPixel
virtual Bool_t SupportsSecondarySelect() const
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
virtual void DLCacheDrop()
Drop all display-list definitions.
void DrawAxis2D(TGLRnrCtx &rnrCtx) const
Draw XY axis.
virtual void DLCachePurge()
Unregister all display-lists.
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
virtual ~TEveCaloLegoGL()
Destructor.
void PrepareCell2DDataRebin(TEveCaloData::RebinData_t &rebinData, vCell2D_t &cells2D) const
Prepare cells 2D rebinned data for drawing.
SliceDLMap_t fDLMap
Color_t fGridColor
TEveCaloData::RebinData_t fRebinData
GL-overlay control GUI for TEveCaloLego.
Visualization of calorimeter data as eta/phi histogram.
Definition: TEveCalo.h:250
TEveCaloData * GetData() const
Definition: TEveCalo.h:86
Float_t GetPhiMax() const
Definition: TEveCalo.h:145
Float_t GetPhiMin() const
Definition: TEveCalo.h:144
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:37
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
static constexpr double ps
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
constexpr Double_t Pi()
Definition: TMath.h:38
constexpr Double_t TwoPi()
Definition: TMath.h:45
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)