Removing fitted parameters from stats box

Hi, I have been trying to remove the fixed fitted parameters from the stats box using the SetOptStat(p,c,e,v) option in root. When I set v=1 the fixed parameters still remain in the box. I tried using a different version of root and it seems to work. However I have installed Mac version 5.14 on my laptop and I really need a way of working round this. Any suggestions? Thanks, Caroline.

Can you send a small script showing what you are doing exactly ?

Hi, My program is a bit too long to send!
I set the option gStyle->SetOptFit(1111) in the code so that the fixed parameters can be removed from the box. The last digit should be the one that allows the fixed parameters to be shown or not.


Doing 1111 you show all:
Values, Prob, Errors and Chi
I just checked it works (with the GUI too).

Hi, Yes I also checked out a simple program on the latest version on root and it works fine. The problem is that I have version 5.14 installed on my mac and I guess there is a bug since by setting the option to 1110, I still see all my parameters. I thought there might have been a work round for this, since I do not want to reinstall a new version of root on the mac!

I can dig into the svn history and try to find out what will be the patch to apply to the code, but then will be able apply the patch on the version you have on Mac ? i.e. do ou have the source code there ?

Hi, yes I have here the source code. A patch would be great. Thanks C

Attached is the latest version of THIstPainter::PaintStat. Try to replace it in the file $ROOTSYS/histpainter/src/THistPainter.cxx
THistPainter_PaintStat.cxx (10.3 KB)

Hi, Thanks for download. Unfortunately this hasn’t made any difference. Is there another way of turning off certain parameters in the fit statistics box? Basically I only want to display some parameters.The only other way I can think of is to make a new text box. Although this seems tedious especially since all the values are given in the stats box.

Cheers, C.

No, the only way is to use SetStat. May be some other file need also to be change. As I cannot see the problem it is difficult for me to tell what should be changed. May be you should take the complete THistPainter there: … x?view=log … h?view=log

Hi, To try and provide a bit more information, I have a function that has 11 parameters.

Double_t encfunlinexp(Double_t *x, Double_t *par){
Double_t bias=x[0];
Double_t length = par[0];
Double_t dep = par[1];
Double_t Thybrid = par[2];
Double_t files=par[3];
Double_t WhatToReturn=par[4];
Double_t a=par[5];
Double_t b=par[6];
Double_t c=par[7];
Double_t d=par[8];
Double_t C0=par[9];
Double_t Beta0=par[10];
When the SetOptStat is set to one, the statistics box puts the values and errors of each of these parameters. I only want to select some of the parameters. For example, par[0], par[3], par[4] are not inportant so i do not want to display them.

I have looked into the SetOptFit options but I don’t see it as an option to only display some parameters.

ANy ideas? Thanks, C.

I think the example given is this post answers your question:

Hi, This is the piece of code that I am using inside a macro in order to display the fitted parameters in the statistics box:

TPaveStats st = (TPaveStats)tge->FindObject(“stats”);
TList *list = st->GetListOfLines();
TText *p1 = st->GetLineWith(“dep_vol”);


Note that tge is a TGraphErrors object.

the st->Print() shows the list without the “dep_vol” line

However when tge->Draw() although the stat box is now called “myStats” the line “dep_vol” is still there.

What should I do now?

Thanks, C.

It would nice if you can provide me a small running macro showing the problem.


Attached is a small macro with a simple example of a T graph errors plus function. I try and delete p0 from the statistics box. When I print it out in the root terminal, the line in deleted, but the statistics box does not update with the changes.

Thanks very much, C.
tf.cpp (73 Bytes)
pr.C (608 Bytes)

I think it does not work as it was explained in the post I mentionned because you are using a TGrapErrors whereas the other example uses a TH1. I am trying to find a solution.

The TPaveStats containing the fit parameters is always recomputed for the graphs. There is no function like the SetStats() for the histograms. That’s why you cannot remove or add a parameter in the fit box. It will always be recomputed according to the value you gave to SetOptFit.

1 Like