gStyle->SetOptStat(mode);The "mode" has up to nine digits that can be set to on(1 or 2), off(0).
mode = iourmen (default = 000001111) k = 1; kurtosis printed k = 2; kurtosis and kurtosis error printed s = 1; skewness printed s = 2; skewness and skewness error printed i = 1; integral of bins printed o = 1; number of overflows printed u = 1; number of underflows printed r = 1; rms printed r = 2; rms and rms error printed m = 1; mean value printed m = 2; mean and mean error values printed e = 1; number of entries printed n = 1; name of histogram is printedFor example:
gStyle->SetOptStat(11);displays only the name of histogram and the number of entries, whereas:
gStyle->SetOptStat(1101);displays the name of histogram, mean value and RMS.
WARNING 1: never do:
but instead do:gStyle->SetOptStat(000111);
gStyle->SetOptStat(1111);because 0001111 will be taken as an octal number!
WARNING 2: for backward compatibility with older versions
gStyle->SetOptStat(1);is taken as:
gStyle->SetOptStat(1111)To print only the name of the histogram do:
gStyle->SetOptStat(1000000001);NOTE that in case of 2D histograms, when selecting only underflow (10000) or overflow (100000), the statistics box will show all combinations of underflow/overflows and not just one single number.
The parameter mode can be any combination of the letters kKsSiourRmMen
k : kurtosis printed K : kurtosis and kurtosis error printed s : skewness printed S : skewness and skewness error printed i : integral of bins printed o : number of overflows printed u : number of underflows printed r : rms printed R : rms and rms error printed m : mean value printed M : mean value mean error values printed e : number of entries printed n : name of histogram is printedFor example, to print only name of histogram and number of entries do:
gStyle->SetOptStat("ne");To print only the name of the histogram do:
gStyle->SetOptStat("n");The default value is:
gStyle->SetOptStat("nemr");
When a histogram is painted, a TPaveStats object is created and added to the list of functions of the histogram. If a TPaveStats object already exists in the histogram list of functions, the existing object is just updated with the current histogram parameters.
Once a histogram is painted, the statistics box can be accessed using h->FindObject("stats"). In the command line it is enough to do:
Root > h->Draw() Root > TPaveStats *st = (TPaveStats*)h->FindObject("stats")because after h->Draw() the histogram is automatically painted. But in a script file the painting should be forced using gPad->Update() in order to make sure the statistics box is created:
h->Draw(); gPad->Update(); TPaveStats *st = (TPaveStats*)h->FindObject("stats");
Without gPad->Update() the line h->FindObject("stats") returns a null pointer.
When a histogram is drawn with the option "SAME", the statistics box is not drawn. To force the statistics box drawing with the option "SAME", the option "SAMES" must be used. If the new statistics box hides the previous statistics box, one can change its position with these lines ("h" being the pointer to the histogram):
Root > TPaveStats *st = (TPaveStats*)h->FindObject("stats") Root > st->SetX1NDC(newx1); //new x start position Root > st->SetX2NDC(newx2); //new x end positionTo change the type of information for an histogram with an existing TPaveStats one should do:
st->SetOptStat(mode);Where "mode" has the same meaning than when calling gStyle->SetOptStat(mode) (see above).
One can delete the statistics box for a histogram TH1* h with:
h->SetStats(0)and activate it again with:
h->SetStats(1).
p = 1; print Probability c = 1; print Chisquare/Number of degrees of freedom e = 1; print errors (if e=1, v must be 1) v = 1; print name/values of parametersExample:
gStyle->SetOptFit(1011);print fit probability, parameter names/values and errors.
TPaveStats() | |
TPaveStats(const TPaveStats&) | |
TPaveStats(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t* option = "br") | |
virtual | ~TPaveStats() |
void | TObject::AbstractMethod(const char* method) const |
virtual TBox* | AddBox(Double_t, Double_t, Double_t, Double_t) |
virtual TLine* | AddLine(Double_t, Double_t, Double_t, Double_t) |
virtual TText* | TPaveText::AddText(const char* label) |
virtual TText* | TPaveText::AddText(Double_t x1, Double_t y1, const char* label) |
virtual void | TObject::AppendPad(Option_t* option = "") |
virtual void | TObject::Browse(TBrowser* b) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TPaveText::Clear(Option_t* option = "")MENU |
virtual TObject* | TObject::Clone(const char* newname = "") const |
virtual Int_t | TObject::Compare(const TObject* obj) const |
virtual void | TPave::ConvertNDCtoPad() |
virtual void | TPave::Copy(TObject& pave) const |
virtual void | TObject::Delete(Option_t* option = "")MENU |
virtual void | DeleteText() |
Int_t | TAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2) |
virtual Int_t | TPave::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TPaveText::Draw(Option_t* option = "") |
virtual TBox* | TBox::DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TPaveText::DrawFile(const char* filename, Option_t* option = "") |
virtual void | TPave::DrawPave(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize = 4, Option_t* option = "br") |
virtual void | TObject::Dump() constMENU |
virtual void | EditText() |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TPave::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
Int_t | TPave::GetBorderSize() const |
Double_t | TPave::GetCornerRadius() const |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
virtual Color_t | TAttFill::GetFillColor() const |
virtual Style_t | TAttFill::GetFillStyle() const |
virtual const char* | GetFitFormat() const |
virtual const char* | TObject::GetIconName() const |
const char* | TPaveText::GetLabel() const |
virtual TText* | TPaveText::GetLine(Int_t number) const |
virtual Color_t | TAttLine::GetLineColor() const |
virtual Style_t | TAttLine::GetLineStyle() const |
virtual Width_t | TAttLine::GetLineWidth() const |
virtual TText* | TPaveText::GetLineWith(const char* text) const |
virtual TList* | TPaveText::GetListOfLines() const |
Float_t | TPaveText::GetMargin() const |
virtual Option_t* | TPave::GetName() const |
virtual TObject* | TPaveText::GetObject(Double_t& ymouse, Double_t& yobj) const |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
Int_t | GetOptFit() const |
virtual Option_t* | TPave::GetOption() const |
Int_t | GetOptStat() const |
TObject* | GetParent() const |
Int_t | TPave::GetShadowColor() const |
virtual Int_t | TPaveText::GetSize() const |
virtual const char* | GetStatFormat() const |
virtual Short_t | TAttText::GetTextAlign() const |
virtual Float_t | TAttText::GetTextAngle() const |
virtual Color_t | TAttText::GetTextColor() const |
virtual Font_t | TAttText::GetTextFont() const |
virtual Float_t | TAttText::GetTextSize() const |
virtual const char* | TObject::GetTitle() const |
virtual UInt_t | TObject::GetUniqueID() const |
Double_t | TBox::GetX1() const |
Double_t | TPave::GetX1NDC() const |
Double_t | TBox::GetX2() const |
Double_t | TPave::GetX2NDC() const |
Double_t | TBox::GetY1() const |
Double_t | TPave::GetY1NDC() const |
Double_t | TBox::GetY2() const |
Double_t | TPave::GetY2NDC() const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TPave::Hash() const |
virtual void | TBox::HideToolTip(Int_t event) |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | InsertLine() |
virtual void | InsertText(const char*) |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
Bool_t | TBox::IsBeingResized() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
virtual Int_t | TBox::IsInside(Double_t x, Double_t y) const |
Bool_t | TObject::IsOnHeap() const |
virtual Bool_t | TPave::IsSortable() const |
virtual Bool_t | TAttFill::IsTransparent() const |
Bool_t | TObject::IsZombie() const |
virtual void | TPave::ls(Option_t* option = "") const |
void | TObject::MayNotUse(const char* method) const |
virtual void | TAttLine::Modify() |
virtual Bool_t | TObject::Notify() |
static void | TObject::operator delete(void* ptr) |
static void | TObject::operator delete(void* ptr, void* vp) |
static void | TObject::operator delete[](void* ptr) |
static void | TObject::operator delete[](void* ptr, void* vp) |
void* | TObject::operator new(size_t sz) |
void* | TObject::operator new(size_t sz, void* vp) |
void* | TObject::operator new[](size_t sz) |
void* | TObject::operator new[](size_t sz, void* vp) |
TPaveStats& | operator=(const TPaveStats&) |
virtual void | Paint(Option_t* option = "") |
virtual void | TBox::PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t* option = "") |
virtual void | TPave::PaintPave(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize = 4, Option_t* option = "br") |
virtual void | TPave::PaintPaveArc(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize = 4, Option_t* option = "br") |
virtual void | TPaveText::PaintPrimitives(Int_t mode) |
virtual void | TObject::Pop() |
virtual void | TPaveText::Print(Option_t* option = "") const |
virtual Int_t | TObject::Read(const char* name) |
virtual void | ReadFile(const char*, Option_t*, Int_t, Int_t) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
virtual void | TAttFill::ResetAttFill(Option_t* option = "") |
virtual void | TAttLine::ResetAttLine(Option_t* option = "") |
virtual void | TAttText::ResetAttText(Option_t* toption = "") |
void | TObject::ResetBit(UInt_t f) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | TAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001) |
virtual void | TAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1) |
virtual void | TPaveText::SaveLines(ostream& out, const char* name) |
virtual void | SavePrimitive(ostream& out, Option_t* option = "") |
virtual void | SaveStyle()MENU |
virtual void | TAttText::SaveTextAttributes(ostream& out, const char* name, Int_t alidef = 12, Float_t angdef = 0, Int_t coldef = 1, Int_t fondef = 61, Float_t sizdef = 1) |
virtual void | SetAllWith(const char*, Option_t*, Double_t) |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual void | TPave::SetBorderSize(Int_t bordersize = 4)MENU |
virtual void | TPave::SetCornerRadius(Double_t rad = 0.2)MENU |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
virtual void | TAttFill::SetFillAttributes()MENU |
virtual void | TAttFill::SetFillColor(Color_t fcolor) |
virtual void | TAttFill::SetFillStyle(Style_t fstyle) |
virtual void | SetFitFormat(const char* format = "5.4g")MENU |
virtual void | TPaveText::SetLabel(const char* label)MENU |
virtual void | TAttLine::SetLineAttributes()MENU |
virtual void | TAttLine::SetLineColor(Color_t lcolor) |
virtual void | TAttLine::SetLineStyle(Style_t lstyle) |
virtual void | TAttLine::SetLineWidth(Width_t lwidth) |
virtual void | SetMargin(Float_t) |
virtual void | TPave::SetName(const char* name = "")MENU |
static void | TObject::SetObjectStat(Bool_t stat) |
void | SetOptFit(Int_t fit = 1)MENU |
virtual void | TPave::SetOption(Option_t* option = "br") |
void | SetOptStat(Int_t stat = 1)MENU |
void | SetParent(TObject* obj) |
virtual void | TPave::SetShadowColor(Int_t color)MENU |
virtual void | SetStatFormat(const char* format = "6.4g")MENU |
virtual void | TAttText::SetTextAlign(Short_t align = 11) |
virtual void | TAttText::SetTextAngle(Float_t tangle = 0)MENU |
virtual void | TAttText::SetTextAttributes()MENU |
virtual void | TAttText::SetTextColor(Color_t tcolor = 1) |
virtual void | TAttText::SetTextFont(Font_t tfont = 62) |
virtual void | TAttText::SetTextSize(Float_t tsize = 1) |
virtual void | TAttText::SetTextSizePixels(Int_t npixels) |
virtual void | TBox::SetToolTipText(const char* text, Long_t delayms = 1000) |
virtual void | TObject::SetUniqueID(UInt_t uid) |
virtual void | TBox::SetX1(Double_t x1) |
virtual void | TPave::SetX1NDC(Double_t x1) |
virtual void | TBox::SetX2(Double_t x2) |
virtual void | TPave::SetX2NDC(Double_t x2) |
virtual void | TBox::SetY1(Double_t y1) |
virtual void | TPave::SetY1NDC(Double_t y1) |
virtual void | TBox::SetY2(Double_t y2) |
virtual void | TPave::SetY2NDC(Double_t y2) |
virtual void | ShowMembers(TMemberInspector& insp) |
virtual void | Streamer(TBuffer& b) |
void | StreamerNVirtual(TBuffer& b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
virtual void | UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
void | TObject::MakeZombie() |
enum TPave::[unnamed] { | kNameIsAction | |
}; | ||
enum TBox::[unnamed] { | kCannotMove | |
}; | ||
enum TObject::EStatusBits { | kCanDelete | |
kMustCleanup | ||
kObjInCanvas | ||
kIsReferenced | ||
kHasUUID | ||
kCannotPick | ||
kNoContextMenu | ||
kInvalidObject | ||
}; | ||
enum TObject::[unnamed] { | kIsOnHeap | |
kNotDeleted | ||
kZombie | ||
kBitMask | ||
kSingleKey | ||
kOverwrite | ||
kWriteDelete | ||
}; |
Int_t | TPave::fBorderSize | window box bordersize in pixels |
Double_t | TPave::fCornerRadius | Corner radius in case of option arc |
Color_t | TAttFill::fFillColor | fill area color |
Style_t | TAttFill::fFillStyle | fill area style |
TString | fFitFormat | Printing format for fit parameters |
Int_t | TPave::fInit | (=0 if transformation to NDC not yet done) |
TString | TPaveText::fLabel | Label written at the top of the pavetext |
Color_t | TAttLine::fLineColor | line color |
Style_t | TAttLine::fLineStyle | line style |
Width_t | TAttLine::fLineWidth | line width |
TList* | TPaveText::fLines | List of labels |
Int_t | TPaveText::fLongest | Length of the longest line |
Float_t | TPaveText::fMargin | Text margin |
TString | TPave::fName | Pave name |
Int_t | fOptFit | option Fit |
Int_t | fOptStat | option Stat |
TString | TPave::fOption | Pave style |
TObject* | fParent | owner of this TPaveStats |
Bool_t | TBox::fResizing | !True if box is being resized |
Int_t | TPave::fShadowColor | Color of the pave's shadow |
TString | fStatFormat | Printing format for stats |
Short_t | TAttText::fTextAlign | Text alignment |
Float_t | TAttText::fTextAngle | Text angle |
Color_t | TAttText::fTextColor | Text color index |
Font_t | TAttText::fTextFont | Text font number |
Float_t | TAttText::fTextSize | Text size |
Double_t | TBox::fX1 | X of 1st point |
Double_t | TPave::fX1NDC | X1 point in NDC coordinates |
Double_t | TBox::fX2 | X of 2nd point |
Double_t | TPave::fX2NDC | X2 point in NDC coordinates |
Double_t | TBox::fY1 | Y of 1st point |
Double_t | TPave::fY1NDC | Y1 point in NDC coordinates |
Double_t | TBox::fY2 | Y of 2nd point |
Double_t | TPave::fY2NDC | Y2 point in NDC coordinates |
TPaveStats normal constructor.
Change (i.e. set) the format for printing fit parameters in statistics box.
Change (i.e. set) the format for printing statistics.
Save primitive as a C++ statement(s) on output stream out.