gStyle->SetOptFit(1111) having no effect on fixed variables

Dear Colleagues

I’m trying to get the StatBox of my fit to only show me the free parameters. From the documentation I understand that gStyle->SetOptFit(1111) should have that effect as opposed to gStyle->SetOptFit(1112) which would include all the parameters. However, changing SetOptFit in the attached code has no effect.

Can someone please help out?

Regards,
R

test4MVV_alpha_shabason_gwjd.c (14.2 KB)


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.22
Platform: Ubuntu 16.04
Compiler: Not Provided


How should we run you example ?

root [0] .x test4MVV_alpha_shabason_gwjd.c
warning: Failed to call `test4MVV_alpha_shabason_gwjd()` to execute the macro.
Add this function or rename the macro. Falling back to `.L`.

It seems that I uploaded the wrong file by mistake. Apologies. Please find attached the correct one. It should run using the command:

root [0] .L test4MVV_all_alpha_frm.c

followed by main();
test_all_alpha_frm.c (15.1 KB)

I get:

% root 
   ------------------------------------------------------------------
  | Welcome to ROOT 6.23/01                        https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for macosx64 on Aug 31 2020, 07:45:56                      |
  | From heads/master@v6-23-01-1119-gc464388358                      |
  | With Apple clang version 11.0.3 (clang-1103.0.32.62)             |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] .L test_all_alpha_frm.c
root [1] main()
2.02371
0.13141
1.44551

****************************************
Minimizer is Minuit / Migrad
Chi2                      =  5.32892e-09
NDf                       =            6
Edm                       =  6.32887e-11
NCalls                    =           32
p0                        =         3.75                      	 (fixed)
p1                        =      1.44551                      	 (fixed)
p2                        =      1.44696                      	 (fixed)
p3                        =    0.0119393                      	 (fixed)
x_{d}                     =      2.04472   +/-   0.0160719   
a                         =     0.129063   +/-   0.00376591  
(int) 0
root [2] 

what’s wrong ?

Sorry for the late reply. I only realized that this question got feedback today. You ask ‘what’s wrong?’ My understanding is that by setting gStyle->SetOptFit(1111), the variables p0, p1, p2 and p3 would not be visible in the stat box, and yet they nonetheless are.

I works for me.For instance, if in your macro I do:

 gStyle->SetOptFit(1000); 

I get:

I also think it is a bug. The “fixed parameters” should be displayed only if: gStyle->SetOptFit(1112);
Note: It works properly for histograms’ fits.

Here we can read:

  • When “v”=1 is specified, only the non-fixed parameters are shown.
  • When “v”=2 all parameters are shown.
    It seems that in your code p0,p1 etc… are fixed:
****************************************
Minimizer is Minuit / Migrad
Chi2                      =  5.32892e-09
NDf                       =            6
Edm                       =  6.32887e-11
NCalls                    =           32
p0                        =         3.75                      	 (fixed)
p1                        =      1.44551                      	 (fixed)
p2                        =      1.44696                      	 (fixed)
p3                        =    0.0119393                      	 (fixed)
x_{d}                     =      2.04472   +/-   0.0160719   
a                         =     0.129063   +/-   0.00376591  

That’s exactly the problem. The “fixed parameters” should NOT appear in the box if: gStyle->SetOptFit(1111);
Note: It works properly for histograms’ fits.

The PR to fix this issue in on the way: TGraph fit parameters painting by couet · Pull Request #7854 · root-project/root · GitHub
Thanks to have reported it.