Re: how to get two fit boxes at a time

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Dec 13 1999 - 15:57:01 MET


Hi Matt,

Matt Dobbs wrote:
> 
> I'm superimposing two TGraphs and performing a fit on each... for some
> reason I can't figure out how to display both fit boxes simultaneously
> (i.e. maybe draw a copy of the first before doing the second fit?).
> 

When the option fit is active (gStyle->SetOptFit(1)) the Fit function
creates a TPaveStats object named "stats". If you want to have more than
one such object in a given pad, simply rename this object to some other
name,
eg "stats1". You can do the following
  TGraph *gr1, *gr2;
  gr1->Fit(...
  TPaveStats *st1 = (TPaveStats*)gPad->GetPrimitive("stats");
  st1->SetName("stats1")
  gr2->fit(..,"same");

> Does someone have a tip or example for this?
> 
> I also had trouble fixing the range along the x-axis for a TGraph
> (Y-axis is easy, but x is more difficult since it treats the graph as
> a histogram with fixed number of bins)... in the end I first plotted a
> dummy graph with points chosen to give the proper range in x, then
> super-imposed the graphs I really wanted. I'm sure there's a much better
> way of doing this -- any suggestion?
> 

We give several examples in the tutorials. look for example
at tutorial gerrors2 or zdemo. They define the pad range and draw the
axis
via TPad::DrawFrame. You can also create an empty TH2F and draw it.
When you draw the graph, do not specify option "A"

Rene Brun

> thanks,
> Matt
> 
> _________________________________________________________________________
>                            Matt   D O B B S
> CERN EP Division, ATLAS Experiment    Office Tel: 41.22.76.71272 (Swiss)
> Office: 40-1-C15, ATLAS Bldg.         Home Tel:  0450 282544    (France)
> Email: Matthew.Adam.Dobbs@Cern.CH     http://wwwhep.phys.uvic.ca/~mdobbs/
> Department of Physics and Astronomy,  University of Victoria, Canada



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:44 MET