Hi Giuseppe, When you delete h1, you still have a reference in canvaslist to h1. You show only a subset of your code, but you should do canvaslist.Remove(h1); delete h1; Rene Brun On Wed, 27 Nov 2002, [iso-8859-1] giuseppe.foggi@libero.it wrote: > Hi, > I have to read histograms by a file root e then I have to write they > into a second file root. > This is my script > ............. > ............ > TObjArray canvaslist; > TFile *filetotal=new TFile(nametotal->Data(),"RECREATE"); > TFile *fileroot= new TFile(s.Data(),"READ"); > TIter next(fileroot->GetListOfKeys()); > TKey *key; > while (key=(TKey*)next()) > { > fileroot->cd(); > TObject *obj= key->ReadObj(); > if (obj->IsA()->InheritsFrom("TH1")) > { > TH1F *h1=(TH1F*)obj; > canvaslist.Add(h1); > cout<<"Aggiunto Histo "<<key->GetClassName()<<" alla posizione > "<<count<<endl; > count++; > filetotal->cd(); > h1->Write(); > delete h1; > } > > } > .................... > ............. > > So when I try to Draw histogram stored in the second file, I get > "segmentation violation" ,why? > Thank you. > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:21 MET