Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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
24GUI editor for TEveCaloLego.
25*/
26
27
28////////////////////////////////////////////////////////////////////////////////
29/// Constructor.
30
32 UInt_t options, Pixel_t back) :
33 TGedFrame(p, width, height, options | kVerticalFrame, back),
34 fM(nullptr),
35 fGridColor(nullptr),
36 fFontColor(nullptr),
37 fPlaneColor(nullptr),
38 fTransparency(nullptr),
39
40 fProjection(nullptr),
41 f2DMode(nullptr),
42 fBoxMode(nullptr),
43
44 fCell2DTextMin(nullptr),
45
46 fRebinFrame(nullptr),
47 fAutoRebin(nullptr),
48 fPixelsPerBin(nullptr),
49 fNormalizeRebin(nullptr)
50
51{
52 MakeTitle("TEveCaloLego");
53
54 { // grid color
56 TGLabel* lab = new TGLabel(f, "GridColor:");
57 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 10, 1, 1));
58
59 fGridColor = new TGColorSelect(f, 0, -1);
60 f->AddFrame(fGridColor, new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
61 fGridColor->Connect("ColorSelected(Pixel_t)", "TEveCaloLegoEditor", this, "DoGridColor(Pixel_t)");
62
63 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
64 }
65 // axis
66 {
67 // font color
69 TGLabel* lab = new TGLabel(f, "FontColor:");
70 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 8, 1, 1));
71
72 fFontColor = new TGColorSelect(f, 0, -1);
73 f->AddFrame(fFontColor, new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
74 fFontColor->Connect("ColorSelected(Pixel_t)", "TEveCaloLegoEditor", this, "DoFontColor(Pixel_t)");
75
76 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
77 }
78 {
79 // plane color
81 TGLabel* lab = new TGLabel(f, "PlaneColor:");
82 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
83
84 fPlaneColor = new TGColorSelect(f, 0, -1);
85 f->AddFrame(fPlaneColor, new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
86 fPlaneColor->Connect("ColorSelected(Pixel_t)", "TEveCaloLegoEditor", this, "DoPlaneColor(Pixel_t)");
87
88 fTransparency = new TGNumberEntry(f, 0., 2, -1,
91 fTransparency->SetHeight(18);
92 fTransparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
93 f->AddFrame(fTransparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
94 fTransparency->Connect("ValueSet(Long_t)","TEveCaloLegoEditor", this, "DoTransparency()");
95
96 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
97 }
98
99 Int_t lw = 80;
100
101 fProjection = MakeLabeledCombo("Project:", 1);
102 fProjection->AddEntry("Auto", TEveCaloLego::kAuto);
103 fProjection->AddEntry("3D", TEveCaloLego::k3D);
104 fProjection->AddEntry("2D", TEveCaloLego::k2D);
105 fProjection->Connect("Selected(Int_t)", "TEveCaloLegoEditor", this, "DoProjection()");
106
107 f2DMode = MakeLabeledCombo("2DMode:", 4);
108 f2DMode->AddEntry("ValColor", TEveCaloLego::kValColor);
109 f2DMode->AddEntry("ValSize", TEveCaloLego::kValSize);
110 f2DMode->AddEntry("ValSizeOutline", TEveCaloLego::kValSizeOutline);
111 f2DMode->Connect("Selected(Int_t)", "TEveCaloLegoEditor", this, "Do2DMode()");
112
113 fBoxMode = MakeLabeledCombo("Box:", 4);
114 fBoxMode->AddEntry("None", TEveCaloLego::kNone);
115 fBoxMode->AddEntry("Back", TEveCaloLego::kBack);
116 fBoxMode->AddEntry("FrontBack", TEveCaloLego::kFrontBack);
117 fBoxMode->Connect("Selected(Int_t)", "TEveCaloLegoEditor", this, "DoBoxMode()");
118
119 fCell2DTextMin = new TEveGValuator(this, "Cell2DTexMin:", 90, 0);
120 fCell2DTextMin->SetLabelWidth(lw);
121 fCell2DTextMin->SetNELength(5);
122 fCell2DTextMin->SetShowSlider(kFALSE);
123 fCell2DTextMin->Build();
124 fCell2DTextMin->SetLimits(1, 1000);
125 fCell2DTextMin->SetToolTip("Draw cell values above N pixels.");
126 fCell2DTextMin->Connect("ValueSet(Double_t)", "TEveCaloLegoEditor", this, "DoCell2DTextMin()");
128
130}
131
132////////////////////////////////////////////////////////////////////////////////
133
135{
137
138 fAutoRebin = new TGCheckButton(fRebinFrame, "AutoRebin");
139 fRebinFrame->AddFrame(fAutoRebin, new TGLayoutHints(kLHintsLeft, 3, 5, 3, 0));
140 fAutoRebin->Connect("Toggled(Bool_t)", "TEveCaloLegoEditor", this, "DoAutoRebin()");
141
142 fNormalizeRebin = new TGCheckButton(fRebinFrame, "NormalizeRebin");
143 fRebinFrame->AddFrame(fNormalizeRebin, new TGLayoutHints(kLHintsLeft, 3, 5, 3, 0));
144 fNormalizeRebin->Connect("Toggled(Bool_t)", "TEveCaloLegoEditor", this, "DoNormalize()");
145
146 fPixelsPerBin = new TEveGValuator(fRebinFrame, "PixelsPerBin:", 90, 0);
147 fPixelsPerBin->SetLabelWidth(80);
148 fPixelsPerBin->SetNELength(5);
149 fPixelsPerBin->SetShowSlider(kFALSE);
150 fPixelsPerBin->Build();
151 fPixelsPerBin->SetLimits(1, 50);
152 fPixelsPerBin->SetToolTip("Number of labels along the Z axis.");
153 fPixelsPerBin->Connect("ValueSet(Double_t)", "TEveCaloLegoEditor", this, "DoPixelsPerBin()");
154 fRebinFrame->AddFrame(fPixelsPerBin, new TGLayoutHints(kLHintsTop, 4, 2, 1, 2));
155}
156
157////////////////////////////////////////////////////////////////////////////////
158/// Helper function. Creates TGComboBox with fixed size TGLabel.
159
161{
162 UInt_t labelW = 60;
163 UInt_t labelH = 20;
164 TGHorizontalFrame* hf = new TGHorizontalFrame(this);
165 // label
166 TGCompositeFrame *labfr = new TGHorizontalFrame(hf, labelW, labelH, kFixedSize);
167 TGLabel* label = new TGLabel(labfr, name);
168 labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
169 hf->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
170 // combo
171 TGLayoutHints* clh = new TGLayoutHints(kLHintsLeft, 0,0,0,0);
172 TGComboBox* combo = new TGComboBox(hf);
173 combo->Resize(90, 20);
174 hf->AddFrame(combo, clh);
175
176 AddFrame(hf, new TGLayoutHints(kLHintsTop, 1, 1, 1, off));
177 return combo;
178}
179
180////////////////////////////////////////////////////////////////////////////////
181/// Set model object.
182
184{
185 fM = dynamic_cast<TEveCaloLego*>(obj);
186
187 fGridColor->SetColor(TColor::Number2Pixel(fM->GetGridColor() < 0 ? 0 : fM->GetGridColor()), kFALSE);
188 fFontColor->SetColor(TColor::Number2Pixel(fM->GetFontColor() < 0 ? 0 : fM->GetFontColor()), kFALSE);
189
190 fPlaneColor->SetColor(TColor::Number2Pixel(fM->GetPlaneColor()), kFALSE);
191 fTransparency->SetNumber(fM->GetPlaneTransparency());
192
193 fCell2DTextMin->SetValue(fM->GetDrawNumberCellPixels());
194
195 fProjection->Select(fM->GetProjection(), kFALSE);
196 f2DMode->Select(fM->Get2DMode(), kFALSE);
197 fBoxMode->Select(fM->GetBoxMode(), kFALSE);
198
199 fPixelsPerBin->SetValue(fM->GetPixelsPerBin());
200 fAutoRebin->SetState(fM->GetAutoRebin() ? kButtonDown : kButtonUp);
201 fNormalizeRebin->SetState(fM->GetNormalizeRebin() ? kButtonDown : kButtonUp);
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// Slot for GridColor.
206
208{
209 fM->SetGridColor(Color_t(TColor::GetColor(pixel)));
210 Update();
211}
212
213////////////////////////////////////////////////////////////////////////////////
214/// Slot for FontColor.
215
217{
218 fM->SetFontColor(Color_t(TColor::GetColor(pixel)));
219 Update();
220}
221
222////////////////////////////////////////////////////////////////////////////////
223/// Slot for PlaneColor.
224
226{
227 fM->SetPlaneColor(Color_t(TColor::GetColor(pixel)));
228 Update();
229}
230
231////////////////////////////////////////////////////////////////////////////////
232/// Slot for setting limit in pixels in which cell value is rendered.
233
235{
236 fM->SetDrawNumberCellPixels((Int_t)fCell2DTextMin->GetValue());
237 Update();
238}
239
240
241////////////////////////////////////////////////////////////////////////////////
242/// Slot for projection.
243
245{
246 fM->SetProjection((TEveCaloLego::EProjection_e)fProjection->GetSelected());
247 Update();
248}
249
250////////////////////////////////////////////////////////////////////////////////
251/// Slot for projection.
252
254{
255 fM->Set2DMode((TEveCaloLego::E2DMode_e)f2DMode->GetSelected());
256 Update();
257}
258
259////////////////////////////////////////////////////////////////////////////////
260/// Slot for projection.
261
263{
264 fM->SetBoxMode((TEveCaloLego::EBoxMode_e)fBoxMode->GetSelected());
265 Update();
266}
267
268////////////////////////////////////////////////////////////////////////////////
269/// Slot for Transparency.
270
272{
273 fM->SetPlaneTransparency((Char_t)(fTransparency->GetNumber()));
274 Update();
275}
276
277////////////////////////////////////////////////////////////////////////////////
278/// Slot for PixelsPerBin.
279
281{
282 fM->SetPixelsPerBin((Int_t)fPixelsPerBin->GetValue());
283 Update();
284}
285
286////////////////////////////////////////////////////////////////////////////////
287
289{
290 fM->SetAutoRebin(fAutoRebin->IsOn());
291 Update();
292}
293
294////////////////////////////////////////////////////////////////////////////////
295
297{
298 fM->SetNormalizeRebin(fNormalizeRebin->IsOn());
299 Update();
300}
@ kVerticalFrame
Definition GuiTypes.h:382
@ kFixedSize
Definition GuiTypes.h:391
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#define f(i)
Definition RSha256.hxx:104
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
char Char_t
Character 1 byte (char).
Definition RtypesCore.h:51
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
short Color_t
Color number (short).
Definition RtypesCore.h:99
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
char name[80]
Definition TGX11.cxx:148
static Int_t GetColor(const char *hexcolor)
static ULong_t Number2Pixel(Int_t ci)
TGCheckButton * fAutoRebin
TGVerticalFrame * fRebinFrame
TEveCaloLegoEditor(const TEveCaloLegoEditor &)
TGColorSelect * fPlaneColor
TGNumberEntry * fTransparency
void DoProjection()
Slot for projection.
TEveGValuator * fCell2DTextMin
TGCheckButton * fNormalizeRebin
void DoBoxMode()
Slot for projection.
void DoFontColor(Pixel_t color)
Slot for FontColor.
void Do2DMode()
Slot for projection.
void SetModel(TObject *obj) override
Set model object.
void DoTransparency()
Slot for Transparency.
TGColorSelect * fFontColor
void DoCell2DTextMin()
Slot for setting limit in pixels in which cell value is rendered.
TEveGValuator * fPixelsPerBin
void DoGridColor(Pixel_t color)
Slot for GridColor.
void DoPlaneColor(Pixel_t color)
Slot for PlaneColor.
void DoPixelsPerBin()
Slot for PixelsPerBin.
TGColorSelect * fGridColor
TGComboBox * MakeLabeledCombo(const char *name, Int_t off)
Helper function. Creates TGComboBox with fixed size TGLabel.
Visualization of calorimeter data as eta/phi histogram.
Definition TEveCalo.h:251
Composite GUI element for single value selection (supports label, number-entry and slider).
Selects different options.
Definition TGButton.h:264
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
TGCompositeFrame(const TGCompositeFrame &)=delete
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
This class handles GUI labels.
Definition TGLabel.h:24
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.
@ kNEANonNegative
Non-negative number.
@ kNESInteger
Style of number entry field.
@ kNELLimitMinMax
Both lower and upper limits.
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
TGedFrame(const TGedFrame &)=delete
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
Mother of all ROOT objects.
Definition TObject.h:42