Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveCaloData.h
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_TEveCaloData
13#define ROOT_TEveCaloData
14
15#include <vector>
16#include "TEveElement.h"
17
18#include "TMath.h"
19
20class TGLSelectRecord;
21
22class TH2F;
23class TAxis;
24class THStack;
25
27 public TNamed
28{
29public:
31 {
32 TString fName; // Name of the slice, eg. ECAL, HCAL.
33 Float_t fThreshold; // Only display towers with higher energy.
34 Color_t fColor; // Color used to draw this longitudinal slice.
35 Color_t fTransparency; // Transparency used to draw this longitudinal slice.
36
38
39 virtual ~SliceInfo_t() {}
40
41 void Setup(const char* name, Float_t threshold, Color_t col, Char_t transp = 101)
42 {
43 fName = name;
44 fThreshold = threshold;
45 fColor = col;
46 if (transp <= 100) fTransparency = transp;
47 };
48
49 ClassDef(SliceInfo_t, 0); // Slice info for histogram stack.
50 };
51
52 typedef std::vector<SliceInfo_t> vSliceInfo_t;
53 typedef std::vector<SliceInfo_t>::iterator vSliceInfo_i;
54
55 /**************************************************************************/
56
57 struct CellId_t
58 {
59 // Cell ID inner structure.
60
63
65
66 CellId_t(Int_t t, Int_t s, Float_t f=1.0f) : fTower(t), fSlice(s), fFraction(f) {}
67
68 bool operator<(const CellId_t& o) const
69 { return (fTower == o.fTower) ? fSlice < o.fSlice : fTower < o.fTower; }
70 };
71
73 {
74 // Cell geometry inner structure.
75
80
81 Float_t fThetaMin; // cached
82 Float_t fThetaMax; // cached
83
85 CellGeom_t(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax) {Configure(etaMin, etaMax, phiMin, phiMax);}
86 virtual ~CellGeom_t() {}
87
88 void Configure(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax);
89
90 Float_t EtaMin() const { return fEtaMin; }
91 Float_t EtaMax() const { return fEtaMax; }
92 Float_t Eta() const { return (fEtaMin+fEtaMax)*0.5f; }
93 Float_t EtaDelta() const { return fEtaMax-fEtaMin; }
94
95 Float_t PhiMin() const { return fPhiMin; }
96 Float_t PhiMax() const { return fPhiMax; }
97 Float_t Phi() const { return (fPhiMin+fPhiMax)*0.5f; }
98 Float_t PhiDelta() const { return fPhiMax-fPhiMin; }
99
100 Float_t ThetaMin() const { return fThetaMin; }
101 Float_t ThetaMax() const { return fThetaMax; }
102 Float_t Theta() const { return (fThetaMax+fThetaMin)*0.5f; }
104
106 {
107 const Float_t phi = Phi();
108 return ((phi > 0 && phi <= TMath::Pi()) || phi < - TMath::Pi());
109 }
110
111 virtual void Dump() const;
112 };
113
114 struct CellData_t : public CellGeom_t
115 {
116 // Cell data inner structure.
117
119
121 virtual ~CellData_t() {}
122
123 Float_t Value(Bool_t) const;
124 virtual void Dump() const;
125 };
126
127
129 {
131
132 std::vector<Float_t> fSliceData;
133 std::vector<Int_t> fBinData;
134
136
137 void Clear()
138 {
139 fSliceData.clear();
140 fBinData.clear();
141 }
142 };
143
144 /**************************************************************************/
145
146 typedef std::vector<CellId_t> vCellId_t;
147 typedef std::vector<CellId_t>::iterator vCellId_i;
148
149 typedef std::vector<CellGeom_t> vCellGeom_t;
150 typedef std::vector<CellGeom_t>::iterator vCellGeom_i;
151 typedef std::vector<CellGeom_t>::const_iterator vCellGeom_ci;
152
153private:
154 TEveCaloData(const TEveCaloData&); // Not implemented
155 TEveCaloData& operator=(const TEveCaloData&); // Not implemented
156
157protected:
159
162
164
166 Float_t fMaxValE; // cached
167
169
172
173public:
174 TEveCaloData(const char* n="TEveCalData", const char* t="");
175 virtual ~TEveCaloData() {}
176
177 virtual void UnSelected();
178 virtual void UnHighlighted();
179
181
182 virtual void FillImpliedSelectedSet(Set_t& impSelSet);
183
184 virtual void GetCellList(Float_t etaMin, Float_t etaMax,
185 Float_t phi, Float_t phiRng,
186 vCellId_t &out) const = 0;
187
190 void PrintCellsSelected();
191 void ProcessSelection(vCellId_t& sel_cells, TGLSelectRecord& rec);
192
193 virtual void Rebin(TAxis *ax, TAxis *ay, vCellId_t &in, Bool_t et, RebinData_t &out) const = 0;
194
195
196 virtual void GetCellData(const CellId_t &id, CellData_t& data) const = 0;
197
198 virtual void InvalidateUsersCellIdCache();
199 virtual void DataChanged();
200 virtual void CellSelectionChanged();
201
202 Int_t GetNSlices() const { return fSliceInfos.size(); }
204 void SetSliceThreshold(Int_t slice, Float_t threshold);
205 Float_t GetSliceThreshold(Int_t slice) const;
206 void SetSliceColor(Int_t slice, Color_t col);
207 Color_t GetSliceColor(Int_t slice) const;
208 void SetSliceTransparency(Int_t slice, Char_t t);
209 Char_t GetSliceTransparency(Int_t slice) const;
210
211 virtual void GetEtaLimits(Double_t &min, Double_t &max) const = 0;
212
213 virtual void GetPhiLimits(Double_t &min, Double_t &max) const = 0;
214
215 virtual Float_t GetMaxVal(Bool_t et) const { return et ? fMaxValEt : fMaxValE; }
216 Bool_t Empty() const { return fMaxValEt < 1e-5; }
217
218 virtual TAxis* GetEtaBins() const { return fEtaAxis; }
219 virtual void SetEtaBins(TAxis* ax) { fEtaAxis=ax; }
220
221 virtual TAxis* GetPhiBins() const { return fPhiAxis; }
222 virtual void SetPhiBins(TAxis* ax) { fPhiAxis=ax; }
223
224 virtual Float_t GetEps() const { return fEps; }
225 virtual void SetEps(Float_t eps) { fEps=eps; }
226
227 Bool_t GetWrapTwoPi() const { return fWrapTwoPi; }
229
230 static Float_t EtaToTheta(Float_t eta);
231
232
233 ClassDef(TEveCaloData, 0); // Manages calorimeter event data.
234};
235
236/**************************************************************************/
237/**************************************************************************/
238
240{
241
242private:
243 TEveCaloDataVec(const TEveCaloDataVec&); // Not implemented
244 TEveCaloDataVec& operator=(const TEveCaloDataVec&); // Not implemented
245
246protected:
247 typedef std::vector<Float_t> vFloat_t;
248 typedef std::vector<Float_t>::iterator vFloat_i;
249
250 typedef std::vector<vFloat_t> vvFloat_t;
251 typedef std::vector<vFloat_t>::iterator vvFloat_i;
252
255
256 Int_t fTower; // current tower
257
260
263
264public:
265 TEveCaloDataVec(Int_t nslices);
266 virtual ~TEveCaloDataVec();
267
268 Int_t AddSlice();
269 Int_t AddTower(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax);
270 void FillSlice(Int_t slice, Float_t value);
271 void FillSlice(Int_t slice, Int_t tower, Float_t value);
272
273 Int_t GetNCells() { return fGeomVec.size(); }
274 std::vector<Float_t>& GetSliceVals(Int_t slice) { return fSliceVec[slice]; }
275 std::vector<TEveCaloData::CellGeom_t>& GetCellGeom() { return fGeomVec; }
276
277 virtual void GetCellList(Float_t etaMin, Float_t etaMax,
278 Float_t phi, Float_t phiRng,
279 vCellId_t &out) const;
280
281 virtual void Rebin(TAxis *ax, TAxis *ay, vCellId_t &in, Bool_t et, RebinData_t &out) const;
282
283 virtual void GetCellData(const TEveCaloData::CellId_t &id, TEveCaloData::CellData_t& data) const;
284 virtual void GetEtaLimits(Double_t &min, Double_t &max) const { min=fEtaMin, max=fEtaMax;}
285 virtual void GetPhiLimits(Double_t &min, Double_t &max) const { min=fPhiMin; max=fPhiMax;}
286
287
288 virtual void DataChanged();
289 void SetAxisFromBins(Double_t epsX=0.001, Double_t epsY=0.001);
290
291 ClassDef(TEveCaloDataVec, 0); // Manages calorimeter event data.
292};
293
294/**************************************************************************/
295/**************************************************************************/
296
298{
299private:
300 TEveCaloDataHist(const TEveCaloDataHist&); // Not implemented
301 TEveCaloDataHist& operator=(const TEveCaloDataHist&); // Not implemented
302
303protected:
305
306public:
308 virtual ~TEveCaloDataHist();
309
310 virtual void GetCellList( Float_t etaMin, Float_t etaMax,
311 Float_t phi, Float_t phiRng, vCellId_t &out) const;
312
313 virtual void Rebin(TAxis *ax, TAxis *ay, vCellId_t &in, Bool_t et, RebinData_t &out) const;
314
315 virtual void GetCellData(const TEveCaloData::CellId_t &id, TEveCaloData::CellData_t& data) const;
316
317 virtual void GetEtaLimits(Double_t &min, Double_t &max) const;
318 virtual void GetPhiLimits(Double_t &min, Double_t &max) const;
319
320
321 virtual void DataChanged();
322
323 THStack* GetStack() { return fHStack; }
324
325 TH2F* GetHist(Int_t slice) const;
326
327 Int_t AddHistogram(TH2F* hist);
328
329 ClassDef(TEveCaloDataHist, 0); // Manages calorimeter TH2F event data.
330};
331
332#endif
333
#define f(i)
Definition RSha256.hxx:104
#define e(i)
Definition RSha256.hxx:103
int Int_t
Definition RtypesCore.h:45
char Char_t
Definition RtypesCore.h:37
bool Bool_t
Definition RtypesCore.h:63
double Double_t
Definition RtypesCore.h:59
short Color_t
Definition RtypesCore.h:92
float Float_t
Definition RtypesCore.h:57
#define ClassDef(name, id)
Definition Rtypes.h:325
@ kRed
Definition Rtypes.h:66
char name[80]
Definition TGX11.cxx:110
Class to manage histogram axis.
Definition TAxis.h:30
A central manager for calorimeter data of an event written in TH2F.
THStack * GetStack()
virtual void GetEtaLimits(Double_t &min, Double_t &max) const
Get eta limits.
TEveCaloDataHist(const TEveCaloDataHist &)
virtual void Rebin(TAxis *ax, TAxis *ay, vCellId_t &in, Bool_t et, RebinData_t &out) const
Rebin.
Int_t AddHistogram(TH2F *hist)
Add new slice to calo tower.
virtual ~TEveCaloDataHist()
Destructor.
TEveCaloDataHist()
Constructor.
virtual void GetCellList(Float_t etaMin, Float_t etaMax, Float_t phi, Float_t phiRng, vCellId_t &out) const
Get list of cell IDs in given eta and phi range.
virtual void DataChanged()
Update limits and notify data users.
virtual void GetCellData(const TEveCaloData::CellId_t &id, TEveCaloData::CellData_t &data) const
Get cell geometry and value from cell ID.
virtual void GetPhiLimits(Double_t &min, Double_t &max) const
Get phi limits.
TEveCaloDataHist & operator=(const TEveCaloDataHist &)
Calo data for universal cell geometry.
Int_t AddSlice()
Add new slice.
void SetAxisFromBins(Double_t epsX=0.001, Double_t epsY=0.001)
Set XY axis from cells geometry.
virtual void GetCellList(Float_t etaMin, Float_t etaMax, Float_t phi, Float_t phiRng, vCellId_t &out) const
Get list of cell-ids for given eta/phi range.
TEveCaloDataVec(const TEveCaloDataVec &)
std::vector< vFloat_t >::iterator vvFloat_i
virtual void Rebin(TAxis *ax, TAxis *ay, vCellId_t &in, Bool_t et, RebinData_t &out) const
Rebin cells.
vvFloat_t fSliceVec
std::vector< vFloat_t > vvFloat_t
TEveCaloDataVec & operator=(const TEveCaloDataVec &)
std::vector< Float_t > & GetSliceVals(Int_t slice)
void FillSlice(Int_t slice, Float_t value)
Fill given slice in the current tower.
vCellGeom_t fGeomVec
virtual ~TEveCaloDataVec()
Destructor.
Int_t AddTower(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax)
Add tower within eta/phi range.
virtual void GetCellData(const TEveCaloData::CellId_t &id, TEveCaloData::CellData_t &data) const
Get cell geometry and value from cell ID.
virtual void DataChanged()
Update limits and notify data users.
std::vector< Float_t >::iterator vFloat_i
virtual void GetEtaLimits(Double_t &min, Double_t &max) const
std::vector< Float_t > vFloat_t
std::vector< TEveCaloData::CellGeom_t > & GetCellGeom()
virtual void GetPhiLimits(Double_t &min, Double_t &max) const
A central manager for calorimeter event data.
TEveCaloData(const TEveCaloData &)
Float_t fMaxValEt
Bool_t fWrapTwoPi
vCellId_t fCellsSelected
void SetWrapTwoPi(Bool_t w)
vSliceInfo_t fSliceInfos
virtual void GetEtaLimits(Double_t &min, Double_t &max) const =0
virtual TString GetHighlightTooltip()
std::vector< CellId_t > vCellId_t
Bool_t Empty() const
static Float_t EtaToTheta(Float_t eta)
void SetSliceColor(Int_t slice, Color_t col)
Set color for given slice.
virtual void UnHighlighted()
Virtual method TEveElement::UnHighlighted.
virtual void SetEps(Float_t eps)
std::vector< CellGeom_t > vCellGeom_t
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 Float_t GetEps() const
virtual TAxis * GetEtaBins() const
std::vector< SliceInfo_t >::iterator vSliceInfo_i
vCellId_t fCellsHighlighted
TEveCaloData & operator=(const TEveCaloData &)
void SetSliceTransparency(Int_t slice, Char_t t)
Set transparency for given slice.
virtual void SetEtaBins(TAxis *ax)
void SetSliceThreshold(Int_t slice, Float_t threshold)
Set threshold for given slice.
std::vector< SliceInfo_t > vSliceInfo_t
virtual void InvalidateUsersCellIdCache()
Invalidate cell ids cache on back ptr references.
virtual void SetPhiBins(TAxis *ax)
Color_t GetSliceColor(Int_t slice) const
Get color for given slice.
TAxis * fEtaAxis
virtual void DataChanged()
Tell users (TEveCaloViz instances using this data) that data has changed and they should update the l...
virtual ~TEveCaloData()
virtual void UnSelected()
Virtual method TEveElement::UnSelect.
std::vector< CellGeom_t >::const_iterator vCellGeom_ci
virtual void CellSelectionChanged()
Tell users (TEveCaloViz instances using this data) that cell selection has changed and they should up...
Float_t GetSliceThreshold(Int_t slice) const
Get threshold for given slice.
Int_t GetNSlices() const
Float_t fMaxValE
SliceInfo_t & RefSliceInfo(Int_t s)
Bool_t GetWrapTwoPi() const
vCellId_t & GetCellsHighlighted()
virtual void GetPhiLimits(Double_t &min, Double_t &max) const =0
std::vector< CellGeom_t >::iterator vCellGeom_i
virtual TAxis * GetPhiBins() const
virtual void FillImpliedSelectedSet(Set_t &impSelSet)
Populate set impSelSet with derived / dependant elements.
void PrintCellsSelected()
Print selected cells info.
vCellId_t & GetCellsSelected()
virtual void Rebin(TAxis *ax, TAxis *ay, vCellId_t &in, Bool_t et, RebinData_t &out) const =0
TAxis * fPhiAxis
virtual Float_t GetMaxVal(Bool_t et) const
std::vector< CellId_t >::iterator vCellId_i
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
std::set< TEveElement * > Set_t
Definition TEveElement.h:75
Standard selection record including information about containing scene and details ob out selected ob...
2-D histogram with a float per channel (see TH1 documentation)}
Definition TH2.h:251
The Histogram stack class.
Definition THStack.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Basic string class.
Definition TString.h:136
const char * GetHist()
const Int_t n
Definition legend1.C:16
constexpr Double_t Pi()
Definition TMath.h:37
Cell data inner structure.
virtual void Dump() const
Print member data.
Cell geometry inner structure.
Float_t ThetaMin() const
Float_t ThetaMax() const
Float_t PhiDelta() const
Float_t EtaMax() const
Float_t PhiMin() const
Bool_t IsUpperRho() const
Float_t EtaDelta() const
Float_t PhiMax() const
Float_t ThetaDelta() const
virtual void Dump() const
Print member data.
void Configure(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax)
Float_t EtaMin() const
CellGeom_t(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax)
bool operator<(const CellId_t &o) const
CellId_t(Int_t t, Int_t s, Float_t f=1.0f)
std::vector< Float_t > fSliceData
std::vector< Int_t > fBinData
Float_t * GetSliceVals(Int_t bin)
void Setup(const char *name, Float_t threshold, Color_t col, Char_t transp=101)