[ROOT] drawing form empty tree and ntuple with one variable

From: Miroslav Helbich (helbich@mail.desy.de)
Date: Sat Dec 16 2000 - 18:47:41 MET


Hi,

 I think this two features should be changed.

1; when creating a TNtuple object with only one variable it gives me
error in filling time. It works fine with more variables.

root [0]  TNtuple *ntuple = new TNtuple("ntuple","Demo ntuple","px");
root [1]  ntuple->Fill(1.);
 
 *** Break *** segmentation violation
Root > 

2; When drawing histogram from an empty TTree or TNtuple object directly to
histogram, it doesn't fill nor create this histogram. I think it should
create some default empty histogram, otherwise I get errors when trying to
work with it. I tried to use empty trees, when there were not any
particles passing detector in the simulation. 

Here is interpreter output and corresponding macro

root [2] .x ttree-bug.C    
Error: No symbol histo in current scope  FILE:ttree-bug.C LINE:12
Error: Failed to evaluate histo->SetTitle("my histo") FILE:ttree-bug.C
LINE:12
Possible candidates are...
filename       line:size busy function type and name  

// macro demonstrating use of empty ntuple
{
 gROOT->Reset();
 Int_t nevent=0; // don't generate any events!
 TNtuple *ntuple = new TNtuple("ntuple","Demo ntuple","px:py");

for(Int_t i=0;i<nevent;i++) {   
  ntuple->Fill(gRandom->Gaus(10.,2.5),gRandom->Gaus(0.,0.7));
}

ntuple->Draw("px>>histo");
// I want to work with histogram (here just one example)
histo->SetTitle("my histo");
}

 I use version 2.25/03 on Suse Linux.

                                        Miro



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:39 MET