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 virtual ~TEveCaloLegoGL();
127
128 virtual Bool_t SetModel(TObject* obj, const Option_t* opt = 0);
129
130 virtual void SetBBox();
131
132 virtual void DLCacheDrop();
133 virtual void DLCachePurge();
134
135 virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;
136 virtual void DrawHighlight(TGLRnrCtx& rnrCtx, const TGLPhysicalShape* ps, Int_t lvl=-1) const;
137
138 virtual Bool_t SupportsSecondarySelect() const { return kTRUE; }
139 virtual Bool_t AlwaysSecondarySelect() const { return kTRUE; }
140 virtual void ProcessSelection(TGLRnrCtx & rnrCtx, TGLSelectRecord & rec);
141
142 ClassDef(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
static const double x1[5]
short Color_t
Definition RtypesCore.h:83
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
XFontStruct * id
Definition TGX11.cxx:109
Class to manage histogram axis.
Definition TAxis.h:30
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]
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
Draw the object.
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.
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
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
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
Short_t Min(Short_t a, Short_t b)
Definition TMathBase.h:180
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)