Re: Bug in TTree::Project() ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Feb 03 1999 - 09:26:09 MET


Dmitry Onoprienko wrote:
> 
> When I use TTree::Project() function to fill a TH2F histogram, some data
> members
> (fTsumwy, fTsumwy2, fTsumwxy) are not calculated. As a result, some public
> functions (GetRMS(), GetCorrelationFactor(), ...) produce incorrect results.
> Using Draw() instead of Project() allows to avoid the problem.
> 
> I'm running ROOT under Windows.  Here is a test macro :
> 
> {
> #include <iostream.h>
> 
>   c1 = new TCanvas("c1","Ntuple projection test",500,500);
> 
>   TFile *f = new TFile("test.root", "RECREATE");
> 
>   TNtuple *nt = new TNtuple("nt","test","x:y");
>   TH2F *h = new TH2F("h","htitle",100,-4.,4.,100,-4.,4.);
> 
>   Float_t x,y;
>   Int_t event = 500;
>   TRandom rn = new TRandom();
>   while (event-->0) {
>     nt->Fill(rn.Gaus(),rn.Gaus());
>   }
>   f->Write();
> 
>   nt->Project("h","x:y");
>   h->Draw();
>   c1->Update();
>   cerr << "Now check statistics for the displayed histogram\n";
>   cerr << "Mean and RMS along Y are zero, also\n";
>   cerr << "h->GetCorrelationFactor() gives " << h->GetCorrelationFactor()
> <<endl;
> 
> }

Hi Dmitry,
Statistics for 2-d histograms were not filled by TTree::Draw.
I have fixed this problem in version 2.21/04
Thanks for reporting this problem.

Rene Brun



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