Hi Vuko,
Give a different name to each of your histograms.
In your case, t1->Draw will delete the previous histogram named "srhist"
and your pointers in srhistos[] will be dangling pointers.
Rene Brun
On Tue, 26 Mar 2002, Vuko Brigljevic wrote:
> Hi all,
>
> The following is done using root 3.02/07 on SunOS,
> I see the same problem on Linux.
>
> I am trying to use the same 2D histo several times in a row
> as output of a Tree->Draw() and I am crashing. The code:
>
>
> TH2F *srhistos[10];
>
> int ilay;
> for (ilay=0; ilay<4; ilay++) {
> t1->Draw(scalerName(ilay+1)+":time >> srhist",cutString);
> srhistos[ilay]= new TH2F(*srhist);
> srhistos[ilay]->GetXaxis()->SetTimeDisplay(1);
> srhistos[ilay]->GetXaxis()->SetTimeFormat("%d/%m");
> srhistos[ilay]->Draw();
> gPad->SaveAs(TString(prefix+"singles-layer"+ilay+".eps"));
> // srhist.Reset(); tried this as well: does not help
> delete srhist;
> }
>
> Whether I am deleting the temporary histogram (srhist),
> resetting it or doing neither of both, I am always
> crashing with the following output:
>
> Info in <TPad::Print>: PostScript file lastDays/singles-layer1.eps has
> been created
>
> *** Break *** segmentation violation
> Root > Function makePlots() busy flag cleared
> Function doPlots() busy flag cleared
>
> How am I supposed to do something like that?
>
> Thanks for any help!
>
> Vuko
>
>
> ========================================================================
> Vuko Brigljevic | Mail : SLAC, Mail Stop 41
> Lawrence Livermore National Laboratory | P.O. Box 4349, Stanford
> Nuclear and Particle Physics Division | CA 94309, USA
> | SLAC-Office : B280- room 143
> Member of the BaBar Collaboration | Phone : +1-650-926 8512
> <vuko@slac.stanford.edu> <http://www.slac.stanford.edu/~vuko>
> ========================================================================
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:47 MET