Re: [ROOT] Ntuples

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Oct 25 2000 - 11:46:02 MEST


Hi Tulika,
sorry for this late reply. I desperatly try to catch up with my mail.

Yes, it should be quite easy to compare two or more ntuples using the code
generated by TTree::MakeClass. 
Assuming you do:  Ntuple1->MakeClass("MyMacro") and get the two files
MyMacro.C and MyMacro.h, you can modify the signature of the function
MyMacro::Loop()   to MyMacro::Loop(MyMacro &nt2), then do:

.L MyMacro.C
MyMacro nt1
MyMacro nt2
nt1.Loop(nt2)

In MyMacro::Loop function, you can add a statement like
   nt2.GetEntry(ientry)
nt1 (this) will contain the data for the first ntuple, nt2 the data
for the second ntuple that you can access with nt2.xxxx

Rene Brun


Tulika Bose wrote:
> 
> Hi!
> 
> I've just recently started working with ROOT, so this maybe a silly
> question...
> 
> I have one Ntuple (say Ntuple1) in a root file (say File1.root). I have
> another Ntuple (Ntuple2) in another root file (say File2.root). I want to
> compare these two Ntuples( they are similar but have different numbers in
> them) - more specifically I want to find their
> difference. I was thinking of writing a macro that would do that. After
> opening the root file I'd use the command
> Ntuple1->MakeClass("MyMacro");
> to generate the MyMacro.C and MyMacro.h files for this Ntuple and i can do
> the same for the other Ntuple. But I don't know how to use the MakeClass
> command with two ntuples in such a way that I can obtain a single .C and
> .h file that would help me to carry out the rest of my analysis?
> Or is there any other way I can approach this problem?
> 
> Thanks a lot.
> Cheers,
> Tulika.



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