Logo ROOT  
Reference Guide
TPaveStatsEditor.cxx
Go to the documentation of this file.
1// @(#)root/ged:$Id$
2// Author: Ilka Antcheva
3
4/*************************************************************************
5 * Copyright (C) 1995-2002, 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
13/** \class TPaveStatsEditor
14 \ingroup ged
15
16Implements GUI for editing attributes of TPaveStats objects.
17 all text attributes
18 The following statistics option settings can be set:
19 name, mean, RMS, overflow, underflow, integral of bins,
20 Fit parameters that can be set are: Values/Names, Probability,
21 Errors, Chisquare
22
23*/
24
25
26#include "TPaveStatsEditor.h"
27#include "TGButton.h"
28#include "TPaveStats.h"
29
31
47};
48
49
50////////////////////////////////////////////////////////////////////////////////
51/// Constructor of TPaveStats GUI.
52
54 UInt_t options, Pixel_t back) :
55 TGedFrame(p, width, height, options | kVerticalFrame, back)
56{
57 fPaveStats = 0;
58
59 MakeTitle("Stat Options");
60
63 f1->AddFrame(f2, new TGLayoutHints(kLHintsTop, 0, 1, 0, 0));
64
65 fHistoName = new TGCheckButton(f2, "Name", kSTAT_NAME);
66 fHistoName->SetToolTipText("Print the histogram name");
67 f2->AddFrame(fHistoName, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
68 fOverflow = new TGCheckButton(f2, "Overflow", kSTAT_OVER);
69 fOverflow->SetToolTipText("Print the number of overflows");
70 f2->AddFrame(fOverflow, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
71 fUnderflow = new TGCheckButton(f2, "Underflow", kSTAT_UNDER);
72 fUnderflow->SetToolTipText("Print the number of underflows");
73 f2->AddFrame(fUnderflow, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
74 fSkewness = new TGCheckButton(f2, "Skewness", kSTAT_SKEWNESS);
75 fSkewness->SetToolTipText("Print the skewness");
76 f2->AddFrame(fSkewness, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
77 fKurtosis = new TGCheckButton(f2, "Kurtosis", kSTAT_KURTOSIS);
78 fKurtosis->SetToolTipText("Print the kurtosis");
79 f2->AddFrame(fKurtosis, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
80
82 fEntries = new TGCheckButton(f3, "Entries", kSTAT_ENTRIES);
83 fEntries->SetToolTipText("Print the number of entries");
84 f3->AddFrame(fEntries, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
85 fMean = new TGCheckButton(f3, "Mean", kSTAT_MEAN);
86 fMean->SetToolTipText("Print the mean value");
87 f3->AddFrame(fMean, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
88 fRMS = new TGCheckButton(f3, "RMS", kSTAT_RMS);
89 fRMS->SetToolTipText("Print root-mean-square (RMS)");
90 f3->AddFrame(fRMS, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
91 fIntegral = new TGCheckButton(f3, "Integral", kSTAT_INTEGRAL);
92 fIntegral->SetToolTipText("Print the integral of bins");
93 f3->AddFrame(fIntegral, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
94 fStatsErrors = new TGCheckButton(f3, "Errors", kSTAT_ERR);
95 fStatsErrors->SetToolTipText("Print the errors");
96 f3->AddFrame(fStatsErrors, new TGLayoutHints(kLHintsTop, 1, 1, 0, 5));
97 f1->AddFrame(f3, new TGLayoutHints(kLHintsTop, 0, 1, 0, 0));
98
99 AddFrame(f1, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
100
101 MakeTitle("Fit Options");
102
103 TGCompositeFrame *f4 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
104 TGCompositeFrame *f5 = new TGCompositeFrame(f4, 40, 20, kVerticalFrame);
105 f4->AddFrame(f5, new TGLayoutHints(kLHintsTop, 0, 1, 0, 0));
106
107 fNameValues = new TGCheckButton(f5, "Values", kFIT_NAME);
108 fNameValues->SetToolTipText("Print the parameter name and value");
109 f5->AddFrame(fNameValues, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
110 fProbability = new TGCheckButton(f5, "Probability", kFIT_PROB);
111 fProbability->SetToolTipText("Print probability");
112 f5->AddFrame(fProbability, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
113
114 TGCompositeFrame *f6 = new TGCompositeFrame(f4, 40, 20, kVerticalFrame);
115 fErrors = new TGCheckButton(f6, "Errors", kFIT_ERR);
116 fErrors->SetToolTipText("Print the errors");
117 f6->AddFrame(fErrors, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
118 fChisquare = new TGCheckButton(f6, "Chi", kFIT_CHI);
119 fChisquare->SetToolTipText("Print Chisquare");
120 f6->AddFrame(fChisquare, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
121 f4->AddFrame(f6, new TGLayoutHints(kLHintsTop, 0, 1, 0, 0));
122
123 AddFrame(f4, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// Destructor of fill editor.
128
130{
131}
132
133////////////////////////////////////////////////////////////////////////////////
134/// Connect signals to slots.
135
137{
138 // about stat options
139 fHistoName->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoStatOptions()");
140 fEntries->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoStatOptions()");
141 fOverflow->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoStatOptions()");
142 fMean->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoStatOptions()");
143 fUnderflow->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoStatOptions()");
144 fRMS->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoStatOptions()");
145 fIntegral->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoStatOptions()");
146 fSkewness->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoStatOptions()");
147 fKurtosis->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoStatOptions()");
148 fStatsErrors->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoStatOptions()");
149
150 // about fit options
151 fNameValues->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoFitOptions()");
152 fErrors->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoFitOptions()");
153 fErrors->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"SetValuesON(Bool_t");
154 fProbability->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoFitOptions()");
155 fChisquare->Connect("Toggled(Bool_t)","TPaveStatsEditor",this,"DoFitOptions()");
156
157 fInit = kFALSE;
158}
159
160////////////////////////////////////////////////////////////////////////////////
161/// Set GUI widgets according to the used TPaveStats attributes.
162
164{
165 fPaveStats = (TPaveStats *)obj;
167
168 Int_t stat = fPaveStats->GetOptStat();
169
170 if (stat % 10) fHistoName->SetState(kButtonDown);
172
173 if (stat/10 % 10) fEntries->SetState(kButtonDown);
175
176 if (stat/100 % 10) fMean->SetState(kButtonDown);
177 else fMean->SetState(kButtonUp);
178
179 if (stat/1000 % 10) fRMS->SetState(kButtonDown);
180 else fRMS->SetState(kButtonUp);
181
182 if (stat/10000 % 10) fUnderflow->SetState(kButtonDown);
184
185 if (stat/100000 % 10) fOverflow->SetState(kButtonDown);
187
188 if (stat/1000000 % 10) fIntegral->SetState(kButtonDown);
190
191 if (stat/10000000 % 10) fSkewness->SetState(kButtonDown);
193
194 if (stat/100000000 % 10) fKurtosis->SetState(kButtonDown);
196
200
201 if (fit/10 % 10) {
204 } else {
206 }
207
208 if (fit/100 % 10) fChisquare->SetState(kButtonDown);
210
211 if (fit/1000 % 10) fProbability->SetState(kButtonDown);
213
215
217}
218
219////////////////////////////////////////////////////////////////////////////////
220/// Slot connected to the stat options.
221
223{
224 if (fAvoidSignal) return;
225 Int_t stat = 0;
226 if (fHistoName->GetState() == kButtonDown) stat +=1;
227 if (fEntries->GetState() == kButtonDown) stat +=10;
228 if (fMean->GetState() == kButtonDown) stat +=100;
229 if (fRMS->GetState() == kButtonDown) stat +=1000;
230 if (fUnderflow->GetState() == kButtonDown) stat +=10000;
231 if (fOverflow->GetState() == kButtonDown) stat +=100000;
232 if (fIntegral->GetState() == kButtonDown) stat +=1000000;
233 if (fSkewness->GetState() == kButtonDown) stat +=10000000;
234 if (fKurtosis->GetState() == kButtonDown) stat +=100000000;
236 if (fMean->GetState() == kButtonDown) stat +=100;
237 if (fRMS->GetState() == kButtonDown) stat +=1000;
238 if (fSkewness->GetState() == kButtonDown) stat +=10000000;
239 if (fKurtosis->GetState() == kButtonDown) stat +=100000000;
240 }
241
242 if (!stat) {
243 stat = 1;
245 }
246 if (stat == 1) stat = 1000000001;
247 fPaveStats->SetOptStat(stat);
248 Update();
249}
250
251////////////////////////////////////////////////////////////////////////////////
252/// Slot connected to the fit options.
253
255{
256 if (fAvoidSignal) return;
257 Int_t fit = 0;
258 if (fNameValues->GetState() == kButtonDown) fit +=1;
259 if (fErrors->GetState() == kButtonDown) fit +=10;
260 if (fChisquare->GetState() == kButtonDown) fit +=100;
261 if (fProbability->GetState() == kButtonDown) fit +=1000;
262
263 if (fit == 1) fit = 10001;
265 Update();
266}
267
268////////////////////////////////////////////////////////////////////////////////
269/// Slot connected to the selection of the button 'Errors':
270/// check button Values should be selected if Errors is selected.
271
273{
274 if (fAvoidSignal) return;
276}
@ kVerticalFrame
Definition: GuiTypes.h:381
@ kHorizontalFrame
Definition: GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassImp(name)
Definition: Rtypes.h:364
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
@ kLHintsTop
Definition: TGLayout.h:27
EPaveStatsWid
@ kSTAT_OVER
@ kSTAT_ENTRIES
@ kFIT_NAME
@ kFIT_ERR
@ kSTAT_MEAN
@ kSTAT_INTEGRAL
@ kSTAT_KURTOSIS
@ kSTAT_ERR
@ kFIT_CHI
@ kSTAT_NAME
@ kSTAT_RMS
@ kSTAT_UNDER
@ kSTAT_SKEWNESS
@ kFIT_PROB
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:445
virtual EButtonState GetState() const
Definition: TGButton.h:112
Selects different options.
Definition: TGButton.h:264
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1250
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1117
TGCompositeFrame(const TGCompositeFrame &)=delete
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
ROOT GUI Window base class.
Definition: TGWindow.h:23
Base frame for implementing GUI - a service class.
Definition: TGedFrame.h:27
Bool_t fInit
init flag for setting signals/slots
Definition: TGedFrame.h:47
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:95
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:72
Bool_t fAvoidSignal
flag for executing slots
Definition: TGedFrame.h:50
Mother of all ROOT objects.
Definition: TObject.h:37
Implements GUI for editing attributes of TPaveStats objects.
TGCheckButton * fUnderflow
underflow number check box
virtual void DoStatOptions()
Slot connected to the stat options.
TGCheckButton * fRMS
RMS check box.
TGCheckButton * fNameValues
parameters' name/values check box
virtual void DoFitOptions()
Slot connected to the fit options.
virtual void SetValuesON(Bool_t on)
Slot connected to the selection of the button 'Errors': check button Values should be selected if Err...
TGCheckButton * fErrors
error check box
TPaveStats * fPaveStats
TPaveStats object.
TGCheckButton * fStatsErrors
statistics error check box
TGCheckButton * fIntegral
integral of bins check box
virtual ~TPaveStatsEditor()
Destructor of fill editor.
TGCheckButton * fChisquare
Chisquare check box.
TGCheckButton * fOverflow
overflow number check box
TPaveStatsEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of TPaveStats GUI.
TGCheckButton * fMean
mean value check box
TGCheckButton * fEntries
entries' number check box
TGCheckButton * fProbability
probability check box
TGCheckButton * fSkewness
skewness check box
virtual void SetModel(TObject *obj)
Set GUI widgets according to the used TPaveStats attributes.
virtual void ConnectSignals2Slots()
Connect signals to slots.
TGCheckButton * fKurtosis
kurtosis check box
TGCheckButton * fHistoName
histo name check box
The histogram statistics painter class.
Definition: TPaveStats.h:18
Int_t GetOptStat() const
Return the stat option.
Definition: TPaveStats.cxx:269
void SetOptStat(Int_t stat=1)
Set the stat option.
Definition: TPaveStats.cxx:306
Int_t GetOptFit() const
Return the fit option.
Definition: TPaveStats.cxx:260
void SetOptFit(Int_t fit=1)
Set the fit option.
Definition: TPaveStats.cxx:297
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:869
TF1 * f1
Definition: legend1.C:11
def fit(model, train_loader, val_loader, num_epochs, batch_size, optimizer, criterion, save_best, scheduler)