Home | News | Documentation | Download

Histo plotted with the "same" option dissapear when fitting


#1

Hello,
I have plotted 5 TH1 in test.C
The first I have plotted is the red one (hh). Then I plotted the black TH1 with the option “same”. If I choose to fit the red TH1 (via graphical tool or via command line), the result of the fit is displayed but the other TH1s (hh1, hh2, … in black) disappear.
It is not the cas if I fit one of the black histo (the result of the fit is displayed and no TH1 is removed)
I guess it is a bug which should be fixed.
Thanks in advance

The problem is present in ROOT 5.34/18
test.C (227 KB)


#2

I do not see anything wrong with your macro. Seems to me it does what it should. It does not fit by the way.


#3

Hmmm, sorry to do not have explain very well. My macro works well.
To reproduce what I described, do the following

Zoom around a peak (for example between 500 and 520)
Click right on the red histo and select "FitPanel"
Click on fit to fit the red histo with a Gaussian.
The result of the fit is displayed but meanwhile the other TH1 are removed from the frame.


#4

Ah ok … clear now… I think the Fit command ignore the fact there was other histogram on the plot. I will tell my colleague responsible of the fit panel to look are this.


#5

Hi,

You should use the option “same”, passed as graphics option in TH1::Fit. Do for example

hh->Fit(“gaus”,"",“same”);

However, I see that in the FitPanel, the “Same” draw option does not work. I will fix this bug
Thank you for posting this problem
Lorenzo


#6

Hi, thank you for the answer.
Could we imagine that the “same” option be enabled by default?
It would be nice because it is inconvenient to lose some histos after a fit…


#7

Hi,

You are right. It is better to have the histogram redrawn on the same canvas as before by default. This has been fixed now in both 5.34 and master versions of ROOT

Lorenzo