[ROOT] Histogram

From: giuseppe.foggi@libero.it
Date: Wed Nov 27 2002 - 15:30:13 MET


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