Working with two different files

Hi everybody.

I have the following problem. I would like to fill in a histogram projecting on it variables from two trees. The two trees belong to different files. Unfortunately the trees are similar but not identical and I cannot use the tree chain.

The macro I am attempting to use looks as:

TFile f("Dst_ntuples.root"); TH1F *D0massrec = new TH1F("D0massrec","D0massrec",30,1.83,1.9); TTree* nt1=gDirectory->Get("1"); TCut cut1= "D0pionPt>0.9"; nt1.Draw("D0mass>>D0massrec", cut1); TFile g("NoPidBincl/NoPidNtuplesBincl2.root");"Dstar2D0PiNoPid"); TTree* nt2=gDirectory->Get("1"); nt2.Draw("D0mass>>+D0massrec", cut1);

In some way, the entries from nt2 does not arrive in the histogram (I checked and if I remove the +, I get the nt2 entries obviously the nt1 ones are not there in this case).

I am aware that the problem is related to the “places” in which ROOT is looking for histograms and/or trees but I do not know how to solve it.

Sorry for such a long mail,
Thank you very much in advance for your answer,

One possible solution:TTree* nt2=gDirectory->Get("1");; // Because D0massrec was crated when f was the current directory nt2.Draw("D0mass>>+D0massrec", cut1); Philippe.