Hi Martin, I am not sure I properly understood your situation but it seems that you are trying to - open a file - create some histo - close the file - open another file - create some more histo and maybe add to the first histos. - close the other file - display all the histo. If this is the case, what you want to do is call TH1::AddDirectory(kFALSE); This tells the system to NOT add the histogram to the current file. The default is to attach any new histogram to the current file and the consequence is that when the current file is close, ALL its attached histograms are deleted. When you use hwhatever->SetDirectory(0) you are explicitly de-attaching the histogram from which ever file it could have been attached to. TH1::AddDirectory makes this unattached behavior the default. Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Martin Turner Sent: Tuesday, April 09, 2002 5:00 AM To: roottalk@pcroot.cern.ch Subject: [ROOT] problems with using more than 1 branch. Hello ROOT experts, This is the frame of some code I have: TFile *f =new TFile("Lambda_analysis.root","READ"); TTree *lambda_tree =(TTree*)f.Get("Lambda_analysis"); //Do analysis f->close() TFile *f =new TFile("Lambda_analysis.root","READ"); TTree *lambda_tree =(TTree*)f.Get("Lambda_analysis_track"); //ie. a different branch TH1F* hpt_all_pion=new TH1F("pion pt","pion pt",100,0,10); lambda_tree2->Draw("ftrack_pt>> pion pt"); This prints nothing except the Canvas and Pad. It will work if I use hwhatever->SetDirectory(0), but I must do this for every histogram. Clearly this is messy. Is there any way I can specify where to place or subsequent histograms. It seems to get confused by using another branch before it. What exactly is happening? Martin
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:48 MET