Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TEveDigitSetEditor.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 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 "TEveDigitSetEditor.h"
13#include "TEveDigitSet.h"
14
15#include "TEveGValuators.h"
17#include "TEveGedEditor.h"
18
19#include "TVirtualPad.h"
20#include "TH1F.h"
21#include "TStyle.h"
22
23#include "TGLabel.h"
24#include "TG3DLine.h"
25
26/** \class TEveDigitSetEditor
27\ingroup TEve
28Editor for TEveDigitSet class.
29*/
30
31
32////////////////////////////////////////////////////////////////////////////////
33/// Constructor.
34
36 UInt_t options, Pixel_t back) :
37 TGedFrame(p, width, height, options | kVerticalFrame, back),
38 fM (nullptr),
39 fPalette (nullptr),
40
41 fHistoButtFrame(nullptr),
42 fInfoFrame(nullptr)
43{
44 MakeTitle("Palette controls");
45
48 fPalette->Connect("Changed()", "TEveDigitSetEditor", this, "Update()");
49
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Create information tab.
55
57{
59
60 TGCompositeFrame *title1 = new TGCompositeFrame(fInfoFrame, 180, 10,
62 kFitWidth |
65
66 title1->AddFrame(new TGLabel(title1, "TEveDigitSet Info"),
67 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
68 title1->AddFrame(new TGHorizontal3DLine(title1),
69 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
70 fInfoFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
71
72
75 b->SetToolTipText("Show histogram over full range.");
76 fHistoButtFrame->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
77 b->Connect("Clicked()", "TEveDigitSetEditor", this, "DoHisto()");
78
79 b = new TGTextButton(fHistoButtFrame, "Range Histo");
80 b->SetToolTipText("Show histogram over selected range.");
81 fHistoButtFrame->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
82 b->Connect("Clicked()", "TEveDigitSetEditor", this, "DoRangeHisto()");
83 fInfoFrame->AddFrame(fHistoButtFrame, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
84}
85
86////////////////////////////////////////////////////////////////////////////////
87/// Set model object.
88
90{
91 fM = dynamic_cast<TEveDigitSet*>(obj);
92
93 if (fM->fValueIsColor || fM->fPalette == nullptr) {
94 fPalette->UnmapWindow();
95 } else {
96 fPalette->SetModel(fM->fPalette);
97 fPalette->MapWindow();
98 }
99
100 if (fM->fHistoButtons)
101 fHistoButtFrame->MapWindow();
102 else
103 fHistoButtFrame->UnmapWindow();
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Show histogram slot.
108
110{
111 Int_t min, max;
112 if (fM->fPalette) {
113 min = fM->fPalette->GetLowLimit();
114 max = fM->fPalette->GetHighLimit();
115 } else {
116 fM->ScanMinMaxValues(min, max);
117 }
118 PlotHisto(min, max);
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Show ranged histogram slot.
123
125{
126 Int_t min, max;
127 if (fM->fPalette) {
128 min = fM->fPalette->GetMinVal();
129 max = fM->fPalette->GetMaxVal();
130 } else {
131 fM->ScanMinMaxValues(min, max);
132 }
133 PlotHisto(min, max);
134}
135
136////////////////////////////////////////////////////////////////////////////////
137/// Plots a histogram from digit vales with given range.
138
140{
141 Int_t nbins = max-min+1;
142 while (nbins > 200)
143 nbins /= 2;
144
145 TH1F* h = new TH1F(fM->GetName(), fM->GetTitle(), nbins, min-0.5, max+0.5);
146 h->SetDirectory(nullptr);
147 h->SetBit(kCanDelete);
149 while (qi.next())
150 h->Fill(((TEveDigitSet::DigitBase_t*)qi())->fValue);
151
152 gStyle->SetOptStat(1111111);
153 h->Draw();
154 gPad->Modified();
155 gPad->Update();
156}
@ kVerticalFrame
Definition GuiTypes.h:382
@ kFixedWidth
Definition GuiTypes.h:388
@ kFitWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:383
@ kOwnBackground
Definition GuiTypes.h:392
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#define b(i)
Definition RSha256.hxx:100
#define h(i)
Definition RSha256.hxx:106
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
@ kCanDelete
Definition TObject.h:375
externTStyle * gStyle
Definition TStyle.h:442
#define gPad
void PlotHisto(Int_t min, Int_t max)
Plots a histogram from digit vales with given range.
void DoHisto()
Show histogram slot.
void SetModel(TObject *obj) override
Set model object.
TEveDigitSetEditor(const TEveDigitSetEditor &)
TEveRGBAPaletteSubEditor * fPalette
TGHorizontalFrame * fHistoButtFrame
void CreateInfoTab()
Create information tab.
TGVerticalFrame * fInfoFrame
void DoRangeHisto()
Show ranged histogram slot.
Base-class for storage of digit collections; provides transformation matrix (TEveTrans),...
Sub-editor for TEveRGBAPalette class.
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
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
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
Yield an action as soon as it is clicked.
Definition TGButton.h:142
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
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:878
Mother of all ROOT objects.
Definition TObject.h:42
Bool_t next()
Go to next atom.