Re: [ROOT] how to compare 2 datasets from 2 different ntuples

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jan 14 2002 - 08:32:49 MET


As pointed out by Axel, the comparison of two ntuple/Trees make sense in general
only if you compare statistically the histograms for each variable.

However (and I suspect that this is your case), if you want to compare
2 Trees with the same number of entries and entry I of Tree 1 versus entry I
of Tree 2, you can use Tree friends in a very simple way. Example
Suppose 2 Trees named "T" in file1.root and file2.root
root > TFile f1("file1.root");
root > TTree *T = (TTree*)f1.Get("T");
root > T->AddFriend("T2=T","file2.root");
root > T->Draw("x:T2.x")

The last command above will produce a scatter plot of variable "x" of "T"
in file1.root versus variable "x" of "T" in file2.root.
Note that "T" in file2.root has been given an alias "T2".
For more details, see TTree::AddFriend
  http://root.cern.ch/root/htmldoc/src/TTree.cxx.html#TTree:AddFriend
See also $ROOTSYS/tutorials/tree3.C

Rene Brun


AMN wrote:
> 
> hi folks,
> 
> i wanted to compare two data sets from two different ntuples that have
> different number of events. i wish to plot one variable from one ntuple
> against another variable of the other ntuple. but don't know how to
> implement that. can somebody help please?
> 
> i work on redhat linux on a sun microsystem ultra 5 machine. root version
> is 3.00/06.
> 
> thanks and kind regards,
> 
> asif
> 
> IPST, University of Maryland,
> College Park, MD



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