Re: [ROOT] Ntuples

From: Suyong Choi (suyong@fnal.gov)
Date: Fri Oct 20 2000 - 15:37:35 MEST


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.

As far as I can see, there's no elegant way of doing this and I haven't actually tried this but
it could work.
You'll need to change the header file significantly.
Merge the list of  Ntuple variables, but the names of the second set of
variables would have to be changed. And then copy all the functions like
Init(), Notify(), GetEntry(), LoadTree()  etc. to Init2(), Notify2() etc. and change the variables names
in those functions. Obviously, you'll need fChain2 in addition to fChain for those, so declare fChain2.
Then you can load simultaneously 2 files, but for the second file, you'll make calls like fChain2->GetEntry2(nevent).
You get the idea.

Regards,
Suyong Choi



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