Logo ROOT  
Reference Guide
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
39
40////////////////////////////////////////////////////////////////////////////////
41/// Constructor.
42
44 UInt_t options, Pixel_t back) :
45 TGedFrame(p, width, height, options | kVerticalFrame, back),
46 fM(0),
47
48 fPlotE(0),
49 fPlotEt(0),
50
51 fScaleAbs(0),
52 fMaxValAbs(0),
53 fMaxTowerH(0),
54
55 fEtaRng(0),
56 fPhi(0),
57 fPhiOffset(0),
58 fDataFrame(0),
59 fSliceFrame(0)
60{
61 MakeTitle("TEveCaloViz");
62
63 TGLabel* label = 0;
64 Int_t labelW = 45;
65
66 // scaling
67 TGHorizontalFrame* scf = new TGHorizontalFrame(this);
68
69 label = new TGLabel(scf, "ScaleAbsolute:");
71
72 fScaleAbs = new TGCheckButton(scf);
73 scf->AddFrame(fScaleAbs, new TGLayoutHints(kLHintsLeft, 3, 5, 3, 0));
74 fScaleAbs->Connect("Toggled(Bool_t)", "TEveCaloVizEditor", this, "DoScaleAbs()");
75
76
77 fMaxValAbs = new TEveGValuator(scf, "MaxEVal:", 70, 0);
82 fMaxValAbs->SetLimits(0, 1000);
83 fMaxValAbs->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoMaxValAbs()");
84 scf->AddFrame(fMaxValAbs, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
85
86 AddFrame(scf, new TGLayoutHints(kLHintsTop, 4, 1, 1, 0));
87
88
89 // tower height
90 fMaxTowerH = new TEveGValuator(this, "MaxTowerH:", 96, 0);
96 fMaxTowerH->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoMaxTowerH()");
98
99
100 //______________________________________________________________________________
101
103
104 // E/Et Plot
105 {
107 TGCompositeFrame *labfr = new TGHorizontalFrame(group, 28, 20, kFixedSize);
108
109 TGFont *myfont = gClient->GetFont("-adobe-times-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
110 label = new TGLabel(labfr, "Plot:");
111 label->SetTextFont(myfont);
112 labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
113 group->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
114
115 fPlotE = new TGRadioButton(group, new TGHotString("E"), 11);
116 fPlotE->Connect("Clicked()", "TEveCaloVizEditor", this, "DoPlot()");
117 group->AddFrame(fPlotE, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 2, 2, 0, 0));
118
119 fPlotEt = new TGRadioButton(group, new TGHotString("Et"), 22);
120 fPlotEt->Connect("Clicked()", "TEveCaloVizEditor", this, "DoPlot()");
121 group->AddFrame(fPlotEt, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 2, 2, 0, 0));
122
124 }
125
126 // eta
127 fEtaRng = new TEveGDoubleValuator(fDataFrame,"Eta rng:", 40, 0);
129 fEtaRng->SetLabelWidth(labelW);
130 fEtaRng->Build();
131 fEtaRng->GetSlider()->SetWidth(195);
133 fEtaRng->Connect("ValueSet()", "TEveCaloVizEditor", this, "DoEtaRange()");
135
136 // phi
137 fPhi = new TEveGValuator(fDataFrame, "Phi:", 90, 0);
138 fPhi->SetLabelWidth(labelW);
139 fPhi->SetNELength(6);
140 fPhi->Build();
142 fPhi->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoPhi()");
143 fDataFrame->AddFrame(fPhi, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
144
145 fPhiOffset = new TEveGValuator(fDataFrame, "PhiOff:", 90, 0);
146 fPhiOffset->SetLabelWidth(labelW);
148 fPhiOffset->Build();
150 fPhiOffset->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoPhi()");
152
155}
156
157////////////////////////////////////////////////////////////////////////////////
158/// Create slice info gui.
159
161{
162 Int_t ns = fM->GetData()->GetNSlices();
163 Int_t nf = fSliceFrame->GetList()->GetSize();
164
165 if (ns > nf)
166 {
167 for (Int_t i=nf; i<ns; ++i)
168 {
170
171 TEveGValuator* threshold = new TEveGValuator(f,"", 90, 0, i);
172 threshold->SetLabelWidth(50);
173 threshold->SetNELength(6);
174 threshold->SetShowSlider(kFALSE);
175 threshold->Build();
176 threshold->SetLimits(0, 1000, TGNumberFormat::kNESRealTwo);
177 threshold->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoSliceThreshold()");
178 f->AddFrame(threshold, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
179
180 TGColorSelect* color = new TGColorSelect(f, 0, i);
181 f->AddFrame(color, new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
182 color->Connect("ColorSelected(Pixel_t)", "TEveCaloVizEditor", this, "DoSliceColor(Pixel_t)");
183
184 TGNumberEntry* transparency = new TGNumberEntry(f, 0., 2, i,
187 transparency->SetHeight(18);
188 transparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
189 f->AddFrame(transparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
190 transparency->Connect("ValueSet(Long_t)", "TEveCaloVizEditor", this, "DoSliceTransparency(Long_t)");
191
192
193 fSliceFrame->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
194 }
195 nf = ns;
196 }
197
198 TIter frame_iterator(fSliceFrame->GetList());
199 for (Int_t i=0; i<nf; ++i)
200 {
201 TGFrameElement *el = (TGFrameElement*) frame_iterator();
203 if (i < ns)
204 {
206
207 TEveGValuator *threshold = (TEveGValuator*) ((TGFrameElement*) fr->GetList()->At(0))->fFrame;
208 TGColorSelect *color = (TGColorSelect*) ((TGFrameElement*) fr->GetList()->At(1) )->fFrame;
209 TGNumberEntry *transp = (TGNumberEntry*) ((TGFrameElement*) fr->GetList()->At(2))->fFrame;
210
211 threshold->GetLabel()->SetText(si.fName);
212 threshold->SetValue(si.fThreshold);
214 transp->SetNumber(si.fTransparency);
215
216 if (! fr->IsMapped()) {
217 fr->MapSubwindows();
218 fr->MapWindow();
219 }
220 }
221 else
222 {
223 if (fr->IsMapped()) {
224 fr->UnmapWindow();
225 }
226 }
227 }
228}
229
230////////////////////////////////////////////////////////////////////////////////
231/// Set model object.
232
234{
235 fM = dynamic_cast<TEveCaloViz*>(obj);
236 if (fM->GetPlotEt())
237 {
240 }
241 else
242 {
245 }
246
247 if (fM->fData)
248 {
250 if (p->GetList()->IsEmpty())
251 {
252 p->MapWindow();
253 p->MapSubwindows();
254 }
255
259
260 Double_t min, max;
261 fM->GetData()->GetEtaLimits(min, max);
262 fEtaRng->SetLimits((Float_t)min, (Float_t)max);
264
265 fM->GetData()->GetPhiLimits(min, max);
267 fPhi->SetValue(fM->fPhi);
268 if ( fM->GetData()->GetWrapTwoPi())
269 {
270 fPhi->SetToolTip("Center angle in radians");
272 }
273 else
274 {
275 Float_t d = (max-min)*0.5;
277 }
279 fPhiOffset->SetToolTip("Phi range in radians");
280
282 }
283 else
284 {
285
287 }
288}
289
290////////////////////////////////////////////////////////////////////////////////
291/// Slot for setting max tower height.
292
294{
296 Update();
297}
298
299////////////////////////////////////////////////////////////////////////////////
300/// Slot for enabling/disabling absolute scale.
301
303{
305 Update();
306}
307
308////////////////////////////////////////////////////////////////////////////////
309/// Slot for setting max E in for absolute scale.
310
312{
314 Update();
315}
316
317////////////////////////////////////////////////////////////////////////////////
318/// Slot for setting E/Et plot.
319
321{
322 TGButton *btn = (TGButton *) gTQSender;
323 Int_t id = btn->WidgetId();
324
325 if (id == fPlotE->WidgetId())
327 else
329
331 Update();
332}
333
334////////////////////////////////////////////////////////////////////////////////
335/// Slot for setting eta range.
336
338{
340 Update();
341}
342
343////////////////////////////////////////////////////////////////////////////////
344/// Slot for setting phi range.
345
347{
349 Update();
350}
351
352////////////////////////////////////////////////////////////////////////////////
353/// Slot for SliceThreshold.
354
356{
359 Update();
360}
361
362////////////////////////////////////////////////////////////////////////////////
363/// Slot for slice info Color.
364
366{
369 Update();
370}
371
372////////////////////////////////////////////////////////////////////////////////
373/// Slot for slice transparency.
374
376{
379 Update();
380}
381
382/** \class TEveCalo3DEditor
383\ingroup TEve
384GUI editor for TEveCalo3D.
385*/
386
388
389////////////////////////////////////////////////////////////////////////////////
390/// Constructor.
391
393 UInt_t options, Pixel_t back) :
394 TGedFrame(p, width, height, options | kVerticalFrame, back),
395 fM(0),
396 fFrameTransparency(0)
397{
398 MakeTitle("TEveCalo3D");
399
401 TGLabel* lab = new TGLabel(f, "Frame transparency: ");
402 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
403
404 fFrameTransparency = new TGNumberEntry(f, 0., 2, -1,
407
409 fFrameTransparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
410 f->AddFrame(fFrameTransparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
411 fFrameTransparency->Connect("ValueSet(Long_t)","TEveCalo3DEditor", this, "DoFrameTransparency()");
412
413 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
414}
415
416////////////////////////////////////////////////////////////////////////////////
417/// Set model object.
418
420{
421 fM = dynamic_cast<TEveCalo3D*>(obj);
423}
424
425////////////////////////////////////////////////////////////////////////////////
426/// Slot for frame transparency.
427
429{
431 Update();
432}
@ 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
int Int_t
Definition: RtypesCore.h:45
char Char_t
Definition: RtypesCore.h:33
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
long Long_t
Definition: RtypesCore.h:54
double Double_t
Definition: RtypesCore.h:59
short Color_t
Definition: RtypesCore.h:92
float Float_t
Definition: RtypesCore.h:57
#define ClassImp(name)
Definition: Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ 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
R__EXTERN void * gTQSender
Definition: TQObject.h:44
virtual Bool_t IsEmpty() const
Definition: TCollection.h:188
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:184
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:2069
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:1822
GUI editor for TEveCalo3D.
virtual void SetModel(TObject *obj)
Set model object.
void DoFrameTransparency()
Slot for frame transparency.
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
Definition: TEveCaloData.h:202
SliceInfo_t & RefSliceInfo(Int_t s)
Definition: TEveCaloData.h:203
Bool_t GetWrapTwoPi() const
Definition: TEveCaloData.h:227
virtual void GetPhiLimits(Double_t &min, Double_t &max) const =0
GUI editor for TEveCaloEditor.
void DoMaxValAbs()
Slot for setting max E in for absolute scale.
TEveGValuator * fPhiOffset
TGRadioButton * fPlotEt
void DoPlot()
Slot for setting E/Et plot.
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
virtual void SetModel(TObject *obj)
Set model object.
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:129
void SetDataSliceThreshold(Int_t slice, Float_t val)
Set threshold for given slice.
Definition: TEveCalo.cxx:113
Float_t GetMaxTowerH() const
Definition: TEveCalo.h:113
void SetPlotEt(Bool_t x)
Set E/Et plot.
Definition: TEveCalo.cxx:148
void SetPhiWithRng(Float_t x, Float_t r)
Set phi range.
Definition: TEveCalo.cxx:170
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:137
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
TGDoubleHSlider * GetSlider()
void SetLimits(Int_t min, Int_t max)
Set limits of the represented range for integer values.
Float_t GetMax() const
virtual void Build(Bool_t connect=kTRUE)
Create sub-components (label, number entries, double-slider).
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)
TGLabel * GetLabel()
Composite GUI element for single value selection (supports label, number-entry and 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.
virtual void Build(Bool_t connect=kTRUE)
Create sub-components (label, number entry, slider).
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
virtual Bool_t IsOn() const
Definition: TGButton.h:311
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1250
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:287
virtual TList * GetList() const
Definition: TGFrame.h:310
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1117
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1164
Encapsulate fonts used in the GUI system.
Definition: TGFont.h:140
TGFrame * fFrame
Definition: TGLayout.h:112
virtual void SetWidth(UInt_t w)
Definition: TGFrame.h:246
virtual void MapWindow()
map window
Definition: TGFrame.h:204
virtual void SetHeight(UInt_t h)
Definition: TGFrame.h:247
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:206
A composite frame that layout their children in horizontal way.
Definition: TGFrame.h:386
TGHotString is a string with a "hot" character underlined.
Definition: TGString.h:42
This class handles GUI labels.
Definition: TGLabel.h:24
virtual void SetText(TGString *newText)
Set new text in label.
Definition: TGLabel.cxx:180
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Definition: TGLabel.cxx:324
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
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
@ kNEANonNegative
Non-negative number.
Definition: TGNumberEntry.h:42
@ kNESRealOne
Fixed fraction real, one digit.
Definition: TGNumberEntry.h:26
@ kNESInteger
Style of number entry field.
Definition: TGNumberEntry.h:25
@ kNESRealTwo
Fixed fraction real, two digit.
Definition: TGNumberEntry.h:27
@ kNELLimitMinMax
Both lower and upper limits.
Definition: TGNumberEntry.h:50
Selects different options.
Definition: TGButton.h:322
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set radio button state.
Definition: TGButton.cxx:1613
virtual Bool_t IsDown() const
Definition: TGButton.h:371
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:375
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:295
virtual TGCompositeFrame * GetEditorTab(const char *name)
Find or create tab with name.
Definition: TGedEditor.cxx:184
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'.
Definition: TGedFrame.cxx:122
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:95
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:72
TGedEditor * GetGedEditor()
Definition: TGedFrame.h:71
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:357
Mother of all ROOT objects.
Definition: TObject.h:37
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:869
static constexpr double ns
constexpr Double_t Pi()
Definition: TMath.h:37