Re: [ROOT] TH1::Draw, option HIST and fitted functions

From: Gero Flucke (gero.flucke@desy.de)
Date: Thu Feb 26 2004 - 18:28:10 MET


On Thu, 26 Feb 2004, Rene Brun wrote:

> Olivier,
>
> If you want to plot only the fitted function, you get the pointer to the
> function and you draw it. As simple as that. You do not need an option.
> PAW was not able to support more than one fitting function, so the
> analogy is not relevant.
> The same argument applies to any object added to the histogram list of
> functions.
>

Hi Rene,
my original problem is not covered:

1) I have a histogram with (or without) errors.
2) I fit some function to it.
3) I decide whether I want errors to be shown or not and my use
   TH1::SetOption("HIST")
4) I want to draw the histogram with the 'style' (i.e. not to
   show error bars - I don't say 'option' as 'HIST' is an option but
   seems to imply not to draw any functions) previoulsy chosen. As
   ususal attached function should be drawn - if any present.

That are 4 independent steps, but whether I have to do some extra lines of
code in 4) to draw also attached functions or this comes
automatically depends on the fact whether the histogram has errors AND
option HIST or not.

Cheers

	Gero

> On
> Thu, 26 Feb 2004, Olivier Couet wrote:
>
> >
> > Hi,
> >
> >  By default when a 1D histogram contains errors it is plotted with errors
> > bars whatever the plotting option is. This was like that in PAW and this
> > way has been kept in ROOT. The idea was to make sure that the user knows
> > his histogram contains error bars. If, nevertheless, one wants to not show
> > the error bars and activate an other plotting option, the option HIST
> > should be given in addition.
> >
> >  I agree that I found no way to plot only the daughter function (in case
> > of a fit for instance). In PAW the option FUNC was doing that. I tried it
> > in root but it as no effect.
> >
> > test() {
> >    TH1F *histo=new TH1F("aaa","bbb",25,0,100);
> >    for (int i=1; i<26; i++){
> >       histo->SetBinContent(i,i);
> >       histo->SetBinError(i,sqrt(i));
> >    }
> >    histo->Fit("gaus");
> >    histo->Draw("FUNC");
> > }
> >
> > May be that option should be reactivated in the case of 1D histograms. In
> > that case your two points will become:
> >
> >  1) do not draw any error bars (option HIST)
> >  2) draw only the 'daughters', i.e. functions etc. (option FUNC)
> >
> >  Cheers,       O.Couet
> >
> >
> >
> > On Thu, 26 Feb 2004, Gero Flucke wrote:
> >
> > > Hi!
> > > I am hit by the same problem as 'solved' in
> > >
> > > http://root.cern.ch/root/roottalk/roottalk03/4016.html
> > >
> > > but I don't think that this is an appropriate solution in general,
> > > especially in the case where the draw option (TH1::SetOption("HIST")) is
> > > set somewhere in the program, fitting at another place and having a
> > > genaral drawing routine that is responsible for putting hists into several
> > > pads of several canvas  etc.
> > >
> > > I'd expect too different options that are now both 'merged' in option HIST:
> > >
> > > 1) do not draw any error bars
> > > 2) draw the histogram without its 'daughters', i.e. functions etc.
> > >
> > >
> > > Cheers
> > > 	Gero
> > >
> > > PS: Using old 3.05_07, but same in 3.10_02, on linux.
> > >
> > > -----------------------------------------------------------------------
> > > Gero Flucke
> > > 1a / 603
> > > DESY
> > > Notkestr. 85
> > > 22607 Hamburg
> > > +49-(0)40-8998-2454
> > >
> > >
> >
> >
>
>

-----------------------------------------------------------------------
Gero Flucke
1a / 603
DESY
Notkestr. 85
22607 Hamburg
+49-(0)40-8998-2454


Privat / private:
-----------------
Von-Hutten-Str. 20
22761 Hamburg



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET