Hi Ken,
Very easy.
Assuming MyCodeA a;
a.fChain->GetDirectory()->ls()
To get one histogram from the corresponding directory, do, eg:
TH1F *h = (TH1F*)a.fChain->GetDirectory()->Get(hist_name);
Rene Brun
On Wed, 27 Feb 2002, Ken Bloom wrote:
> Dear ROOT,
>
> I have two different ROOT ntuples, in two different files. I use the
> MakeClass method to give me a skeleton of code that allows me to create and
> fill histograms based on the contents of the two ntuples, and I can use these
> classes like so:
>
> .L MyCodeA.C
> MyCodeA a;
> a.Loop();
> .L MyCodeB.C
> MyCodeB b;
> b.Loop();
>
> By doing this, TFile objects are being created inside a and b, but I never get
> to see those.
>
> Now, I would like to compare the histograms made by a to those made by
> b. At this point, I believe I'm in a directory that belongs to b, so I can
> see the histograms made by b, but seeing the ones made by a is harder. I know
> that I can see a list of those histograms via something like:
>
> TFile* f1 =
> (TFile*)gROOT->GetListOfFiles()->FindObject("/path/name/of/file");
> f1.Print();
>
> but I seem to have trouble then grabbing the histograms in said list.
>
> So how can I get to use both sets of histograms simultaneously? And
> is there a way to do this without going through gROOT? I feel like I did
> things like this in PAW, and that it was much easier! Thanks, best wishes.
>
> Ken
>
> ------------------------------------------------------------------------------
> Ken Bloom, Karma Adjuster Department of Physics
> 734-763-2329 / 734-936-1817 (fax) University of Michigan
> kenbloom@umich.edu http://www.umich.edu/~kenbloom
>
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:43 MET