Hi, I am using the TH2::FillRandom method to fill histograms with some 2D distribution. I was using so far the following (slightly modified here) macro, and was happy with it (I was using quite old 2.21/08 HP-UX/CC Root version). If I try now with Root 2.23/12 Linux RH6.1, I obtain strange result for the Y-Projection of the histogram (h10_py)... Am I doing something obviously wrong or is there a problem with the FillRandom method ? Thanks, --- { Float_t KPIMAX = 40 ; Int_t NCX=180 ; Int_t NCY=100 ; char fileout[80] ; TCanvas* c1 = new TCanvas("c1","c1",500,500) ; TF2* f2 = new TF2("f2","y**[0]*exp(-y/[1])/(1+exp((y-[2])/[3]))*sin(x*3.141592653590e+00/180.0)",0,180,0,KPIMAX) ; f2->SetParameters(0.6,17,30,2) ; f2->Draw("LEGO") ; c1->Update() ; c1->Clear() ; c1->Divide(2,2) ; TH2F* h2 = (TH2F*)f2->GetHistogram() ; h2->SetName("h2") ; h2->ProjectionX() ; h2->ProjectionY() ; c1->cd(1) ; h2_py->Draw() ; c1->cd(2) ; h2_px->Draw() ; TH2F* h10 = new TH2F("h10","h10",NCX,0,180,NCY,0,KPIMAX) ; h10->FillRandom("f2",1e5) ; h10->ProjectionX() ; h10->ProjectionY() ; c1->cd(3) ; h10_py->Draw() ; c1->cd(4) ; h10_px->Draw() ; } -- Dr. Laurent APHECETCHE (mailto:aphecetc@in2p3.fr) | TAPS/PHENIX/ALICE SUBATECH-Ecole des Mines de Nantes-4 rue Alfred Kastler-44070 NANTES cedex 03 TEL (+33/0) 2 51 85 84 17 - FAX (+33/0) 2 51 85 84 24 (France) http://www-subatech.in2p3.fr/~photons - http://www.phenix.bnl.gov/~aphecetc
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:24 MET