Logo ROOT  
Reference Guide
REveCalo.hxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Author: Matevz 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_REveCalo
13#define ROOT_REveCalo
14
15#include "ROOT/REveElement.hxx"
18
19#include "TAtt3D.h"
20#include "TAttBBox.h"
21#include "ROOT/REveCaloData.hxx"
22
23class TClass;
24
25namespace ROOT {
26namespace Experimental {
27
28class REveRGBAPalette;
29class REveCaloViz : public REveElement,
30 public TAtt3D,
31 public TAttBBox,
32 public REveProjectable
33{
34
35private:
37
38protected:
39 REveCaloData* fData; // event data reference
40 Bool_t fCellIdCacheOK; // data cell ids cache state
41
44
46 Double_t fPhiOffset; // phi range +/- offset
47
48 Bool_t fAutoRange; // set eta phi limits on DataChanged()
49
50 Float_t fBarrelRadius; // barrel raidus in cm
51 Float_t fEndCapPosF; // forward end cap z coordinate in cm
52 Float_t fEndCapPosB; // backward end cap z coordinate in cm (should be < 0)
53
54 Float_t fPlotEt; // plot E or Et.
55
56 Float_t fMaxTowerH; // bounding box z dimesion
59
60 Bool_t fValueIsColor; // Interpret signal value as RGBA color.
61 REveRGBAPalette* fPalette; // Pointer to signal-color palette.
62
63
65
66 void SetupHeight(Float_t value, Int_t slice, Float_t& height) const;
67
68 virtual void BuildCellIdCache() = 0;
69
70public:
71 REveCaloViz(REveCaloData* data=nullptr, const char* n="REveCaloViz", const char* t="");
72
73 virtual ~REveCaloViz();
74
75 bool RequiresExtraSelectionData() const override { return true; };
77 virtual REveElement* ForwardEdit();
78
79 TClass* ProjectedClass(const REveProjection* p) const override;
80 virtual Float_t GetValToHeight() const;
81 // virtual void CellSelectionChanged() {}
82
83 virtual void SetScaleAbs(Bool_t x) { fScaleAbs = x; }
84
85 REveCaloData* GetData() const { return fData; }
86 void SetData(REveCaloData* d);
87 void DataChanged();
88 Float_t GetMaxVal() const;
89
92
94 void SetDataSliceThreshold(Int_t slice, Float_t val);
95 Color_t GetDataSliceColor(Int_t slice) const;
96 void SetDataSliceColor(Int_t slice, Color_t col);
97
100 Float_t GetEndCapPos () const { return fEndCapPosF; } // get end cap position, assuming fEndCapPosF = -fEndCapPosB
106
107 Bool_t GetPlotEt() const { return fPlotEt; }
108 void SetPlotEt(Bool_t x);
109
111 Float_t GetMaxTowerH() const { return fMaxTowerH; }
112 Bool_t GetScaleAbs() const { return fScaleAbs; }
114 Float_t GetMaxValAbs() const { return fMaxValAbs; }
115
122
125
129
130 Bool_t GetAutoRange() const { return fAutoRange; }
132
133 void SetEta(Float_t l, Float_t u);
134 Float_t GetEta() const { return 0.5f*(fEtaMin+fEtaMax); }
135 Float_t GetEtaMin() const { return fEtaMin; }
136 Float_t GetEtaMax() const { return fEtaMax; }
137 Float_t GetEtaRng() const { return fEtaMax-fEtaMin; }
138
140 void SetPhiRng(Float_t rng) { SetPhiWithRng(fPhi, rng); }
142 Float_t GetPhi() const { return fPhi; }
143 Float_t GetPhiMin() const { return fPhi-fPhiOffset; }
144 Float_t GetPhiMax() const { return fPhi+fPhiOffset; }
145 Float_t GetPhiRng() const { return 2.0f*fPhiOffset; }
146
148
149 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
151};
152
153/**************************************************************************/
154/**************************************************************************/
155
157{
158private:
159 REveCalo3D& operator=(const REveCalo3D&) = delete;
160
161 void MakeBarrelCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t& offset, float *pnts) const;
162 void MakeEndCapCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t& offset, float *pnts) const;
163
164protected:
166
169
173
174 void BuildCellIdCache() override;
175
176public:
177 REveCalo3D(REveCaloData* d=nullptr, const char* n="REveCalo3D", const char* t="");
178 virtual ~REveCalo3D() {}
179 void ComputeBBox() override;
180
181 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
183 void BuildRenderData() override;
184
187
194
197
198 void NewTowerPicked(Int_t tower, Int_t slice, Int_t selectionId, Bool_t multi);
199};
200
201/**************************************************************************/
202/**************************************************************************/
203
204class REveCalo2D : public REveCaloViz,
205 public REveProjected
206{
207public:
208 typedef std::vector<REveCaloData::vCellId_t*> vBinCells_t;
209 typedef std::vector<REveCaloData::vCellId_t*>::iterator vBinCells_i;
210
211private:
212 REveCalo2D& operator=(const REveCalo2D&) = delete;
213
215 void CellSelectionChangedInternal(REveCaloData::vCellId_t& cells, std::vector<REveCaloData::vCellId_t*>& cellLists);
216
217 void MakeRPhiCell(Float_t phiMin, Float_t phiMax,
218 Float_t towerH, Float_t offset, float* pntsOut) const;
219
220 void MakeRhoZCell(Float_t thetaMin, Float_t thetaMax,
221 Float_t& offset, Bool_t isBarrel, Bool_t phiPlus, Float_t towerH, float *pntsOut) const;
222
223 void BuildRenderDataRPhi();
224 void BuildRenderDataRhoZ();
225
226protected:
227 std::vector<REveCaloData::vCellId_t*> fCellLists;
228
229 std::vector<REveCaloData::vCellId_t*> fCellListsSelected;
230 std::vector<REveCaloData::vCellId_t*> fCellListsHighlighted;
231
234
235 void BuildCellIdCache() override;
236
237 void SetDepthLocal(Float_t x) override { fDepth = x; }
238
239 bool IsRPhi() const;
240
241public:
242 REveCalo2D(const char* n="REveCalo2D", const char* t="");
243 virtual ~REveCalo2D();
244
245 void SetProjection(REveProjectionManager* proj, REveProjectable* model) override;
246 void UpdateProjection() override;
247 void ComputeBBox() override;
248
249 void SetScaleAbs(Bool_t) override;
250
251 Float_t GetValToHeight() const override;
252
253 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
255 void BuildRenderData() override;
256
257 void NewBinPicked(Int_t bin, Int_t slice, Int_t selectionId, Bool_t multi);
258
260};
261
262/**************************************************************************/
263/**************************************************************************/
264
266{
267public:
271
272private:
274
275protected:
277
282
283 Int_t fNZSteps; // Z axis label step in GeV
285
289
292 EBoxMode_e fBoxMode; // additional scale info
293
296
298 Float_t fFixedHeightValIn2DMode; // 1% of whole height
299
302
303 void BuildCellIdCache() override;
304
305public:
306 REveCaloLego(REveCaloData* data=nullptr, const char* n="REveCaloLego", const char* t="");
307 virtual ~REveCaloLego(){}
308
309 void ComputeBBox() override;
310 virtual void SetData(REveCaloData* d);
311
312 Color_t GetFontColor() const { return fFontColor; }
314
315 Color_t GetGridColor() const { return fGridColor; }
317
320
323
324 Int_t GetNZSteps() const { return fNZSteps; }
326
329
330 Bool_t GetAutoRebin() const { return fAutoRebin; }
332
335
338
341
344
347
350
351 Bool_t GetDrawHPlane() const { return fDrawHPlane; }
353
354 Float_t GetHPlaneVal() const { return fHPlaneVal; }
356
361};
362
363} // namespace Experimental
364} // namespace ROOT
365
366#endif
#define d(i)
Definition: RSha256.hxx:102
#define e(i)
Definition: RSha256.hxx:103
bool Bool_t
Definition: RtypesCore.h:63
short Color_t
Definition: RtypesCore.h:92
char Char_t
Definition: RtypesCore.h:37
const Bool_t kFALSE
Definition: RtypesCore.h:101
float Float_t
Definition: RtypesCore.h:57
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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 Float_t Float_t b
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 value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
A generic, speed-optimised mapping from value to RGBA color supporting different wrapping and range t...
void BuildRenderData() override
Creates 2D point array for rendering.
Definition: REveCalo.cxx:1170
std::vector< REveCaloData::vCellId_t * > vBinCells_t
Definition: REveCalo.hxx:208
void SetProjection(REveProjectionManager *proj, REveProjectable *model) override
Set projection manager and model object.
Definition: REveCalo.cxx:797
void MakeRhoZCell(Float_t thetaMin, Float_t thetaMax, Float_t &offset, Bool_t isBarrel, Bool_t phiPlus, Float_t towerH, float *pntsOut) const
Get cell vertices in RhoZ projection.
Definition: REveCalo.cxx:1278
void BuildRenderDataRPhi()
Creates 2D point array in RPhi() projection.
Definition: REveCalo.cxx:1335
void SetDepthLocal(Float_t x) override
Base-class implementation – just sets fDepth.
Definition: REveCalo.hxx:237
bool IsRPhi() const
Is current projection type RPhi.
Definition: REveCalo.cxx:807
void WriteCoreJsonSelection(nlohmann::json &j, REveCaloData::vCellId_t) override
Fill core part of JSON representation for selection.
Definition: REveCalo.cxx:1030
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
Definition: REveCalo.cxx:987
std::vector< REveCaloData::vCellId_t * >::iterator vBinCells_i
Definition: REveCalo.hxx:209
void NewBinPicked(Int_t bin, Int_t slice, Int_t selectionId, Bool_t multi)
Client callback.
Definition: REveCalo.cxx:1408
void CellSelectionChangedInternal(REveCaloData::vCellId_t &cells, std::vector< REveCaloData::vCellId_t * > &cellLists)
s////////////////////////////////// Sort selected cells in eta or phi bins.
Definition: REveCalo.cxx:908
REveProjection::EPType_e fOldProjectionType
Definition: REveCalo.hxx:214
REveCalo2D(const char *n="REveCalo2D", const char *t="")
Constructor.
Definition: REveCalo.cxx:743
void UpdateProjection() override
This is virtual method from base-class REveProjected.
Definition: REveCalo.cxx:784
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition: REveCalo.cxx:1020
std::vector< REveCaloData::vCellId_t * > fCellLists
Definition: REveCalo.hxx:227
std::vector< REveCaloData::vCellId_t * > fCellListsHighlighted
Definition: REveCalo.hxx:230
std::vector< REveCaloData::vCellId_t * > fCellListsSelected
Definition: REveCalo.hxx:229
const REveCalo2D::vBinCells_t & GetBinLists() const
Definition: REveCalo.hxx:259
void BuildCellIdCache() override
Build lists of drawn cell IDs. See REveCalo2DGL::DirecDraw().
Definition: REveCalo.cxx:815
void BuildRenderDataRhoZ()
Creates 2D point array in RhoZ projection.
Definition: REveCalo.cxx:1197
REveCalo2D & operator=(const REveCalo2D &)=delete
virtual ~REveCalo2D()
Destructor.
Definition: REveCalo.cxx:755
Float_t GetValToHeight() const override
Virtual function of REveCaloViz.
Definition: REveCalo.cxx:963
void MakeRPhiCell(Float_t phiMin, Float_t phiMax, Float_t towerH, Float_t offset, float *pntsOut) const
Calculate vertices for the calorimeter cell in RPhi projection.
Definition: REveCalo.cxx:1382
void SetScaleAbs(Bool_t) override
Set absolute scale in projected calorimeter.
Definition: REveCalo.cxx:953
REveCalo3D(REveCaloData *d=nullptr, const char *n="REveCalo3D", const char *t="")
Constructor.
Definition: REveCalo.cxx:452
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition: REveCalo.cxx:659
void SetRnrEndCapFrame(Bool_t r)
Definition: REveCalo.hxx:190
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
Definition: REveCalo.cxx:708
Char_t GetFrameTransparency() const
Definition: REveCalo.hxx:196
void MakeBarrelCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t &offset, float *pnts) const
Make endcap cell.
Definition: REveCalo.cxx:535
void SetRnrFrame(Bool_t e, Bool_t b)
Definition: REveCalo.hxx:188
void MakeEndCapCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t &offset, float *pnts) const
Make endcap cell.
Definition: REveCalo.cxx:470
void SetFrameWidth(Float_t w)
Definition: REveCalo.hxx:185
Bool_t GetRnrEndCapFrame() const
Definition: REveCalo.hxx:192
void WriteCoreJsonSelection(nlohmann::json &j, REveCaloData::vCellId_t) override
Fill core part of JSON representation for selection.
Definition: REveCalo.cxx:667
void BuildRenderData() override
Crates 3D point array for rendering.
Definition: REveCalo.cxx:602
void BuildCellIdCache() override
Build list of drawn cell IDs. See REveCalo3DGL::DirectDraw().
Definition: REveCalo.cxx:696
void NewTowerPicked(Int_t tower, Int_t slice, Int_t selectionId, Bool_t multi)
Client selection callback.
Definition: REveCalo.cxx:730
void SetFrameTransparency(Char_t x)
Definition: REveCalo.hxx:195
REveCalo3D & operator=(const REveCalo3D &)=delete
REveCaloData::vCellId_t fCellList
Definition: REveCalo.hxx:165
void GetRnrFrame(Bool_t &e, Bool_t &b) const
Definition: REveCalo.hxx:189
void SetRnrBarrelFrame(Bool_t r)
Definition: REveCalo.hxx:191
Bool_t GetRnrBarrelFrame() const
Definition: REveCalo.hxx:193
Float_t GetFrameWidth() const
Definition: REveCalo.hxx:186
std::vector< CellId_t > vCellId_t
Char_t GetPlaneTransparency() const
Definition: REveCalo.hxx:321
void SetHasFixedHeightIn2DMode(bool x)
Definition: REveCalo.hxx:343
void BuildCellIdCache() override
Build list of drawn cell IDs. For more information see REveCaloLegoGL:DirectDraw().
Definition: REveCalo.cxx:1487
float GetFixedHeightValIn2DMode() const
Definition: REveCalo.hxx:345
void SetDrawNumberCellPixels(Int_t x)
Definition: REveCalo.hxx:358
void SetBoxMode(EBoxMode_e p)
Definition: REveCalo.hxx:348
void SetFixedHeightValIn2DMode(float x)
Definition: REveCalo.hxx:346
virtual void SetData(REveCaloData *d)
Definition: REveCalo.cxx:1479
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
Definition: REveCalo.cxx:1499
REveCaloData::vCellId_t fCellList
Definition: REveCalo.hxx:276
bool GetHasFixedHeightIn2DMode() const
Definition: REveCalo.hxx:342
REveCaloLego & operator=(const REveCaloLego &)=delete
void SetPlaneColor(Color_t ci)
Definition: REveCalo.hxx:319
void SetPlaneTransparency(Char_t t)
Definition: REveCalo.hxx:322
REveCaloLego(REveCaloData *data=nullptr, const char *n="REveCaloLego", const char *t="")
Constructor.
Definition: REveCalo.cxx:1443
void SetProjection(EProjection_e p)
Definition: REveCalo.hxx:337
EProjection_e GetProjection() const
Definition: REveCalo.hxx:336
bool RequiresExtraSelectionData() const override
Definition: REveCalo.hxx:75
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition: REveCalo.cxx:427
virtual REveElement * ForwardSelection()
Management of selection state and ownership of selected cell list is done in REveCaloData.
Definition: REveCalo.cxx:96
Float_t GetBarrelRadius() const
Definition: REveCalo.hxx:98
Float_t GetBackwardEndCapPos() const
Definition: REveCalo.hxx:102
void SetPlotEt(Bool_t x)
Set E/Et plot.
Definition: REveCalo.cxx:149
void SetPhiRng(Float_t rng)
Definition: REveCalo.hxx:140
Float_t GetTransitionTheta() const
Get transition angle between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
Definition: REveCalo.cxx:184
virtual void BuildCellIdCache()=0
void SetPalette(REveRGBAPalette *p)
Set REveRGBAPalette object pointer.
Definition: REveCalo.cxx:348
virtual void SetScaleAbs(Bool_t x)
Definition: REveCalo.hxx:83
Float_t GetTransitionEtaForward() const
Get transition eta between barrel and forward end-cap cells.
Definition: REveCalo.cxx:210
void DataChanged()
Update setting and cache on data changed.
Definition: REveCalo.cxx:257
REveCaloViz(REveCaloData *data=nullptr, const char *n="REveCaloViz", const char *t="")
Definition: REveCalo.cxx:41
void SetDataSliceColor(Int_t slice, Color_t col)
Set slice color in data.
Definition: REveCalo.cxx:130
REveCaloViz & operator=(const REveCaloViz &)=delete
REveCaloData * GetData() const
Definition: REveCalo.hxx:85
Float_t GetTransitionEta() const
Get transition eta between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
Definition: REveCalo.cxx:192
Color_t GetDataSliceColor(Int_t slice) const
Get slice color from data.
Definition: REveCalo.cxx:122
virtual void WriteCoreJsonSelection(nlohmann::json &j, REveCaloData::vCellId_t)=0
Float_t GetTransitionEtaBackward() const
Get transition eta between barrel and backward end-cap cells.
Definition: REveCalo.cxx:228
Bool_t AssertCellIdCache() const
Assert cell id cache is ok.
Definition: REveCalo.cxx:294
void SetBackwardEndCapPos(Float_t z)
Definition: REveCalo.hxx:105
void SetPhiWithRng(Float_t x, Float_t r)
Set phi range.
Definition: REveCalo.cxx:171
virtual ~REveCaloViz()
Destructor.
Definition: REveCalo.cxx:79
virtual Float_t GetValToHeight() const
Get transformation factor from E/Et to height.
Definition: REveCalo.cxx:359
REveRGBAPalette * GetPalette() const
Definition: REveCalo.hxx:123
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, returns REveCalo2D class.
Definition: REveCalo.cxx:399
void SetBarrelRadius(Float_t r)
Definition: REveCalo.hxx:99
Float_t GetDataSliceThreshold(Int_t slice) const
Get threshold for given slice.
Definition: REveCalo.cxx:87
Float_t GetForwardEndCapPos() const
Definition: REveCalo.hxx:101
Bool_t CellInEtaPhiRng(REveCaloData::CellData_t &) const
Returns true if given cell is in the ceta phi range.
Definition: REveCalo.cxx:308
void SetupHeight(Float_t value, Int_t slice, Float_t &height) const
Set color and height for a given value and slice using slice color or REveRGBAPalette.
Definition: REveCalo.cxx:407
void SetForwardEndCapPos(Float_t z)
Definition: REveCalo.hxx:104
Float_t GetTransitionThetaForward() const
Get transition angle between barrel and forward end-cap cells.
Definition: REveCalo.cxx:202
void SetData(REveCaloData *d)
Set calorimeter event data.
Definition: REveCalo.cxx:240
Float_t GetTransitionThetaBackward() const
Get transition angle between barrel and backward end-cap cells.
Definition: REveCalo.cxx:220
void AssignCaloVizParameters(REveCaloViz *cv)
Assign parameters from given model.
Definition: REveCalo.cxx:322
virtual REveElement * ForwardEdit()
Management of selection state and ownership of selected cell list is done in REveCaloData.
Definition: REveCalo.cxx:106
void SetDataSliceThreshold(Int_t slice, Float_t val)
Set threshold for given slice.
Definition: REveCalo.cxx:114
REveRGBAPalette * fPalette
Definition: REveCalo.hxx:61
REveRGBAPalette * AssertPalette()
Make sure the REveRGBAPalette pointer is not null.
Definition: REveCalo.cxx:380
void SetEta(Float_t l, Float_t u)
Set eta range.
Definition: REveCalo.cxx:138
REveProjectionManager Manager class for steering of projections and managing projected objects.
REveProjection Base for specific classes that implement non-linear projections.
Use this attribute class when an object should have 3D capabilities.
Definition: TAtt3D.h:19
Helper for management of bounding-box information.
Definition: TAttBBox.h:18
void ResetBBox()
Definition: TAttBBox.h:57
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:81
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
static constexpr double s
basic_json<> json
Definition: REveElement.hxx:62
TLine l
Definition: textangle.C:4