Logo ROOT   6.10/09
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"
15 #include "TEveRGBAPaletteEditor.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
36 GUI 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:");
71  scf->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
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);
82  fMaxValAbs->Build();
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);
95  fMaxTowerH->Build();
97  fMaxTowerH->Connect("ValueSet(Double_t)", "TEveCaloVizEditor", this, "DoMaxTowerH()");
98  AddFrame(fMaxTowerH, new TGLayoutHints(kLHintsTop, 4, 1, 1, 1));
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 
124  fDataFrame->AddFrame(group, new TGLayoutHints(kLHintsTop, 4, 1, 1, 0));
125  }
126 
127  // eta
128  fEtaRng = new TEveGDoubleValuator(fDataFrame,"Eta rng:", 40, 0);
129  fEtaRng->SetNELength(6);
130  fEtaRng->SetLabelWidth(labelW);
131  fEtaRng->Build();
132  fEtaRng->GetSlider()->SetWidth(195);
134  fEtaRng->Connect("ValueSet()", "TEveCaloVizEditor", this, "DoEtaRange()");
135  fDataFrame->AddFrame(fEtaRng, new TGLayoutHints(kLHintsTop, 1, 1, 4, 5));
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);
267  fPhi->SetLimits(min, max, 101, TGNumberFormat::kNESRealTwo);
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 
282  MakeSliceInfo();
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 
331  fM->SetPlotEt(fPlotEt->IsDown());
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 {
359  fM->SetDataSliceThreshold(st->WidgetId(), st->GetValue());
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 {
379  fM->GetData()->SetSliceTransparency(cs->WidgetId(), t);
380  Update();
381 }
382 
383 /** \class TEveCalo3DEditor
384 \ingroup TEve
385 GUI 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),
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.");
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 }
TGVerticalFrame * fSliceFrame
TEveCaloData * GetData() const
Definition: TEveCalo.h:86
Float_t GetMaxTowerH() const
Definition: TEveCalo.h:112
virtual TGCompositeFrame * GetEditorTab(const char *name)
Find or create tab with name.
Definition: TGedEditor.cxx:188
void DoScaleAbs()
Slot for enabling/disabling absolute scale.
void SetEta(Float_t l, Float_t u)
Set eta range.
Definition: TEveCalo.cxx:137
void DoSliceColor(Pixel_t color)
Slot for slice info Color.
SliceInfo_t & RefSliceInfo(Int_t s)
Definition: TEveCaloData.h:203
Bool_t GetWrapTwoPi() const
Definition: TEveCaloData.h:227
void SetPlotEt(Bool_t x)
Set E/Et plot.
Definition: TEveCalo.cxx:148
float Float_t
Definition: RtypesCore.h:53
virtual void SetValue(Float_t v, Bool_t emit=kFALSE)
Set value, optionally emit signal.
Float_t GetMaxValAbs() const
Definition: TEveCalo.h:115
void SetMaxTowerH(Float_t x)
Definition: TEveCalo.h:111
R__EXTERN void * gTQSender
Definition: TQObject.h:45
void SetDataSliceColor(Int_t slice, Color_t col)
Set slice color in data.
Definition: TEveCalo.cxx:129
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
Char_t GetFrameTransparency() const
Definition: TEveCalo.h:191
void SetPhiWithRng(Float_t x, Float_t r)
Set phi range.
Definition: TEveCalo.cxx:170
Int_t WidgetId() const
Definition: TGWidget.h:80
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual void SetNumber(Double_t val)
void SetLimits(Int_t min, Int_t max)
Set limits of the represented range for integer values.
#define gClient
Definition: TGClient.h:166
int Int_t
Definition: RtypesCore.h:41
void DoSliceThreshold()
Slot for SliceThreshold.
virtual void SetModel(TObject *obj)
Set model object.
void SetToolTip(const char *tip)
Set the tooltip of the number-entry.
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Definition: TGLabel.cxx:321
void SetFrameTransparency(Char_t x)
Definition: TEveCalo.h:190
TGDoubleHSlider * GetSlider()
Composite GUI element for single value selection (supports label, number-entry and slider)...
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set radio button state.
Definition: TGButton.cxx:1563
TEveCaloVizEditor(const TEveCaloVizEditor &)
void DoFrameTransparency()
Slot for frame transparency.
TGVerticalFrame * fDataFrame
GUI editor for TEveCalo3D.
TEveCalo3DEditor(const TEveCalo3DEditor &)
ULong_t Pixel_t
Definition: GuiTypes.h:39
virtual void SetText(TGString *newText)
Set new text in label.
Definition: TGLabel.cxx:177
TGNumberEntry * fFrameTransparency
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
Float_t GetMax() const
TEveGValuator * fMaxValAbs
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by &#39;owner&#39; in extra tab &#39;name&#39;.
Definition: TGedFrame.cxx:123
TGRadioButton * fPlotEt
virtual Bool_t IsOn() const
Definition: TGButton.h:311
virtual void SetScaleAbs(Bool_t x)
Definition: TEveCalo.h:84
virtual TList * GetList() const
Definition: TGFrame.h:369
TEveGValuator * fMaxTowerH
constexpr Double_t Pi()
Definition: TMath.h:40
virtual void GetPhiLimits(Double_t &min, Double_t &max) const =0
void DoEtaRange()
Slot for setting eta range.
TGNumberEntry * fFrameTransparency
short Color_t
Definition: RtypesCore.h:79
Bool_t GetScaleAbs() const
Definition: TEveCalo.h:113
Double_t fEtaMin
Definition: TEveCalo.h:42
void SetDataSliceThreshold(Int_t slice, Float_t val)
Set threshold for given slice.
Definition: TEveCalo.cxx:113
TGCheckButton * fScaleAbs
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
void SetShowSlider(Bool_t s=kTRUE)
void SetNELength(Int_t l)
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t GetPlotEt() const
Definition: TEveCalo.h:108
TGFrame * fFrame
Definition: TGLayout.h:119
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:1707
GUI editor for TEveCaloEditor.
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:315
Double_t fPhi
Definition: TEveCalo.h:45
TGRadioButton * fPlotE
void DoPlot()
Slot for setting E/Et plot.
void DoMaxTowerH()
Slot for setting max tower height.
const Bool_t kFALSE
Definition: RtypesCore.h:92
void SetValues(Float_t min, Float_t max, Bool_t emit=kFALSE)
Set min/max values, optionally emit signal.
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:1917
long Long_t
Definition: RtypesCore.h:50
virtual void SetWidth(UInt_t w)
Definition: TGFrame.h:293
virtual Bool_t IsEmpty() const
Definition: TCollection.h:93
virtual void Build(Bool_t connect=kTRUE)
Create sub-components (label, number entry, slider).
#define ClassImp(name)
Definition: Rtypes.h:336
double f(double x)
virtual void Build(Bool_t connect=kTRUE)
Create sub-components (label, number entries, double-slider).
double Double_t
Definition: RtypesCore.h:55
virtual Double_t GetNumber() const
TGLabel * GetLabel()
Definition: TGFont.h:149
void SetSliceTransparency(Int_t slice, Char_t t)
Set transparency for given slice.
virtual void SetModel(TObject *obj)
Set model object.
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition: TGWindow.cxx:180
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
Base class for calorimeter data visualization.
Definition: TEveCalo.h:26
void DoSliceTransparency(Long_t transp)
Slot for slice transparency.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
TEveGValuator * fPhi
Float_t GetMin() const
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
Double_t fPhiOffset
Definition: TEveCalo.h:46
Mother of all ROOT objects.
Definition: TObject.h:37
char Char_t
Definition: RtypesCore.h:29
virtual void GetEtaLimits(Double_t &min, Double_t &max) const =0
virtual void UnmapWindow()
Definition: TGFrame.h:253
virtual void SetHeight(UInt_t h)
Definition: TGFrame.h:294
TGNumberEntryField * GetNumberEntry() const
virtual void MapWindow()
Definition: TGFrame.h:251
void SetLabelWidth(Int_t w)
Composite GUI element for selection of range (label, two number-entries and double-slider).
TEveGValuator * fPhiOffset
Visualization of a calorimeter event data in 3D.
Definition: TEveCalo.h:156
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
void SetLimits(Int_t min, Int_t max)
Set limits of the represented value for integer values.
TEveGDoubleValuator * fEtaRng
virtual Int_t GetSize() const
Definition: TCollection.h:89
void SetMaxValAbs(Float_t x)
Definition: TEveCalo.h:114
virtual Bool_t IsDown() const
Definition: TGButton.h:371
TEveCaloData * fData
Definition: TEveCalo.h:39
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
void DoPhi()
Slot for setting phi range.
Float_t GetValue() const
Int_t GetNSlices() const
Definition: TEveCaloData.h:202
void DoMaxValAbs()
Slot for setting max E in for absolute scale.
Double_t fEtaMax
Definition: TEveCalo.h:43
void MakeSliceInfo()
Create slice info gui.