ROOT
Version v6.34
master
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
Reference Guide
▼
ROOT
ROOT Reference Documentation
Tutorials
▼
Functional Parts
►
Core ROOT classes
►
std Extension classes
►
Parallelized classes
►
The Geometry Package
►
Graphics
►
Event display with ROOT7
►
GUI
►
Web Widgets
►
Web Display
►
Histogram Library
►
Input/Output Library
►
Math
►
N-D parametric functions
►
VecOps
►
Monte Carlo
►
HTTP server
►
PROOF
►
TMVA
►
RooFit
►
Dataframe
►
ROOT7 classes
►
NTuple-related classes
►
Tree Library
►
TreePlayer Library
▼
Tutorials
▼
Histograms tutorials
candledecay.C
candlehisto.C
candleplot.C
candleplotoption.C
candleplotstack.C
candleplotwhiskers.C
candlescaled.C
ContourList.C
cumulative.C
draw2dopt.C
DynamicSlice.C
exec1.C
exec2.C
Fibonacci.C
fillhistosauto2p.C
fillrandom.C
fillrandom.py
FirstContour.C
greyscale.C
h1ReadAndDraw.C
h2_cut.C
h2proj.C
hbars.C
histpalettecolor.C
hksimple.C
hlabels1.C
hlabels2.C
hlHisto1.C
hlHisto2.C
hlHisto3.C
hlHisto4.C
hstack.C
hstackpads.C
hsum.C
hsumTimer.C
legendautoplaced.C
logscales.C
movepalette.C
multicolor.C
NormalizeHistogram.C
ratioplot1.C
ratioplot1.py
ratioplot2.C
ratioplot2.py
ratioplot3.C
ratioplot3.py
ratioplot4.C
ratioplot4.py
ratioplot5.C
ratioplot5.py
ratioplot6.C
ratioplot6.py
ratioplotOld.C
rebin.C
reverseaxis.C
sparsehist.C
statsEditing.C
testSmooth.C
th2polyBoxes.C
th2polyEurope.C
th2polyHoneycomb.C
th2polyUSA.C
thstack2palettecolor.C
thstackcolorscheme.C
thstackpalettecolor.C
tprofile2polyRealistic.C
tprofile2polyRealisticModuleError.C
transpad.C
twoscales.C
twoscales.py
xyplot.C
ZoomHistogram.C
►
Tree tutorials
►
Dataframe tutorials
►
ROOT 7 tutorials
►
FOAM tutorials
►
Containers tutorials
►
Event display tutorials
►
Event display ROOT7 tutorials
►
Geometry tutorials
►
Fast Fourier Transforms tutorials
►
Fit Tutorials
►
RooFit Tutorials
►
Graphs tutorials
►
Graphics tutorials
►
OpenGL tutorials
►
Tutorials specific to Mac/Cocoa
►
GUI tutorials
►
HistFactory Tutorials
►
HTTP tutorials
►
Image tutorials
►
IO tutorials
►
Math tutorials
►
Matrix tutorials
►
Monte Carlo tutorials
►
Multicore tutorials
►
Net tutorials
►
Physics tutorials
►
PyRoot tutorials
►
Pythia tutorials
►
Quadratic programming package.
►
R tutorials
►
RooStats Tutorials
►
Spectrum tutorials
►
TSPlot tutorials
►
SQL tutorials
►
TMVA tutorials
►
TUnfold tutorials
►
Unuran tutorials
►
VecOps tutorials
►
FITS files interface tutorials
►
XML tutorials
►
Proof tutorials
►
TWebCanvas tutorials
►
Webgui tutorials
►
Legacy tutorials
demos.C
demoshelp.C
hsimple.C
rootlogoff.C
rootlogon.C
►
R Interface for Statistical Computing
►
Namespaces
►
All Classes
►
Files
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
statsEditing.C File Reference
Tutorials
»
Histograms tutorials
Detailed Description
Edit statistics box.
This example shows:
how to remove a stat element from the stat box
how to add a new one
TCanvas
*
statsEditing
() {
// Create and plot a test histogram with stats
TCanvas
*
se
=
new
TCanvas
;
TH1F
*
h
=
new
TH1F
(
"h"
,
"test"
,100,-3,3);
h
->FillRandom(
"gaus"
,3000);
gStyle
->
SetOptStat
();
h
->Draw();
se
->Update();
// Retrieve the stat box
TPaveStats
*ps = (
TPaveStats
*)
se
->GetPrimitive(
"stats"
);
ps->
SetName
(
"mystats"
);
TList
*
listOfLines
= ps->
GetListOfLines
();
// Remove the RMS line
TText
*
tconst
= ps->
GetLineWith
(
"RMS"
);
listOfLines
->Remove(
tconst
);
// Add a new line in the stat box.
// Note that "=" is a control character
TLatex
*
myt
=
new
TLatex
(0,0,
"Test = 10"
);
myt
->SetTextFont(42);
myt
->SetTextSize(0.04);
myt
->SetTextColor(
kRed
);
listOfLines
->Add(
myt
);
// the following line is needed to avoid that the automatic redrawing of stats
h
->SetStats(0);
se
->Modified();
return
se
;
}
h
#define h(i)
Definition
RSha256.hxx:106
kRed
@ kRed
Definition
Rtypes.h:66
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
gStyle
R__EXTERN TStyle * gStyle
Definition
TStyle.h:436
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TH1F
1-D histogram with a float per channel (see TH1 documentation)
Definition
TH1.h:622
TLatex
To draw Mathematical Formula.
Definition
TLatex.h:18
TList
A doubly linked list.
Definition
TList.h:38
TPaveStats
The histogram statistics painter class.
Definition
TPaveStats.h:18
TPaveText::GetListOfLines
virtual TList * GetListOfLines() const
Definition
TPaveText.h:48
TPaveText::GetLineWith
virtual TText * GetLineWith(const char *text) const
Get Pointer to first containing string text in this pavetext.
Definition
TPaveText.cxx:302
TPave::SetName
virtual void SetName(const char *name="")
Definition
TPave.h:79
TStyle::SetOptStat
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition
TStyle.cxx:1640
TText
Base class for several text objects.
Definition
TText.h:22
Author
Olivier Couet
Definition in file
statsEditing.C
.
tutorials
hist
statsEditing.C
ROOT tags/6-34-04 - Reference Guide Generated on Wed Mar 26 2025 04:46:35 (GVA Time) using Doxygen 1.10.0