[ROOT] Segmentation fault. Cause: Closing a TFile

From: Pierre-Luc Drouin (pldrouin@physics.carleton.ca)
Date: Wed Jul 02 2003 - 18:02:50 MEST


Hello,

I've to open a TFile, get a TTree instance from it, and copy this TTree
with some selections to a new TTree object and then to close the TFile. My
code is the following:

	    TTree *tbuf, *ctbuf;
            TDirectory* fluxdir= \\A pointer to a TDirectory in a TFile
            TDirectory *ctdir;

	    TFile *myfile=new TFile("myfile.root","READ");

          
          tbuf=dynamic_cast<TTree*>(myfile->Get("mytree"));

	    ctdir=fluxdir->mkdir("Event Info");
	    ctdir->cd();

	    ctbuf=tbuf->CopyTree(allcuts);

	    myfile->Close();
	    gROOT->Delete(cardbuf[i][filenameindex]);


I get a segmentation fault when I try to ctbuf->Draw() further in the
code. Since gDirectory==ctdir in the code, I don't understand how ctbuf
could depend on myfile. When I comment the last two lines in the code,
everything works fine

Thank you

Pierre-Luc Drouin



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET