Hello, I do (in cint): TF2 *dens_func = new TF2("two_gaus","1/(2*3.14159265358979323846)*exp(-(x*x+y*y)/2)",-3,3,-3,3); TH2F *h = (TH2F*)dens_func->GetHistogram(); and I get a segmentation fault after the second statement. Looking at TH1F::GetHistogram: TH1 *TF1::GetHistogram() const { // return a pointer to the histogram used to vusualize the function if (fHistogram) return fHistogram; // may be function has not yet be painted. force a pad update gPad->Modified(); gPad->Update(); return fHistogram; } I guess the problem is, that gPad is a null pointer (I didn't open any canvas before). So my question / suggestion: Why not separating out the code in TF1::Paint (and TF2::Paint etc.) which creates the histogram and stores it in fHistogram into a (possibly protected) method CreateHistogram and modify TF1::GetHistogram to: TH1 *TF1::GetHistogram() const { // return a pointer to the histogram used to vusualize the function if (fHistogram) return fHistogram; CreateHistogram(); return fHistogram; } ? That way one does not have to create a canvas when one is simply interested in the histogram filled into the function. Or is there another function to do this ? (by the way, I use root 3.01/05 / 9 July 2001 on Linux/i386). best regards, André -- ------------------+---------------------------------- Andre Holzner | +41 22 76 76750 Bureau 32 2-C13 | Building 32 CERN | Office 2-C13 CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:53 MET