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 "TGNumberEntry.h"
26#include "TG3DLine.h"
27#include "TGButtonGroup.h"
28#include "TColor.h"
29#include "TGColorSelect.h"
30
31#include "TMathBase.h"
32#include "TMath.h"
33
34/** \class TEveCaloVizEditor
35\ingroup TEve
36GUI editor for TEveCaloEditor.
37*/
38
40
41////////////////////////////////////////////////////////////////////////////////
42/// Constructor.
43
45 UInt_t options, Pixel_t back) :
46 TGedFrame(p, width, height, options | kVerticalFrame, back),
47 fM(0),
48
49 fPlotE(0),
50 fPlotEt(0),
51
52 fScaleAbs(0),
53 fMaxValAbs(0),
54 fMaxTowerH(0),
55
56 fEtaRng(0),
57 fPhi(0),
58 fPhiOffset(0),
59 fDataFrame(0),
60 fSliceFrame(0)
61{
62 MakeTitle("TEveCaloViz");
63
64 TGLabel* label = 0;
65 Int_t labelW = 45;
66
67 // scaling
68 TGHorizontalFrame* scf = new TGHorizontalFrame(this);
69
70 label = new TGLabel(scf, "ScaleAbsolute:");
72
73 fScaleAbs = new TGCheckButton(scf);
74 scf->AddFrame(fScaleAbs, new TGLayoutHints(kLHintsLeft, 3, 5, 3, 0));
75 fScaleAbs->Connect("Toggled(Bool_t)", "TEveCaloVizEditor", this, "DoScaleAbs()");
76
77
78 fMaxValAbs = new TEveGValuator(scf, "MaxEVal:", 70, 0);
83 fMaxValAbs->SetLimits(0, 1000);
84 fMaxValAbs->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoMaxValAbs()");
85 scf->AddFrame(fMaxValAbs, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
86
87 AddFrame(scf, new TGLayoutHints(kLHintsTop, 4, 1, 1, 0));
88
89
90 // tower height
91 fMaxTowerH = new TEveGValuator(this, "MaxTowerH:", 96, 0);
97 fMaxTowerH->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoMaxTowerH()");
99
100
101 //______________________________________________________________________________
102
104
105 // E/Et Plot
106 {
108 TGCompositeFrame *labfr = new TGHorizontalFrame(group, 28, 20, kFixedSize);
109
110 TGFont *myfont = gClient->GetFont("-adobe-times-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
111 label = new TGLabel(labfr, "Plot:");
112 label->SetTextFont(myfont);
113 labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
114 group->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
115
116 fPlotE = new TGRadioButton(group, new TGHotString("E"), 11);
117 fPlotE->Connect("Clicked()", "TEveCaloVizEditor", this, "DoPlot()");
118 group->AddFrame(fPlotE, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 2, 2, 0, 0));
119
120 fPlotEt = new TGRadioButton(group, new TGHotString("Et"), 22);
121 fPlotEt->Connect("Clicked()", "TEveCaloVizEditor", this, "DoPlot()");
122 group->AddFrame(fPlotEt, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 2, 2, 0, 0));
123
125 }
126
127 // eta
128 fEtaRng = new TEveGDoubleValuator(fDataFrame,"Eta rng:", 40, 0);
130 fEtaRng->SetLabelWidth(labelW);
131 fEtaRng->Build();
132 fEtaRng->GetSlider()->SetWidth(195);
134 fEtaRng->Connect("ValueSet()", "TEveCaloVizEditor", this, "DoEtaRange()");
136
137 // phi
138 fPhi = new TEveGValuator(fDataFrame, "Phi:", 90, 0);
139 fPhi->SetLabelWidth(labelW);
140 fPhi->SetNELength(6);
141 fPhi->Build();
143 fPhi->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoPhi()");
144 fDataFrame->AddFrame(fPhi, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
145
146 fPhiOffset = new TEveGValuator(fDataFrame, "PhiOff:", 90, 0);
147 fPhiOffset->SetLabelWidth(labelW);
149 fPhiOffset->Build();
151 fPhiOffset->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoPhi()");
153
156}
157
158////////////////////////////////////////////////////////////////////////////////
159/// Create slice info gui.
160
162{
163 Int_t ns = fM->GetData()->GetNSlices();
164 Int_t nf = fSliceFrame->GetList()->GetSize();
165
166 if (ns > nf)
167 {
168 for (Int_t i=nf; i<ns; ++i)
169 {
171
172 TEveGValuator* threshold = new TEveGValuator(f,"", 90, 0, i);
173 threshold->SetLabelWidth(50);
174 threshold->SetNELength(6);
175 threshold->SetShowSlider(kFALSE);
176 threshold->Build();
177 threshold->SetLimits(0, 1000, TGNumberFormat::kNESRealTwo);
178 threshold->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoSliceThreshold()");
179 f->AddFrame(threshold, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
180
181 TGColorSelect* color = new TGColorSelect(f, 0, i);
182 f->AddFrame(color, new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
183 color->Connect("ColorSelected(Pixel_t)", "TEveCaloVizEditor", this, "DoSliceColor(Pixel_t)");
184
185 TGNumberEntry* transparency = new TGNumberEntry(f, 0., 2, i,
188 transparency->SetHeight(18);
189 transparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
190 f->AddFrame(transparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
191 transparency->Connect("ValueSet(Long_t)", "TEveCaloVizEditor", this, "DoSliceTransparency(Long_t)");
192
193
194 fSliceFrame->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
195 }
196 nf = ns;
197 }
198
199 TIter frame_iterator(fSliceFrame->GetList());
200 for (Int_t i=0; i<nf; ++i)
201 {
202 TGFrameElement *el = (TGFrameElement*) frame_iterator();
204 if (i < ns)
205 {
207
208 TEveGValuator *threshold = (TEveGValuator*) ((TGFrameElement*) fr->GetList()->At(0))->fFrame;
209 TGColorSelect *color = (TGColorSelect*) ((TGFrameElement*) fr->GetList()->At(1) )->fFrame;
210 TGNumberEntry *transp = (TGNumberEntry*) ((TGFrameElement*) fr->GetList()->At(2))->fFrame;
211
212 threshold->GetLabel()->SetText(si.fName);
213 threshold->SetValue(si.fThreshold);
215 transp->SetNumber(si.fTransparency);
216
217 if (! fr->IsMapped()) {
218 fr->MapSubwindows();
219 fr->MapWindow();
220 }
221 }
222 else
223 {
224 if (fr->IsMapped()) {
225 fr->UnmapWindow();
226 }
227 }
228 }
229}
230
231////////////////////////////////////////////////////////////////////////////////
232/// Set model object.
233
235{
236 fM = dynamic_cast<TEveCaloViz*>(obj);
237 if (fM->GetPlotEt())
238 {
241 }
242 else
243 {
246 }
247
248 if (fM->fData)
249 {
251 if (p->GetList()->IsEmpty())
252 {
253 p->MapWindow();
254 p->MapSubwindows();
255 }
256
260
261 Double_t min, max;
262 fM->GetData()->GetEtaLimits(min, max);
263 fEtaRng->SetLimits((Float_t)min, (Float_t)max);
265
266 fM->GetData()->GetPhiLimits(min, max);
268 fPhi->SetValue(fM->fPhi);
269 if ( fM->GetData()->GetWrapTwoPi())
270 {
271 fPhi->SetToolTip("Center angle in radians");
273 }
274 else
275 {
276 Float_t d = (max-min)*0.5;
278 }
280 fPhiOffset->SetToolTip("Phi range in radians");
281
283 }
284 else
285 {
286
288 }
289}
290
291////////////////////////////////////////////////////////////////////////////////
292/// Slot for setting max tower height.
293
295{
297 Update();
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// Slot for enabling/disabling absolute scale.
302
304{
306 Update();
307}
308
309////////////////////////////////////////////////////////////////////////////////
310/// Slot for setting max E in for absolute scale.
311
313{
315 Update();
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Slot for setting E/Et plot.
320
322{
323 TGButton *btn = (TGButton *) gTQSender;
324 Int_t id = btn->WidgetId();
325
326 if (id == fPlotE->WidgetId())
328 else
330
332 Update();
333}
334
335////////////////////////////////////////////////////////////////////////////////
336/// Slot for setting eta range.
337
339{
341 Update();
342}
343
344////////////////////////////////////////////////////////////////////////////////
345/// Slot for setting phi range.
346
348{
350 Update();
351}
352
353////////////////////////////////////////////////////////////////////////////////
354/// Slot for SliceThreshold.
355
357{
360 Update();
361}
362
363////////////////////////////////////////////////////////////////////////////////
364/// Slot for slice info Color.
365
367{
370 Update();
371}
372
373////////////////////////////////////////////////////////////////////////////////
374/// Slot for slice transparency.
375
377{
380 Update();
381}
382
383/** \class TEveCalo3DEditor
384\ingroup TEve
385GUI editor for TEveCalo3D.
386*/
387
389
390////////////////////////////////////////////////////////////////////////////////
391/// Constructor.
392
394 UInt_t options, Pixel_t back) :
395 TGedFrame(p, width, height, options | kVerticalFrame, back),
396 fM(0),
397 fFrameTransparency(0)
398{
399 MakeTitle("TEveCalo3D");
400
402 TGLabel* lab = new TGLabel(f, "Frame transparency: ");
403 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
404
405 fFrameTransparency = new TGNumberEntry(f, 0., 2, -1,
408
410 fFrameTransparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
411 f->AddFrame(fFrameTransparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
412 fFrameTransparency->Connect("ValueSet(Long_t)","TEveCalo3DEditor", this, "DoFrameTransparency()");
413
414 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
415}
416
417////////////////////////////////////////////////////////////////////////////////
418/// Set model object.
419
421{
422 fM = dynamic_cast<TEveCalo3D*>(obj);
424}
425
426////////////////////////////////////////////////////////////////////////////////
427/// Slot for frame transparency.
428
430{
432 Update();
433}
ULong_t Pixel_t
Definition: GuiTypes.h:39
#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:41
char Char_t
Definition: RtypesCore.h:29
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
double Double_t
Definition: RtypesCore.h:55
short Color_t
Definition: RtypesCore.h:79
float Float_t
Definition: RtypesCore.h:53
#define ClassImp(name)
Definition: Rtypes.h:365
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:166
@ kVerticalFrame
Definition: TGFrame.h:59
@ kFixedSize
Definition: TGFrame.h:68
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsBottom
Definition: TGLayout.h:36
@ kLHintsTop
Definition: TGLayout.h:34
R__EXTERN void * gTQSender
Definition: TQObject.h:44
virtual Bool_t IsEmpty() const
Definition: TCollection.h:186
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:2003
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:1764
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:157
void SetFrameTransparency(Char_t x)
Definition: TEveCalo.h:190
Char_t GetFrameTransparency() const
Definition: TEveCalo.h:191
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:31
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:112
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:43
TEveCaloData * GetData() const
Definition: TEveCalo.h:86
void SetEta(Float_t l, Float_t u)
Set eta range.
Definition: TEveCalo.cxx:137
virtual void SetScaleAbs(Bool_t x)
Definition: TEveCalo.h:84
void SetMaxTowerH(Float_t x)
Definition: TEveCalo.h:111
Float_t GetMaxValAbs() const
Definition: TEveCalo.h:115
Bool_t GetPlotEt() const
Definition: TEveCalo.h:108
Double_t fPhiOffset
Definition: TEveCalo.h:46
void SetMaxValAbs(Float_t x)
Definition: TEveCalo.h:114
Double_t fPhi
Definition: TEveCalo.h:45
TEveCaloData * fData
Definition: TEveCalo.h:39
Double_t fEtaMin
Definition: TEveCalo.h:42
Bool_t GetScaleAbs() const
Definition: TEveCalo.h:113
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.
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:1200
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual TList * GetList() const
Definition: TGFrame.h:369
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
Definition: TGFont.h:149
TGFrame * fFrame
Definition: TGLayout.h:119
virtual void SetWidth(UInt_t w)
Definition: TGFrame.h:293
virtual void MapWindow()
Definition: TGFrame.h:251
virtual void SetHeight(UInt_t h)
Definition: TGFrame.h:294
virtual void UnmapWindow()
Definition: TGFrame.h:253
virtual void SetText(TGString *newText)
Set new text in label.
Definition: TGLabel.cxx:177
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Definition: TGLabel.cxx:321
virtual void SetNumber(Double_t val)
TGNumberEntryField * GetNumberEntry() const
virtual Double_t GetNumber() const
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set radio button state.
Definition: TGButton.cxx:1563
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.
Int_t WidgetId() const
Definition: TGWidget.h:80
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition: TGWindow.cxx:180
virtual TGCompositeFrame * GetEditorTab(const char *name)
Find or create tab with name.
Definition: TGedEditor.cxx:188
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Definition: TGedFrame.cxx:123
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
TGedEditor * GetGedEditor()
Definition: TGedFrame.h:77
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:354
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:867
static constexpr double ns
constexpr Double_t Pi()
Definition: TMath.h:38