Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveCaloVizEditor.cxx
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#include "TEveCaloVizEditor.h"
13#include "TEveCalo.h"
14#include "TEveGValuators.h"
16#include "TEveCaloData.h"
17
18#include "TGClient.h"
19#include "TGFont.h"
20#include "TGedEditor.h"
21
22#include "TGLabel.h"
23#include "TGNumberEntry.h"
24#include "TGDoubleSlider.h"
25#include "TG3DLine.h"
26#include "TGButtonGroup.h"
27#include "TColor.h"
28#include "TGColorSelect.h"
29
30#include "TMathBase.h"
31#include "TMath.h"
32
33/** \class TEveCaloVizEditor
34\ingroup TEve
35GUI editor for TEveCaloEditor.
36*/
37
38
39////////////////////////////////////////////////////////////////////////////////
40/// Constructor.
41
43 UInt_t options, Pixel_t back) :
44 TGedFrame(p, width, height, options | kVerticalFrame, back),
45 fM(nullptr),
46
47 fPlotE(nullptr),
48 fPlotEt(nullptr),
49
50 fScaleAbs(nullptr),
51 fMaxValAbs(nullptr),
52 fMaxTowerH(nullptr),
53
54 fEtaRng(nullptr),
55 fPhi(nullptr),
56 fPhiOffset(nullptr),
57 fDataFrame(nullptr),
58 fSliceFrame(nullptr)
59{
60 MakeTitle("TEveCaloViz");
61
62 TGLabel* label = nullptr;
63 Int_t labelW = 45;
64
65 // scaling
67
68 label = new TGLabel(scf, "ScaleAbsolute:");
69 scf->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
70
72 scf->AddFrame(fScaleAbs, new TGLayoutHints(kLHintsLeft, 3, 5, 3, 0));
73 fScaleAbs->Connect("Toggled(Bool_t)", "TEveCaloVizEditor", this, "DoScaleAbs()");
74
75
76 fMaxValAbs = new TEveGValuator(scf, "MaxEVal:", 70, 0);
81 fMaxValAbs->SetLimits(0, 1000);
82 fMaxValAbs->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoMaxValAbs()");
83 scf->AddFrame(fMaxValAbs, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
84
85 AddFrame(scf, new TGLayoutHints(kLHintsTop, 4, 1, 1, 0));
86
87
88 // tower height
89 fMaxTowerH = new TEveGValuator(this, "MaxTowerH:", 96, 0);
95 fMaxTowerH->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoMaxTowerH()");
97
98
99 //______________________________________________________________________________
100
102
103 // E/Et Plot
104 {
107
108 TGFont *myfont = gClient->GetFont("-adobe-times-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
109 label = new TGLabel(labfr, "Plot:");
110 label->SetTextFont(myfont);
111 labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
112 group->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
113
114 fPlotE = new TGRadioButton(group, new TGHotString("E"), 11);
115 fPlotE->Connect("Clicked()", "TEveCaloVizEditor", this, "DoPlot()");
116 group->AddFrame(fPlotE, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 2, 2, 0, 0));
117
118 fPlotEt = new TGRadioButton(group, new TGHotString("Et"), 22);
119 fPlotEt->Connect("Clicked()", "TEveCaloVizEditor", this, "DoPlot()");
120 group->AddFrame(fPlotEt, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 2, 2, 0, 0));
121
123 }
124
125 // eta
126 fEtaRng = new TEveGDoubleValuator(fDataFrame,"Eta rng:", 40, 0);
129 fEtaRng->Build();
130 fEtaRng->GetSlider()->SetWidth(195);
132 fEtaRng->Connect("ValueSet()", "TEveCaloVizEditor", this, "DoEtaRange()");
134
135 // phi
136 fPhi = new TEveGValuator(fDataFrame, "Phi:", 90, 0);
138 fPhi->SetNELength(6);
139 fPhi->Build();
141 fPhi->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoPhi()");
142 fDataFrame->AddFrame(fPhi, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
143
144 fPhiOffset = new TEveGValuator(fDataFrame, "PhiOff:", 90, 0);
147 fPhiOffset->Build();
149 fPhiOffset->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoPhi()");
151
154}
155
156////////////////////////////////////////////////////////////////////////////////
157/// Create slice info gui.
158
160{
161 Int_t ns = fM->GetData()->GetNSlices();
162 Int_t nf = fSliceFrame->GetList()->GetSize();
163
164 if (ns > nf)
165 {
166 for (Int_t i=nf; i<ns; ++i)
167 {
169
170 TEveGValuator* threshold = new TEveGValuator(f,"", 90, 0, i);
171 threshold->SetLabelWidth(50);
172 threshold->SetNELength(6);
173 threshold->SetShowSlider(kFALSE);
174 threshold->Build();
175 threshold->SetLimits(0, 1000, TGNumberFormat::kNESRealTwo);
176 threshold->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoSliceThreshold()");
177 f->AddFrame(threshold, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
178
179 TGColorSelect* color = new TGColorSelect(f, 0, i);
180 f->AddFrame(color, new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
181 color->Connect("ColorSelected(Pixel_t)", "TEveCaloVizEditor", this, "DoSliceColor(Pixel_t)");
182
183 TGNumberEntry* transparency = new TGNumberEntry(f, 0., 2, i,
186 transparency->SetHeight(18);
187 transparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
188 f->AddFrame(transparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
189 transparency->Connect("ValueSet(Long_t)", "TEveCaloVizEditor", this, "DoSliceTransparency(Long_t)");
190
191
192 fSliceFrame->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
193 }
194 nf = ns;
195 }
196
198 for (Int_t i=0; i<nf; ++i)
199 {
201 TGHorizontalFrame *fr = (TGHorizontalFrame*) el->fFrame;
202 if (i < ns)
203 {
205
206 TEveGValuator *threshold = (TEveGValuator*) ((TGFrameElement*) fr->GetList()->At(0))->fFrame;
207 TGColorSelect *color = (TGColorSelect*) ((TGFrameElement*) fr->GetList()->At(1) )->fFrame;
208 TGNumberEntry *transp = (TGNumberEntry*) ((TGFrameElement*) fr->GetList()->At(2))->fFrame;
209
210 threshold->GetLabel()->SetText(si.fName);
211 threshold->SetValue(si.fThreshold);
212 color->SetColor(TColor::Number2Pixel(si.fColor), kFALSE);
213 transp->SetNumber(si.fTransparency);
214
215 if (! fr->IsMapped()) {
216 fr->MapSubwindows();
217 fr->MapWindow();
218 }
219 }
220 else
221 {
222 if (fr->IsMapped()) {
223 fr->UnmapWindow();
224 }
225 }
226 }
227}
228
229////////////////////////////////////////////////////////////////////////////////
230/// Set model object.
231
233{
234 fM = dynamic_cast<TEveCaloViz*>(obj);
235 if (fM->GetPlotEt())
236 {
239 }
240 else
241 {
244 }
245
246 if (fM->fData)
247 {
249 if (p->GetList()->IsEmpty())
250 {
251 p->MapWindow();
252 p->MapSubwindows();
253 }
254
258
259 Double_t min, max;
260 fM->GetData()->GetEtaLimits(min, max);
261 fEtaRng->SetLimits((Float_t)min, (Float_t)max);
263
264 fM->GetData()->GetPhiLimits(min, max);
266 fPhi->SetValue(fM->fPhi);
267 if ( fM->GetData()->GetWrapTwoPi())
268 {
269 fPhi->SetToolTip("Center angle in radians");
271 }
272 else
273 {
274 Float_t d = (max-min)*0.5;
276 }
278 fPhiOffset->SetToolTip("Phi range in radians");
279
281 }
282 else
283 {
284
286 }
287}
288
289////////////////////////////////////////////////////////////////////////////////
290/// Slot for setting max tower height.
291
297
298////////////////////////////////////////////////////////////////////////////////
299/// Slot for enabling/disabling absolute scale.
300
306
307////////////////////////////////////////////////////////////////////////////////
308/// Slot for setting max E in for absolute scale.
309
315
316////////////////////////////////////////////////////////////////////////////////
317/// Slot for setting E/Et plot.
318
320{
322 Int_t id = btn->WidgetId();
323
324 if (id == fPlotE->WidgetId())
326 else
328
330 Update();
331}
332
333////////////////////////////////////////////////////////////////////////////////
334/// Slot for setting eta range.
335
341
342////////////////////////////////////////////////////////////////////////////////
343/// Slot for setting phi range.
344
350
351////////////////////////////////////////////////////////////////////////////////
352/// Slot for SliceThreshold.
353
355{
357 fM->SetDataSliceThreshold(st->WidgetId(), st->GetValue());
358 Update();
359}
360
361////////////////////////////////////////////////////////////////////////////////
362/// Slot for slice info Color.
363
370
371////////////////////////////////////////////////////////////////////////////////
372/// Slot for slice transparency.
373
380
381/** \class TEveCalo3DEditor
382\ingroup TEve
383GUI editor for TEveCalo3D.
384*/
385
386
387////////////////////////////////////////////////////////////////////////////////
388/// Constructor.
389
391 UInt_t options, Pixel_t back) :
392 TGedFrame(p, width, height, options | kVerticalFrame, back),
393 fM(nullptr),
394 fFrameTransparency(nullptr)
395{
396 MakeTitle("TEveCalo3D");
397
399 TGLabel* lab = new TGLabel(f, "Frame transparency: ");
400 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
401
402 fFrameTransparency = new TGNumberEntry(f, 0., 2, -1,
405
407 fFrameTransparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
408 f->AddFrame(fFrameTransparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
409 fFrameTransparency->Connect("ValueSet(Long_t)","TEveCalo3DEditor", this, "DoFrameTransparency()");
410
411 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
412}
413
414////////////////////////////////////////////////////////////////////////////////
415/// Set model object.
416
418{
419 fM = dynamic_cast<TEveCalo3D*>(obj);
421}
422
423////////////////////////////////////////////////////////////////////////////////
424/// Slot for frame transparency.
425
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFixedSize
Definition GuiTypes.h:390
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define d(i)
Definition RSha256.hxx:102
#define f(i)
Definition RSha256.hxx:104
#define e(i)
Definition RSha256.hxx:103
short Color_t
Color number (short)
Definition RtypesCore.h:99
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:51
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
#define gClient
Definition TGClient.h:157
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
R__EXTERN void * gTQSender
Definition TQObject.h:46
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition TColor.cxx:2445
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1926
void DoFrameTransparency()
Slot for frame transparency.
void SetModel(TObject *obj) override
Set model object.
TGNumberEntry * fFrameTransparency
TEveCalo3DEditor(const TEveCalo3DEditor &)
Visualization of a calorimeter event data in 3D.
Definition TEveCalo.h:158
void SetFrameTransparency(Char_t x)
Definition TEveCalo.h:191
Char_t GetFrameTransparency() const
Definition TEveCalo.h:192
virtual void GetEtaLimits(Double_t &min, Double_t &max) const =0
void SetSliceTransparency(Int_t slice, Char_t t)
Set transparency for given slice.
Int_t GetNSlices() const
SliceInfo_t & RefSliceInfo(Int_t s)
Bool_t GetWrapTwoPi() const
virtual void GetPhiLimits(Double_t &min, Double_t &max) const =0
void DoMaxValAbs()
Slot for setting max E in for absolute scale.
TEveGValuator * fPhiOffset
TGRadioButton * fPlotEt
void DoPlot()
Slot for setting E/Et plot.
void SetModel(TObject *obj) override
Set model object.
void DoEtaRange()
Slot for setting eta range.
TEveCaloVizEditor(const TEveCaloVizEditor &)
void DoScaleAbs()
Slot for enabling/disabling absolute scale.
TEveGDoubleValuator * fEtaRng
TEveGValuator * fPhi
TGCheckButton * fScaleAbs
TGVerticalFrame * fSliceFrame
void DoSliceTransparency(Long_t transp)
Slot for slice transparency.
TEveGValuator * fMaxTowerH
TGVerticalFrame * fDataFrame
void DoMaxTowerH()
Slot for setting max tower height.
TGRadioButton * fPlotE
void DoSliceColor(Pixel_t color)
Slot for slice info Color.
void DoSliceThreshold()
Slot for SliceThreshold.
void MakeSliceInfo()
Create slice info gui.
TEveGValuator * fMaxValAbs
void DoPhi()
Slot for setting phi range.
Base class for calorimeter data visualization.
Definition TEveCalo.h:32
void SetDataSliceColor(Int_t slice, Color_t col)
Set slice color in data.
Definition TEveCalo.cxx:128
void SetDataSliceThreshold(Int_t slice, Float_t val)
Set threshold for given slice.
Definition TEveCalo.cxx:112
Float_t GetMaxTowerH() const
Definition TEveCalo.h:113
void SetPlotEt(Bool_t x)
Set E/Et plot.
Definition TEveCalo.cxx:147
void SetPhiWithRng(Float_t x, Float_t r)
Set phi range.
Definition TEveCalo.cxx:169
Double_t fEtaMax
Definition TEveCalo.h:44
TEveCaloData * GetData() const
Definition TEveCalo.h:87
void SetEta(Float_t l, Float_t u)
Set eta range.
Definition TEveCalo.cxx:136
virtual void SetScaleAbs(Bool_t x)
Definition TEveCalo.h:85
void SetMaxTowerH(Float_t x)
Definition TEveCalo.h:112
Float_t GetMaxValAbs() const
Definition TEveCalo.h:116
Bool_t GetPlotEt() const
Definition TEveCalo.h:109
Double_t fPhiOffset
Definition TEveCalo.h:47
void SetMaxValAbs(Float_t x)
Definition TEveCalo.h:115
Double_t fPhi
Definition TEveCalo.h:46
TEveCaloData * fData
Definition TEveCalo.h:40
Double_t fEtaMin
Definition TEveCalo.h:43
Bool_t GetScaleAbs() const
Definition TEveCalo.h:114
Composite GUI element for selection of range (label, two number-entries and double-slider).
Float_t GetMin() const
void Build(Bool_t connect=kTRUE) override
Create sub-components (label, number entries, double-slider).
TGDoubleHSlider * GetSlider()
void SetLimits(Int_t min, Int_t max)
Set limits of the represented range for integer values.
Float_t GetMax() const
void SetValues(Float_t min, Float_t max, Bool_t emit=kFALSE)
Set min/max values, optionally emit signal.
void SetLabelWidth(Int_t w)
void SetShowSlider(Bool_t s=kTRUE)
void SetNELength(Int_t l)
Composite GUI element for single value selection (supports label, number-entry and slider).
void Build(Bool_t connect=kTRUE) override
Create sub-components (label, number entry, slider).
void SetToolTip(const char *tip)
Set the tooltip of the number-entry.
void SetLimits(Int_t min, Int_t max)
Set limits of the represented value for integer values.
Float_t GetValue() const
virtual void SetValue(Float_t v, Bool_t emit=kFALSE)
Set value, optionally emit signal.
A button abstract base class.
Definition TGButton.h:68
Selects different options.
Definition TGButton.h:264
Bool_t IsOn() const override
Definition TGButton.h:310
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set check button state.
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
virtual TList * GetList() const
Definition TGFrame.h:312
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
void MapWindow() override
map window
Definition TGFrame.h:206
void UnmapWindow() override
unmap window
Definition TGFrame.h:208
virtual void SetWidth(UInt_t w)
Definition TGFrame.h:248
virtual void SetHeight(UInt_t h)
Definition TGFrame.h:249
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
This class handles GUI labels.
Definition TGLabel.h:24
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Definition TGLabel.cxx:323
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
TGNumberEntry is a number entry input widget with up/down buttons.
TGNumberEntryField * GetNumberEntry() const
Get the number entry field.
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
@ kNEANonNegative
Non-negative number.
@ kNESRealOne
Fixed fraction real, one digit.
@ kNESInteger
Style of number entry field.
@ kNESRealTwo
Fixed fraction real, two digit.
@ kNELLimitMinMax
Both lower and upper limits.
Selects different options.
Definition TGButton.h:321
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set radio button state.
Bool_t IsDown() const override
Definition TGButton.h:370
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
A composite frame that layout their children in vertical way.
Definition TGFrame.h:376
Int_t WidgetId() const
Definition TGWidget.h:68
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition TGWindow.cxx:293
virtual TGCompositeFrame * GetEditorTab(const char *name)
Find or create tab with name.
Base frame for implementing GUI - a service class.
Definition TGedFrame.h:27
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:94
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:71
TGedEditor * GetGedEditor()
Definition TGedFrame.h:71
Mother of all ROOT objects.
Definition TObject.h:41
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:865
constexpr Double_t Pi()
Definition TMath.h:40