Logo ROOT   6.14/05
Reference Guide
TEveCaloLegoEditor.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 "TEveCaloLegoEditor.h"
13 #include "TEveCalo.h"
14 #include "TEveGValuators.h"
15 #include "TGComboBox.h"
16 
17 #include "TColor.h"
18 #include "TGColorSelect.h"
19 #include "TGLabel.h"
20 #include "TG3DLine.h"
21 
22 /** \class TEveCaloLegoEditor
23 \ingroup TEve
24 GUI editor for TEveCaloLego.
25 */
26 
28 
29 ////////////////////////////////////////////////////////////////////////////////
30 /// Constructor.
31 
33  UInt_t options, Pixel_t back) :
34  TGedFrame(p, width, height, options | kVerticalFrame, back),
35  fM(0),
36  fGridColor(0),
37  fFontColor(0),
38  fPlaneColor(0),
39  fTransparency(0),
40 
41  fProjection(0),
42  f2DMode(0),
43  fBoxMode(0),
44 
45  fCell2DTextMin(0),
46 
47  fRebinFrame(0),
48  fAutoRebin(0),
49  fPixelsPerBin(0),
50  fNormalizeRebin(0)
51 
52 {
53  MakeTitle("TEveCaloLego");
54 
55  { // grid color
57  TGLabel* lab = new TGLabel(f, "GridColor:");
58  f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 10, 1, 1));
59 
60  fGridColor = new TGColorSelect(f, 0, -1);
62  fGridColor->Connect("ColorSelected(Pixel_t)", "TEveCaloLegoEditor", this, "DoGridColor(Pixel_t)");
63 
64  AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
65  }
66  // axis
67  {
68  // font color
70  TGLabel* lab = new TGLabel(f, "FontColor:");
71  f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 8, 1, 1));
72 
73  fFontColor = new TGColorSelect(f, 0, -1);
75  fFontColor->Connect("ColorSelected(Pixel_t)", "TEveCaloLegoEditor", this, "DoFontColor(Pixel_t)");
76 
77  AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
78  }
79  {
80  // plane color
82  TGLabel* lab = new TGLabel(f, "PlaneColor:");
83  f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
84 
85  fPlaneColor = new TGColorSelect(f, 0, -1);
87  fPlaneColor->Connect("ColorSelected(Pixel_t)", "TEveCaloLegoEditor", this, "DoPlaneColor(Pixel_t)");
88 
89  fTransparency = new TGNumberEntry(f, 0., 2, -1,
93  fTransparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
94  f->AddFrame(fTransparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
95  fTransparency->Connect("ValueSet(Long_t)","TEveCaloLegoEditor", this, "DoTransparency()");
96 
97  AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
98  }
99 
100  Int_t lw = 80;
101 
102  fProjection = MakeLabeledCombo("Project:", 1);
106  fProjection->Connect("Selected(Int_t)", "TEveCaloLegoEditor", this, "DoProjection()");
107 
108  f2DMode = MakeLabeledCombo("2DMode:", 4);
111  f2DMode->AddEntry("ValSizeOutline", TEveCaloLego::kValSizeOutline);
112  f2DMode->Connect("Selected(Int_t)", "TEveCaloLegoEditor", this, "Do2DMode()");
113 
114  fBoxMode = MakeLabeledCombo("Box:", 4);
118  fBoxMode->Connect("Selected(Int_t)", "TEveCaloLegoEditor", this, "DoBoxMode()");
119 
120  fCell2DTextMin = new TEveGValuator(this, "Cell2DTexMin:", 90, 0);
125  fCell2DTextMin->SetLimits(1, 1000);
126  fCell2DTextMin->SetToolTip("Draw cell values above N pixels.");
127  fCell2DTextMin->Connect("ValueSet(Double_t)", "TEveCaloLegoEditor", this, "DoCell2DTextMin()");
128  AddFrame(fCell2DTextMin, new TGLayoutHints(kLHintsTop, 1, 2, 1, 2));
129 
130  MakeRebinFrame();
131 }
132 
133 ////////////////////////////////////////////////////////////////////////////////
134 
136 {
138 
139  fAutoRebin = new TGCheckButton(fRebinFrame, "AutoRebin");
141  fAutoRebin->Connect("Toggled(Bool_t)", "TEveCaloLegoEditor", this, "DoAutoRebin()");
142 
143  fNormalizeRebin = new TGCheckButton(fRebinFrame, "NormalizeRebin");
145  fNormalizeRebin->Connect("Toggled(Bool_t)", "TEveCaloLegoEditor", this, "DoNormalize()");
146 
147  fPixelsPerBin = new TEveGValuator(fRebinFrame, "PixelsPerBin:", 90, 0);
151  fPixelsPerBin->Build();
152  fPixelsPerBin->SetLimits(1, 50);
153  fPixelsPerBin->SetToolTip("Number of labels along the Z axis.");
154  fPixelsPerBin->Connect("ValueSet(Double_t)", "TEveCaloLegoEditor", this, "DoPixelsPerBin()");
156 }
157 
158 ////////////////////////////////////////////////////////////////////////////////
159 /// Helper function. Creates TGComboBox with fixed size TGLabel.
160 
162 {
163  UInt_t labelW = 60;
164  UInt_t labelH = 20;
165  TGHorizontalFrame* hf = new TGHorizontalFrame(this);
166  // label
167  TGCompositeFrame *labfr = new TGHorizontalFrame(hf, labelW, labelH, kFixedSize);
168  TGLabel* label = new TGLabel(labfr, name);
169  labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
170  hf->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
171  // combo
172  TGLayoutHints* clh = new TGLayoutHints(kLHintsLeft, 0,0,0,0);
173  TGComboBox* combo = new TGComboBox(hf);
174  combo->Resize(90, 20);
175  hf->AddFrame(combo, clh);
176 
177  AddFrame(hf, new TGLayoutHints(kLHintsTop, 1, 1, 1, off));
178  return combo;
179 }
180 
181 ////////////////////////////////////////////////////////////////////////////////
182 /// Set model object.
183 
185 {
186  fM = dynamic_cast<TEveCaloLego*>(obj);
187 
190 
193 
195 
199 
203 }
204 
205 ////////////////////////////////////////////////////////////////////////////////
206 /// Slot for GridColor.
207 
209 {
211  Update();
212 }
213 
214 ////////////////////////////////////////////////////////////////////////////////
215 /// Slot for FontColor.
216 
218 {
220  Update();
221 }
222 
223 ////////////////////////////////////////////////////////////////////////////////
224 /// Slot for PlaneColor.
225 
227 {
229  Update();
230 }
231 
232 ////////////////////////////////////////////////////////////////////////////////
233 /// Slot for setting limit in pixels in which cell value is rendered.
234 
236 {
238  Update();
239 }
240 
241 
242 ////////////////////////////////////////////////////////////////////////////////
243 /// Slot for projection.
244 
246 {
248  Update();
249 }
250 
251 ////////////////////////////////////////////////////////////////////////////////
252 /// Slot for projection.
253 
255 {
257  Update();
258 }
259 
260 ////////////////////////////////////////////////////////////////////////////////
261 /// Slot for projection.
262 
264 {
266  Update();
267 }
268 
269 ////////////////////////////////////////////////////////////////////////////////
270 /// Slot for Transparency.
271 
273 {
275  Update();
276 }
277 
278 ////////////////////////////////////////////////////////////////////////////////
279 /// Slot for PixelsPerBin.
280 
282 {
284  Update();
285 }
286 
287 ////////////////////////////////////////////////////////////////////////////////
288 
290 {
292  Update();
293 }
294 
295 ////////////////////////////////////////////////////////////////////////////////
296 
298 {
300  Update();
301 }
void SetNormalizeRebin(Bool_t s)
Definition: TEveCalo.h:322
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
Bool_t GetNormalizeRebin() const
Definition: TEveCalo.h:321
virtual void SetValue(Float_t v, Bool_t emit=kFALSE)
Set value, optionally emit signal.
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
Definition: TGaxis.cxx:2551
void SetDrawNumberCellPixels(Int_t x)
Definition: TEveCalo.h:346
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
GUI editor for TEveCaloLego.
E2DMode_e Get2DMode()
Definition: TEveCalo.h:328
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual void SetNumber(Double_t val)
TGComboBox * fProjection
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:41
void SetPixelsPerBin(Int_t bw)
Definition: TEveCalo.h:316
void SetToolTip(const char *tip)
Set the tooltip of the number-entry.
void Set2DMode(E2DMode_e p)
Definition: TEveCalo.h:327
Int_t GetDrawNumberCellPixels()
Definition: TEveCalo.h:345
TGColorSelect * fFontColor
void SetProjection(EProjection_e p)
Definition: TEveCalo.h:325
Composite GUI element for single value selection (supports label, number-entry and slider)...
void SetFontColor(Color_t ci)
Definition: TEveCalo.h:301
TGComboBox * MakeLabeledCombo(const char *name, Int_t off)
Helper function. Creates TGComboBox with fixed size TGLabel.
ULong_t Pixel_t
Definition: GuiTypes.h:39
EProjection_e GetProjection() const
Definition: TEveCalo.h:324
Color_t GetGridColor() const
Definition: TEveCalo.h:303
void DoProjection()
Slot for projection.
TEveGValuator * fPixelsPerBin
TEveCaloLegoEditor(const TEveCaloLegoEditor &)
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:443
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
virtual Bool_t IsOn() const
Definition: TGButton.h:311
TGColorSelect * fGridColor
void DoGridColor(Pixel_t color)
Slot for GridColor.
short Color_t
Definition: RtypesCore.h:79
void DoFontColor(Pixel_t color)
Slot for FontColor.
TGNumberEntry * fTransparency
virtual void SetModel(TObject *obj)
Set model object.
TGVerticalFrame * fRebinFrame
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
TGColorSelect * fPlaneColor
void SetShowSlider(Bool_t s=kTRUE)
TGCheckButton * fAutoRebin
void SetNELength(Int_t l)
Color_t GetPlaneColor() const
Definition: TEveCalo.h:306
void DoPlaneColor(Pixel_t color)
Slot for PlaneColor.
unsigned int UInt_t
Definition: RtypesCore.h:42
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:1758
Color_t GetFontColor() const
Definition: TEveCalo.h:300
Char_t GetPlaneTransparency() const
Definition: TEveCalo.h:309
void SetGridColor(Color_t ci)
Definition: TEveCalo.h:304
void SetPlaneTransparency(Char_t t)
Definition: TEveCalo.h:310
const Bool_t kFALSE
Definition: RtypesCore.h:88
Visualization of calorimeter data as eta/phi histogram.
Definition: TEveCalo.h:249
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:1997
virtual void Build(Bool_t connect=kTRUE)
Create sub-components (label, number entry, slider).
#define ClassImp(name)
Definition: Rtypes.h:359
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:106
void DoTransparency()
Slot for Transparency.
virtual Double_t GetNumber() const
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
void Do2DMode()
Slot for projection.
void SetBoxMode(EBoxMode_e p)
Definition: TEveCalo.h:336
void DoBoxMode()
Slot for projection.
Mother of all ROOT objects.
Definition: TObject.h:37
Bool_t GetAutoRebin() const
Definition: TEveCalo.h:318
char Char_t
Definition: RtypesCore.h:29
Int_t GetPixelsPerBin() const
Definition: TEveCalo.h:315
virtual void SetHeight(UInt_t h)
Definition: TGFrame.h:294
virtual Int_t GetSelected() const
Definition: TGComboBox.h:134
TGNumberEntryField * GetNumberEntry() const
EBoxMode_e GetBoxMode()
Definition: TEveCalo.h:337
void DoCell2DTextMin()
Slot for setting limit in pixels in which cell value is rendered.
void SetPlaneColor(Color_t ci)
Definition: TEveCalo.h:307
void SetLabelWidth(Int_t w)
TGCheckButton * fNormalizeRebin
void SetAutoRebin(Bool_t s)
Definition: TEveCalo.h:319
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.
void DoPixelsPerBin()
Slot for PixelsPerBin.
TEveGValuator * fCell2DTextMin
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
char name[80]
Definition: TGX11.cxx:109
Float_t GetValue() const