Hi Dimitris, I would suggest to replace: hEquiMap[1]->Delete(); by delete hEquiMap[1]; and make sure that your array TH2F *hEquiMap[2] has its elements correctly preset to 0. Rene Brun On Wed, 10 Apr 2002, Dimitris Sideris wrote: > Dear Rooters, > > I have a problem with th1f->Write(). If you look at the sample code bellow, what I do is I fill a histogram then I want to save it and redefine it it with different x-axis, refill it, save it etc. So the code bellow is executed again and again. When the ->Write() statement is commented out, the code works ok. When I introduce the write statement the code crashes after a random number of iterations. > > This code bit is part of a lrager multithreaded application, and it could be that it's an indirect problem with my code. However maybe it's simple and direct, that's why I would like your advice. > > Thanks > > Dimitris > > > TH2F *hEquiMap[2]; > ..... > //******************** loop ************************ > if (tim>eqStop[1]) > { > if (hEquiMap[1]) { > TreeOutFile->cd(); > hEquiMap[1]->Write(hEquiMap[1]->GetName(), TObject::kOverwrite); > hEquiMap[1]->Delete(); > } > > eqStart[1]=eqStop[0]-equi_width2; > eqStop[1]=eqStart[1]+4*equi_width2; > eqBins[1]=(eqStop[1]-eqStart[1])/2+1; > ceqname2.Format("equim_%i",eqStart[1]); > > hEquiMap[1] = new TH2F((LPCTSTR) ceqname2,"Equiphase Map",eqBins[1],eqStart[1],eqStop[1],POptionspdaTotalPixels/4,1.,float(POptions->pdaTotalPixels)); > > hEquiMap[1]->SetFillColor(1); > hEquiMap[1]->SetContour(128); > > > } > > //***************************************************************
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:48 MET