Re: [ROOT] Question about accessing histos from two different files

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Sep 18 2002 - 14:46:16 MEST


Hi Jyothsna,

I have spent several hours trying to fix this problem, but I must admit
that I am stuck now. I would appreciate the help from a mathematician,
expert in statistics,etc.
The computation of errors when dividing two TProfile is not correct
in the current version of Root. I have added a warning and a message
explaining how to circumvent the problem in the development version.
If you have TProfile *h1, *h2, *h3;
doing h3->Divide(h1,h2);
will not compute correct error bars. To get the right result, project
the TProfile to a normal histogram, then divide the two histograms, eg
  TH1D *p1 = p1->ProjectionX();
  TH1D *p2 = p2->ProjectionX();
  p1->Divide(p2);
Now p1 will have the right error bars.

If somebody is interested to fix the computation of errors in
TProfile::Divide, please let me know.

Rene Brun

On Tue, 17 Sep 2002, Jyothsna Rani wrote:

> 
> Hi,
> 
> I would like to access two profile/ 2D histos from two different files and
> would like to divide them.
> 
> When I use the following code to do that I get a funny plot for sign.  Is
> there a better way of doing it?
> 
> Thanks for any help,
> Jyothsna
> 
> ////////////////////////////////////////////////////////////
> {
> TFile bbh("signal.root");
> TFile qcd("bgd.root");
> 
> TCanvas *c1 = new TCanvas("c1","c1",600,600);
> c1->cd();
> bbh->cd();
> signal_et1cut.Draw();
> 
> TProfile *sig_et1 = (TProfile*)signal_et1cut->Clone();
> 
> TCanvas *c2 = new TCanvas("c2","c2",600,600);
> c2->cd();
> qcd->cd();
> bgd_et1cut.Draw();
> 
> TProfile *bgd_et1 = (TProfile*)bgd_et1cut->Clone();
> 
> TCanvas *c3 = new TCanvas("c3","c3",600,600);
> c3->cd();
> TProfile *sign = new TProfile("sign","",50,0.,95.,0,800);
> sign.Divide(sig_et1,bgd_et1,1.,1.,"B");
> sign.Draw();
> }
>    -------------------------------------------------------------
>         K. Jyothsna Rani,       Phone Number:
>         Tata Institute,                 630-840-3590 (Office)
>         DZero Experiment,               630-840-4236 (Residence)
>         Mail Station : 352,     FAX:
>         P.O.Box : 500,                  630-840-8481
>         Fermilab,               E-mail:
>         Batavia, IL - 60510             jyothsna@fnal.gov
>   ---------------------------------------------------------------
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:10 MET