Bug in TTree::Project() ?

From: Dmitry Onoprienko (onoprien@SLAC.stanford.edu)
Date: Wed Feb 03 1999 - 00:20:38 MET


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;

}



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