Decimal number approximation

Hi,
I’ve a question about the decimal number approximation printed on the TPaveStats after a fit is performed.
For example: suppose you fit a function and you have printed

chi^2/ndf 45.26/49
Prob 0.6254
p0 1.006±0.002609

I would like to know if it is possible to fix the number of digits after the dot. In this case:

chi^2/ndf 45/49
Prob 0.6
p0 1.006±0.003

I hope it is clear.
Thank you in advance.
ziosa

Have you tried this ?
root.cern.ch/root/html/TPaveStat … tFitFormat

Thank you for the reply.
Yes I’ve tried it, but it does not work as I want :frowning:
The print on the screen is ok.

Minimizer is Linear
Chi2 = 45.263
NDf = 49
p0 = 1.006 +/- 0.003

but the box on the Canvas is not (See attachment Ratio.pdf).

If it can help, I attach the macros I’m using (See attachments Compare_ratio.txt (the macro), output_ratio_SlPi_3.txt, output_ratio_Pion_3.txt ).

It is not clear to me what it means 5.4g (5 is not clear, 4 should mean number of digits after dot, and g the format of number (extended(g) vs scientific notation (e)) ?).
The aim is to have for the error the same approximation as the parameter value.

Thank you very much for the attention.
Francesco Romeo
Compare_ratio.txt (8.27 KB)
output_ratio_Pion_3.txt (600 Bytes)
output_ratio_SlPi_3.txt (900 Bytes)
Ratio.pdf (17.2 KB)

Try:

root [0] gStyle->SetFitFormat("3.1g"); // Try with and without this line to see the difference
root [1] gStyle->SetOptFit(11111);
root [2] hpx->Fit("gaus");

the format is the normal printf convention. See for instance: en.wikipedia.org/wiki/Printf

I understand the example, thank you.
But there still is a problem with the Macro.

Hi,

Were you able to resolve your problem?

Philippe.

Can you be more precise ?